From nobody Sat Oct 25 23:38:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15162010510771019.5649497081423; Wed, 17 Jan 2018 06:57:31 -0800 (PST) Received: from localhost ([::1]:41183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebp9d-0005DP-Dp for importer@patchew.org; Wed, 17 Jan 2018 09:57:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebp4i-0001IC-WC for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebp4h-0002EH-W2 for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:25 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebp4h-0002DH-PZ for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:23 -0500 Received: by mail-wm0-x243.google.com with SMTP id 81so22225224wmb.1 for ; Wed, 17 Jan 2018 06:52:23 -0800 (PST) Received: from Nikki.cbg.collabora.co.uk ([2a00:5f00:102:0:9eb6:d0ff:fed4:843f]) by smtp.googlemail.com with ESMTPSA id c11sm6604854wrc.8.2018.01.17.06.52.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 06:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z+h0MrHHu14OJJcAviVpjNEpdEuri7Cv76fpJX2EwJE=; b=ojKoRXuQRjPudQ4FsZOW3DVcBzZySsTJ9VW7BfjDXXY/AGfDpKBHBRgrB5WOKTenzx SEbEx1tgej7mkuQ04oqwulnxxqfq49jV70HU69YXuY2AnSJ2TXNfNV89vaSWB48wAtYH M88JKdyTb4jcdJOn2ogNNy458CPlD++UksQsmALCrdXFGYxlhgApoMo3/9W+KBgEyk+W GJ40XF2DVYwzo5v1Ys9w3XXsEfS55B1F4TF3tlHTaqCQPBwBqHMAsHHisnlyNTGjMPNb YyycjByxyeJtH5NApQtl4fxCHAKkNPoD5cx3IefRJSOXdI905uZT3Hrw5j5v3oR135gF 707w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z+h0MrHHu14OJJcAviVpjNEpdEuri7Cv76fpJX2EwJE=; b=bHCGOIEOF5ZtfbGRwxreqv3FPqfjWTMcaPa8AFbSH3qzzHgvn13y2F+DjsDcAfx9ok j3RtJMTy9rXqdDsEvYo3McvSFaS4l8VKTEaYsdOaGglmkLWYpZeP8wOmv+CKrSdWAv+N 6LTYQh/+mkxQ5ie1RHfBiLlWwuwRwwOF4vlPmSSm0fzlBB+JU4/EpdPlpyM/KlPkH+OY miyMJlLL2VTMv/AIYmiTPdTG2oC2a7HGJsFW2BB+s0pdAMXY4h7li+N5cND1oLppeF2h RDj4U3PjtirnijRNykKGb4PWlqQnjpuqjZDHC6voH07QQHll7/OtVQWSiTnyMUNsPBz8 so5A== X-Gm-Message-State: AKwxyteG8NUzOMB/5IcNzDiWitCwI+EHDVaQmHqW0A6QAwTCMn5KrFw7 8j9CxToohhkjoyiPqzhRtrOqvA== X-Google-Smtp-Source: ACJfBovy7Is56znLk0/Iezj70aGK6yFk4Rbhl+Gxjj7QcHd4NXlp1yPkI29NcPeAcoiIJHX/ReN7ig== X-Received: by 10.28.126.133 with SMTP id z127mr2287263wmc.130.1516200742490; Wed, 17 Jan 2018 06:52:22 -0800 (PST) From: Elie Tournier To: qemu-devel@nongnu.org Date: Wed, 17 Jan 2018 14:50:28 +0000 Message-Id: <20180117145029.28736-2-tournier.elie@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180117145029.28736-1-tournier.elie@gmail.com> References: <20180117145029.28736-1-tournier.elie@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC 1/2] sdl2: Add gles options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Elie Tournier , kraxel@redhat.com, Elie Tournier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit add an option to the sdl display: `-display sdl,gles=3Don` This will allow the user to create an OpenGL ES context. Signed-off-by: Elie Tournier --- qemu-options.hx | 5 ++++- ui/sdl2.c | 1 + vl.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 678181c599..18a616e339 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1257,7 +1257,7 @@ ETEXI =20 DEF("display", HAS_ARG, QEMU_OPTION_display, "-display sdl[,frame=3Don|off][,alt_grab=3Don|off][,ctrl_grab=3Don|off= ]\n" - " [,window_close=3Don|off][,gl=3Don|off]\n" + " [,window_close=3Don|off][,gl=3Don|off][,gles=3Don|off]\n" "-display gtk[,grab_on_hover=3Don|off][,gl=3Don|off]|\n" "-display vnc=3D[,]\n" "-display curses\n" @@ -1492,6 +1492,9 @@ Enable/disable spice seamless migration. Default is o= ff. @item gl=3D[on|off] Enable/disable OpenGL context. Default is off. =20 +@item gles=3D[on|off] +Enable/disable OpenGL ES context. Default is off. + @item rendernode=3D DRM render node for OpenGL rendering. If not specified, it will pick the first available. (Since 2.9) diff --git a/ui/sdl2.c b/ui/sdl2.c index 89c6a2633c..e78cff1a6f 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -762,6 +762,7 @@ void sdl_display_early_init(int opengl) case 0: /* off */ break; case 1: /* on */ + case 2: /* gles =3D on */ #ifdef CONFIG_OPENGL display_opengl =3D 1; #endif diff --git a/vl.c b/vl.c index 2586f25952..3fe325222e 100644 --- a/vl.c +++ b/vl.c @@ -2154,6 +2154,15 @@ static DisplayType select_display(const char *p) } else { goto invalid_sdl_args; } + } else if (strstart(opts, ",gles=3D", &nextopt)) { + opts =3D nextopt; + if (strstart(opts, "on", &nextopt)) { + request_opengl =3D 2; + } else if (strstart(opts, "off", &nextopt)) { + request_opengl =3D 0; + } else { + goto invalid_sdl_args; + } } else if (strstart(opts, ",gl=3D", &nextopt)) { opts =3D nextopt; if (strstart(opts, "on", &nextopt)) { @@ -4364,7 +4373,7 @@ int main(int argc, char **argv, char **envp) =20 qemu_console_early_init(); =20 - if (request_opengl =3D=3D 1 && display_opengl =3D=3D 0) { + if ((request_opengl =3D=3D 1 || request_opengl =3D=3D 2) && display_op= engl =3D=3D 0) { #if defined(CONFIG_OPENGL) error_report("OpenGL is not supported by the display"); #else --=20 2.15.1 From nobody Sat Oct 25 23:38:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516201013354502.41767435779934; Wed, 17 Jan 2018 06:56:53 -0800 (PST) Received: from localhost ([::1]:41154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebp92-0004k5-Iq for importer@patchew.org; Wed, 17 Jan 2018 09:56:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebp4k-0001Jg-6f for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebp4j-0002Ft-3V for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:26 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebp4i-0002Er-Tx for qemu-devel@nongnu.org; Wed, 17 Jan 2018 09:52:25 -0500 Received: by mail-wm0-x243.google.com with SMTP id r78so16367357wme.0 for ; Wed, 17 Jan 2018 06:52:24 -0800 (PST) Received: from Nikki.cbg.collabora.co.uk ([2a00:5f00:102:0:9eb6:d0ff:fed4:843f]) by smtp.googlemail.com with ESMTPSA id c11sm6604854wrc.8.2018.01.17.06.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 06:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ae18AmKwH1In8jIyvn5gJXY+DgGI7kTb0i25TQLIHbM=; b=qVFnJx/ucJfxCWPMH5hxlxFjNUzblcBYfJm+gJ96F6tMseOjHC9KADsRxQppYCs0Kq nurtKuuWpd3miQ96iIjOUQKAp5089HQgHXMwGw4O441+IQ21LAxLsZ9NzkshHZ0tg2mm nnuWNNelup62mexiwHKi0fbjzzZW/N3z3cuS5vVl2mWJsZNQ+myMEQ/acDPzX4AMuCdm 58yIUIJl6maoi36zwnC0GKiKS0YwQCyVAVv0a2zYu4aPzlHdrpfyuHCdPxbb8qbRaieP DqVwWkuiFTkiVYfBM7Wolpm860um+G1x+At2Rq0NhW8C8FtjH10PBJqE26uUW/BEPZOu muxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ae18AmKwH1In8jIyvn5gJXY+DgGI7kTb0i25TQLIHbM=; b=E21S9t73vzAigq9Qph19kcezntLpxoYqhVAOmtqTjjKCwN368IDLZsavcy8lWZhG/L OpTs5FixQPnMpGGN/n/Da8Ic2k7uODT57LJ7Msh1SibqNAujHayS1JbRvHIG/+xegv60 /bhe4pnZIK870j8oHhBKc7i/snmaoP+BNiHm+Wh6HdsdJ7F5BBy+awoIlR472MtDGGBQ tA1M0Q2Sv8bsvhoOHNo/L5Du2jkSzUPTG5WyihS+LdbVFSzBl2UXxVoMNuxRCVtC5Rg6 S5yqSvFj+hv5hQNKm3znc/LggP4VafD1JakGVymaoXu5VtKR/fXqiTcYiC2X5GPK/Yna vGqw== X-Gm-Message-State: AKwxytf+CEdUYDWXWB1siSaR86coal9ndUAbN2Sr9HAzOSUPR5agq/lk 0NCA4xtJ0FNdQn4JSgjk41hxlA== X-Google-Smtp-Source: ACJfBosYjRxqH4Hs9renhEV4/2uA4C3oeLYSSLjhXYi4z2uGtNSI6DtFPNGQOIMMQNClDKAwfAMf7A== X-Received: by 10.28.225.133 with SMTP id y127mr2214593wmg.55.1516200743656; Wed, 17 Jan 2018 06:52:23 -0800 (PST) From: Elie Tournier To: qemu-devel@nongnu.org Date: Wed, 17 Jan 2018 14:50:29 +0000 Message-Id: <20180117145029.28736-3-tournier.elie@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180117145029.28736-1-tournier.elie@gmail.com> References: <20180117145029.28736-1-tournier.elie@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC 2/2] sdl2: gles option will create a gles context X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Elie Tournier , kraxel@redhat.com, Elie Tournier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Create an OpenGL ES context if the option `-display sdl,gles=3Don` is set. Signed-off-by: Elie Tournier --- include/sysemu/sysemu.h | 1 + include/ui/sdl2.h | 1 + ui/sdl2-gl.c | 8 ++++++-- ui/sdl2.c | 7 +++++++ vl.c | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 31612caf10..32f242c4c5 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -108,6 +108,7 @@ extern int graphic_width; extern int graphic_height; extern int graphic_depth; extern int display_opengl; +extern bool use_opengl_es; extern const char *keyboard_layout; extern int win2k_install_hack; extern int alt_grab; diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 51084e6320..2aaa203f51 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -26,6 +26,7 @@ struct sdl2_console { int idle_counter; int ignore_hotkeys; SDL_GLContext winctx; + bool opengl_es; #ifdef CONFIG_OPENGL QemuGLShader *gls; egl_fb guest_fb; diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 5e1073a084..4e620c5ff7 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -142,8 +142,12 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeList= ener *dcl, SDL_GL_MakeCurrent(scon->real_window, scon->winctx); =20 SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, - SDL_GL_CONTEXT_PROFILE_CORE); + if (scon->opengl_es) + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + else + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, params->major_ver); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, params->minor_ver); =20 diff --git a/ui/sdl2.c b/ui/sdl2.c index e78cff1a6f..a1250a6902 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -762,9 +762,14 @@ void sdl_display_early_init(int opengl) case 0: /* off */ break; case 1: /* on */ +#ifdef CONFIG_OPENGL + display_opengl =3D 1; +#endif + break; case 2: /* gles =3D on */ #ifdef CONFIG_OPENGL display_opengl =3D 1; + use_opengl_es =3D true; #endif break; default: @@ -829,9 +834,11 @@ void sdl_display_init(DisplayState *ds, int full_scree= n, int no_frame) #ifdef CONFIG_OPENGL sdl2_console[i].opengl =3D display_opengl; sdl2_console[i].dcl.ops =3D display_opengl ? &dcl_gl_ops : &dcl_2d= _ops; + sdl2_console[i].opengl_es =3D use_opengl_es; #else sdl2_console[i].opengl =3D 0; sdl2_console[i].dcl.ops =3D &dcl_2d_ops; + sdl2_console[i].opengl_es =3D false; #endif sdl2_console[i].dcl.con =3D con; register_displaychangelistener(&sdl2_console[i].dcl); diff --git a/vl.c b/vl.c index 3fe325222e..a7bde1fa1e 100644 --- a/vl.c +++ b/vl.c @@ -137,6 +137,7 @@ const char *bios_name =3D NULL; enum vga_retrace_method vga_retrace_method =3D VGA_RETRACE_DUMB; int request_opengl =3D -1; int display_opengl; +bool use_opengl_es; const char* keyboard_layout =3D NULL; ram_addr_t ram_size; const char *mem_path =3D NULL; --=20 2.15.1