|
|
7a54649 |
From 291bc9f827188461ff9717efccec1e350db537e8 Mon Sep 17 00:00:00 2001
|
|
|
f76b04d |
From: Adam Jackson <ajax@redhat.com>
|
|
|
f76b04d |
Date: Tue, 28 Jul 2009 11:07:13 -0400
|
|
|
7a54649 |
Subject: [PATCH 3/7] RANDR: right-of placement by default
|
|
|
f76b04d |
|
|
|
add10e2 |
[Enhanced to add a new prefer clone option for drivers. This
|
|
|
add10e2 |
allows for servers like RN50 where two heads are disjoint. - airlied]
|
|
|
f76b04d |
---
|
|
Peter Hutterer |
a035615 |
hw/xfree86/common/xf86str.h | 8 ++++-
|
|
Peter Hutterer |
a035615 |
hw/xfree86/modes/xf86Crtc.c | 76 ++++++++++++++++++++++++++++++++++++++-----
|
|
Peter Hutterer |
a035615 |
2 files changed, 75 insertions(+), 9 deletions(-)
|
|
|
f76b04d |
|
|
|
add10e2 |
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
|
|
|
7a54649 |
index 0590262..d246634 100644
|
|
|
add10e2 |
--- a/hw/xfree86/common/xf86str.h
|
|
|
add10e2 |
+++ b/hw/xfree86/common/xf86str.h
|
|
|
7a54649 |
@@ -508,10 +508,13 @@ typedef struct _confdrirec {
|
|
|
add10e2 |
} confDRIRec, *confDRIPtr;
|
|
|
add10e2 |
|
|
|
add10e2 |
/* These values should be adjusted when new fields are added to ScrnInfoRec */
|
|
Peter Hutterer |
77cc640 |
-#define NUM_RESERVED_INTS 16
|
|
Peter Hutterer |
77cc640 |
+#define NUM_RESERVED_INTS 15
|
|
|
add10e2 |
#define NUM_RESERVED_POINTERS 14
|
|
Peter Hutterer |
379416a |
#define NUM_RESERVED_FUNCS 10
|
|
|
add10e2 |
|
|
|
add10e2 |
+/* let clients know they can use this */
|
|
|
add10e2 |
+#define XF86_SCRN_HAS_PREFER_CLONE 1
|
|
|
add10e2 |
+
|
|
Peter Hutterer |
a035615 |
typedef pointer (*funcPointer) (void);
|
|
|
add10e2 |
|
|
|
add10e2 |
/* flags for depth 24 pixmap options */
|
|
|
7a54649 |
@@ -769,6 +772,9 @@ typedef struct _ScrnInfoRec {
|
|
Peter Hutterer |
a035615 |
ClockRangePtr clockRanges;
|
|
Peter Hutterer |
a035615 |
int adjustFlags;
|
|
|
c22de5d |
|
|
|
add10e2 |
+ /* initial rightof support disable */
|
|
|
add10e2 |
+ int preferClone;
|
|
|
c22de5d |
+
|
|
|
add10e2 |
/*
|
|
|
add10e2 |
* These can be used when the minor ABI version is incremented.
|
|
|
c22de5d |
* The NUM_* parameters must be reduced appropriately to keep the
|
|
|
f76b04d |
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
|
|
|
7a54649 |
index 154f684..c58088d 100644
|
|
|
f76b04d |
--- a/hw/xfree86/modes/xf86Crtc.c
|
|
|
f76b04d |
+++ b/hw/xfree86/modes/xf86Crtc.c
|
|
|
7a54649 |
@@ -1130,6 +1130,15 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
|
|
Peter Hutterer |
a035615 |
int o;
|
|
Peter Hutterer |
a035615 |
int min_x, min_y;
|
|
Peter Hutterer |
a035615 |
|
|
|
f76b04d |
+ /* check for initial right-of heuristic */
|
|
|
f76b04d |
+ for (o = 0; o < config->num_output; o++)
|
|
|
f76b04d |
+ {
|
|
Peter Hutterer |
a035615 |
+ xf86OutputPtr output = config->output[o];
|
|
|
f76b04d |
+
|
|
Peter Hutterer |
a035615 |
+ if (output->initial_x || output->initial_y)
|
|
|
f76b04d |
+ return TRUE;
|
|
|
f76b04d |
+ }
|
|
|
d62a092 |
+
|
|
Peter Hutterer |
a035615 |
for (o = 0; o < config->num_output; o++) {
|
|
Peter Hutterer |
a035615 |
xf86OutputPtr output = config->output[o];
|
|
Peter Hutterer |
a035615 |
|
|
|
7a54649 |
@@ -1998,6 +2007,57 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
|
|
f76b04d |
return match;
|
|
|
f76b04d |
}
|
|
|
f76b04d |
|
|
|
f76b04d |
+static int
|
|
|
f76b04d |
+numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled)
|
|
|
f76b04d |
+{
|
|
|
f76b04d |
+ int i = 0, p;
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+ return i;
|
|
|
f76b04d |
+}
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+static Bool
|
|
|
f76b04d |
+xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
|
Peter Hutterer |
a035615 |
+ DisplayModePtr *modes, Bool *enabled,
|
|
Peter Hutterer |
a035615 |
+ int width, int height)
|
|
|
f76b04d |
+{
|
|
|
f76b04d |
+ int o;
|
|
|
f76b04d |
+ int w = 0;
|
|
|
f76b04d |
+
|
|
|
add10e2 |
+ if (scrn->preferClone)
|
|
Peter Hutterer |
a035615 |
+ return FALSE;
|
|
|
add10e2 |
+
|
|
|
f76b04d |
+ if (numEnabledOutputs(config, enabled) < 2)
|
|
Peter Hutterer |
a035615 |
+ return FALSE;
|
|
|
d62a092 |
+
|
|
|
f76b04d |
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
|
Peter Hutterer |
a035615 |
+ DisplayModePtr mode =
|
|
Peter Hutterer |
a035615 |
+ xf86OutputHasPreferredMode(config->output[o], width, height);
|
|
|
f76b04d |
+
|
|
Peter Hutterer |
a035615 |
+ if (!mode)
|
|
Peter Hutterer |
a035615 |
+ return FALSE;
|
|
|
f76b04d |
+
|
|
Peter Hutterer |
a035615 |
+ w += mode->HDisplay;
|
|
|
f76b04d |
+ }
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+ if (w > width)
|
|
Peter Hutterer |
a035615 |
+ return FALSE;
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+ w = 0;
|
|
|
f76b04d |
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
|
|
Peter Hutterer |
a035615 |
+ DisplayModePtr mode =
|
|
Peter Hutterer |
a035615 |
+ xf86OutputHasPreferredMode(config->output[o], width, height);
|
|
|
f76b04d |
+
|
|
Peter Hutterer |
a035615 |
+ config->output[o]->initial_x = w;
|
|
Peter Hutterer |
a035615 |
+ w += mode->HDisplay;
|
|
|
f76b04d |
+
|
|
Peter Hutterer |
a035615 |
+ modes[o] = mode;
|
|
|
f76b04d |
+ }
|
|
|
f76b04d |
+
|
|
|
f76b04d |
+ return TRUE;
|
|
|
f76b04d |
+}
|
|
|
f76b04d |
+
|
|
|
f76b04d |
static Bool
|
|
|
f76b04d |
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
|
Peter Hutterer |
a035615 |
DisplayModePtr * modes, Bool *enabled,
|
|
|
7a54649 |
@@ -2074,14 +2134,10 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
|
|
f76b04d |
*/
|
|
Peter Hutterer |
a035615 |
if (!ret)
|
|
Peter Hutterer |
a035615 |
do {
|
|
Peter Hutterer |
a035615 |
- int i = 0;
|
|
Peter Hutterer |
a035615 |
float aspect = 0.0;
|
|
|
7a54649 |
DisplayModePtr a = NULL, b = NULL;
|
|
|
f76b04d |
|
|
Peter Hutterer |
a035615 |
- /* count the number of enabled outputs */
|
|
Peter Hutterer |
a035615 |
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
|
|
|
f76b04d |
-
|
|
Peter Hutterer |
a035615 |
- if (i != 1)
|
|
Peter Hutterer |
a035615 |
+ if (numEnabledOutputs(config, enabled) != 1)
|
|
Peter Hutterer |
a035615 |
break;
|
|
|
f76b04d |
|
|
Peter Hutterer |
a035615 |
p = -1;
|
|
|
7a54649 |
@@ -2385,6 +2441,8 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
|
|
Peter Hutterer |
a035615 |
else {
|
|
Peter Hutterer |
a035615 |
if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
|
|
Peter Hutterer |
a035615 |
xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
|
|
Peter Hutterer |
a035615 |
+ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
|
|
Peter Hutterer |
a035615 |
+ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
|
|
Peter Hutterer |
a035615 |
else if (xf86TargetPreferred
|
|
Peter Hutterer |
a035615 |
(scrn, config, modes, enabled, width, height))
|
|
Peter Hutterer |
a035615 |
xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
|
|
|
7a54649 |
@@ -2404,9 +2462,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
|
|
Peter Hutterer |
a035615 |
"Output %s enabled but has no modes\n",
|
|
Peter Hutterer |
a035615 |
config->output[o]->name);
|
|
Peter Hutterer |
a035615 |
else
|
|
Peter Hutterer |
a035615 |
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
|
|
Peter Hutterer |
a035615 |
- "Output %s using initial mode %s\n",
|
|
Peter Hutterer |
a035615 |
- config->output[o]->name, modes[o]->name);
|
|
Peter Hutterer |
a035615 |
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
|
|
Peter Hutterer |
a035615 |
+ "Output %s using initial mode %s +%d+%d\n",
|
|
Peter Hutterer |
a035615 |
+ config->output[o]->name, modes[o]->name,
|
|
|
f76b04d |
+ config->output[o]->initial_x,
|
|
|
f76b04d |
+ config->output[o]->initial_y);
|
|
|
f76b04d |
}
|
|
|
f76b04d |
|
|
|
f76b04d |
/*
|
|
|
f76b04d |
--
|
|
|
7a54649 |
1.7.10.4
|
|
|
f76b04d |
|