diff mbox series

[v1,2/2] ui/gtk: Don't disable scanout when display is refreshed

Message ID 20241006234353.3201037-3-dmitry.osipenko@collabora.com (mailing list archive)
State New, archived
Headers show
Series GTK/SDL fixes for a black screen displayed by virtio-gpu | expand

Commit Message

Dmitry Osipenko Oct. 6, 2024, 11:43 p.m. UTC
Display refreshment is invoked by a timer and it erroneously disables
the active scanout if it happens to be invoked after scanout has been
enabled. This offending scanout-disable race condition with a timer
can be easily hit when Qemu runs with a disabled vsync by using SDL or
GTK displays (with vblank_mode=0 for GTK). Refreshment of display's
content shouldn't disable the active display. Fix it by keeping the
scanout's state unchanged when display is redrawn.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 ui/gtk-egl.c     | 1 -
 ui/gtk-gl-area.c | 1 -
 2 files changed, 2 deletions(-)

Comments

Akihiko Odaki Oct. 7, 2024, 6:15 p.m. UTC | #1
On 2024/10/07 8:43, Dmitry Osipenko wrote:
> Display refreshment is invoked by a timer and it erroneously disables
> the active scanout if it happens to be invoked after scanout has been
> enabled. This offending scanout-disable race condition with a timer
> can be easily hit when Qemu runs with a disabled vsync by using SDL or
> GTK displays (with vblank_mode=0 for GTK). Refreshment of display's
> content shouldn't disable the active display. Fix it by keeping the
> scanout's state unchanged when display is redrawn.
> 
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>

> ---
>   ui/gtk-egl.c     | 1 -
>   ui/gtk-gl-area.c | 1 -
>   2 files changed, 2 deletions(-)
> 
> diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
> index 9831c10e1bd5..6b85a51c4284 100644
> --- a/ui/gtk-egl.c
> +++ b/ui/gtk-egl.c
> @@ -179,7 +179,6 @@ void gd_egl_refresh(DisplayChangeListener *dcl)
>   
>       if (vc->gfx.glupdates) {
>           vc->gfx.glupdates = 0;
> -        gtk_egl_set_scanout_mode(vc, false);
>           gd_egl_draw(vc);
>       }
>   }
> diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
> index b628b354510d..b00817abc011 100644
> --- a/ui/gtk-gl-area.c
> +++ b/ui/gtk-gl-area.c
> @@ -148,7 +148,6 @@ void gd_gl_area_refresh(DisplayChangeListener *dcl)
>   
>       if (vc->gfx.glupdates) {
>           vc->gfx.glupdates = 0;
> -        gtk_gl_area_set_scanout_mode(vc, false);
>           gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
>       }
>   }
diff mbox series

Patch

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 9831c10e1bd5..6b85a51c4284 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -179,7 +179,6 @@  void gd_egl_refresh(DisplayChangeListener *dcl)
 
     if (vc->gfx.glupdates) {
         vc->gfx.glupdates = 0;
-        gtk_egl_set_scanout_mode(vc, false);
         gd_egl_draw(vc);
     }
 }
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index b628b354510d..b00817abc011 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -148,7 +148,6 @@  void gd_gl_area_refresh(DisplayChangeListener *dcl)
 
     if (vc->gfx.glupdates) {
         vc->gfx.glupdates = 0;
-        gtk_gl_area_set_scanout_mode(vc, false);
         gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
     }
 }