edid: fix physical display size computation
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Sun, 27 Sep 2020 14:57:46 +0000 (18:57 +0400)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 29 Sep 2020 08:08:25 +0000 (10:08 +0200)
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>
Message-id: 20200927145751.365446-2-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/edid-generate.c

index e58472fde5015589f710235fd4b573790ac5f239..618c74e1df3965b2ee27bb6f612fe87008ac3129 100644 (file)
@@ -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;