xorg-x11-server/xserver-1.6.99-right-of.patch
Peter Hutterer 379416ab6b xserver 1.10.0
server-1.9-99.901-xkb-repeat-issues.patch: drop, merged
xserver-1.4.99-pic-libxf86config.patch: drop, see 60801ff8
xserver-1.6.99-default-modes.patch: drop, see dc498b4
xserver-1.7.1-multilib.patch: drop, see a16e282
ABI bumps: xinput to 12.2, extension to 5.0, video to 10.0
2011-02-28 09:24:09 +10:00

168 lines
5.0 KiB
Diff

From ebc70eaa0f7a60e7fb88f3173b3e86a78ab9be79 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 28 Jul 2009 11:07:13 -0400
Subject: [PATCH] RANDR: right-of placement by default
[Enhanced to add a new prefer clone option for drivers. This
allows for servers like RN50 where two heads are disjoint. - airlied]
---
hw/xfree86/common/xf86str.h | 9 ++++-
hw/xfree86/modes/xf86Crtc.c | 74 ++++++++++++++++++++++++++++++++++++++----
2 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 0493dc5..d66e373 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -496,10 +496,13 @@ typedef struct _confdrirec {
} confDRIRec, *confDRIPtr;
/* These values should be adjusted when new fields are added to ScrnInfoRec */
-#define NUM_RESERVED_INTS 16
+#define NUM_RESERVED_INTS 15
#define NUM_RESERVED_POINTERS 14
#define NUM_RESERVED_FUNCS 10
+/* let clients know they can use this */
+#define XF86_SCRN_HAS_PREFER_CLONE 1
+
typedef pointer (*funcPointer)(void);
/* flags for depth 24 pixmap options */
@@ -659,7 +662,6 @@ typedef void xf86ModeSetProc (ScrnInfoPtr);
* are to be dependent on compile-time defines.
*/
-
typedef struct _ScrnInfoRec {
int driverVersion;
char * driverName; /* canonical name used in */
@@ -761,6 +763,9 @@ typedef struct _ScrnInfoRec {
ClockRangePtr clockRanges;
int adjustFlags;
+ /* initial rightof support disable */
+ int preferClone;
+
/*
* These can be used when the minor ABI version is incremented.
* The NUM_* parameters must be reduced appropriately to keep the
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index b5e9dc2..38ce9d0 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1169,6 +1169,15 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
int o;
int min_x, min_y;
+ /* check for initial right-of heuristic */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x || output->initial_y)
+ return TRUE;
+ }
+
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
@@ -2052,6 +2061,57 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
return match;
}
+static int
+numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled)
+{
+ int i = 0, p;
+
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
+
+ return i;
+}
+
+static Bool
+xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ int w = 0;
+
+ if (scrn->preferClone)
+ return FALSE;
+
+ if (numEnabledOutputs(config, enabled) < 2)
+ return FALSE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ if (!mode)
+ return FALSE;
+
+ w += mode->HDisplay;
+ }
+
+ if (w > width)
+ return FALSE;
+
+ w = 0;
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ config->output[o]->initial_x = w;
+ w += mode->HDisplay;
+
+ modes[o] = mode;
+ }
+
+ return TRUE;
+}
+
static Bool
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
DisplayModePtr *modes, Bool *enabled,
@@ -2109,13 +2169,9 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
* biggest mode for its aspect ratio, assuming one exists.
*/
if (!ret) do {
- int i = 0;
float aspect = 0.0;
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
-
- if (i != 1)
+ if (numEnabledOutputs(config, enabled) != 1)
break;
p = -1;
@@ -2409,6 +2465,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
} else {
if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
@@ -2426,8 +2484,10 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
config->output[o]->name);
else
xf86DrvMsg (scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
+ "Output %s using initial mode %s +%d+%d\n",
+ config->output[o]->name, modes[o]->name,
+ config->output[o]->initial_x,
+ config->output[o]->initial_y);
}
/*
--
1.7.4