qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu
@ 2020-09-25 13:50 marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 1/6] edid: fix physical display size computation marcandre.lureau
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

This series improves the support for HiDPI displays with Spice.
The related spice series have already been merged.

v2:
- add patch to "spice: remove the single monitor config logic" (Gerd)

Marc-André Lureau (6):
  edid: fix physical display size computation
  edid: use physical dimensions if available
  ui: add getter for UIInfo
  spice: remove the single monitor config logic
  spice: get monitors physical dimension
  virtio-gpu: set physical dimensions for EDID

 hw/display/edid-generate.c     | 36 +++++++++++++++++++++++----------
 hw/display/virtio-gpu-base.c   |  2 ++
 hw/display/virtio-gpu.c        |  2 ++
 include/hw/display/edid.h      |  5 ++++-
 include/hw/virtio/virtio-gpu.h |  1 +
 include/ui/console.h           |  4 ++++
 qemu-edid.c                    | 11 ++++++++--
 ui/console.c                   |  7 +++++++
 ui/spice-display.c             | 37 +++++++++++++---------------------
 9 files changed, 68 insertions(+), 37 deletions(-)

-- 
2.26.2




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

* [PATCH v2 1/6] edid: fix physical display size computation
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 2/6] edid: use physical dimensions if available marcandre.lureau
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Divide the resolution by the DPI, and multiply to mm.

Note the computation done for edid[21/22] is correct (in cm).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/edid-generate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index e58472fde5..618c74e1df 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -208,8 +208,8 @@ static void edid_desc_timing(uint8_t *desc,
                              uint32_t dpi)
 {
     /* physical display size */
-    uint32_t xmm = xres * dpi / 254;
-    uint32_t ymm = yres * dpi / 254;
+    uint32_t xmm = xres * 254 / 10 / dpi;
+    uint32_t ymm = yres * 254 / 10 / dpi;
 
     /* pull some realistic looking timings out of thin air */
     uint32_t xfront = xres * 25 / 100;
-- 
2.26.2



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

* [PATCH v2 2/6] edid: use physical dimensions if available
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 1/6] edid: fix physical display size computation marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 3/6] ui: add getter for UIInfo marcandre.lureau
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Replace dpi with width_mm/height_mm in qemu_edid_info.

Use it when set (non-zero) to compute the DPI and generate the EDID.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/edid-generate.c | 36 +++++++++++++++++++++++++-----------
 include/hw/display/edid.h  |  5 ++++-
 qemu-edid.c                | 11 +++++++++--
 3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index 618c74e1df..1665b7cbb2 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -205,12 +205,8 @@ static void edid_desc_dummy(uint8_t *desc)
 
 static void edid_desc_timing(uint8_t *desc,
                              uint32_t xres, uint32_t yres,
-                             uint32_t dpi)
+                             uint32_t xmm, uint32_t ymm)
 {
-    /* physical display size */
-    uint32_t xmm = xres * 254 / 10 / dpi;
-    uint32_t ymm = yres * 254 / 10 / dpi;
-
     /* pull some realistic looking timings out of thin air */
     uint32_t xfront = xres * 25 / 100;
     uint32_t xsync  = xres *  3 / 100;
@@ -290,12 +286,24 @@ static void edid_colorspace(uint8_t *edid,
     edid[34] = white_y >> 2;
 }
 
+static uint32_t qemu_edid_dpi_from_mm(uint32_t mm, uint32_t res)
+{
+    return res * 254 / 10 / mm;
+}
+
+uint32_t qemu_edid_dpi_to_mm(uint32_t dpi, uint32_t res)
+{
+    return res * 254 / 10 / dpi;
+}
+
 void qemu_edid_generate(uint8_t *edid, size_t size,
                         qemu_edid_info *info)
 {
     uint32_t desc = 54;
     uint8_t *xtra3 = NULL;
     uint8_t *dta = NULL;
+    uint32_t width_mm, height_mm;
+    uint32_t dpi = 100; /* if no width_mm/height_mm */
 
     /* =============== set defaults  =============== */
 
@@ -305,15 +313,20 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
     if (!info->name) {
         info->name = "QEMU Monitor";
     }
-    if (!info->dpi) {
-        info->dpi = 100;
-    }
     if (!info->prefx) {
         info->prefx = 1024;
     }
     if (!info->prefy) {
         info->prefy = 768;
     }
+    if (info->width_mm && info->height_mm) {
+        width_mm = info->width_mm;
+        height_mm = info->height_mm;
+        dpi = qemu_edid_dpi_from_mm(width_mm, info->prefx);
+    } else {
+        width_mm = qemu_edid_dpi_to_mm(dpi, info->prefx);
+        height_mm = qemu_edid_dpi_to_mm(dpi, info->prefy);
+    }
 
     /* =============== extensions  =============== */
 
@@ -360,8 +373,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
     edid[20] = 0xa5;
 
     /* screen size: undefined */
-    edid[21] = info->prefx * 254 / 100 / info->dpi;
-    edid[22] = info->prefy * 254 / 100 / info->dpi;
+    edid[21] = width_mm / 10;
+    edid[22] = height_mm / 10;
 
     /* display gamma: 2.2 */
     edid[23] = 220 - 100;
@@ -387,7 +400,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
 
     /* =============== descriptor blocks =============== */
 
-    edid_desc_timing(edid + desc, info->prefx, info->prefy, info->dpi);
+    edid_desc_timing(edid + desc, info->prefx, info->prefy,
+                     width_mm, height_mm);
     desc += 18;
 
     edid_desc_ranges(edid + desc);
diff --git a/include/hw/display/edid.h b/include/hw/display/edid.h
index 5b1de57f24..1f8fc9b375 100644
--- a/include/hw/display/edid.h
+++ b/include/hw/display/edid.h
@@ -5,7 +5,8 @@ typedef struct qemu_edid_info {
     const char *vendor; /* http://www.uefi.org/pnp_id_list */
     const char *name;
     const char *serial;
-    uint32_t    dpi;
+    uint16_t    width_mm;
+    uint16_t    height_mm;
     uint32_t    prefx;
     uint32_t    prefy;
     uint32_t    maxx;
@@ -18,6 +19,8 @@ size_t qemu_edid_size(uint8_t *edid);
 void qemu_edid_region_io(MemoryRegion *region, Object *owner,
                          uint8_t *edid, size_t size);
 
+uint32_t qemu_edid_dpi_to_mm(uint32_t dpi, uint32_t res);
+
 #define DEFINE_EDID_PROPERTIES(_state, _edid_info)              \
     DEFINE_PROP_UINT32("xres", _state, _edid_info.prefx, 0),    \
     DEFINE_PROP_UINT32("yres", _state, _edid_info.prefy, 0),    \
diff --git a/qemu-edid.c b/qemu-edid.c
index 46eef70498..1db3372b98 100644
--- a/qemu-edid.c
+++ b/qemu-edid.c
@@ -9,7 +9,10 @@
 #include "qemu/cutils.h"
 #include "hw/display/edid.h"
 
-static qemu_edid_info info;
+static qemu_edid_info info = (qemu_edid_info) {
+    .prefx = 1024,
+    .prefy = 768,
+};
 
 static void usage(FILE *out)
 {
@@ -39,6 +42,7 @@ int main(int argc, char *argv[])
 {
     FILE *outfile = NULL;
     uint8_t blob[256];
+    uint32_t dpi = 100;
     int rc;
 
     for (;;) {
@@ -83,7 +87,7 @@ int main(int argc, char *argv[])
             }
             break;
         case 'd':
-            if (qemu_strtoui(optarg, NULL, 10, &info.dpi) < 0) {
+            if (qemu_strtoui(optarg, NULL, 10, &dpi) < 0) {
                 fprintf(stderr, "not a number: %s\n", optarg);
                 exit(1);
             }
@@ -110,6 +114,9 @@ int main(int argc, char *argv[])
         outfile = stdout;
     }
 
+    info.width_mm = qemu_edid_dpi_to_mm(dpi, info.prefx);
+    info.height_mm = qemu_edid_dpi_to_mm(dpi, info.prefy);
+
     memset(blob, 0, sizeof(blob));
     qemu_edid_generate(blob, sizeof(blob), &info);
     fwrite(blob, sizeof(blob), 1, outfile);
-- 
2.26.2



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

* [PATCH v2 3/6] ui: add getter for UIInfo
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 1/6] edid: fix physical display size computation marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 2/6] edid: use physical dimensions if available marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 4/6] spice: remove the single monitor config logic marcandre.lureau
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following patch is going to introduce extra fields / details to
UIInfo. Add a getter and keep the current values, instead of memset(0)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/console.h | 1 +
 ui/console.c         | 7 +++++++
 ui/spice-display.c   | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 79e301f946..353d2e49a1 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -264,6 +264,7 @@ void update_displaychangelistener(DisplayChangeListener *dcl,
 void unregister_displaychangelistener(DisplayChangeListener *dcl);
 
 bool dpy_ui_info_supported(QemuConsole *con);
+const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con);
 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info);
 
 void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h);
diff --git a/ui/console.c b/ui/console.c
index 7592c3c324..54a74c0b16 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1516,6 +1516,13 @@ bool dpy_ui_info_supported(QemuConsole *con)
     return con->hw_ops->ui_info != NULL;
 }
 
+const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
+{
+    assert(con != NULL);
+
+    return &con->ui_info;
+}
+
 int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)
 {
     assert(con != NULL);
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 19632fdf6c..625d9232b9 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -672,7 +672,7 @@ static int interface_client_monitors_config(QXLInstance *sin,
         return 1;
     }
 
-    memset(&info, 0, sizeof(info));
+    info = *dpy_get_ui_info(ssd->dcl.con);
 
     if (mc->num_of_monitors == 1) {
         /*
-- 
2.26.2



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

* [PATCH v2 4/6] spice: remove the single monitor config logic
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
                   ` (2 preceding siblings ...)
  2020-09-25 13:50 ` [PATCH v2 3/6] ui: add getter for UIInfo marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 5/6] spice: get monitors physical dimension marcandre.lureau
  2020-09-25 13:50 ` [PATCH v2 6/6] virtio-gpu: set physical dimensions for EDID marcandre.lureau
  5 siblings, 0 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Introduced in commit 9c956e646178fee8c14ce7dfae5a9d7cb901876c ("spice:
prepare for upcoming spice-server change"), the new logic never
materialized in the spice server source tree. Let's remove it for now,
until it actually changes in Spice.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/spice-display.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 625d9232b9..b304c13149 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -674,28 +674,10 @@ static int interface_client_monitors_config(QXLInstance *sin,
 
     info = *dpy_get_ui_info(ssd->dcl.con);
 
-    if (mc->num_of_monitors == 1) {
-        /*
-         * New spice-server version which filters the list of monitors
-         * to only include those that belong to our display channel.
-         *
-         * single-head configuration (where filtering doesn't matter)
-         * takes this code path too.
-         */
-        info.width  = mc->monitors[0].width;
-        info.height = mc->monitors[0].height;
-    } else {
-        /*
-         * Old spice-server which gives us all monitors, so we have to
-         * figure ourself which entry we need.  Array index is the
-         * channel_id, which is the qemu console index, see
-         * qemu_spice_add_display_interface().
-         */
-        head = qemu_console_get_index(ssd->dcl.con);
-        if (mc->num_of_monitors > head) {
-            info.width  = mc->monitors[head].width;
-            info.height = mc->monitors[head].height;
-        }
+    head = qemu_console_get_index(ssd->dcl.con);
+    if (mc->num_of_monitors > head) {
+        info.width  = mc->monitors[head].width;
+        info.height = mc->monitors[head].height;
     }
 
     trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height);
-- 
2.26.2



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

* [PATCH v2 5/6] spice: get monitors physical dimension
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
                   ` (3 preceding siblings ...)
  2020-09-25 13:50 ` [PATCH v2 4/6] spice: remove the single monitor config logic marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  2020-09-26  6:56   ` Frediano Ziglio
  2020-09-25 13:50 ` [PATCH v2 6/6] virtio-gpu: set physical dimensions for EDID marcandre.lureau
  5 siblings, 1 reply; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Note that for consistency, we use the same logic as MonitorsConfig to
figure out the associated monitor. However, I can't find traces of the
discussion/patches about the "new spice-server" behaviour: it still uses
the multiple-configurations path in git master.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/console.h | 3 +++
 ui/spice-display.c   | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/ui/console.h b/include/ui/console.h
index 353d2e49a1..e7303d8b98 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -119,6 +119,9 @@ typedef struct DisplaySurface {
 } DisplaySurface;
 
 typedef struct QemuUIInfo {
+    /* physical dimension */
+    uint16_t width_mm;
+    uint16_t height_mm;
     /* geometry */
     int       xoff;
     int       yoff;
diff --git a/ui/spice-display.c b/ui/spice-display.c
index b304c13149..a10f72bc5c 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -679,7 +679,16 @@ static int interface_client_monitors_config(QXLInstance *sin,
         info.width  = mc->monitors[head].width;
         info.height = mc->monitors[head].height;
     }
+#if SPICE_SERVER_VERSION >= 0x000e04 /* release 0.14.4 */
+    if (mc->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) {
+        VDAgentMonitorMM *mm = (void *)&mc->monitors[mc->num_of_monitors];
 
+        if (mc->num_of_monitors > head) {
+            info.width_mm = mm[head].width;
+            info.height_mm = mm[head].height;
+        }
+    }
+#endif
     trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height);
     dpy_set_ui_info(ssd->dcl.con, &info);
     return 1;
-- 
2.26.2



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

* [PATCH v2 6/6] virtio-gpu: set physical dimensions for EDID
  2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
                   ` (4 preceding siblings ...)
  2020-09-25 13:50 ` [PATCH v2 5/6] spice: get monitors physical dimension marcandre.lureau
@ 2020-09-25 13:50 ` marcandre.lureau
  5 siblings, 0 replies; 8+ messages in thread
From: marcandre.lureau @ 2020-09-25 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: spice-devel, Gerd Hoffmann, Marc-André Lureau,
	Michael S. Tsirkin

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/display/virtio-gpu-base.c   | 2 ++
 hw/display/virtio-gpu.c        | 2 ++
 include/hw/virtio/virtio-gpu.h | 1 +
 3 files changed, 5 insertions(+)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index aeb8723542..40ccd00f94 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -82,6 +82,8 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
     g->req_state[idx].y = info->yoff;
     g->req_state[idx].width = info->width;
     g->req_state[idx].height = info->height;
+    g->req_state[idx].width_mm = info->width_mm;
+    g->req_state[idx].height_mm = info->height_mm;
 
     if (info->width && info->height) {
         g->enabled_output_bitmask |= (1 << idx);
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 90be4e3ed7..f3b71fa9c7 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -212,6 +212,8 @@ virtio_gpu_generate_edid(VirtIOGPU *g, int scanout,
 {
     VirtIOGPUBase *b = VIRTIO_GPU_BASE(g);
     qemu_edid_info info = {
+        .width_mm = b->req_state[scanout].width_mm,
+        .height_mm = b->req_state[scanout].height_mm,
         .prefx = b->req_state[scanout].width,
         .prefy = b->req_state[scanout].height,
     };
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 455e0a7433..1aed7275c8 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -62,6 +62,7 @@ struct virtio_gpu_scanout {
 };
 
 struct virtio_gpu_requested_state {
+    uint16_t width_mm, height_mm;
     uint32_t width, height;
     int x, y;
 };
-- 
2.26.2



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

* Re: [PATCH v2 5/6] spice: get monitors physical dimension
  2020-09-25 13:50 ` [PATCH v2 5/6] spice: get monitors physical dimension marcandre.lureau
@ 2020-09-26  6:56   ` Frediano Ziglio
  0 siblings, 0 replies; 8+ messages in thread
From: Frediano Ziglio @ 2020-09-26  6:56 UTC (permalink / raw)
  To: marcandre lureau
  Cc: spice-devel, Michael S. Tsirkin, qemu-devel, Gerd Hoffmann

> 
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Note that for consistency, we use the same logic as MonitorsConfig to
> figure out the associated monitor. However, I can't find traces of the
> discussion/patches about the "new spice-server" behaviour: it still uses
> the multiple-configurations path in git master.
> 

This part is now obsolete.

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/ui/console.h | 3 +++
>  ui/spice-display.c   | 9 +++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/include/ui/console.h b/include/ui/console.h
> index 353d2e49a1..e7303d8b98 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -119,6 +119,9 @@ typedef struct DisplaySurface {
>  } DisplaySurface;
>  
>  typedef struct QemuUIInfo {
> +    /* physical dimension */
> +    uint16_t width_mm;
> +    uint16_t height_mm;
>      /* geometry */
>      int       xoff;
>      int       yoff;
> diff --git a/ui/spice-display.c b/ui/spice-display.c
> index b304c13149..a10f72bc5c 100644
> --- a/ui/spice-display.c
> +++ b/ui/spice-display.c
> @@ -679,7 +679,16 @@ static int interface_client_monitors_config(QXLInstance
> *sin,
>          info.width  = mc->monitors[head].width;
>          info.height = mc->monitors[head].height;
>      }
> +#if SPICE_SERVER_VERSION >= 0x000e04 /* release 0.14.4 */
> +    if (mc->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) {
> +        VDAgentMonitorMM *mm = (void *)&mc->monitors[mc->num_of_monitors];
>  
> +        if (mc->num_of_monitors > head) {

This check is the same of above. Won't be better to move al these block
inside the above if block and remove here?

> +            info.width_mm = mm[head].width;
> +            info.height_mm = mm[head].height;
> +        }
> +    }
> +#endif
>      trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height);
>      dpy_set_ui_info(ssd->dcl.con, &info);
>      return 1;

Frediano



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

end of thread, other threads:[~2020-09-26  6:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25 13:50 [PATCH v2 0/6] Add physical display dimensions to spice/virtio-gpu marcandre.lureau
2020-09-25 13:50 ` [PATCH v2 1/6] edid: fix physical display size computation marcandre.lureau
2020-09-25 13:50 ` [PATCH v2 2/6] edid: use physical dimensions if available marcandre.lureau
2020-09-25 13:50 ` [PATCH v2 3/6] ui: add getter for UIInfo marcandre.lureau
2020-09-25 13:50 ` [PATCH v2 4/6] spice: remove the single monitor config logic marcandre.lureau
2020-09-25 13:50 ` [PATCH v2 5/6] spice: get monitors physical dimension marcandre.lureau
2020-09-26  6:56   ` Frediano Ziglio
2020-09-25 13:50 ` [PATCH v2 6/6] virtio-gpu: set physical dimensions for EDID marcandre.lureau

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).