Hi Daniel, > -----Original Message----- > From: Daniel P. Berrangé <[email protected]> > Sent: Thursday, March 7, 2024 1:41 AM > To: Kim, Dongwon <[email protected]> > Cc: [email protected] > Subject: Re: [PATCH 1/3] ui/gtk: skip drawing guest scanout when associated > VC is invisible > > On Tue, Jan 30, 2024 at 03:48:38PM -0800, [email protected] wrote: > > From: Dongwon Kim <[email protected]> > > > > A new flag "visible" is added to show visibility status of the gfx console. > > The flag is set to 'true' when the VC is visible but set to 'false' > > when it is hidden or closed. When the VC is invisible, drawing guest > > frames should be skipped as it will never be completed and it would > > potentially lock up the guest display especially when blob scanout is used. > > > > Cc: Marc-André Lureau <[email protected]> > > Cc: Gerd Hoffmann <[email protected]> > > Cc: Vivek Kasireddy <[email protected]> > > > > Signed-off-by: Dongwon Kim <[email protected]> > > --- > > include/ui/gtk.h | 1 + > > ui/gtk-egl.c | 8 ++++++++ > > ui/gtk-gl-area.c | 8 ++++++++ > > ui/gtk.c | 10 +++++++++- > > 4 files changed, 26 insertions(+), 1 deletion(-) > > > > diff --git a/include/ui/gtk.h b/include/ui/gtk.h index > > aa3d637029..2de38e5724 100644 > > --- a/include/ui/gtk.h > > +++ b/include/ui/gtk.h > > @@ -57,6 +57,7 @@ typedef struct VirtualGfxConsole { > > bool y0_top; > > bool scanout_mode; > > bool has_dmabuf; > > + bool visible; > > #endif > > } VirtualGfxConsole; > > > > diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 3af5ac5bcf..993c283191 > > 100644 > > --- a/ui/gtk-egl.c > > +++ b/ui/gtk-egl.c > > @@ -265,6 +265,10 @@ void > gd_egl_scanout_dmabuf(DisplayChangeListener > > *dcl, #ifdef CONFIG_GBM > > VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); > > > > + if (!vc->gfx.visible) { > > + return; > > + } > > + > > eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, > > vc->gfx.esurface, vc->gfx.ectx); > > > > @@ -363,6 +367,10 @@ void gd_egl_flush(DisplayChangeListener *dcl, > > VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); > > GtkWidget *area = vc->gfx.drawing_area; > > > > + if (!vc->gfx.visible) { > > + return; > > + } > > + > > if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf- > >draw_submitted) { > > graphic_hw_gl_block(vc->gfx.dcl.con, true); > > vc->gfx.guest_fb.dmabuf->draw_submitted = true; diff --git > > a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 52dcac161e..04e07bd7ee > > 100644 > > --- a/ui/gtk-gl-area.c > > +++ b/ui/gtk-gl-area.c > > @@ -285,6 +285,10 @@ void > > gd_gl_area_scanout_flush(DisplayChangeListener *dcl, { > > VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); > > > > + if (!vc->gfx.visible) { > > + return; > > + } > > + > > if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf- > >draw_submitted) { > > graphic_hw_gl_block(vc->gfx.dcl.con, true); > > vc->gfx.guest_fb.dmabuf->draw_submitted = true; @@ -299,6 > > +303,10 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl, > > #ifdef CONFIG_GBM > > VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); > > > > + if (!vc->gfx.visible) { > > + return; > > + } > > + > > gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); > > egl_dmabuf_import_texture(dmabuf); > > if (!dmabuf->texture) { > > If we skip processing these requests, what happens when the QEMU windows is > then re-displayed. Won't it now be missing updates to various regions of the > guest display ? [Kim, Dongwon] Scanout blob is continuously submitted by the guest even when the vc->visible is false. So it will just display the current guest frame right away when the window is redisplayed again.
> > > > With regards, > Daniel > -- > |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| > |: https://libvirt.org -o- https://fstop138.berrange.com :| > |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
