[Spice-devel] [PATCH spice-server 2/2] QXL devices must be registered before Stream Devices

Jonathon Jongsma jjongsma at redhat.com
Tue Feb 12 20:26:53 UTC 2019


Stream devices assume that all QXL devices are registered with the
server before we receive any communications from the stream device. This
is due to the fact that QXL display channel IDs are assigned directly
from the QXL device ID, whereas Stream display channels are assigned
channel IDs based on the next free ID. If the stream channel is
created first, it will find that 0 is the first available display ID and
use that for its channel ID. Then when QXL device #0 is registered, it
will also create a display channel with channel ID 0, and they will
conflict.
---
 server/tests/test-stream-device.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/server/tests/test-stream-device.c b/server/tests/test-stream-device.c
index dcdd91896..86c33a145 100644
--- a/server/tests/test-stream-device.c
+++ b/server/tests/test-stream-device.c
@@ -493,6 +493,12 @@ static void test_stream_device_data_message(TestFixture *fixture, gconstpointer
 
 static void test_display_info(TestFixture *fixture, gconstpointer user_data)
 {
+    // initialize a QXL interface. This must be done before recieving the display info message from
+    // the stream
+    test_add_display_interface(test);
+    /* qxl device supports 2 monitors */
+    spice_qxl_set_device_info(&test->qxl_instance, "pci/0/1.2", 0, 2);
+
     // craft a message from the mock stream device that provides display info to the server for the
     // given stream
     static const char address[] = "pci/a/b.cde";
@@ -515,11 +521,6 @@ static void test_display_info(TestFixture *fixture, gconstpointer user_data)
     // info for the mock stream device
     test_kick();
 
-    // initialize a QXL interface
-    test_add_display_interface(test);
-    /* qxl device supports 2 monitors */
-    spice_qxl_set_device_info(&test->qxl_instance, "pci/0/1.2", 0, 2);
-
     // build the buffer to send to the agent for display information
     SpiceMarshaller *m = spice_marshaller_new();
     reds_marshall_device_display_info(test->server, m);
@@ -544,7 +545,7 @@ static void test_display_info(TestFixture *fixture, gconstpointer user_data)
           /* device_address_len */ 10,  0,  0,  0,
           /* device_address */    'p','c', 'i','/','0','/','1','.','2',  0,
 
-          /* channel_id */          0,  0,  0,  0,
+          /* channel_id */          1,  0,  0,  0,
           /* monitor_id */          4,  3,  2,  1,
           /* device_display_id */  13, 12, 11, 10,
           /* device_address_len */ 12,  0,  0,  0,
-- 
2.17.2



More information about the Spice-devel mailing list