From e68d127198bca378ff9f9a3e532d3be067a74af7 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 6 Jan 2010 10:42:17 -0500 Subject: [PATCH] xfree86: Add DontForce96DPI server flag. Since commit fff00df94d7ebd18a8e24537ec96073717375a3f, RandR 1.2 drivers lie about the resolution of the attached screen by default. When the reported resolution is wrong, fonts and other UI elements that use physical units are not sized correctly. This patch adds a new server flag, DontForce96DPI, which encourages the server to be honest by default. Signed-off-by: Nick Bowler Signed-off-by: Martin Dengler --- hw/xfree86/common/xf86Config.c | 6 +++++- hw/xfree86/common/xf86Globals.c | 1 + hw/xfree86/common/xf86Privstr.h | 2 ++ hw/xfree86/doc/man/xorg.conf.man | 6 ++++++ hw/xfree86/modes/xf86RandR12.c | 12 ++++++++++++ 5 files changed, 26 insertions(+), 1 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 6fbf613..88c8a56 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -703,7 +703,8 @@ typedef enum { FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, FLAG_DRI2, - FLAG_USE_SIGIO + FLAG_USE_SIGIO, + FLAG_DONTFORCE96DPI } FlagValues; /** @@ -767,6 +768,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_DONTFORCE96DPI, "DontForce96DPI", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -824,6 +827,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch); xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); + xf86GetOptValBool(FlagOptions, FLAG_DONTFORCE96DPI, &xf86Info.dontforce96dpi); xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); if (xf86Info.ignoreABI) { diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 98f8284..c7d03a4 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -110,6 +110,7 @@ xf86InfoRec xf86Info = { .dontVTSwitch = FALSE, .dontZap = FALSE, .dontZoom = FALSE, + .dontforce96dpi = FALSE, .notrapSignals = FALSE, .caughtSignal = FALSE, .currentScreen = NULL, diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index b2095aa..05166f9 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -68,6 +68,8 @@ typedef struct { Bool dontVTSwitch; Bool dontZap; Bool dontZoom; + Bool dontforce96dpi; + Bool notrapSignals; /* don't exit cleanly - die at fault */ Bool caughtSignal; diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 2fe0c47..a20cf14 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -784,6 +784,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) else { xf86OutputPtr output = xf86CompatOutput(pScrn); + xf86CrtcPtr crtc = output->crtc; if (output && output->conf_monitor && @@ -796,6 +797,17 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) mmWidth = output->conf_monitor->mon_width; mmHeight = output->conf_monitor->mon_height; } + else if (xf86Info.dontforce96dpi && crtc && crtc->mode.HDisplay && + output->mm_width && output->mm_height) + { + /* + * If the output has a mode and a declared size, use that + * to scale the screen size + */ + DisplayModePtr mode = &crtc->mode; + mmWidth = output->mm_width * width / mode->HDisplay; + mmHeight = output->mm_height * height / mode->VDisplay; + } else { /*