[Qemu-devel] [PATCH-v2 spice-protocol 1/2] Add A8 surface capability
Even though the ability to handle a8 surfaces was added at the same time as the composite command, they are logically separate, so add a capability bit to indicate the presence of a8 surfaces. --- spice/protocol.h | 1 + 1 file changed, 1 insertion(+) diff --git a/spice/protocol.h b/spice/protocol.h index 7008399..0671292 100644 --- a/spice/protocol.h +++ b/spice/protocol.h @@ -128,6 +128,7 @@ enum { SPICE_DISPLAY_CAP_SIZED_STREAM, SPICE_DISPLAY_CAP_MONITORS_CONFIG, SPICE_DISPLAY_CAP_COMPOSITE, +SPICE_DISPLAY_CAP_A8_SURFACE, }; enum { -- 1.7.11.4
[Qemu-devel] New patches to add capabilities to spice and qxl
Hi, Here are new revisions of the capabilities patches. Also included here is a new SPICE_DISPLAY_CAP_A8_SURFACE capability since this is logically distinct from the composite command. Thanks, Soren
[Qemu-devel] [PATCH-v2 spice-gtk] Advertise SPICE_DISPLAY_CAP_A8_SURFACE
--- gtk/channel-display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 99fe9c9..326ad22 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -682,6 +682,7 @@ static void spice_display_channel_reset_capabilities(SpiceChannel *channel) spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_SIZED_STREAM); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_MONITORS_CONFIG); spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_COMPOSITE); +spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_A8_SURFACE); } static void spice_display_channel_init(SpiceDisplayChannel *channel) -- 1.7.11.4
[Qemu-devel] [PATCH-v2 qemu] qxl: Add set_client_capabilities() interface to QXLInterface
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 s...@redhat.com --- hw/qxl.c | 29 - hw/qxl.h | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) 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); -- 1.7.11.4
[Qemu-devel] [PATCH-v2 spice 2/2] Bump spice.h version number to 0.11.4
No new symbols are added, but there is an addition to QXLInterface: void (*set_client_capabilities)(QXLInstance *qin, uint8_t client_present, uint8_t caps[58]); --- server/spice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/spice.h b/server/spice.h index 9d65efa..71adfb6 100644 --- a/server/spice.h +++ b/server/spice.h @@ -22,7 +22,7 @@ #include sys/socket.h #include spice/qxl_dev.h -#define SPICE_SERVER_VERSION 0x000b02 /* release 0.11.2 */ +#define SPICE_SERVER_VERSION 0x000b04 /* release 0.11.4 */ /* interface base type */ -- 1.7.11.4
[Qemu-devel] [PATCH-v2 spice-protocol 2/2] Add new client_present and client capabilities fields to QXLRom
The client_present field is a byte that is set of non-zero when a client is connected and to zero when no client is connected. The client_capabilities[58] array contains 464 bits that indicate the capabilities of the client. Each bit corresponds to a SPICE_DISPLAY_CAP_* capability. In particular, if the client has capability C, then bit (C % 8) in byte (C / 8) is set. The capability bits only have a defined meaning when a client is connected, ie., when client_present is non-zero. The number 58 was chosen to fill out a cache line in QXLRom. A new QXL_INTERRUPT_CLIENT interrupt is defined, which will be raised whenever a client connects or disconnects. --- spice/qxl_dev.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h index 1292767..50784dc 100644 --- a/spice/qxl_dev.h +++ b/spice/qxl_dev.h @@ -148,7 +148,9 @@ typedef struct SPICE_ATTR_PACKED QXLRom { uint8_t slot_gen_bits; uint8_t slot_id_bits; uint8_t slot_generation; -uint8_t padding[3]; /* Padding to 32bit align */ +/* appended for qxl-4 */ +uint8_t client_present; +uint8_t client_capabilities[58]; } QXLRom; /* qxl-1 compat: fixed */ @@ -231,6 +233,7 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE); #define QXL_INTERRUPT_CURSOR (1 1) #define QXL_INTERRUPT_IO_CMD (1 2) #define QXL_INTERRUPT_ERROR (1 3) +#define QXL_INTERRUPT_CLIENT (1 4) /* qxl-1 compat: append only */ typedef struct SPICE_ATTR_PACKED QXLRam { -- 1.7.11.4
[Qemu-devel] [PATCH-v2 spice 1/2] Set a8 capability in the QXL device if supported by the client
--- server/red_worker.c | 2 ++ spice-common| 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/red_worker.c b/server/red_worker.c index 843f559..23f3464 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -10377,6 +10377,8 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red SET_CAP(caps, SPICE_DISPLAY_CAP_MONITORS_CONFIG); if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_COMPOSITE)) SET_CAP(caps, SPICE_DISPLAY_CAP_COMPOSITE); +if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_COMPOSITE)) +SET_CAP(caps, SPICE_DISPLAY_CAP_A8_SURFACE); worker-qxl-st-qif-set_client_capabilities(worker-qxl, TRUE, caps); } diff --git a/spice-common b/spice-common index 86e286b..04dc2be 16 --- a/spice-common +++ b/spice-common @@ -1 +1 @@ -Subproject commit 86e286ba2003c206e700fd70ec67c1cf4ac8d8a6 +Subproject commit 04dc2bee9ecdda7d7966f9267df37ab23bb5a802 -- 1.7.11.4
[Qemu-devel] [PATCH] Add new client_present and client capabilities fields to QXLRom
From: Søren Sandmann Pedersen s...@redhat.com The client_present field is a byte that is set of non-zero when a client is connected and to zero when no client is connected. The client_capabilities[58] array contains 464 bits that indicate the capabilities of the client. Each bit corresponds to a SPICE_DISPLAY_CAP_* capability. In particular, if the client has capability C, then bit (C % 8) in byte (C / 8) is set. The capability bits only have a defined meaning when a client is connected, ie., when client_present is non-zero. The number 58 was chosen to fill out a cache line in QXLRom. A new QXL_INTERRUPT_CLIENT interrupt is defined, which will be raised whenever a client connects or disconnects. Finally, add a new QXL_REVISION_STABLE_V13 = 0x05 constant to indicate the presence of these new features. --- spice/qxl_dev.h |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h index 1292767..a19cc67 100644 --- a/spice/qxl_dev.h +++ b/spice/qxl_dev.h @@ -49,6 +49,7 @@ enum { QXL_REVISION_STABLE_V06=0x02, QXL_REVISION_STABLE_V10=0x03, QXL_REVISION_STABLE_V12=0x04, +QXL_REVISION_STABLE_V13=0x05, }; #define QXL_DEVICE_ID_DEVEL 0x01ff @@ -148,7 +149,9 @@ typedef struct SPICE_ATTR_PACKED QXLRom { uint8_t slot_gen_bits; uint8_t slot_id_bits; uint8_t slot_generation; -uint8_t padding[3]; /* Padding to 32bit align */ +/* appended for qxl-5 */ +uint8_t client_present; +uint8_t client_capabilities[58]; } QXLRom; /* qxl-1 compat: fixed */ @@ -231,6 +234,7 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE); #define QXL_INTERRUPT_CURSOR (1 1) #define QXL_INTERRUPT_IO_CMD (1 2) #define QXL_INTERRUPT_ERROR (1 3) +#define QXL_INTERRUPT_CLIENT (1 4) /* qxl-1 compat: append only */ typedef struct SPICE_ATTR_PACKED QXLRam { -- 1.7.4
[Qemu-devel] Add ability to advertise client capabilities to QXL device
Hi, The following patches add the ability for spice-server to advertise the capabilities of connected clients to guests. They do this through adding some new fields to QXLRom: - whether a client is present - a bit field to indicate which SPICE_DISPLAY_CAP_* capabilities the client has. The patches affect both spice and qemu, and I'm not totally sure how the dependencies between those are usually managed. If I did it wrong, please let me know. Soren
[Qemu-devel] [PATCH] qxl: Add set_client_capabilities() interface to QXLInterface
From: Søren Sandmann Pedersen s...@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 s...@redhat.com --- hw/qxl.c | 21 + hw/qxl.h |2 +- 2 files changed, 22 insertions(+), 1 deletions(-) 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); -- 1.7.4
[Qemu-devel] [PATCH] Add new set_client_capabilities() interface to QXLInstance
From: Søren Sandmann Pedersen s...@redhat.com A new interface set_client_capabilities (QXLInstance *qin, uint8_t client_present, uint8_t caps[58]); is added to QXLInstance, and spice server is changed to call it whenever a client connects or disconnects. The QXL device in response is expected to update the client capability bits in the ROM of the device and raise the QXL_INTERRUPT_CLIENT interrupt. --- server/red_worker.c | 24 server/spice.h |3 +++ 2 files changed, 27 insertions(+), 0 deletions(-) diff --git a/server/red_worker.c b/server/red_worker.c index bd6de1c..6f97d6b 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -10289,6 +10289,23 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red spice_info(jpeg %s, display_channel-enable_jpeg ? enabled : disabled); spice_info(zlib-over-glz %s, display_channel-enable_zlib_glz_wrap ? enabled : disabled); +if (worker-qxl-st-qif-set_client_capabilities) { +RedChannelClient *rcc = (RedChannelClient *)dcc; +uint8_t caps[58] = { 0 }; + +#define SET_CAP(a,c)\ +((a)[(c) / 8] |= (1 ((c) % 8))) + +if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_SIZED_STREAM)) +SET_CAP(caps, SPICE_DISPLAY_CAP_SIZED_STREAM); +if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_MONITORS_CONFIG)) +SET_CAP(caps, SPICE_DISPLAY_CAP_MONITORS_CONFIG); +if (red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_COMPOSITE)) +SET_CAP(caps, SPICE_DISPLAY_CAP_COMPOSITE); + +worker-qxl-st-qif-set_client_capabilities(worker-qxl, TRUE, caps); +} + // todo: tune level according to bandwidth display_channel-zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL; red_display_client_init_streams(dcc); @@ -11137,9 +11154,16 @@ void handle_dev_display_disconnect(void *opaque, void *payload) { RedWorkerMessageDisplayDisconnect *msg = payload; RedChannelClient *rcc = msg-rcc; +RedWorker *worker = opaque; spice_info(disconnect display client); spice_assert(rcc); + +if (worker-qxl-st-qif-set_client_capabilities) { +uint8_t caps[58] = { 0 }; +worker-qxl-st-qif-set_client_capabilities(worker-qxl, FALSE, caps); +} + red_channel_client_disconnect(rcc); } diff --git a/server/spice.h b/server/spice.h index 3d70ec7..c53c044 100644 --- a/server/spice.h +++ b/server/spice.h @@ -237,6 +237,9 @@ struct QXLInterface { void (*update_area_complete)(QXLInstance *qin, uint32_t surface_id, struct QXLRect *updated_rects, uint32_t num_updated_rects); +void (*set_client_capabilities)(QXLInstance *qin, + uint8_t client_present, + uint8_t caps[58]); }; struct QXLInstance { -- 1.7.4
[Qemu-devel] Add ability to advertise client capabilities to QXL device
Hi, The following patches add the ability for spice-server to advertise the capabilities of connected clients to guests. They do this through adding some new fields to QXLRom: - whether a client is present - a bit field to indicate which SPICE_DISPLAY_CAP_* capabilities the client has. The patches affect both spice and qemu, and I'm not totally sure how the dependencies between those are usually managed. If I did it wrong, please let me know. Soren