diff mbox series

[v2,07/20] ui: add gd_gl_area_scanout_disable

Message ID 20210204105232.834642-8-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series Various vhost-user-gpu & UI fixes | expand

Commit Message

Marc-André Lureau Feb. 4, 2021, 10:52 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Require the callback, drop the fallback path.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/gtk.h | 1 +
 ui/console.c     | 7 +------
 ui/gtk-gl-area.c | 7 +++++++
 ui/gtk.c         | 1 +
 4 files changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index 3f395d7f94..7569d090fa 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -140,6 +140,7 @@  void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
                                 uint32_t backing_height,
                                 uint32_t x, uint32_t y,
                                 uint32_t w, uint32_t h);
+void gd_gl_area_scanout_disable(DisplayChangeListener *dcl);
 void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
                               uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 void gtk_gl_area_init(void);
diff --git a/ui/console.c b/ui/console.c
index c0b1a3689c..ab9224429e 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1806,12 +1806,7 @@  int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx)
 void dpy_gl_scanout_disable(QemuConsole *con)
 {
     assert(con->gl);
-    if (con->gl->ops->dpy_gl_scanout_disable) {
-        con->gl->ops->dpy_gl_scanout_disable(con->gl);
-    } else {
-        con->gl->ops->dpy_gl_scanout_texture(con->gl, 0, false, 0, 0,
-                                             0, 0, 0, 0);
-    }
+    con->gl->ops->dpy_gl_scanout_disable(con->gl);
 }
 
 void dpy_gl_scanout_texture(QemuConsole *con,
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 98c22d23f5..96fbe75387 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -198,6 +198,13 @@  void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
                          backing_id, false);
 }
 
+void gd_gl_area_scanout_disable(DisplayChangeListener *dcl)
+{
+    VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+
+    gtk_gl_area_set_scanout_mode(vc, false);
+}
+
 void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
                           uint32_t x, uint32_t y, uint32_t w, uint32_t h)
 {
diff --git a/ui/gtk.c b/ui/gtk.c
index a0e6b60ac4..00045881b1 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -638,6 +638,7 @@  static const DisplayChangeListenerOps dcl_gl_area_ops = {
     .dpy_gl_ctx_destroy      = gd_gl_area_destroy_context,
     .dpy_gl_ctx_make_current = gd_gl_area_make_current,
     .dpy_gl_scanout_texture  = gd_gl_area_scanout_texture,
+    .dpy_gl_scanout_disable  = gd_gl_area_scanout_disable,
     .dpy_gl_update           = gd_gl_area_scanout_flush,
 };