[Spice-devel] [qemu-spice PATCH 2/2] qxl: callback from spice server upon mouse mode change
yuri.benditovich at daynix.com
yuri.benditovich at daynix.com
Mon Nov 14 12:09:43 UTC 2016
From: Yuri Benditovich <yuri.benditovich at daynix.com>
When spice server changes mouse mode (server/client) it
informs QXL device via callback. QXL device keeps current
mouse mode in ROM area and issues interrupt to guest driver.
Guest driver can read current mode from ROM and optimize its
behavior in case the mouse is in 'client' mode
Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
---
hw/display/qxl.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 0e2682d..78f04dc 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -369,6 +369,10 @@ static void init_qxl_rom(PCIQXLDevice *d)
rom->num_pages = cpu_to_le32(num_pages);
rom->ram_header_offset = cpu_to_le32(d->vga.vram_size - ram_header_size);
+#if SPICE_MOUSE_MODE_CHANGE_SUPPORTED
+ rom->mouse_mode = SPICE_MOUSE_MODE_SERVER;
+#endif
+
d->shadow_rom = *rom;
d->rom = rom;
d->modes = modes;
@@ -982,6 +986,17 @@ static void interface_set_client_capabilities(QXLInstance *sin,
qxl_send_events(qxl, QXL_INTERRUPT_CLIENT);
}
+#if SPICE_MOUSE_MODE_CHANGE_SUPPORTED
+static void interface_mouse_mode_changed(QXLInstance *sin)
+{
+ PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
+ qxl->rom->mouse_mode = qemu_spice_is_server_mouse() ?
+ SPICE_MOUSE_MODE_SERVER : SPICE_MOUSE_MODE_CLIENT;
+ qxl_rom_set_dirty(qxl);
+ qxl_send_events(qxl, QXL_INTERRUPT_MOUSE_MODE_CHANGE);
+}
+#endif
+
static uint32_t qxl_crc32(const uint8_t *p, unsigned len)
{
/*
@@ -1088,6 +1103,9 @@ static const QXLInterface qxl_interface = {
.update_area_complete = interface_update_area_complete,
.set_client_capabilities = interface_set_client_capabilities,
.client_monitors_config = interface_client_monitors_config,
+#if SPICE_MOUSE_MODE_CHANGE_SUPPORTED
+ .mouse_mode_changed = interface_mouse_mode_changed,
+#endif
};
static const GraphicHwOps qxl_ops = {
@@ -1996,6 +2014,10 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
pci_device_rev = QXL_REVISION_STABLE_V12;
io_size = pow2ceil(QXL_IO_RANGE_SIZE);
break;
+ case 5: /* qxl-5 */
+ pci_device_rev = 5; /* TODO: change to QXL_REVISION_STABLE_Vx */
+ io_size = pow2ceil(QXL_IO_RANGE_SIZE);
+ break;
default:
error_setg(errp, "Invalid revision %d for qxl device (max %d)",
qxl->revision, QXL_DEFAULT_REVISION);
--
2.7.4
More information about the Spice-devel
mailing list