Patchwork [1/2] qxl: Add set_client_capabilities() interface to QXLInterface

login
register
mail settings
Submitter Søren Sandmann
Date Sept. 4, 2012, 2:14 p.m.
Message ID <1346768089-14774-1-git-send-email-sandmann@cs.au.dk>
Download mbox | patch
Permalink /patch/181580/
State New
Headers show

Comments

Søren Sandmann - Sept. 4, 2012, 2:14 p.m.
From: Søren Sandmann Pedersen <ssp@redhat.com>

This new interface lets spice server inform the guest whether

(a) a client is connected
(b) what capabilities the client has

There is a fixed number (464) of bits reserved for capabilities, and
when the capabilities bits change, the QXL_INTERRUPT_CLIENT interrupt
is generated.

Signed-off-by: Soren Sandmann <ssp@redhat.com>
---
 hw/qxl.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
Gerd Hoffmann - Sept. 4, 2012, 2:46 p.m.
Hi,

> +static void interface_set_client_capabilities(QXLInstance *sin,
> +					      uint8_t client_present,
> +					      uint8_t caps[58])

Please don't use tabs for intention in qemu patches.

Fixed it up this time, added both patches to the spice patch queue.

thanks,
  Gerd

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index c2dd3b4..572daa9 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -901,6 +901,26 @@  static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)
     }
 }
 
+#if SPICE_SERVER_VERSION >= 0x000b04
+
+/* called from spice server thread context only */
+static void interface_set_client_capabilities(QXLInstance *sin,
+					      uint8_t client_present,
+					      uint8_t caps[58])
+{
+    PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
+
+    qxl->shadow_rom.client_present = client_present;
+    memcpy(qxl->shadow_rom.client_capabilities, caps, sizeof(caps));
+    qxl->rom->client_present = client_present;
+    memcpy(qxl->rom->client_capabilities, caps, sizeof(caps));
+    qxl_rom_set_dirty(qxl);
+
+    qxl_send_events(qxl, QXL_INTERRUPT_CLIENT);
+}
+
+#endif
+
 static const QXLInterface qxl_interface = {
     .base.type               = SPICE_INTERFACE_QXL,
     .base.description        = "qxl gpu",
@@ -922,6 +942,9 @@  static const QXLInterface qxl_interface = {
     .flush_resources         = interface_flush_resources,
     .async_complete          = interface_async_complete,
     .update_area_complete    = interface_update_area_complete,
+#if SPICE_SERVER_VERSION >= 0x000b04
+    .set_client_capabilities = interface_set_client_capabilities,
+#endif
 };
 
 static void qxl_enter_vga_mode(PCIQXLDevice *d)