From fdd4c469b4e7663b351b4c0f940922cef551d14b Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 6 Jan 2010 10:42:17 -0500 Subject: [PATCH] xfree86: Add DontLie server flag. Since commit fff00df94d7e ("Ignore EDID-supplied monitor physical sizes for core screen size"), 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, DontLie, which encourages the server to be honest by default. Signed-off-by: Nick Bowler --- hw/xfree86/common/xf86Config.c | 6 +++++- hw/xfree86/common/xf86Globals.c | 1 + hw/xfree86/common/xf86Privstr.h | 1 + hw/xfree86/man/xorg.conf.man | 6 ++++++ hw/xfree86/modes/xf86RandR12.c | 12 ++++++++++++ 5 files changed, 25 insertions(+), 1 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 3aa923a..7a45c08 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -689,7 +689,8 @@ typedef enum { FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, FLAG_DRI2, - FLAG_USE_SIGIO + FLAG_USE_SIGIO, + FLAG_DONTLIE } FlagValues; /** @@ -749,6 +750,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_DONTLIE, "DontLie", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -791,6 +794,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_DONTLIE, &xf86Info.dontLie); 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 93533ec..82f72a5 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -107,6 +107,7 @@ xf86InfoRec xf86Info = { .ShareVTs = FALSE, .dontZap = FALSE, .dontZoom = FALSE, + .dontLie = FALSE, .notrapSignals = FALSE, .caughtSignal = FALSE, .currentScreen = NULL, diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 14cd56a..ff324fe 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -70,6 +70,7 @@ typedef struct { Bool ShareVTs; Bool dontZap; Bool dontZoom; + Bool dontLie; Bool notrapSignals; /* don't exit cleanly - die at fault */ Bool caughtSignal; diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man index 8f14efb..3475711 100644 --- a/hw/xfree86/man/xorg.conf.man +++ b/hw/xfree86/man/xorg.conf.man @@ -544,6 +544,12 @@ When this option is enabled, those key sequences have no special meaning and are passed to clients. Default: off. .TP 7 +.BI "Option \*qDontLie\*q \*q" boolean \*q +This option suggests that the server should avoid lying whenever possible. +Currently this means that RandR 1.2 drivers will try to compute the proper DPI +instead of making it up. +Default: off. +.TP 7 .BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q This disables the parts of the VidMode extension used by the xvidtune client that can be used to change the video modes. diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index cb20d1c..65da9bf 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -805,6 +805,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) else { xf86OutputPtr output = xf86CompatOutput(pScrn); + xf86CrtcPtr crtc = output->crtc; if (output && output->conf_monitor && @@ -817,6 +818,17 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) mmWidth = output->conf_monitor->mon_width; mmHeight = output->conf_monitor->mon_height; } + else if (xf86Info.dontLie && 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 { /* -- 1.7.3.4