diff mbox series

[1/2] console: introduce dpy_gfx_switch_surface

Message ID 1524471278-22546-2-git-send-email-tina.zhang@intel.com
State New
Headers show
Series Add vfio display reset handling | expand

Commit Message

Tina Zhang April 23, 2018, 8:14 a.m. UTC
dpy_gfx_switch_surface is used to ask each valid DisplayChangeListener
of a QemuConsole to switch to another DisplaySurface.

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
---
 include/ui/console.h |  2 ++
 ui/console.c         | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

Comments

Gerd Hoffmann April 23, 2018, 1:04 p.m. UTC | #1
Hi,

>  void dpy_gfx_replace_surface(QemuConsole *con,
>                               DisplaySurface *surface);
> +void dpy_gfx_switch_surface(QemuConsole *con,
> +                             DisplaySurface *surface);

Why?  Any problems with dpy_gfx_replace_surface?

cheers,
  Gerd
diff mbox series

Patch

diff --git a/include/ui/console.h b/include/ui/console.h
index 37a8d68..434033d 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -293,6 +293,8 @@  int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info);
 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h);
 void dpy_gfx_replace_surface(QemuConsole *con,
                              DisplaySurface *surface);
+void dpy_gfx_switch_surface(QemuConsole *con,
+                             DisplaySurface *surface);
 void dpy_text_cursor(QemuConsole *con, int x, int y);
 void dpy_text_update(QemuConsole *con, int x, int y, int w, int h);
 void dpy_text_resize(QemuConsole *con, int w, int h);
diff --git a/ui/console.c b/ui/console.c
index 3fb2f4e..2deb38b 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1595,6 +1595,22 @@  void dpy_gfx_replace_surface(QemuConsole *con,
     qemu_free_displaysurface(old_surface);
 }
 
+void dpy_gfx_switch_surface(QemuConsole *con,
+                             DisplaySurface *surface)
+{
+    DisplayState *s = con->ds;
+    DisplayChangeListener *dcl;
+
+    QLIST_FOREACH(dcl, &s->listeners, next) {
+        if (con != (dcl->con ? dcl->con : active_console)) {
+            continue;
+        }
+        if (dcl->ops->dpy_gfx_switch) {
+            dcl->ops->dpy_gfx_switch(dcl, surface);
+        }
+    }
+}
+
 bool dpy_gfx_check_format(QemuConsole *con,
                           pixman_format_code_t format)
 {