diff mbox series

[RFC,2/3] ui/console: Introduce two new APIs

Message ID 20190604095847.10532-3-tina.zhang@intel.com (mailing list archive)
State New, archived
Headers show
Series hw/display: Refresh UI depending on vGPU page flip events | expand

Commit Message

Zhang, Tina June 4, 2019, 9:58 a.m. UTC
graphic_hw_refresh is used by display to invoke console refresh.
dpy_update_interval is used by display to update gui timer interval.

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

Patch

diff --git a/include/ui/console.h b/include/ui/console.h
index fef900db76..3b46264efb 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -275,6 +275,7 @@  void register_displaychangelistener(DisplayChangeListener *dcl);
 void update_displaychangelistener(DisplayChangeListener *dcl,
                                   uint64_t interval);
 void unregister_displaychangelistener(DisplayChangeListener *dcl);
+void dpy_update_interval(QemuConsole *con, uint64_t interval);
 
 bool dpy_ui_info_supported(QemuConsole *con);
 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info);
@@ -379,6 +380,7 @@  void graphic_console_set_hwops(QemuConsole *con,
 void graphic_console_close(QemuConsole *con);
 
 void graphic_hw_update(QemuConsole *con);
+void graphic_hw_refresh(QemuConsole *con);
 void graphic_hw_invalidate(QemuConsole *con);
 void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata);
 void graphic_hw_gl_block(QemuConsole *con, bool block);
diff --git a/ui/console.c b/ui/console.c
index 6d2282d3e9..3a02cea37d 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -268,6 +268,24 @@  void graphic_hw_update(QemuConsole *con)
     }
 }
 
+void graphic_hw_refresh(QemuConsole *con)
+{
+    DisplayState *ds;
+    DisplayChangeListener *dcl;
+
+    if (!con) {
+        con = active_console;
+    }
+
+    ds = con->ds;
+
+    QLIST_FOREACH(dcl, &ds->listeners, next) {
+        if (dcl->ops->dpy_refresh) {
+            dcl->ops->dpy_refresh(dcl);
+        }
+    }
+}
+
 void graphic_hw_gl_block(QemuConsole *con, bool block)
 {
     assert(con != NULL);
@@ -1480,6 +1498,23 @@  void update_displaychangelistener(DisplayChangeListener *dcl,
     }
 }
 
+void dpy_update_interval(QemuConsole *con, uint64_t interval)
+{
+    DisplayChangeListener *dcl;
+    DisplayState *ds;
+
+    if (!con) {
+        return;
+    }
+
+    ds = con->ds;
+
+    QLIST_FOREACH(dcl, &ds->listeners, next) {
+        update_displaychangelistener(dcl, interval);
+    }
+}
+
+
 void unregister_displaychangelistener(DisplayChangeListener *dcl)
 {
     DisplayState *ds = dcl->ds;