2010-11-24 23:49:36 +00:00
|
|
|
From 2cf7928ed74cbd94e423788a8341bf9a647d0dd9 Mon Sep 17 00:00:00 2001
|
2009-07-28 18:41:28 +00:00
|
|
|
From: Adam Jackson <ajax@redhat.com>
|
|
|
|
Date: Tue, 28 Jul 2009 11:07:13 -0400
|
2010-11-24 23:49:36 +00:00
|
|
|
Subject: [PATCH] RANDR: right-of placement by default
|
2009-07-28 18:41:28 +00:00
|
|
|
|
2010-02-25 02:00:43 +00:00
|
|
|
[Enhanced to add a new prefer clone option for drivers. This
|
|
|
|
allows for servers like RN50 where two heads are disjoint. - airlied]
|
2009-07-28 18:41:28 +00:00
|
|
|
---
|
2010-02-25 02:00:43 +00:00
|
|
|
hw/xfree86/common/xf86str.h | 9 ++++-
|
|
|
|
hw/xfree86/modes/xf86Crtc.c | 74 ++++++++++++++++++++++++++++++++++++++----
|
|
|
|
2 files changed, 74 insertions(+), 9 deletions(-)
|
2009-07-28 18:41:28 +00:00
|
|
|
|
2010-02-25 02:00:43 +00:00
|
|
|
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
|
2010-11-24 23:49:36 +00:00
|
|
|
index ce6b07f..dbac7c5 100644
|
2010-02-25 02:00:43 +00:00
|
|
|
--- a/hw/xfree86/common/xf86str.h
|
|
|
|
+++ b/hw/xfree86/common/xf86str.h
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -496,10 +496,13 @@ typedef struct _confdrirec {
|
2010-02-25 02:00:43 +00:00
|
|
|
} confDRIRec, *confDRIPtr;
|
|
|
|
|
|
|
|
/* These values should be adjusted when new fields are added to ScrnInfoRec */
|
2010-11-24 23:49:36 +00:00
|
|
|
-#define NUM_RESERVED_INTS 16
|
|
|
|
+#define NUM_RESERVED_INTS 15
|
2010-02-25 02:00:43 +00:00
|
|
|
#define NUM_RESERVED_POINTERS 14
|
|
|
|
#define NUM_RESERVED_FUNCS 11
|
|
|
|
|
|
|
|
+/* let clients know they can use this */
|
|
|
|
+#define XF86_SCRN_HAS_PREFER_CLONE 1
|
|
|
|
+
|
|
|
|
typedef pointer (*funcPointer)(void);
|
|
|
|
|
|
|
|
/* flags for depth 24 pixmap options */
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -665,7 +668,6 @@ typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
|
2010-02-25 02:00:43 +00:00
|
|
|
* are to be dependent on compile-time defines.
|
|
|
|
*/
|
|
|
|
|
|
|
|
-
|
|
|
|
typedef struct _ScrnInfoRec {
|
|
|
|
int driverVersion;
|
|
|
|
char * driverName; /* canonical name used in */
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -767,6 +769,9 @@ typedef struct _ScrnInfoRec {
|
|
|
|
ClockRangePtr clockRanges;
|
|
|
|
int adjustFlags;
|
2010-07-05 00:07:04 +00:00
|
|
|
|
2010-02-25 02:00:43 +00:00
|
|
|
+ /* initial rightof support disable */
|
|
|
|
+ int preferClone;
|
2010-07-05 00:07:04 +00:00
|
|
|
+
|
2010-02-25 02:00:43 +00:00
|
|
|
/*
|
|
|
|
* These can be used when the minor ABI version is incremented.
|
2010-07-05 00:07:04 +00:00
|
|
|
* The NUM_* parameters must be reduced appropriately to keep the
|
2009-07-28 18:41:28 +00:00
|
|
|
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
|
2010-11-24 23:49:36 +00:00
|
|
|
index 7fc2a60..5875731 100644
|
2009-07-28 18:41:28 +00:00
|
|
|
--- a/hw/xfree86/modes/xf86Crtc.c
|
|
|
|
+++ b/hw/xfree86/modes/xf86Crtc.c
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -1139,6 +1139,15 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
|
2009-07-28 18:41:28 +00:00
|
|
|
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;
|
|
|
|
+ }
|
2009-09-15 15:10:02 +00:00
|
|
|
+
|
2009-07-28 18:41:28 +00:00
|
|
|
for (o = 0; o < config->num_output; o++)
|
|
|
|
{
|
|
|
|
xf86OutputPtr output = config->output[o];
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -2023,6 +2032,57 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
|
2009-07-28 18:41:28 +00:00
|
|
|
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;
|
|
|
|
+
|
2010-02-25 02:00:43 +00:00
|
|
|
+ if (scrn->preferClone)
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
2009-07-28 18:41:28 +00:00
|
|
|
+ if (numEnabledOutputs(config, enabled) < 2)
|
|
|
|
+ return FALSE;
|
2009-09-15 15:10:02 +00:00
|
|
|
+
|
2009-07-28 18:41:28 +00:00
|
|
|
+ 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,
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -2080,13 +2140,9 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
|
2009-07-28 18:41:28 +00:00
|
|
|
* 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;
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -2380,6 +2436,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
2010-07-05 00:07:04 +00:00
|
|
|
} 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))
|
2010-11-24 23:49:36 +00:00
|
|
|
@@ -2397,8 +2455,10 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
2009-07-28 18:41:28 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
--
|
2010-11-24 23:49:36 +00:00
|
|
|
1.7.3.2
|
2009-07-28 18:41:28 +00:00
|
|
|
|