diff mbox series

ui/gtk: set scanout-mode right before scheduling draw

Message ID 20230706183355.29361-1-dongwon.kim@intel.com (mailing list archive)
State New, archived
Headers show
Series ui/gtk: set scanout-mode right before scheduling draw | expand

Commit Message

Kim, Dongwon July 6, 2023, 6:33 p.m. UTC
Setting scanout mode is better to be done very last minute
right because the mode can be reset anytime after it is set in
dpy_gl_scanout_texture by any asynchronouse dpy_refresh call,
which eventually cancels drawing of the guest scanout texture.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 ui/gtk-egl.c     | 2 +-
 ui/gtk-gl-area.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Marc-André Lureau July 17, 2023, 9:29 a.m. UTC | #1
On Thu, Jul 6, 2023 at 10:57 PM Dongwon Kim <dongwon.kim@intel.com> wrote:

> Setting scanout mode is better to be done very last minute
> right because the mode can be reset anytime after it is set in
> dpy_gl_scanout_texture by any asynchronouse dpy_refresh call,
> which eventually cancels drawing of the guest scanout texture.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
>

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


> ---
>  ui/gtk-egl.c     | 2 +-
>  ui/gtk-gl-area.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
> index d59b8cd7d7..b0356d1969 100644
> --- a/ui/gtk-egl.c
> +++ b/ui/gtk-egl.c
> @@ -238,7 +238,6 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl,
>      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);
>  }
> @@ -347,6 +346,7 @@ void gd_egl_flush(DisplayChangeListener *dcl,
>      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;
> +        gtk_egl_set_scanout_mode(vc, true);
>          gtk_widget_queue_draw_area(area, x, y, w, h);
>          return;
>      }
> diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
> index 7367dfd793..cc8c2f8061 100644
> --- a/ui/gtk-gl-area.c
> +++ b/ui/gtk-gl-area.c
> @@ -262,7 +262,6 @@ void gd_gl_area_scanout_texture(DisplayChangeListener
> *dcl,
>          return;
>      }
>
> -    gtk_gl_area_set_scanout_mode(vc, true);
>      egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
>                           backing_id, false);
>  }
> @@ -282,6 +281,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener
> *dcl,
>      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;
> +        gtk_gl_area_set_scanout_mode(vc, true);
>      }
>      gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
>  }
> --
> 2.34.1
>
>
>
diff mbox series

Patch

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index d59b8cd7d7..b0356d1969 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -238,7 +238,6 @@  void gd_egl_scanout_texture(DisplayChangeListener *dcl,
     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);
 }
@@ -347,6 +346,7 @@  void gd_egl_flush(DisplayChangeListener *dcl,
     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;
+        gtk_egl_set_scanout_mode(vc, true);
         gtk_widget_queue_draw_area(area, x, y, w, h);
         return;
     }
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 7367dfd793..cc8c2f8061 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -262,7 +262,6 @@  void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
         return;
     }
 
-    gtk_gl_area_set_scanout_mode(vc, true);
     egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height,
                          backing_id, false);
 }
@@ -282,6 +281,7 @@  void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
     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;
+        gtk_gl_area_set_scanout_mode(vc, true);
     }
     gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));
 }