qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/5] Ui patches
@ 2023-11-07  9:30 marcandre.lureau
  2023-11-07  9:30 ` [PULL 1/5] ui/gtk: force realization of drawing area marcandre.lureau
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit 8aba939e77daca10eac99d9d467f65ba7df5ab3e:

  Merge tag 'pull-riscv-to-apply-20231107' of https://github.com/alistair23/qemu into staging (2023-11-07 11:08:16 +0800)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request

for you to fetch changes up to fb93569e422d4f4b5953dd953c92ba7838309972:

  ui: Replacing pointer in function (2023-11-07 11:45:48 +0400)

----------------------------------------------------------------
UI patch queue

----------------------------------------------------------------

Antonio Caggiano (1):
  ui/gtk-egl: Check EGLSurface before doing scanout

Carwyn Ellis (1):
  ui/cocoa: add zoom-to-fit display option

Dongwon Kim (1):
  ui/gtk-egl: apply scale factor when calculating window's dimension

Marc-André Lureau (1):
  ui/gtk: force realization of drawing area

Sergey Mironov (1):
  ui: Replacing pointer in function

 qapi/ui.json |  7 ++++++-
 ui/gtk-egl.c | 31 ++++++++++++++++++++-----------
 ui/gtk.c     | 12 +++++++++++-
 ui/cocoa.m   | 32 ++++++++++++++++++--------------
 4 files changed, 55 insertions(+), 27 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PULL 1/5] ui/gtk: force realization of drawing area
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
@ 2023-11-07  9:30 ` marcandre.lureau
  2023-11-07  9:30 ` [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout marcandre.lureau
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fixes the GL context creation from a widget that isn't yet realized (in
a hidden tab for example).

Resolves:
https://gitlab.com/qemu-project/qemu/-/issues/1727

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Message-Id: <20231017111642.1155545-1-marcandre.lureau@redhat.com>
---
 ui/gtk.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 935de1209b..2a4c9b84ba 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2371,6 +2371,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
     GdkDisplay *window_display;
     GtkIconTheme *theme;
     char *dir;
+    int idx;
 
     if (!gtkinit) {
         fprintf(stderr, "gtk initialization failed\n");
@@ -2434,6 +2435,15 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
     gtk_container_add(GTK_CONTAINER(s->window), s->vbox);
 
     gtk_widget_show_all(s->window);
+
+    for (idx = 0;; idx++) {
+        QemuConsole *con = qemu_console_lookup_by_index(idx);
+        if (!con) {
+            break;
+        }
+        gtk_widget_realize(s->vc[idx].gfx.drawing_area);
+    }
+
     if (opts->u.gtk.has_show_menubar &&
         !opts->u.gtk.show_menubar) {
         gtk_widget_hide(s->menu_bar);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
  2023-11-07  9:30 ` [PULL 1/5] ui/gtk: force realization of drawing area marcandre.lureau
@ 2023-11-07  9:30 ` marcandre.lureau
  2023-11-09 19:59   ` Volker Rümelin
  2023-11-07  9:30 ` [PULL 3/5] ui/gtk-egl: apply scale factor when calculating window's dimension marcandre.lureau
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell, Antonio Caggiano

From: Antonio Caggiano <quic_acaggian@quicinc.com>

The first time gd_egl_scanout_texture() is called, there's a possibility
that the GTK drawing area might not be realized yet, in which case its
associated GdkWindow is NULL. This means gd_egl_init() was also skipped
and the EGLContext and EGLSurface stored in the VirtualGfxConsole are
not valid yet.

Continuing with the scanout in this conditions would result in hitting
an assert in libepoxy: "Couldn't find current GLX or EGL context".

A possible workaround is to just ignore the scanout request, giving the
the GTK drawing area some time to finish its realization. At that point,
the gd_egl_init() will succeed and the EGLContext and EGLSurface stored
in the VirtualGfxConsole will be valid.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20231016123215.2699269-1-quic_acaggian@quicinc.com>
---
 ui/gtk-egl.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index a1060fd80f..3e8d1c1d02 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -243,12 +243,19 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
     vc->gfx.h = h;
     vc->gfx.y0_top = backing_y_0_top;
 
-    eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
-                   vc->gfx.esurface, vc->gfx.ectx);
+    if (!vc->gfx.esurface) {
+        gd_egl_init(vc);
+        if (!vc->gfx.esurface) {
+            return;
+        }
+
+        eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
+                       vc->gfx.esurface, vc->gfx.ectx);
 
-    gtk_egl_set_scanout_mode(vc, true);
-    egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
-                         backing_id, false);
+        gtk_egl_set_scanout_mode(vc, true);
+        egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
+                             backing_id, false);
+    }
 }
 
 void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PULL 3/5] ui/gtk-egl: apply scale factor when calculating window's dimension
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
  2023-11-07  9:30 ` [PULL 1/5] ui/gtk: force realization of drawing area marcandre.lureau
  2023-11-07  9:30 ` [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout marcandre.lureau
@ 2023-11-07  9:30 ` marcandre.lureau
  2023-11-07  9:30 ` [PULL 4/5] ui/cocoa: add zoom-to-fit display option marcandre.lureau
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell, Dongwon Kim

From: Dongwon Kim <dongwon.kim@intel.com>

Scale factor needs to be applied when calculating width/height of the
GTK windows.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20231012222643.13996-1-dongwon.kim@intel.com>
---
 ui/gtk-egl.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 3e8d1c1d02..cd2f176502 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -69,15 +69,16 @@ void gd_egl_draw(VirtualConsole *vc)
 #ifdef CONFIG_GBM
     QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
 #endif
-    int ww, wh;
+    int ww, wh, ws;
 
     if (!vc->gfx.gls) {
         return;
     }
 
     window = gtk_widget_get_window(vc->gfx.drawing_area);
-    ww = gdk_window_get_width(window);
-    wh = gdk_window_get_height(window);
+    ws = gdk_window_get_scale_factor(window);
+    ww = gdk_window_get_width(window) * ws;
+    wh = gdk_window_get_height(window) * ws;
 
     if (vc->gfx.scanout_mode) {
 #ifdef CONFIG_GBM
@@ -319,7 +320,7 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,
 {
     VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
     GdkWindow *window;
-    int ww, wh;
+    int ww, wh, ws;
 
     if (!vc->gfx.scanout_mode) {
         return;
@@ -332,8 +333,9 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,
                    vc->gfx.esurface, vc->gfx.ectx);
 
     window = gtk_widget_get_window(vc->gfx.drawing_area);
-    ww = gdk_window_get_width(window);
-    wh = gdk_window_get_height(window);
+    ws = gdk_window_get_scale_factor(window);
+    ww = gdk_window_get_width(window) * ws;
+    wh = gdk_window_get_height(window) * ws;
     egl_fb_setup_default(&vc->gfx.win_fb, ww, wh);
     if (vc->gfx.cursor_fb.texture) {
         egl_texture_blit(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PULL 4/5] ui/cocoa: add zoom-to-fit display option
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
                   ` (2 preceding siblings ...)
  2023-11-07  9:30 ` [PULL 3/5] ui/gtk-egl: apply scale factor when calculating window's dimension marcandre.lureau
@ 2023-11-07  9:30 ` marcandre.lureau
  2023-11-07  9:30 ` [PULL 5/5] ui: Replacing pointer in function marcandre.lureau
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell, Carwyn Ellis

From: Carwyn Ellis <carwynellis@gmail.com>

Provides a display option, zoom-to-fit, that enables scaling of the
display when full-screen mode is enabled.

Also ensures that the corresponding menu item is marked as enabled when
the option is set to on.

Signed-off-by: Carwyn Ellis <carwynellis@gmail.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20231027154920.80626-2-carwynellis@gmail.com>
---
 qapi/ui.json |  7 ++++++-
 ui/cocoa.m   | 32 ++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/qapi/ui.json b/qapi/ui.json
index 006616aa77..3718d40fcf 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -1409,13 +1409,18 @@
 #     codes match their position on non-Mac keyboards and you can use
 #     Meta/Super and Alt where you expect them.  (default: off)
 #
+# @zoom-to-fit: Zoom guest display to fit into the host window. When
+#     turned off the host window will be resized instead. Defaults to
+#     "off". (Since 8.2)
+#
 # Since: 7.0
 ##
 { 'struct': 'DisplayCocoa',
   'data': {
       '*left-command-key': 'bool',
       '*full-grab': 'bool',
-      '*swap-opt-cmd': 'bool'
+      '*swap-opt-cmd': 'bool',
+      '*zoom-to-fit': 'bool'
   } }
 
 ##
diff --git a/ui/cocoa.m b/ui/cocoa.m
index d95276013c..cd069da696 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1247,7 +1247,6 @@ - (id) init
         [normalWindow makeKeyAndOrderFront:self];
         [normalWindow center];
         [normalWindow setDelegate: self];
-        stretch_video = false;
 
         /* Used for displaying pause on the screen */
         pauseLabel = [NSTextField new];
@@ -1671,7 +1670,9 @@ static void create_initial_menus(void)
     // View menu
     menu = [[NSMenu alloc] initWithTitle:@"View"];
     [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Enter Fullscreen" action:@selector(doToggleFullScreen:) keyEquivalent:@"f"] autorelease]]; // Fullscreen
-    [menu addItem: [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:@selector(zoomToFit:) keyEquivalent:@""] autorelease]];
+    menuItem = [[[NSMenuItem alloc] initWithTitle:@"Zoom To Fit" action:@selector(zoomToFit:) keyEquivalent:@""] autorelease];
+    [menuItem setState: stretch_video ? NSControlStateValueOn : NSControlStateValueOff];
+    [menu addItem: menuItem];
     menuItem = [[[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""] autorelease];
     [menuItem setSubmenu:menu];
     [[NSApp mainMenu] addItem:menuItem];
@@ -2041,18 +2042,6 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
 
     [QemuApplication sharedApplication];
 
-    create_initial_menus();
-
-    /*
-     * Create the menu entries which depend on QEMU state (for consoles
-     * and removable devices). These make calls back into QEMU functions,
-     * which is OK because at this point we know that the second thread
-     * holds the iothread lock and is synchronously waiting for us to
-     * finish.
-     */
-    add_console_menu_entries();
-    addRemovableDevicesMenuItems();
-
     // Create an Application controller
     QemuCocoaAppController *controller = [[QemuCocoaAppController alloc] init];
     [NSApp setDelegate:controller];
@@ -2077,6 +2066,21 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
         left_command_key_enabled = 0;
     }
 
+    if (opts->u.cocoa.has_zoom_to_fit && opts->u.cocoa.zoom_to_fit) {
+        stretch_video = true;
+    }
+
+    create_initial_menus();
+    /*
+     * Create the menu entries which depend on QEMU state (for consoles
+     * and removable devices). These make calls back into QEMU functions,
+     * which is OK because at this point we know that the second thread
+     * holds the iothread lock and is synchronously waiting for us to
+     * finish.
+     */
+    add_console_menu_entries();
+    addRemovableDevicesMenuItems();
+
     // register vga output callbacks
     register_displaychangelistener(&dcl);
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PULL 5/5] ui: Replacing pointer in function
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
                   ` (3 preceding siblings ...)
  2023-11-07  9:30 ` [PULL 4/5] ui/cocoa: add zoom-to-fit display option marcandre.lureau
@ 2023-11-07  9:30 ` marcandre.lureau
  2023-11-07 13:40 ` [PULL 0/5] Ui patches Stefan Hajnoczi
  2023-11-07 16:57 ` Michael Tokarev
  6 siblings, 0 replies; 18+ messages in thread
From: marcandre.lureau @ 2023-11-07  9:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell, Sergey Mironov

From: Sergey Mironov <mironov@fintech.ru>

At the end of the first if we see 'vc->gfx.surface = NULL;',
further checking of it is pointless. In the second if, ectx is taken.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Co-developed-by: Linux Verification Center <sdl.qemu@linuxtesting.org>
Signed-off-by: Sergey Mironov <mironov@fintech.ru>
Message-ID: <20231012104448.1251039-1-mironov@fintech.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2a4c9b84ba..be047a41ad 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1400,7 +1400,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque)
             eglDestroySurface(qemu_egl_display, vc->gfx.esurface);
             vc->gfx.esurface = NULL;
         }
-        if (vc->gfx.esurface) {
+        if (vc->gfx.ectx) {
             eglDestroyContext(qemu_egl_display, vc->gfx.ectx);
             vc->gfx.ectx = NULL;
         }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] Ui patches
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
                   ` (4 preceding siblings ...)
  2023-11-07  9:30 ` [PULL 5/5] ui: Replacing pointer in function marcandre.lureau
@ 2023-11-07 13:40 ` Stefan Hajnoczi
  2023-11-07 16:57 ` Michael Tokarev
  6 siblings, 0 replies; 18+ messages in thread
From: Stefan Hajnoczi @ 2023-11-07 13:40 UTC (permalink / raw)
  To: marcandre.lureau
  Cc: qemu-devel, Gerd Hoffmann, Marc-André Lureau, Akihiko Odaki,
	Philippe Mathieu-Daudé, Markus Armbruster, Eric Blake,
	Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] Ui patches
  2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
                   ` (5 preceding siblings ...)
  2023-11-07 13:40 ` [PULL 0/5] Ui patches Stefan Hajnoczi
@ 2023-11-07 16:57 ` Michael Tokarev
  6 siblings, 0 replies; 18+ messages in thread
From: Michael Tokarev @ 2023-11-07 16:57 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel
  Cc: Gerd Hoffmann, Akihiko Odaki, Philippe Mathieu-Daudé,
	Markus Armbruster, Eric Blake, Peter Maydell, Antonio Caggiano,
	Dongwon Kim, Sergey Mironov

07.11.2023 12:30, marcandre.lureau@redhat.com:
...
> Antonio Caggiano (1):
>    ui/gtk-egl: Check EGLSurface before doing scanout
> 
> Carwyn Ellis (1):
>    ui/cocoa: add zoom-to-fit display option
> 
> Dongwon Kim (1):
>    ui/gtk-egl: apply scale factor when calculating window's dimension
> 
> Marc-André Lureau (1):
>    ui/gtk: force realization of drawing area
> 
> Sergey Mironov (1):
>    ui: Replacing pointer in function

Which changes are worth picking up for qemu-stable?

I'm definitely picking up "ui/gtk: force realization of drawing area"
which fixes a real bug.  "ui/gtk-egl: Check EGLSurface before doing scanout"
and "ui/gtk-egl: apply scale factor when calculating window's dimension"
smells like valid candidates too, maybe "ui: Replacing pointer in function"
as well?

(Adding patch authors to the Cc list)

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout
  2023-11-07  9:30 ` [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout marcandre.lureau
@ 2023-11-09 19:59   ` Volker Rümelin
  2023-11-10 19:25     ` Volker Rümelin
  0 siblings, 1 reply; 18+ messages in thread
From: Volker Rümelin @ 2023-11-09 19:59 UTC (permalink / raw)
  To: Antonio Caggiano
  Cc: Marc-André Lureau, Gerd Hoffmann, Michael Tokarev,
	qemu-devel

> From: Antonio Caggiano <quic_acaggian@quicinc.com>
>
> The first time gd_egl_scanout_texture() is called, there's a possibility
> that the GTK drawing area might not be realized yet, in which case its
> associated GdkWindow is NULL. This means gd_egl_init() was also skipped
> and the EGLContext and EGLSurface stored in the VirtualGfxConsole are
> not valid yet.
>
> Continuing with the scanout in this conditions would result in hitting
> an assert in libepoxy: "Couldn't find current GLX or EGL context".
>
> A possible workaround is to just ignore the scanout request, giving the
> the GTK drawing area some time to finish its realization. At that point,
> the gd_egl_init() will succeed and the EGLContext and EGLSurface stored
> in the VirtualGfxConsole will be valid.
>
> Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-Id: <20231016123215.2699269-1-quic_acaggian@quicinc.com>
> ---
>  ui/gtk-egl.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)

Hi Antonio,

this patch breaks the QEMU guest display on my system. QEMU was started
with ./qemu-system-x86_64 -machine q35 -device
virtio-vga-gl,xres=1280,yres=768 -display gtk,zoom-to-fit=off,gl=on. I
can see the OVMF boot screen and then GRUB. After Linux was started,
plymouth normally shows the OVMF boot logo and a rotating spinner. With
your patch the guest screen is black and shows 'Display output is not
active.'. It seems the guest works without issues. I can use ssh to log
in and I can't find any obvious errors in the guest log files. The host
uses a GNOME desktop under X11.

If I revert this patch everything works as expected.

With best regards,
Volker

Cc: Michael Tokarev
This will affect Stable-7.2.7 and Stable-8.1.3.

> diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
> index a1060fd80f..3e8d1c1d02 100644
> --- a/ui/gtk-egl.c
> +++ b/ui/gtk-egl.c
> @@ -243,12 +243,19 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
>      vc->gfx.h = h;
>      vc->gfx.y0_top = backing_y_0_top;
>  
> -    eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
> -                   vc->gfx.esurface, vc->gfx.ectx);
> +    if (!vc->gfx.esurface) {
> +        gd_egl_init(vc);
> +        if (!vc->gfx.esurface) {
> +            return;
> +        }
> +
> +        eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
> +                       vc->gfx.esurface, vc->gfx.ectx);
>  
> -    gtk_egl_set_scanout_mode(vc, true);
> -    egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
> -                         backing_id, false);
> +        gtk_egl_set_scanout_mode(vc, true);
> +        egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
> +                             backing_id, false);
> +    }
>  }
>  
>  void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout
  2023-11-09 19:59   ` Volker Rümelin
@ 2023-11-10 19:25     ` Volker Rümelin
  0 siblings, 0 replies; 18+ messages in thread
From: Volker Rümelin @ 2023-11-10 19:25 UTC (permalink / raw)
  To: Antonio Caggiano
  Cc: Marc-André Lureau, Gerd Hoffmann, Michael Tokarev,
	qemu-devel

>> From: Antonio Caggiano <quic_acaggian@quicinc.com>
>>
>> The first time gd_egl_scanout_texture() is called, there's a possibility
>> that the GTK drawing area might not be realized yet, in which case its
>> associated GdkWindow is NULL. This means gd_egl_init() was also skipped
>> and the EGLContext and EGLSurface stored in the VirtualGfxConsole are
>> not valid yet.
>>
>> Continuing with the scanout in this conditions would result in hitting
>> an assert in libepoxy: "Couldn't find current GLX or EGL context".
>>
>> A possible workaround is to just ignore the scanout request, giving the
>> the GTK drawing area some time to finish its realization. At that point,
>> the gd_egl_init() will succeed and the EGLContext and EGLSurface stored
>> in the VirtualGfxConsole will be valid.
>>
>> Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
>> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Message-Id: <20231016123215.2699269-1-quic_acaggian@quicinc.com>
>> ---
>>  ui/gtk-egl.c | 17 ++++++++++++-----
>>  1 file changed, 12 insertions(+), 5 deletions(-)
> Hi Antonio,
>
> this patch breaks the QEMU guest display on my system. QEMU was started
> with ./qemu-system-x86_64 -machine q35 -device
> virtio-vga-gl,xres=1280,yres=768 -display gtk,zoom-to-fit=off,gl=on. I
> can see the OVMF boot screen and then GRUB. After Linux was started,
> plymouth normally shows the OVMF boot logo and a rotating spinner. With
> your patch the guest screen is black and shows 'Display output is not
> active.'. It seems the guest works without issues. I can use ssh to log
> in and I can't find any obvious errors in the guest log files. The host
> uses a GNOME desktop under X11.
>
> If I revert this patch everything works as expected.
>
> With best regards,
> Volker
>
> Cc: Michael Tokarev
> This will affect Stable-7.2.7 and Stable-8.1.3.
>
>> diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
>> index a1060fd80f..3e8d1c1d02 100644
>> --- a/ui/gtk-egl.c
>> +++ b/ui/gtk-egl.c
>> @@ -243,12 +243,19 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
>>      vc->gfx.h = h;
>>      vc->gfx.y0_top = backing_y_0_top;
>>  
>> -    eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
>> -                   vc->gfx.esurface, vc->gfx.ectx);
>> +    if (!vc->gfx.esurface) {
>> +        gd_egl_init(vc);
>> +        if (!vc->gfx.esurface) {
>> +            return;
>> +        }
>> +
>> +        eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
>> +                       vc->gfx.esurface, vc->gfx.ectx);
>>  
>> -    gtk_egl_set_scanout_mode(vc, true);
>> -    egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
>> -                         backing_id, false);
>> +        gtk_egl_set_scanout_mode(vc, true);
>> +        egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
>> +                             backing_id, false);
>> +    }
>>  }
>>  
>>  void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,

I can see the mistake. I'll write a patch to fix it.

With best regards,
Volker





^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PULL 0/5] Ui patches
@ 2023-11-21 10:40 marcandre.lureau
  2023-11-21 15:14 ` Stefan Hajnoczi
  0 siblings, 1 reply; 18+ messages in thread
From: marcandre.lureau @ 2023-11-21 10:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Paolo Bonzini, Marc-André Lureau,
	peter.maydell, dwmw

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit af9264da80073435fd78944bc5a46e695897d7e5:

  Merge tag '20231119-xtensa-1' of https://github.com/OSLL/qemu-xtensa into staging (2023-11-20 05:25:19 -0500)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request

for you to fetch changes up to e0c58720bfd8c0553f170b64717278b07438d2f5:

  ui/pixman-minimal.h: fix empty allocation (2023-11-21 14:38:14 +0400)

----------------------------------------------------------------
UI: fixes for 8.2-rc1

----------------------------------------------------------------

Manos Pitsidianakis (1):
  ui/pixman-minimal.h: fix empty allocation

Marc-André Lureau (4):
  vl: revert behaviour for -display none
  ui: use "vc" chardev for dbus, gtk & spice-app
  ui/console: fix default VC when there are no display
  vl: add missing display_remote++

 include/ui/pixman-minimal.h | 48 +++++++++++++++++++++++++++++++++++--
 system/vl.c                 |  4 +++-
 ui/console.c                | 18 +++++++-------
 ui/dbus.c                   |  1 +
 ui/gtk.c                    |  1 +
 ui/spice-app.c              |  1 +
 6 files changed, 60 insertions(+), 13 deletions(-)

-- 
2.42.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] Ui patches
  2023-11-21 10:40 marcandre.lureau
@ 2023-11-21 15:14 ` Stefan Hajnoczi
  0 siblings, 0 replies; 18+ messages in thread
From: Stefan Hajnoczi @ 2023-11-21 15:14 UTC (permalink / raw)
  To: marcandre.lureau
  Cc: qemu-devel, Gerd Hoffmann, Paolo Bonzini, Marc-André Lureau,
	peter.maydell, dwmw

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PULL 0/5] UI patches
@ 2024-03-12 14:02 marcandre.lureau
  2024-03-12 21:32 ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: marcandre.lureau @ 2024-03-12 14:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, Marc-André Lureau, Gerd Hoffmann,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit 8f3f329f5e0117bd1a23a79ab751f8a7d3471e4b:

  Merge tag 'migration-20240311-pull-request' of https://gitlab.com/peterx/qemu into staging (2024-03-12 11:35:41 +0000)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request

for you to fetch changes up to dfcf74fa68c88233209aafc5f82728d0b9a1af5c:

  virtio-gpu: fix scanout migration post-load (2024-03-12 17:57:58 +0400)

----------------------------------------------------------------
display/ui: pending fixes

- ui/vnc: Respect bound console
- ui/dbus: optimize a bit message queuing
- virtio-gpu: fix blob scanout post-load

----------------------------------------------------------------

Akihiko Odaki (1):
  ui/vnc: Respect bound console

Marc-André Lureau (4):
  ui/dbus: factor out sending a scanout
  ui/dbus: filter out pending messages when scanout
  virtio-gpu: remove needless condition
  virtio-gpu: fix scanout migration post-load

 include/hw/virtio/virtio-gpu.h |  1 +
 hw/display/virtio-gpu.c        | 58 ++++++++++++++++++--------
 ui/dbus-listener.c             | 75 ++++++++++++++++++++++++++--------
 ui/vnc.c                       | 59 +++++++++++++-------------
 ui/trace-events                |  1 +
 5 files changed, 130 insertions(+), 64 deletions(-)

-- 
2.44.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] UI patches
  2024-03-12 14:02 [PULL 0/5] UI patches marcandre.lureau
@ 2024-03-12 21:32 ` Peter Maydell
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Maydell @ 2024-03-12 21:32 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: qemu-devel, Gerd Hoffmann, Michael S. Tsirkin

On Tue, 12 Mar 2024 at 14:02, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The following changes since commit 8f3f329f5e0117bd1a23a79ab751f8a7d3471e4b:
>
>   Merge tag 'migration-20240311-pull-request' of https://gitlab.com/peterx/qemu into staging (2024-03-12 11:35:41 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request
>
> for you to fetch changes up to dfcf74fa68c88233209aafc5f82728d0b9a1af5c:
>
>   virtio-gpu: fix scanout migration post-load (2024-03-12 17:57:58 +0400)
>
> ----------------------------------------------------------------
> display/ui: pending fixes
>
> - ui/vnc: Respect bound console
> - ui/dbus: optimize a bit message queuing
> - virtio-gpu: fix blob scanout post-load
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PULL 0/5] Ui patches
@ 2024-03-20 13:53 marcandre.lureau
  2024-03-20 16:58 ` Peter Maydell
  0 siblings, 1 reply; 18+ messages in thread
From: marcandre.lureau @ 2024-03-20 13:53 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Michael S. Tsirkin, Peter Maydell,
	Gerd Hoffmann, Akihiko Odaki, Philippe Mathieu-Daudé

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit c62d54d0a8067ffb3d5b909276f7296d7df33fa7:

  Update version for v9.0.0-rc0 release (2024-03-19 19:13:52 +0000)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request

for you to fetch changes up to d4069a84a3380247c1b524096c6a807743bf687a:

  ui: compile dbus-display1.c with -fPIC as necessary (2024-03-20 10:28:00 +0400)

----------------------------------------------------------------
UI: fixes

- dbus-display shared-library compilation fix
- remove console_select() and fix related issues

----------------------------------------------------------------

Akihiko Odaki (4):
  ui/vc: Do not inherit the size of active console
  ui/vnc: Do not use console_select()
  ui/cocoa: Do not use console_select()
  ui/curses: Do not use console_select()

Marc-André Lureau (1):
  ui: compile dbus-display1.c with -fPIC as necessary

 include/ui/console.h   |   2 +-
 include/ui/kbd-state.h |  11 ++++
 ui/console-priv.h      |   2 +-
 ui/console-vc-stubs.c  |   2 +-
 ui/console-vc.c        |   7 +--
 ui/console.c           | 133 ++++++++++-------------------------------
 ui/curses.c            |  48 ++++++++-------
 ui/kbd-state.c         |   6 ++
 ui/vnc.c               |  14 +++--
 ui/cocoa.m             |  37 ++++++++----
 ui/meson.build         |   3 +-
 11 files changed, 119 insertions(+), 146 deletions(-)

-- 
2.44.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] Ui patches
  2024-03-20 13:53 [PULL 0/5] Ui patches marcandre.lureau
@ 2024-03-20 16:58 ` Peter Maydell
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Maydell @ 2024-03-20 16:58 UTC (permalink / raw)
  To: marcandre.lureau
  Cc: qemu-devel, Michael S. Tsirkin, Gerd Hoffmann, Akihiko Odaki,
	Philippe Mathieu-Daudé

On Wed, 20 Mar 2024 at 13:54, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The following changes since commit c62d54d0a8067ffb3d5b909276f7296d7df33fa7:
>
>   Update version for v9.0.0-rc0 release (2024-03-19 19:13:52 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request
>
> for you to fetch changes up to d4069a84a3380247c1b524096c6a807743bf687a:
>
>   ui: compile dbus-display1.c with -fPIC as necessary (2024-03-20 10:28:00 +0400)
>
> ----------------------------------------------------------------
> UI: fixes
>
> - dbus-display shared-library compilation fix
> - remove console_select() and fix related issues
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PULL 0/5] Ui patches
@ 2025-09-30  7:55 marcandre.lureau
  2025-10-01 13:29 ` Richard Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: marcandre.lureau @ 2025-09-30  7:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, richard.henderson

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit 9b16edec6e9a483469c789475b2065d26b52db35:

  Merge tag 'pull-ppc-for-20250928-20250929' of https://gitlab.com/harshpb/qemu into staging (2025-09-29 07:25:28 -0700)

are available in the Git repository at:

  https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request

for you to fetch changes up to 9163424c50981dbc4ded9990228ac01a3b193656:

  ui/icons/qemu.svg: Add metadata information (author, license) to the logo (2025-09-30 11:21:55 +0400)

----------------------------------------------------------------
UI-related

Fixes for gtk, sdl2, spice UI backends.

----------------------------------------------------------------

Marc-André Lureau (1):
  ui/spice: fix crash when disabling GL scanout on

Mohamed Akram (1):
  ui/spice: Fix abort on macOS

Nir Lichtman (1):
  ui/sdl2: fix reset scaling binding to be consistent with gtk

Thomas Huth (1):
  ui/icons/qemu.svg: Add metadata information (author, license) to the
    logo

Weifeng Liu (1):
  gtk: Skip drawing if console surface is NULL

 ui/gtk-egl.c       |  5 +----
 ui/gtk-gl-area.c   |  5 +----
 ui/sdl2.c          |  2 +-
 ui/spice-core.c    |  6 +-----
 ui/spice-display.c |  4 +++-
 ui/icons/qemu.svg  | 21 ++++++++++++++++++++-
 6 files changed, 27 insertions(+), 16 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PULL 0/5] Ui patches
  2025-09-30  7:55 marcandre.lureau
@ 2025-10-01 13:29 ` Richard Henderson
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2025-10-01 13:29 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel

On 9/30/25 00:55, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau<marcandre.lureau@redhat.com>
> 
> The following changes since commit 9b16edec6e9a483469c789475b2065d26b52db35:
> 
>    Merge tag 'pull-ppc-for-20250928-20250929' ofhttps://gitlab.com/harshpb/qemu into staging (2025-09-29 07:25:28 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/marcandre.lureau/qemu.git tags/ui-pull-request
> 
> for you to fetch changes up to 9163424c50981dbc4ded9990228ac01a3b193656:
> 
>    ui/icons/qemu.svg: Add metadata information (author, license) to the logo (2025-09-30 11:21:55 +0400)
> 
> ----------------------------------------------------------------
> UI-related
> 
> Fixes for gtk, sdl2, spice UI backends.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-10-01 13:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07  9:30 [PULL 0/5] Ui patches marcandre.lureau
2023-11-07  9:30 ` [PULL 1/5] ui/gtk: force realization of drawing area marcandre.lureau
2023-11-07  9:30 ` [PULL 2/5] ui/gtk-egl: Check EGLSurface before doing scanout marcandre.lureau
2023-11-09 19:59   ` Volker Rümelin
2023-11-10 19:25     ` Volker Rümelin
2023-11-07  9:30 ` [PULL 3/5] ui/gtk-egl: apply scale factor when calculating window's dimension marcandre.lureau
2023-11-07  9:30 ` [PULL 4/5] ui/cocoa: add zoom-to-fit display option marcandre.lureau
2023-11-07  9:30 ` [PULL 5/5] ui: Replacing pointer in function marcandre.lureau
2023-11-07 13:40 ` [PULL 0/5] Ui patches Stefan Hajnoczi
2023-11-07 16:57 ` Michael Tokarev
  -- strict thread matches above, loose matches on Subject: below --
2023-11-21 10:40 marcandre.lureau
2023-11-21 15:14 ` Stefan Hajnoczi
2024-03-12 14:02 [PULL 0/5] UI patches marcandre.lureau
2024-03-12 21:32 ` Peter Maydell
2024-03-20 13:53 [PULL 0/5] Ui patches marcandre.lureau
2024-03-20 16:58 ` Peter Maydell
2025-09-30  7:55 marcandre.lureau
2025-10-01 13:29 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).