From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524825173122790.0883063029434; Fri, 27 Apr 2018 03:32:53 -0700 (PDT) Received: from localhost ([::1]:47147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0gM-00026G-AW for importer@patchew.org; Fri, 27 Apr 2018 06:32:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05R-0007NS-8y for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05Q-0001eI-Jx for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36838 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05Q-0001e3-E6 for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAE3B722FC for ; Fri, 27 Apr 2018 09:54:39 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44FC2AB3F3; Fri, 27 Apr 2018 09:54:35 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 342A331E63; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:29 +0200 Message-Id: <20180427095434.14013-2-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 09:54:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 09:54:39 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/6] vnc: fix use-after-free 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: Paolo Bonzini , Alex Williamson , Markus Armbruster , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When vnc_client_read() return value is -1 vs is not valid any more. Fixes: d49b87f0d1e0520443a990fc610d0f02bc63c556 Reported-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Marc-Andr=C3=A9 Lureau Tested-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180420084820.3873-1-kraxel@redhat.com --- ui/vnc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index e164eb798c..5526e54f48 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1539,13 +1539,14 @@ gboolean vnc_client_io(QIOChannel *ioc G_GNUC_UNUSE= D, VncState *vs =3D opaque; if (condition & G_IO_IN) { if (vnc_client_read(vs) < 0) { - goto end; + /* vs is free()ed here */ + return TRUE; } } if (condition & G_IO_OUT) { vnc_client_write(vs); } -end: + if (vs->disconnecting) { if (vs->ioc_tag !=3D 0) { g_source_remove(vs->ioc_tag); --=20 2.9.3 From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524825019023675.550729264414; Fri, 27 Apr 2018 03:30:19 -0700 (PDT) Received: from localhost ([::1]:47127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0dn-00087m-61 for importer@patchew.org; Fri, 27 Apr 2018 06:30:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05T-0007PA-4C for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05S-0001fb-9M for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48694 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05S-0001fN-3L for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98C9B81A88AD; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id D49DD215CDCB; Fri, 27 Apr 2018 09:54:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3D5983EB80; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:30 +0200 Message-Id: <20180427095434.14013-3-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/6] qapi: Parameter gl of DisplayType now accept an enum 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: Markus Armbruster , Alex Williamson , Gerd Hoffmann , Elie Tournier , Paolo Bonzini , Elie Tournier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elie Tournier v2: Rebase on top of master v3: Fix the json format (Eric Blake) Fix a comparison issue (Gerd Hoffmann) Signed-off-by: Elie Tournier Message-id: 20180413135842.21325-2-tournier.elie@gmail.com Signed-off-by: Gerd Hoffmann --- vl.c | 10 +++++----- qapi/ui.json | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 616956adf1..f7804f7a18 100644 --- a/vl.c +++ b/vl.c @@ -2143,9 +2143,9 @@ static void parse_display(const char *p) opts =3D nextopt; dpy.has_gl =3D true; if (strstart(opts, "on", &nextopt)) { - dpy.gl =3D true; + dpy.gl =3D DISPLAYGL_MODE_ON; } else if (strstart(opts, "off", &nextopt)) { - dpy.gl =3D false; + dpy.gl =3D DISPLAYGL_MODE_OFF; } else { goto invalid_sdl_args; } @@ -2186,9 +2186,9 @@ static void parse_display(const char *p) opts =3D nextopt; dpy.has_gl =3D true; if (strstart(opts, "on", &nextopt)) { - dpy.gl =3D true; + dpy.gl =3D DISPLAYGL_MODE_ON; } else if (strstart(opts, "off", &nextopt)) { - dpy.gl =3D false; + dpy.gl =3D DISPLAYGL_MODE_OFF; } else { goto invalid_gtk_args; } @@ -4356,7 +4356,7 @@ int main(int argc, char **argv, char **envp) qemu_display_early_init(&dpy); qemu_console_early_init(); =20 - if (dpy.has_gl && dpy.gl && display_opengl =3D=3D 0) { + if (dpy.has_gl && dpy.gl !=3D DISPLAYGL_MODE_OFF && display_opengl =3D= =3D 0) { #if defined(CONFIG_OPENGL) error_report("OpenGL is not supported by the display"); #else diff --git a/qapi/ui.json b/qapi/ui.json index 5d01ad4304..3ad7835992 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1019,6 +1019,24 @@ { 'struct' : 'DisplayGTK', 'data' : { '*grab-on-hover' : 'bool' } } =20 + ## + # @DisplayGLMode: + # + # Display OpenGL mode. + # + # @off: Disable OpenGL (default). + # @on: Use OpenGL, pick context type automatically. + # Would better be named 'auto' but is called 'on' for backward + # compatibility with bool type. + # @core: Use OpenGL with Core (desktop) Context. + # @es: Use OpenGL with ES (embedded systems) Context. + # + # Since: 2.13 + # + ## + { 'enum' : 'DisplayGLMode', + 'data' : [ 'off', 'on', 'core', 'es' ] } + ## # @DisplayType: # @@ -1048,7 +1066,7 @@ 'base' : { 'type' : 'DisplayType', '*full-screen' : 'bool', '*window-close' : 'bool', - '*gl' : 'bool' }, + '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', 'data' : { 'default' : 'DisplayNoOpts', 'none' : 'DisplayNoOpts', --=20 2.9.3 From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524823408278206.8163444439091; Fri, 27 Apr 2018 03:03:28 -0700 (PDT) Received: from localhost ([::1]:46929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0Dv-00060F-EO for importer@patchew.org; Fri, 27 Apr 2018 06:03:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05S-0007P0-U5 for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05R-0001fT-VU for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55250 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05R-0001ez-R0 for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 575FF4023112; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03076AB3F1; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 45F1B3EB8A; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:31 +0200 Message-Id: <20180427095434.14013-4-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/6] sdl: Move DisplayOptions global to sdl2_console 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: Markus Armbruster , Alex Williamson , Gerd Hoffmann , Elie Tournier , Paolo Bonzini , Elie Tournier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elie Tournier Suggested-by: Gerd Hoffmann Signed-off-by: Elie Tournier Message-id: 20180413135842.21325-3-tournier.elie@gmail.com Signed-off-by: Gerd Hoffmann --- include/ui/sdl2.h | 1 + ui/sdl2.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 51084e6320..f43eecdbd6 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -14,6 +14,7 @@ struct sdl2_console { DisplayChangeListener dcl; DisplaySurface *surface; + DisplayOptions *opts; SDL_Texture *texture; SDL_Window *real_window; SDL_Renderer *real_renderer; diff --git a/ui/sdl2.c b/ui/sdl2.c index 83b917fa37..da037248c2 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -32,7 +32,6 @@ =20 static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; -static DisplayOptions *opts; =20 static SDL_Surface *guest_sprite_surface; static int gui_grab; /* if true, all keyboard/mouse events are grabbed */ @@ -566,7 +565,7 @@ static void handle_windowevent(SDL_Event *ev) break; case SDL_WINDOWEVENT_CLOSE: if (qemu_console_is_graphic(scon->dcl.con)) { - if (opts->has_window_close && !opts->window_close) { + if (scon->opts->has_window_close && !scon->opts->window_close)= { allow_close =3D false; } if (allow_close) { @@ -613,7 +612,7 @@ void sdl2_poll_events(struct sdl2_console *scon) handle_textinput(ev); break; case SDL_QUIT: - if (opts->has_window_close && !opts->window_close) { + if (scon->opts->has_window_close && !scon->opts->window_close)= { allow_close =3D false; } if (allow_close) { @@ -770,7 +769,6 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) SDL_SysWMinfo info; =20 assert(o->type =3D=3D DISPLAY_TYPE_SDL); - opts =3D o; =20 #ifdef __linux__ /* on Linux, SDL may use fbcon|directfb|svgalib when run without @@ -806,6 +804,7 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) return; } sdl2_console =3D g_new0(struct sdl2_console, sdl2_num_outputs); + sdl2_console->opts =3D o; for (i =3D 0; i < sdl2_num_outputs; i++) { QemuConsole *con =3D qemu_console_lookup_by_index(i); assert(con !=3D NULL); @@ -846,7 +845,8 @@ static void sdl2_display_init(DisplayState *ds, Display= Options *o) g_free(filename); } =20 - if (opts->has_full_screen && opts->full_screen) { + if (sdl2_console->opts->has_full_screen && + sdl2_console->opts->full_screen) { gui_fullscreen =3D 1; sdl_grab_start(0); } --=20 2.9.3 From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524824355010349.4731674963723; Fri, 27 Apr 2018 03:19:15 -0700 (PDT) Received: from localhost ([::1]:47056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0T8-0005WD-Va for importer@patchew.org; Fri, 27 Apr 2018 06:19:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05T-0007Q9-Qb for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05S-0001g7-Rh for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57010 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05S-0001fg-Lf for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30087406C78C; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4A0F215CDCE; Fri, 27 Apr 2018 09:54:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4FDDD50E0D; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:32 +0200 Message-Id: <20180427095434.14013-5-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 27 Apr 2018 09:54:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 27 Apr 2018 09:54:42 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/6] sdl: Allow OpenGL ES context creation 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: Markus Armbruster , Alex Williamson , Gerd Hoffmann , Elie Tournier , Paolo Bonzini , Elie Tournier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Elie Tournier Signed-off-by: Elie Tournier Message-id: 20180413135842.21325-4-tournier.elie@gmail.com [ kraxel: fix indent ] Signed-off-by: Gerd Hoffmann --- ui/sdl2-gl.c | 19 +++++++++++++++++-- vl.c | 4 ++++ qemu-options.hx | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index c3683e6b65..83b71853d1 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -140,12 +140,27 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeLis= tener *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->opts->gl =3D=3D DISPLAYGL_MODE_ON || + scon->opts->gl =3D=3D DISPLAYGL_MODE_CORE) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_CORE); + } else if (scon->opts->gl =3D=3D DISPLAYGL_MODE_ES) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, params->major_ver); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, params->minor_ver); =20 ctx =3D SDL_GL_CreateContext(scon->real_window); + + /* If SDL fail to create a GL context and we use the "on" flag, + * then try to fallback to GLES. + */ + if (!ctx && scon->opts->gl =3D=3D DISPLAYGL_MODE_ON) { + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_CONTEXT_PROFILE_ES); + ctx =3D SDL_GL_CreateContext(scon->real_window); + } return (QEMUGLContext)ctx; } =20 diff --git a/vl.c b/vl.c index f7804f7a18..916d2a80a7 100644 --- a/vl.c +++ b/vl.c @@ -2144,6 +2144,10 @@ static void parse_display(const char *p) dpy.has_gl =3D true; if (strstart(opts, "on", &nextopt)) { dpy.gl =3D DISPLAYGL_MODE_ON; + } else if (strstart(opts, "core", &nextopt)) { + dpy.gl =3D DISPLAYGL_MODE_CORE; + } else if (strstart(opts, "es", &nextopt)) { + dpy.gl =3D DISPLAYGL_MODE_ES; } else if (strstart(opts, "off", &nextopt)) { dpy.gl =3D DISPLAYGL_MODE_OFF; } else { diff --git a/qemu-options.hx b/qemu-options.hx index ca4e412f2f..333dd1f1c8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1240,7 +1240,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|core|es|off]\n" "-display gtk[,grab_on_hover=3Don|off][,gl=3Don|off]|\n" "-display vnc=3D[,]\n" "-display curses\n" --=20 2.9.3 From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524824884935512.5954918041559; Fri, 27 Apr 2018 03:28:04 -0700 (PDT) Received: from localhost ([::1]:47114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0bj-0005nt-UN for importer@patchew.org; Fri, 27 Apr 2018 06:28:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05S-0007OP-AM for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05R-0001ey-JA for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36842 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05R-0001ek-FP for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 049F1722FC; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id B599D10B2B22; Fri, 27 Apr 2018 09:54:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5871740DC4; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:33 +0200 Message-Id: <20180427095434.14013-6-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 5/6] console: introduce dpy_gfx_update_full 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: Markus Armbruster , Tina Zhang , Alex Williamson , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Tina Zhang dpy_gfx_update_full is used to do the whole display surface update. This function is proposed by Gerd Hoffmann. Signed-off-by: Tina Zhang Message-id: 1524820266-27079-2-git-send-email-tina.zhang@intel.com Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 1 + ui/console.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index 37a8d68d29..981b519dde 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -291,6 +291,7 @@ bool dpy_ui_info_supported(QemuConsole *con); int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info); =20 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h); +void dpy_gfx_update_full(QemuConsole *con); void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *surface); void dpy_text_cursor(QemuConsole *con, int x, int y); diff --git a/ui/console.c b/ui/console.c index 3fb2f4e09f..b02510cdca 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1574,6 +1574,16 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, = int w, int h) } } =20 +void dpy_gfx_update_full(QemuConsole *con) +{ + if (!con->surface) { + return; + } + dpy_gfx_update(con, 0, 0, + surface_width(con->surface), + surface_height(con->surface)); +} + void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *surface) { --=20 2.9.3 From nobody Wed Oct 29 06:39:39 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; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524824147921636.2663376733157; Fri, 27 Apr 2018 03:15:47 -0700 (PDT) Received: from localhost ([::1]:47029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC0Pr-0002zg-2Z for importer@patchew.org; Fri, 27 Apr 2018 06:15:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC05S-0007Om-M0 for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC05R-0001fB-Ns for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40854 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC05R-0001em-JL for qemu-devel@nongnu.org; Fri, 27 Apr 2018 05:54:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AB2AEC01D; Fri, 27 Apr 2018 09:54:41 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8D2E10B2B41; Fri, 27 Apr 2018 09:54:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6239F40DCA; Fri, 27 Apr 2018 11:54:34 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 27 Apr 2018 11:54:34 +0200 Message-Id: <20180427095434.14013-7-kraxel@redhat.com> In-Reply-To: <20180427095434.14013-1-kraxel@redhat.com> References: <20180427095434.14013-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 27 Apr 2018 09:54:41 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 6/6] ui: introduce vfio_display_reset 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: Markus Armbruster , Tina Zhang , Alex Williamson , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Tina Zhang During guest OS reboot, guest framebuffer is invalid. It will cause bugs, if the invalid guest framebuffer is still used by host. This patch is to introduce vfio_display_reset which is invoked during vfio display reset. This vfio_display_reset function is used to release the invalid display resource, disable scanout mode and replace the invalid surface with QemuConsole's DisplaySurafce. This patch can fix the GPU hang issue caused by gd_egl_draw during guest OS reboot. Changes v3->v4: - Move dma-buf based display check into the vfio_display_reset(). (Gerd) Changes v2->v3: - Limit vfio_display_reset to dma-buf based vfio display. (Gerd) Changes v1->v2: - Use dpy_gfx_update_full() update screen after reset. (Gerd) - Remove dpy_gfx_switch_surface(). (Gerd) Signed-off-by: Tina Zhang Message-id: 1524820266-27079-3-git-send-email-tina.zhang@intel.com Signed-off-by: Gerd Hoffmann --- hw/vfio/pci.h | 1 + hw/vfio/display.c | 11 +++++++++++ hw/vfio/pci.c | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 629c875701..59ab7757a3 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -176,6 +176,7 @@ int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, struct vfio_region_info *info, Error **errp); =20 +void vfio_display_reset(VFIOPCIDevice *vdev); int vfio_display_probe(VFIOPCIDevice *vdev, Error **errp); void vfio_display_finalize(VFIOPCIDevice *vdev); =20 diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 7d727ce910..59c0e5d1d7 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -198,6 +198,17 @@ static void vfio_display_dmabuf_exit(VFIODisplay *dpy) } =20 /* ---------------------------------------------------------------------- = */ +void vfio_display_reset(VFIOPCIDevice *vdev) +{ + if (!vdev || !vdev->dpy || !vdev->dpy->con || + !vdev->dpy->dmabuf.primary) { + return; + } + + dpy_gl_scanout_disable(vdev->dpy->con); + vfio_display_dmabuf_exit(vdev->dpy); + dpy_gfx_update_full(vdev->dpy->con); +} =20 static void vfio_display_region_update(void *opaque) { diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index b9bc6cd310..4947fe39a2 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3103,6 +3103,10 @@ static void vfio_pci_reset(DeviceState *dev) =20 vfio_pci_pre_reset(vdev); =20 + if (vdev->display !=3D ON_OFF_AUTO_OFF) { + vfio_display_reset(vdev); + } + if (vdev->resetfn && !vdev->resetfn(vdev)) { goto post_reset; } --=20 2.9.3