If an output provides its physical dimensions, they should be used in
preference to computing them on the assumption that the display has a
default DPI setting.

Signed-off-by: Thierry Reding <thierry.red...@avionic-design.de>
---
 hw/xfree86/modes/xf86RandR12.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 6f487bb..e18f357 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -806,10 +806,16 @@ xf86RandR12CreateScreenResources(ScreenPtr pScreen)
             }
             else {
                 /*
-                 * Otherwise, just set the screen to DEFAULT_DPI
+                 * Otherwise, just set the screen to DEFAULT_DPI unless the
+                 * output knows its physical dimensions.
                  */
-                mmWidth = width * 25.4 / DEFAULT_DPI;
-                mmHeight = height * 25.4 / DEFAULT_DPI;
+                if (output->mm_width == 0 || output->mm_height == 0) {
+                    mmWidth = width * 25.4 / DEFAULT_DPI;
+                    mmHeight = height * 25.4 / DEFAULT_DPI;
+                } else {
+                    mmWidth = output->mm_width;
+                    mmHeight = output->mm_height;
+                }
             }
         }
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-- 
1.8.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to