render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0013-spice-add-qemu_spice_display_init_common.patch

Justin M. Forbes fc5c27
>From c28ee0e7c851fc58ac6ef8f5137fc35cc55b607c Mon Sep 17 00:00:00 2001
Justin M. Forbes 13f703
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes 13f703
Date: Fri, 17 Jun 2011 10:42:25 +0200
Justin M. Forbes fc5c27
Subject: [PATCH 13/28] spice: add qemu_spice_display_init_common
Justin M. Forbes 13f703
Justin M. Forbes 13f703
Factor out SimpleSpiceDisplay initialization into
Justin M. Forbes 13f703
qemu_spice_display_init_common() and call it from
Justin M. Forbes 13f703
both qxl.c (for vga mode) and spice-display.c
Justin M. Forbes 13f703
Justin M. Forbes 13f703
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes 13f703
---
Justin M. Forbes 13f703
 hw/qxl.c           |    7 +------
Justin M. Forbes 13f703
 ui/spice-display.c |   17 +++++++++++------
Justin M. Forbes 13f703
 ui/spice-display.h |    1 +
Justin M. Forbes 13f703
 3 files changed, 13 insertions(+), 12 deletions(-)
Justin M. Forbes 13f703
Justin M. Forbes 13f703
diff --git a/hw/qxl.c b/hw/qxl.c
Justin M. Forbes 13f703
index 5deb776..2127fa3 100644
Justin M. Forbes 13f703
--- a/hw/qxl.c
Justin M. Forbes 13f703
+++ b/hw/qxl.c
Justin M. Forbes 13f703
@@ -1315,12 +1315,7 @@ static int qxl_init_primary(PCIDevice *dev)
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
     vga->ds = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,
Justin M. Forbes 13f703
                                    qxl_hw_screen_dump, qxl_hw_text_update, qxl);
Justin M. Forbes 13f703
-    qxl->ssd.ds = vga->ds;
Justin M. Forbes 13f703
-    qemu_mutex_init(&qxl->ssd.lock);
Justin M. Forbes 13f703
-    qxl->ssd.mouse_x = -1;
Justin M. Forbes 13f703
-    qxl->ssd.mouse_y = -1;
Justin M. Forbes 13f703
-    qxl->ssd.bufsize = (16 * 1024 * 1024);
Justin M. Forbes 13f703
-    qxl->ssd.buf = qemu_malloc(qxl->ssd.bufsize);
Justin M. Forbes 13f703
+    qemu_spice_display_init_common(&qxl->ssd, vga->ds);
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
     qxl0 = qxl;
Justin M. Forbes 13f703
     register_displaychangelistener(vga->ds, &display_listener);
Justin M. Forbes 13f703
diff --git a/ui/spice-display.c b/ui/spice-display.c
Justin M. Forbes 13f703
index 1e6a38f..93e25bf 100644
Justin M. Forbes 13f703
--- a/ui/spice-display.c
Justin M. Forbes 13f703
+++ b/ui/spice-display.c
Justin M. Forbes 13f703
@@ -286,6 +286,16 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason)
Justin M. Forbes 13f703
     ssd->running = running;
Justin M. Forbes 13f703
 }
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
+void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds)
Justin M. Forbes 13f703
+{
Justin M. Forbes 13f703
+    ssd->ds = ds;
Justin M. Forbes 13f703
+    qemu_mutex_init(&ssd->lock);
Justin M. Forbes 13f703
+    ssd->mouse_x = -1;
Justin M. Forbes 13f703
+    ssd->mouse_y = -1;
Justin M. Forbes 13f703
+    ssd->bufsize = (16 * 1024 * 1024);
Justin M. Forbes 13f703
+    ssd->buf = qemu_malloc(ssd->bufsize);
Justin M. Forbes 13f703
+}
Justin M. Forbes 13f703
+
Justin M. Forbes 13f703
 /* display listener callbacks */
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
 void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
Justin M. Forbes 13f703
@@ -499,12 +509,7 @@ static DisplayChangeListener display_listener = {
Justin M. Forbes 13f703
 void qemu_spice_display_init(DisplayState *ds)
Justin M. Forbes 13f703
 {
Justin M. Forbes 13f703
     assert(sdpy.ds == NULL);
Justin M. Forbes 13f703
-    sdpy.ds = ds;
Justin M. Forbes 13f703
-    qemu_mutex_init(&sdpy.lock);
Justin M. Forbes 13f703
-    sdpy.mouse_x = -1;
Justin M. Forbes 13f703
-    sdpy.mouse_y = -1;
Justin M. Forbes 13f703
-    sdpy.bufsize = (16 * 1024 * 1024);
Justin M. Forbes 13f703
-    sdpy.buf = qemu_malloc(sdpy.bufsize);
Justin M. Forbes 13f703
+    qemu_spice_display_init_common(&sdpy, ds);
Justin M. Forbes 13f703
     register_displaychangelistener(ds, &display_listener);
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
     sdpy.qxl.base.sif = &dpy_interface.base;
Justin M. Forbes 13f703
diff --git a/ui/spice-display.h b/ui/spice-display.h
Justin M. Forbes 13f703
index 5b06b11..eb7a573 100644
Justin M. Forbes 13f703
--- a/ui/spice-display.h
Justin M. Forbes 13f703
+++ b/ui/spice-display.h
Justin M. Forbes 13f703
@@ -75,6 +75,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
Justin M. Forbes 13f703
 void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);
Justin M. Forbes 13f703
 void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd);
Justin M. Forbes 13f703
 void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason);
Justin M. Forbes 13f703
+void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds);
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
 void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
Justin M. Forbes 13f703
                                int x, int y, int w, int h);
Justin M. Forbes 13f703
-- 
Justin M. Forbes 13f703
1.7.5.1
Justin M. Forbes 13f703