1 From 73d915296302f49024bf3d7cab2b11e253d5c8da Mon Sep 17 00:00:00 2001
2 From: Nick Bowler <nbowler@draconx.ca>
3 Date: Wed, 6 Jan 2010 10:42:17 -0500
4 Subject: [PATCH] xfree86: Add DontLie server flag.
6 Since commit fff00df94d7ebd18a8e24537ec96073717375a3f, RandR 1.2 drivers
7 lie about attached screen resolution by default. The new server flag,
8 DontLie, causes the server to be honest by default.
10 Signed-off-by: Nick Bowler <nbowler@draconx.ca>
12 hw/xfree86/common/xf86Config.c | 6 +++++-
13 hw/xfree86/common/xf86Globals.c | 1 +
14 hw/xfree86/common/xf86Privstr.h | 2 ++
15 hw/xfree86/doc/man/xorg.conf.man.pre | 6 ++++++
16 hw/xfree86/modes/xf86RandR12.c | 12 ++++++++++++
17 5 files changed, 26 insertions(+), 1 deletions(-)
19 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
20 index 6fbf613..88c8a56 100644
21 --- a/hw/xfree86/common/xf86Config.c
22 +++ b/hw/xfree86/common/xf86Config.c
23 @@ -703,7 +703,8 @@ typedef enum {
24 FLAG_AUTO_ENABLE_DEVICES,
33 @@ -767,6 +768,8 @@ static OptionInfoRec FlagOptions[] = {
35 { FLAG_USE_SIGIO, "UseSIGIO", OPTV_BOOLEAN,
37 + { FLAG_DONTLIE, "DontLie", OPTV_BOOLEAN,
39 { -1, NULL, OPTV_NONE,
42 @@ -824,6 +827,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
43 xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
44 xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
45 xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
46 + xf86GetOptValBool(FlagOptions, FLAG_DONTLIE, &xf86Info.dontLie);
48 xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
49 if (xf86Info.ignoreABI) {
50 diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
51 index 98f8284..c7d03a4 100644
52 --- a/hw/xfree86/common/xf86Globals.c
53 +++ b/hw/xfree86/common/xf86Globals.c
54 @@ -110,6 +110,7 @@ xf86InfoRec xf86Info = {
55 .dontVTSwitch = FALSE,
59 .notrapSignals = FALSE,
60 .caughtSignal = FALSE,
61 .currentScreen = NULL,
62 diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
63 index b2095aa..05166f9 100644
64 --- a/hw/xfree86/common/xf86Privstr.h
65 +++ b/hw/xfree86/common/xf86Privstr.h
66 @@ -68,6 +68,8 @@ typedef struct {
72 Bool notrapSignals; /* don't exit cleanly - die at fault */
75 diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
76 index 942c397..dd1269c 100644
77 --- a/hw/xfree86/doc/man/xorg.conf.man.pre
78 +++ b/hw/xfree86/doc/man/xorg.conf.man.pre
79 @@ -490,6 +490,12 @@ When this option is enabled, those key sequences have no special meaning
80 and are passed to clients.
83 +.BI "Option \*qDontLie\*q \*q" boolean \*q
84 +This option suggests that the server should avoid lying whenever possible.
85 +Currently this means that RandR 1.2 drivers will try to compute the proper DPI
86 +instead of making it up.
89 .BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q
90 This disables the parts of the VidMode extension used by the xvidtune client
91 that can be used to change the video modes.
92 diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
93 index 1fc63c4..5d8bc29 100644
94 --- a/hw/xfree86/modes/xf86RandR12.c
95 +++ b/hw/xfree86/modes/xf86RandR12.c
96 @@ -806,6 +806,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
99 xf86OutputPtr output = config->output[config->compat_output];
100 + xf86CrtcPtr crtc = output->crtc;
102 if (output->conf_monitor &&
103 (output->conf_monitor->mon_width > 0 &&
104 @@ -817,6 +818,17 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
105 mmWidth = output->conf_monitor->mon_width;
106 mmHeight = output->conf_monitor->mon_height;
108 + else if (xf86Info.dontLie && crtc && crtc->mode.HDisplay &&
109 + output->mm_width && output->mm_height)
112 + * If the output has a mode and a declared size, use that
113 + * to scale the screen size
115 + DisplayModePtr mode = &crtc->mode;
116 + mmWidth = output->mm_width * width / mode->HDisplay;
117 + mmHeight = output->mm_height * height / mode->VDisplay;