summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-12-19 16:45:39 -0800
committerKeith Packard <keithp@guitar.keithp.com>2006-12-19 16:45:39 -0800
commit2ef4c5e8f6444aad192304e5a2f7a0c77bfb917d (patch)
tree5d41c892002ed21e5981a7cbad3e62114a379d2c
parentb00951a5c87ca8c596ee9cc73d96d598eec60751 (diff)
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.
-rw-r--r--src/i830_randr.c24
1 files 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);