qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH spice/qemu v3 0/3] QXL interface to set monitor ID
@ 2018-11-07 10:49 Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest Lukáš Hrázký
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Lukáš Hrázký @ 2018-11-07 10:49 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

Hello,

another version of the proposed API for monitor identification
information. Still not for merge yet, the plan is to merge when it's
complete.

Changes since v2:
* Merged the two API functions into one:
  spice_qxl_set_device_info(QXLInstance *instance,
                            const char *device_address,
                            uint32_t device_display_id_start,
                            uint32_t device_display_id_count)

* Minor fixes and documentation adjustments

-- 
2.19.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-07 10:49 [Qemu-devel] [RFC PATCH spice/qemu v3 0/3] QXL interface to set monitor ID Lukáš Hrázký
@ 2018-11-07 10:49 ` Lukáš Hrázký
  2018-11-08  6:49   ` Gerd Hoffmann
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 2/3] QXL interface: deprecate spice_qxl_set_max_monitors Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH qemu v3 3/3] spice: set device address and device display ID in QXL interface Lukáš Hrázký
  2 siblings, 1 reply; 10+ messages in thread
From: Lukáš Hrázký @ 2018-11-07 10:49 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

Adds a function to let QEMU provide information to identify graphics
devices and their monitors in the guest. The function
(spice_qxl_set_device_info) sets the device address (e.g. a PCI path)
and monitor ID -> device display ID mapping of displays exposed by given
QXL interface.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
---
 server/red-qxl.c         | 44 ++++++++++++++++++++++++++++++++++++++
 server/spice-qxl.h       | 46 ++++++++++++++++++++++++++++++++++++++++
 server/spice-server.syms |  5 +++++
 3 files changed, 95 insertions(+)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 97940611..0ea424cd 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -41,6 +41,9 @@
 #include "red-qxl.h"
 
 
+#define MAX_DEVICE_ADDRESS_LEN 256
+#define MAX_MONITORS_COUNT 16
+
 struct QXLState {
     QXLWorker qxl_worker;
     QXLInstance *qxl;
@@ -53,6 +56,9 @@ struct QXLState {
     unsigned int max_monitors;
     RedsState *reds;
     RedWorker *worker;
+    char device_address[MAX_DEVICE_ADDRESS_LEN];
+    uint32_t device_display_ids[MAX_MONITORS_COUNT];
+    size_t monitors_count;  // length of ^^^
 
     pthread_mutex_t scanout_mutex;
     SpiceMsgDisplayGlScanoutUnix scanout;
@@ -846,6 +852,44 @@ void red_qxl_gl_draw_async_complete(QXLInstance *qxl)
     red_qxl_async_complete(qxl, cookie);
 }
 
+SPICE_GNUC_VISIBLE
+void spice_qxl_set_device_info(QXLInstance *instance,
+                               const char *device_address,
+                               uint32_t device_display_id_start,
+                               uint32_t device_display_id_count)
+{
+    g_return_if_fail(device_address != NULL);
+
+    size_t da_len = strnlen(device_address, MAX_DEVICE_ADDRESS_LEN);
+    if (da_len >= MAX_DEVICE_ADDRESS_LEN) {
+        spice_error("Device address too long: %lu > %u", da_len, MAX_DEVICE_ADDRESS_LEN);
+        return;
+    }
+
+    if (device_display_id_count > MAX_MONITORS_COUNT) {
+        spice_error("Device display ID count (%u) is greater than limit %u",
+                    device_display_id_count,
+                    MAX_MONITORS_COUNT);
+        return;
+    }
+
+    strncpy(instance->st->device_address, device_address, MAX_DEVICE_ADDRESS_LEN);
+
+    g_debug("QXL Instance %d setting device address \"%s\" and monitor -> device display mapping:",
+            instance->id,
+            device_address);
+
+    // store the mapping monitor_id -> device_display_id
+    for (uint32_t monitor_id = 0; monitor_id < device_display_id_count; ++monitor_id) {
+        uint32_t device_display_id = device_display_id_start + monitor_id;
+        instance->st->device_display_ids[monitor_id] = device_display_id;
+        g_debug("   monitor ID %u -> device display ID %u",
+                monitor_id, device_display_id);
+    }
+
+    instance->st->monitors_count = device_display_id_count;
+}
+
 void red_qxl_init(RedsState *reds, QXLInstance *qxl)
 {
     QXLState *qxl_state;
diff --git a/server/spice-qxl.h b/server/spice-qxl.h
index 0c4e75fc..547d3d93 100644
--- a/server/spice-qxl.h
+++ b/server/spice-qxl.h
@@ -115,6 +115,52 @@ void spice_qxl_gl_draw_async(QXLInstance *instance,
                              uint32_t w, uint32_t h,
                              uint64_t cookie);
 
+/* since spice 0.14.2 */
+
+/**
+ * spice_qxl_set_device_info:
+ * @instance the QXL instance to set the path to
+ * @device_address the path of the device this QXL instance belongs to
+ * @device_display_id_start the starting device display ID of this interface,
+ *                          i.e. the one monitor ID 0 maps to
+ * @device_display_id_count the total number of device display IDs on this
+ *                          interface
+ *
+ * Sets the device information for this QXL interface, i.e. the hardware
+ * address (e.g. PCI) of the graphics device and the IDs of the displays of the
+ * graphics device that are exposed by this interface (device display IDs).
+ *
+ * The supported device address format is:
+ * "pci/<DOMAIN>/<SLOT>.<FUNCTION>/.../<SLOT>.<FUNCTION>"
+ *
+ * The "pci" identifies the rest of the string as a PCI address. It is the only
+ * supported address at the moment, other identifiers can be introduced later.
+ * <DOMAIN> is the PCI domain, followed by <SLOT>.<FUNCTION> of any PCI bridges
+ * in the chain leading to the device. The last <SLOT>.<FUNCTION> is the
+ * graphics device. All of <DOMAIN>, <SLOT>, <FUNCTION> are hexadecimal numbers
+ * with the following number of digits:
+ *   <DOMAIN>: 4
+ *   <SLOT>: 2
+ *   <FUNCTION>: 1
+ *
+ * The device_display_id_{start,count} denotes the sequence of device display
+ * IDs that map to the zero-based sequence of monitor IDs provided by monitors
+ * config on this interface. For example with device_display_id_start = 2 and
+ * device_display_id_count = 3 you get the following mapping:
+ * monitor_id  ->  device_display_id
+ *          0  ->  2
+ *          1  ->  3
+ *          2  ->  4
+ *
+ * Note this example is unsupported in practice. The only supported cases are
+ * either a single device display ID (count = 1) or multiple device display IDs
+ * in a sequence starting from 0.
+ */
+void spice_qxl_set_device_info(QXLInstance *instance,
+                               const char *device_address,
+                               uint32_t device_display_id_start,
+                               uint32_t device_display_id_count);
+
 typedef struct QXLDevInitInfo {
     uint32_t num_memslots_groups;
     uint32_t num_memslots;
diff --git a/server/spice-server.syms b/server/spice-server.syms
index edf04a42..ac4d9b14 100644
--- a/server/spice-server.syms
+++ b/server/spice-server.syms
@@ -173,3 +173,8 @@ SPICE_SERVER_0.13.2 {
 global:
     spice_server_set_video_codecs;
 } SPICE_SERVER_0.13.1;
+
+SPICE_SERVER_0.14.2 {
+global:
+    spice_qxl_set_device_info;
+} SPICE_SERVER_0.13.2;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [RFC PATCH spice v3 2/3] QXL interface: deprecate spice_qxl_set_max_monitors
  2018-11-07 10:49 [Qemu-devel] [RFC PATCH spice/qemu v3 0/3] QXL interface to set monitor ID Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest Lukáš Hrázký
@ 2018-11-07 10:49 ` Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH qemu v3 3/3] spice: set device address and device display ID in QXL interface Lukáš Hrázký
  2 siblings, 0 replies; 10+ messages in thread
From: Lukáš Hrázký @ 2018-11-07 10:49 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

Replace it by spice_qxl_set_device_info. Note we can't use
monitors_count for what's stored in max_monitors, because monitors_count
denotes the length of the device_display_ids array, which
spice_qxl_set_max_monitors doesn't touch.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
---
 server/red-qxl.c   | 1 +
 server/spice-qxl.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 0ea424cd..6ffd8286 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -888,6 +888,7 @@ void spice_qxl_set_device_info(QXLInstance *instance,
     }
 
     instance->st->monitors_count = device_display_id_count;
+    instance->st->max_monitors = device_display_id_count;
 }
 
 void red_qxl_init(RedsState *reds, QXLInstance *qxl)
diff --git a/server/spice-qxl.h b/server/spice-qxl.h
index 547d3d93..e7af5e5e 100644
--- a/server/spice-qxl.h
+++ b/server/spice-qxl.h
@@ -101,9 +101,9 @@ void spice_qxl_monitors_config_async(QXLInstance *instance, QXLPHYSICAL monitors
                                      int group_id, uint64_t cookie);
 /* since spice 0.12.3 */
 void spice_qxl_driver_unload(QXLInstance *instance);
-/* since spice 0.12.6 */
+/* since spice 0.12.6, deprecated since 0.14.2, spice_qxl_set_device_info replaces it */
 void spice_qxl_set_max_monitors(QXLInstance *instance,
-                                unsigned int max_monitors);
+                                unsigned int max_monitors) SPICE_GNUC_DEPRECATED;
 /* since spice 0.13.1 */
 void spice_qxl_gl_scanout(QXLInstance *instance,
                           int fd,
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [RFC PATCH qemu v3 3/3] spice: set device address and device display ID in QXL interface
  2018-11-07 10:49 [Qemu-devel] [RFC PATCH spice/qemu v3 0/3] QXL interface to set monitor ID Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest Lukáš Hrázký
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 2/3] QXL interface: deprecate spice_qxl_set_max_monitors Lukáš Hrázký
@ 2018-11-07 10:49 ` Lukáš Hrázký
  2 siblings, 0 replies; 10+ messages in thread
From: Lukáš Hrázký @ 2018-11-07 10:49 UTC (permalink / raw)
  To: spice-devel, qemu-devel; +Cc: kraxel

Calls the new SPICE QXL interface function spice_qxl_set_device_info to
set the hardware address of the graphics device represented by the QXL
interface (e.g. a PCI path) and the device display IDs (the IDs of the
device's monitors that belong to this QXL interface).

Also stops using the deprecated spice_qxl_set_max_monitors, the new
interface function replaces it.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
---
 hw/display/qxl.c           | 14 ++++++++++++-
 include/ui/spice-display.h |  2 ++
 ui/spice-core.c            | 42 ++++++++++++++++++++++++++++++++++++++
 ui/spice-display.c         | 11 ++++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f608abc769..f4bef8e4da 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -276,7 +276,8 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
                     QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
                     0));
     } else {
-#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
+#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */ && \
+    SPICE_SERVER_VERSION < 0x000e02
         if (qxl->max_outputs) {
             spice_qxl_set_max_monitors(&qxl->ssd.qxl, qxl->max_outputs);
         }
@@ -2184,6 +2185,17 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
                    SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR);
         return;
     }
+
+#if SPICE_SERVER_VERSION >= 0x000e02 /* release 0.14.2 */
+    char device_address[256] = "";
+    if (qemu_spice_fill_device_address(qxl->vga.con, device_address, 256)) {
+        spice_qxl_set_device_info(&qxl->ssd.qxl,
+                                  device_address,
+                                  0,
+                                  qxl->max_outputs);
+    }
+#endif
+
     qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
     qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl);
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index 87a84a59d4..7608fa7ebd 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -179,3 +179,5 @@ void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
 void qemu_spice_display_start(void);
 void qemu_spice_display_stop(void);
 int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd);
+
+bool qemu_spice_fill_device_address(QemuConsole *con, char *device_address, size_t size);
diff --git a/ui/spice-core.c b/ui/spice-core.c
index a4fbbc3898..0bc8b002ec 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -35,6 +35,8 @@
 #include "qemu/option.h"
 #include "migration/misc.h"
 #include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_bus.h"
 #include "ui/spice-display.h"
 
 /* core bits */
@@ -871,6 +873,46 @@ bool qemu_spice_have_display_interface(QemuConsole *con)
     return false;
 }
 
+/*
+ * Recursively (in reverse order) appends addresses of PCI devices as it moves
+ * up in the PCI hierarchy.
+ *
+ * @returns true on success, false when the buffer wasn't large enough
+ */
+static bool append_pci_address(char *buf, size_t buf_size, const PCIDevice *pci)
+{
+    PCIBus *bus = pci_get_bus(pci);
+    if (!pci_bus_is_root(bus)) {
+        append_pci_address(buf, buf_size, bus->parent_dev);
+    }
+
+    size_t len = strlen(buf);
+    ssize_t written = snprintf(buf + len, buf_size - len, "/%02x.%x",
+        PCI_SLOT(pci->devfn), PCI_FUNC(pci->devfn));
+
+    return written > 0 && written < buf_size - len;
+}
+
+bool qemu_spice_fill_device_address(QemuConsole *con, char *device_address, size_t size)
+{
+    DeviceState *dev = DEVICE(object_property_get_link(OBJECT(con), "device", &error_abort));
+    PCIDevice *pci = (PCIDevice *) object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE);
+
+    if (pci == NULL) {
+        warn_report("Setting device address of a display device to SPICE: Not a PCI device.");
+        return false;
+    }
+
+    strncpy(device_address, "pci/0000", size);
+    if (!append_pci_address(device_address, size, pci)) {
+        warn_report("Setting device address of a display device to SPICE: "
+            "Too many PCI devices in the chain.");
+        return false;
+    }
+
+    return true;
+}
+
 int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con)
 {
     if (g_slist_find(spice_consoles, con)) {
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 2f8adb6b9f..578ec6bf8b 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1129,6 +1129,17 @@ static void qemu_spice_display_init_one(QemuConsole *con)
 
     ssd->qxl.base.sif = &dpy_interface.base;
     qemu_spice_add_display_interface(&ssd->qxl, con);
+
+#if SPICE_SERVER_VERSION >= 0x000e02 /* release 0.14.2 */
+    char device_address[256] = "";
+    if (qemu_spice_fill_device_address(con, device_address, 256)) {
+        spice_qxl_set_device_info(&ssd->qxl,
+                                  device_address,
+                                  qemu_console_get_head(con),
+                                  1);
+    }
+#endif
+
     qemu_spice_create_host_memslot(ssd);
 
     register_displaychangelistener(&ssd->dcl);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest Lukáš Hrázký
@ 2018-11-08  6:49   ` Gerd Hoffmann
  2018-11-08 10:05     ` Lukáš Hrázký
  0 siblings, 1 reply; 10+ messages in thread
From: Gerd Hoffmann @ 2018-11-08  6:49 UTC (permalink / raw)
  To: Lukáš Hrázký; +Cc: spice-devel, qemu-devel

  Hi,

> + * The device_display_id_{start,count} denotes the sequence of device display
> + * IDs that map to the zero-based sequence of monitor IDs provided by monitors
> + * config on this interface. For example with device_display_id_start = 2 and
> + * device_display_id_count = 3 you get the following mapping:
> + * monitor_id  ->  device_display_id
> + *          0  ->  2
> + *          1  ->  3
> + *          2  ->  4
> + *
> + * Note this example is unsupported in practice. The only supported cases are
> + * either a single device display ID (count = 1) or multiple device display IDs
> + * in a sequence starting from 0.

This is confusing.  The usage of this api in the qemu counterpart looks
sane though.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-08  6:49   ` Gerd Hoffmann
@ 2018-11-08 10:05     ` Lukáš Hrázký
  2018-11-08 16:34       ` [Qemu-devel] [Spice-devel] " Jonathon Jongsma
  2018-11-09 10:10       ` [Qemu-devel] " Gerd Hoffmann
  0 siblings, 2 replies; 10+ messages in thread
From: Lukáš Hrázký @ 2018-11-08 10:05 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: spice-devel, qemu-devel

Hello,

On Thu, 2018-11-08 at 07:49 +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> > + * The device_display_id_{start,count} denotes the sequence of device display
> > + * IDs that map to the zero-based sequence of monitor IDs provided by monitors
> > + * config on this interface. For example with device_display_id_start = 2 and
> > + * device_display_id_count = 3 you get the following mapping:
> > + * monitor_id  ->  device_display_id
> > + *          0  ->  2
> > + *          1  ->  3
> > + *          2  ->  4
> > + *
> > + * Note this example is unsupported in practice. The only supported cases are
> > + * either a single device display ID (count = 1) or multiple device display IDs
> > + * in a sequence starting from 0.
> 
> This is confusing.  The usage of this api in the qemu counterpart looks
> sane though.

Not sure what you find confusing in particular... The example? Using an
example and then saying it's not supported? (I wated to use a
nontrivial example that will show the concept...) Suggestions for
improvement?

Thanks,
Lukas

> cheers,
>   Gerd
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [Spice-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-08 10:05     ` Lukáš Hrázký
@ 2018-11-08 16:34       ` Jonathon Jongsma
  2018-11-09 10:10       ` [Qemu-devel] " Gerd Hoffmann
  1 sibling, 0 replies; 10+ messages in thread
From: Jonathon Jongsma @ 2018-11-08 16:34 UTC (permalink / raw)
  To: Lukáš Hrázký, Gerd Hoffmann; +Cc: spice-devel, qemu-devel

On Thu, 2018-11-08 at 11:05 +0100, Lukáš Hrázký wrote:
> Hello,
> 
> On Thu, 2018-11-08 at 07:49 +0100, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > > + * The device_display_id_{start,count} denotes the sequence of
> > > device display
> > > + * IDs that map to the zero-based sequence of monitor IDs
> > > provided by monitors
> > > + * config on this interface. For example with
> > > device_display_id_start = 2 and
> > > + * device_display_id_count = 3 you get the following mapping:
> > > + * monitor_id  ->  device_display_id
> > > + *          0  ->  2
> > > + *          1  ->  3
> > > + *          2  ->  4
> > > + *
> > > + * Note this example is unsupported in practice. The only
> > > supported cases are
> > > + * either a single device display ID (count = 1) or multiple
> > > device display IDs
> > > + * in a sequence starting from 0.
> > 
> > This is confusing.  The usage of this api in the qemu counterpart
> > looks
> > sane though.
> 
> Not sure what you find confusing in particular... The example? Using
> an
> example and then saying it's not supported? (I wated to use a
> nontrivial example that will show the concept...) Suggestions for
> improvement?

It is funny that you chose an unsupported example for demonstration,
but I can't think of a better option. The supported scenarios don't
demonstrate the full behavior very well...


> 
> Thanks,
> Lukas
> 
> > cheers,
> >   Gerd
> > 
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-08 10:05     ` Lukáš Hrázký
  2018-11-08 16:34       ` [Qemu-devel] [Spice-devel] " Jonathon Jongsma
@ 2018-11-09 10:10       ` Gerd Hoffmann
  2018-11-09 10:20         ` Frediano Ziglio
  1 sibling, 1 reply; 10+ messages in thread
From: Gerd Hoffmann @ 2018-11-09 10:10 UTC (permalink / raw)
  To: Lukáš Hrázký; +Cc: spice-devel, qemu-devel

On Thu, Nov 08, 2018 at 11:05:10AM +0100, Lukáš Hrázký wrote:
> Hello,
> 
> On Thu, 2018-11-08 at 07:49 +0100, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > > + * The device_display_id_{start,count} denotes the sequence of device display
> > > + * IDs that map to the zero-based sequence of monitor IDs provided by monitors
> > > + * config on this interface. For example with device_display_id_start = 2 and
> > > + * device_display_id_count = 3 you get the following mapping:
> > > + * monitor_id  ->  device_display_id
> > > + *          0  ->  2
> > > + *          1  ->  3
> > > + *          2  ->  4
> > > + *
> > > + * Note this example is unsupported in practice. The only supported cases are
> > > + * either a single device display ID (count = 1) or multiple device display IDs
> > > + * in a sequence starting from 0.
> > 
> > This is confusing.  The usage of this api in the qemu counterpart looks
> > sane though.
> 
> Not sure what you find confusing in particular... The example? Using an
> example and then saying it's not supported?

Yes, that for example.  Also wondering why device_display_id doesn't
start at zero.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-09 10:10       ` [Qemu-devel] " Gerd Hoffmann
@ 2018-11-09 10:20         ` Frediano Ziglio
  2018-11-09 10:52           ` Gerd Hoffmann
  0 siblings, 1 reply; 10+ messages in thread
From: Frediano Ziglio @ 2018-11-09 10:20 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Lukáš Hrázký, spice-devel, qemu-devel

> On Thu, Nov 08, 2018 at 11:05:10AM +0100, Lukáš Hrázký wrote:
> > Hello,
> > 
> > On Thu, 2018-11-08 at 07:49 +0100, Gerd Hoffmann wrote:
> > >   Hi,
> > > 
> > > > + * The device_display_id_{start,count} denotes the sequence of device
> > > > display
> > > > + * IDs that map to the zero-based sequence of monitor IDs provided by
> > > > monitors
> > > > + * config on this interface. For example with device_display_id_start
> > > > = 2 and
> > > > + * device_display_id_count = 3 you get the following mapping:
> > > > + * monitor_id  ->  device_display_id
> > > > + *          0  ->  2
> > > > + *          1  ->  3
> > > > + *          2  ->  4
> > > > + *
> > > > + * Note this example is unsupported in practice. The only supported
> > > > cases are
> > > > + * either a single device display ID (count = 1) or multiple device
> > > > display IDs
> > > > + * in a sequence starting from 0.
> > > 
> > > This is confusing.  The usage of this api in the qemu counterpart looks
> > > sane though.
> > 
> > Not sure what you find confusing in particular... The example? Using an
> > example and then saying it's not supported?
> 
> Yes, that for example.  Also wondering why device_display_id doesn't
> start at zero.
> 

You introduced this ID so you should remember.
It starts from 0, just this is not the first registration, the other displays
were registered to other QXL instances.
This was introduced for virtio-gpu to be able to register the different
outputs to different QXL instances so to have

first output/display:
  spice_qxl_set_device_info(instance1, path1, 0, 1);
second:
  spice_qxl_set_device_info(instance2, path1, 1, 1);
third:
  spice_qxl_set_device_info(instance3, path1, 2, 1);

So as you can see device_display_id start from 0 but does not mean
is always 0 for every call.

> cheers,
>   Gerd
> 
> 
> 

Frediano

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest
  2018-11-09 10:20         ` Frediano Ziglio
@ 2018-11-09 10:52           ` Gerd Hoffmann
  0 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2018-11-09 10:52 UTC (permalink / raw)
  To: Frediano Ziglio; +Cc: spice-devel, Lukáš Hrázký, qemu-devel

  Hi,

> first output/display:
>   spice_qxl_set_device_info(instance1, path1, 0, 1);
> second:
>   spice_qxl_set_device_info(instance2, path1, 1, 1);
> third:
>   spice_qxl_set_device_info(instance3, path1, 2, 1);

That is a much better example IMHO.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-11-09 10:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 10:49 [Qemu-devel] [RFC PATCH spice/qemu v3 0/3] QXL interface to set monitor ID Lukáš Hrázký
2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 1/3] QXL interface: add a function to identify monitors in the guest Lukáš Hrázký
2018-11-08  6:49   ` Gerd Hoffmann
2018-11-08 10:05     ` Lukáš Hrázký
2018-11-08 16:34       ` [Qemu-devel] [Spice-devel] " Jonathon Jongsma
2018-11-09 10:10       ` [Qemu-devel] " Gerd Hoffmann
2018-11-09 10:20         ` Frediano Ziglio
2018-11-09 10:52           ` Gerd Hoffmann
2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH spice v3 2/3] QXL interface: deprecate spice_qxl_set_max_monitors Lukáš Hrázký
2018-11-07 10:49 ` [Qemu-devel] [RFC PATCH qemu v3 3/3] spice: set device address and device display ID in QXL interface Lukáš Hrázký

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).