]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
Arithmetic error in EDID generation fixed
authorAnton V. Boyarshinov <boyarsh@altlinux.org>
Wed, 26 Feb 2020 12:20:54 +0000 (15:20 +0300)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 2 Mar 2020 07:20:30 +0000 (08:20 +0100)
To calculate screen size in centimeters we should calculate:
pixels/dpi*2.54
but not
pixels*dpi/2540

Using wrong formula we actually get 65 DPI and very small fonts.

Signed-off-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
Message-id: 20200226122054.366b9cda@table.localdomain
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/edid-generate.c

index 75c945a94813316d2b104cccf7b645a51b2cfc03..e58472fde5015589f710235fd4b573790ac5f239 100644 (file)
@@ -360,8 +360,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
     edid[20] = 0xa5;
 
     /* screen size: undefined */
-    edid[21] = info->prefx * info->dpi / 2540;
-    edid[22] = info->prefy * info->dpi / 2540;
+    edid[21] = info->prefx * 254 / 100 / info->dpi;
+    edid[22] = info->prefy * 254 / 100 / info->dpi;
 
     /* display gamma: 2.2 */
     edid[23] = 220 - 100;