From 2ef4c5e8f6444aad192304e5a2f7a0c77bfb917d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 19 Dec 2006 16:45:39 -0800 Subject: Re-initialize physical screen size only if -dpi was passed. Physical screen size from the config file or DDC will already be set correctly in the screen structure, unless it was computed from the virtual size using the -dpi command line option. Recompute physical size as we reset the screen size if the -dpi option was used. --- src/i830_randr.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/i830_randr.c b/src/i830_randr.c index 290cb10d..0a103846 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -835,9 +835,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); int c; int width, height; + int mmWidth, mmHeight; /* - * Compute width of screen + * Compute size of screen */ width = 0; height = 0; for (c = 0; c < config->num_crtc; c++) @@ -854,14 +855,19 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) if (width && height) { - int mmWidth, mmHeight; - - mmWidth = pScreen->mmWidth; - mmHeight = pScreen->mmHeight; - if (width != pScreen->width) - mmWidth = mmWidth * width / pScreen->width; - if (height != pScreen->height) - mmHeight = mmHeight * height / pScreen->height; + /* + * Compute physical size of screen + */ + if (monitorResolution) + { + mmWidth = width * 25.4 / monitorResolution; + mmHeight = height * 25.4 / monitorResolution; + } + else + { + mmWidth = pScreen->mmWidth; + mmHeight = pScreen->mmHeight; + } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting screen physical size to %d x %d\n", mmWidth, mmHeight); -- cgit v1.2.3