dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0005-spice-gl-add-use-qemu_spice_gl_monitor_config.patch

f8dc43
From: Gerd Hoffmann <kraxel@redhat.com>
f8dc43
Date: Wed, 3 Feb 2016 13:55:00 +0100
f8dc43
Subject: [PATCH] spice/gl: add & use qemu_spice_gl_monitor_config
f8dc43
MIME-Version: 1.0
f8dc43
Content-Type: text/plain; charset=UTF-8
f8dc43
Content-Transfer-Encoding: 8bit
f8dc43
f8dc43
Cc: qemu-stable@nongnu.org
f8dc43
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
f8dc43
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
f8dc43
(cherry picked from commit 39414ef4e93db9041e463a097084a407d0d374f0)
f8dc43
---
f8dc43
 include/ui/spice-display.h |  1 +
f8dc43
 ui/spice-display.c         | 30 ++++++++++++++++++++++++++++++
f8dc43
 2 files changed, 31 insertions(+)
f8dc43
f8dc43
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
f8dc43
index 00e4a0b..3c679e8 100644
f8dc43
--- a/include/ui/spice-display.h
f8dc43
+++ b/include/ui/spice-display.h
f8dc43
@@ -71,6 +71,7 @@ typedef struct QXLCookie {
f8dc43
             QXLRect area;
f8dc43
             int redraw;
f8dc43
         } render;
f8dc43
+        void *data;
f8dc43
     } u;
f8dc43
 } QXLCookie;
f8dc43
 
f8dc43
diff --git a/ui/spice-display.c b/ui/spice-display.c
f8dc43
index 242ab5f..2a77a54 100644
f8dc43
--- a/ui/spice-display.c
f8dc43
+++ b/ui/spice-display.c
f8dc43
@@ -660,6 +660,11 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)
f8dc43
         qemu_bh_schedule(ssd->gl_unblock_bh);
f8dc43
         break;
f8dc43
     }
f8dc43
+    case QXL_COOKIE_TYPE_IO:
f8dc43
+        if (cookie->io == QXL_IO_MONITORS_CONFIG_ASYNC) {
f8dc43
+            g_free(cookie->u.data);
f8dc43
+        }
f8dc43
+        break;
f8dc43
 #endif
f8dc43
     default:
f8dc43
         /* should never be called, used in qxl native mode only */
f8dc43
@@ -795,6 +800,29 @@ static const DisplayChangeListenerOps display_listener_ops = {
f8dc43
 
f8dc43
 #ifdef HAVE_SPICE_GL
f8dc43
 
f8dc43
+static void qemu_spice_gl_monitor_config(SimpleSpiceDisplay *ssd,
f8dc43
+                                         int x, int y, int w, int h)
f8dc43
+{
f8dc43
+    QXLMonitorsConfig *config;
f8dc43
+    QXLCookie *cookie;
f8dc43
+
f8dc43
+    config = g_malloc0(sizeof(QXLMonitorsConfig) + sizeof(QXLHead));
f8dc43
+    config->count = 1;
f8dc43
+    config->max_allowed = 1;
f8dc43
+    config->heads[0].x = x;
f8dc43
+    config->heads[0].y = y;
f8dc43
+    config->heads[0].width = w;
f8dc43
+    config->heads[0].height = h;
f8dc43
+    cookie = qxl_cookie_new(QXL_COOKIE_TYPE_IO,
f8dc43
+                            QXL_IO_MONITORS_CONFIG_ASYNC);
f8dc43
+    cookie->u.data = config;
f8dc43
+
f8dc43
+    spice_qxl_monitors_config_async(&ssd->qxl,
f8dc43
+                                    (uintptr_t)config,
f8dc43
+                                    MEMSLOT_GROUP_HOST,
f8dc43
+                                    (uintptr_t)cookie);
f8dc43
+}
f8dc43
+
f8dc43
 static void qemu_spice_gl_block(SimpleSpiceDisplay *ssd, bool block)
f8dc43
 {
f8dc43
     uint64_t timeout;
f8dc43
@@ -858,6 +886,8 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl,
f8dc43
                          surface_width(ssd->ds),
f8dc43
                          surface_height(ssd->ds),
f8dc43
                          stride, fourcc, y_0_top);
f8dc43
+
f8dc43
+    qemu_spice_gl_monitor_config(ssd, x, y, w, h);
f8dc43
 }
f8dc43
 
f8dc43
 static void qemu_spice_gl_update(DisplayChangeListener *dcl,