Patchwork qxl: Add set_client_capabilities() interface to QXLInterface

login
register
mail settings
Submitter Søren Sandmann
Date Aug. 27, 2012, 5:20 p.m.
Message ID <1346088041-17062-4-git-send-email-sandmann@cs.au.dk>
Download mbox | patch
Permalink /patch/180271/
State New
Headers show

Comments

Søren Sandmann - Aug. 27, 2012, 5:20 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 |   21 +++++++++++++++++++++
 hw/qxl.h |    2 +-
 2 files changed, 22 insertions(+), 1 deletions(-)
Gerd Hoffmann - Aug. 28, 2012, 6:19 a.m.
On 08/27/12 19:20, Søren Sandmann Pedersen wrote:
> 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.

Needs some #ifdefs to make sure qemu continues to build with old
spice-server versions.

>      case 3: /* qxl-3 */
> +	pci_device_rev = QXL_REVISION_STABLE_V10;
> +	io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
> +	break;
> +    case 5:

I think there is no need to jump to 5, we can use revision 4 for both
client capabilities and monitors config.

cheers,
  Gerd

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index c2dd3b4..690743a 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -901,6 +901,22 @@  static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)
     }
 }
 
+/* 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);
+}
+
 static const QXLInterface qxl_interface = {
     .base.type               = SPICE_INTERFACE_QXL,
     .base.description        = "qxl gpu",
@@ -922,6 +938,7 @@  static const QXLInterface qxl_interface = {
     .flush_resources         = interface_flush_resources,
     .async_complete          = interface_async_complete,
     .update_area_complete    = interface_update_area_complete,
+    .set_client_capabilities = interface_set_client_capabilities,
 };
 
 static void qxl_enter_vga_mode(PCIQXLDevice *d)
@@ -1785,6 +1802,10 @@  static int qxl_init_common(PCIQXLDevice *qxl)
         io_size = 16;
         break;
     case 3: /* qxl-3 */
+	pci_device_rev = QXL_REVISION_STABLE_V10;
+	io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
+	break;
+    case 5:
     default:
         pci_device_rev = QXL_DEFAULT_REVISION;
         io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
diff --git a/hw/qxl.h b/hw/qxl.h
index 172baf6..a130f19 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -128,7 +128,7 @@  typedef struct PCIQXLDevice {
         }                                                               \
     } while (0)
 
-#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10
+#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V13
 
 /* qxl.c */
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);