[1/2] console: introduce dpy_gfx_switch_surface

Submitted by Zhang, Tina on April 23, 2018, 8:14 a.m.

Details

Message ID 1524471278-22546-2-git-send-email-tina.zhang@intel.com
State New
Headers show
Series "Add vfio display reset handling" ( rev: 2 1 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Zhang, Tina April 23, 2018, 8:14 a.m.
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(+)

Patch hide | download patch | download mbox

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)
 {

Comments

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