summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2007-03-06 23:15:34 -0800
committerKeith Packard <keithp@neko.keithp.com>2007-03-06 23:20:59 -0800
commit72a23d88d73a8c72ed18847b004db05092d3e7be (patch)
tree7541a078c22b6fb37546ac478930cc7d58c530c7
parent81526232bc0119d2ec7b8590be4f78cf066ae359 (diff)
Add xf86CrtcScreenInit to share initialization across drivers.
xf86CrtcScreenInit performs initialization that needs to happen at ScreenInit time. (cherry picked from commit 558a4f5588ad2ec11254e0b5d6ce9515b137369e)
-rw-r--r--hw/xfree86/modes/xf86Crtc.c54
-rw-r--r--hw/xfree86/modes/xf86Crtc.h23
-rw-r--r--hw/xfree86/modes/xf86Rename.h1
3 files changed, 59 insertions, 19 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 46515fdcc..279449688 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -545,6 +545,60 @@ xf86OutputDestroy (xf86OutputPtr output)
xfree (output);
}
+/*
+ * Called during CreateScreenResources to hook up RandR
+ */
+static Bool
+xf86CrtcCreateScreenResources (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ screen->CreateScreenResources = config->CreateScreenResources;
+
+ if (!(*screen->CreateScreenResources)(screen))
+ return FALSE;
+
+ if (!xf86RandR12CreateScreenResources (screen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * Called at ScreenInit time to set up
+ */
+Bool
+xf86CrtcScreenInit (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* Rotation */
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init (screen);
+
+ /* support all rotations if every crtc has the shadow alloc funcs */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
+ }
+ if (c == config->num_crtc)
+ xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270);
+ else
+ xf86RandR12SetRotations (screen, RR_Rotate_0);
+
+ /* Wrap CreateScreenResources so we can initialize the RandR code */
+ config->CreateScreenResources = screen->CreateScreenResources;
+ screen->CreateScreenResources = xf86CrtcCreateScreenResources;
+ return TRUE;
+}
+
static DisplayModePtr
xf86DefaultMode (xf86OutputPtr output, int width, int height)
{
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 062a2dbec..6152ae4c9 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -494,6 +494,7 @@ typedef struct _xf86CrtcConfig {
const xf86CrtcConfigFuncsRec *funcs;
+ CreateScreenResourcesProcPtr CreateScreenResources;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;
@@ -525,25 +526,6 @@ xf86CrtcDestroy (xf86CrtcPtr crtc);
/**
- * Allocate a crtc for the specified output
- *
- * Find a currently unused CRTC which is suitable for
- * the specified output
- */
-
-xf86CrtcPtr
-xf86AllocCrtc (xf86OutputPtr output);
-
-/**
- * Free a crtc
- *
- * Mark the crtc as unused by any outputs
- */
-
-void
-xf86FreeCrtc (xf86CrtcPtr crtc);
-
-/**
* Sets the given video mode on the given crtc
*/
Bool
@@ -583,6 +565,9 @@ void
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
Bool
+xf86CrtcScreenInit (ScreenPtr pScreen);
+
+Bool
xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
void
diff --git a/hw/xfree86/modes/xf86Rename.h b/hw/xfree86/modes/xf86Rename.h
index eae6d64d5..9dcfef5da 100644
--- a/hw/xfree86/modes/xf86Rename.h
+++ b/hw/xfree86/modes/xf86Rename.h
@@ -31,6 +31,7 @@
#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
+#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit)
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
#define xf86CVTMode XF86NAME(xf86CVTMode)