diff mbox

[PATCH-v2,qemu] qxl: Add set_client_capabilities() interface to QXLInterface

Message ID 1346621726-11313-7-git-send-email-ssp@redhat.com
State New
Headers show

Commit Message

Søren Sandmann Pedersen Sept. 2, 2012, 9:35 p.m. UTC
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 | 29 ++++++++++++++++++++++++++++-
 hw/qxl.h |  2 +-
 2 files changed, 29 insertions(+), 2 deletions(-)

Comments

Søren Sandmann Sept. 3, 2012, 5:36 p.m. UTC | #1
Søren Sandmann Pedersen <ssp@redhat.com> writes:

> @@ -1292,7 +1315,7 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
>  
>      d->mode = QXL_MODE_COMPAT;
>      d->cmdflags = QXL_COMMAND_FLAG_COMPAT;
> -#ifdef QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */
> +#if QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */
>      if (mode->bits == 16) {
>          d->cmdflags |= QXL_COMMAND_FLAG_COMPAT_16BPP;
>      }

This one is obviously a mistake. New patch to follow.


Soren
Gerd Hoffmann Sept. 4, 2012, 10:12 a.m. UTC | #2
Hi,

>  static void qxl_enter_vga_mode(PCIQXLDevice *d)
> @@ -1292,7 +1315,7 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
>  
>      d->mode = QXL_MODE_COMPAT;
>      d->cmdflags = QXL_COMMAND_FLAG_COMPAT;
> -#ifdef QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */
> +#if QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */

Unrelated change in there.

btw: we require spice-server > 0.8.x anyway, so this #ifdef can go
anyway, but if you do it make it a separate patch please.

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

Conflicts with queued patches.  Please just drop it, I'll go switch to
rev4 by default once we have a spice-server 0.12.0 release & all qemu
patches needed to use the new stuff merged.

> -#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10
> +#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V12

Likewise.

cheers,
  Gerd
diff mbox

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index c2dd3b4..1f62529 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)
@@ -1292,7 +1315,7 @@  static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
 
     d->mode = QXL_MODE_COMPAT;
     d->cmdflags = QXL_COMMAND_FLAG_COMPAT;
-#ifdef QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */
+#if QXL_COMMAND_FLAG_COMPAT_16BPP /* new in spice 0.6.1 */
     if (mode->bits == 16) {
         d->cmdflags |= QXL_COMMAND_FLAG_COMPAT_16BPP;
     }
@@ -1785,6 +1808,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 4:
     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..98d5a64 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_V12
 
 /* qxl.c */
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);