summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@neko.keithp.com>2007-01-15 08:05:32 +1100
committerKeith Packard <keithp@neko.keithp.com>2007-01-15 08:05:32 +1100
commitbfeda3bfc59d309772398f688d29452ba97f3973 (patch)
treed1ee5f4430098d64f413b991ee54b35a6a34558d
parentda6a00f787e4d13e6b75768c1976f1c44ae5bf72 (diff)
Convert I830PipeSetMode to xf86CrtcSetMode. Add rotation structures.
Makes the mode setting logic device independent. Magic rename hooks allow multiple drivers to provide the generic code without name conflicts. Rotation code requires special pixmap creation hook, and uses Render to perform the actual rotation.
-rw-r--r--src/Makefile.am1
-rw-r--r--src/i830_crt.c2
-rw-r--r--src/i830_display.c208
-rw-r--r--src/i830_display.h6
-rw-r--r--src/i830_driver.c43
-rw-r--r--src/i830_lvds.c6
-rw-r--r--src/i830_modes.c6
-rw-r--r--src/i830_randr.c6
-rw-r--r--src/i830_tv.c2
-rw-r--r--src/i830_xf86Crtc.c305
-rw-r--r--src/i830_xf86Crtc.h60
-rw-r--r--src/i830_xf86Modes.c22
-rw-r--r--src/i830_xf86Modes.h69
-rw-r--r--src/i830_xf86Rename.h66
-rw-r--r--src/i830_xf86Rotate.c324
-rw-r--r--src/local_xf86Rename.h23
16 files changed, 784 insertions, 365 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 80cea10a..02e85768 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,6 +85,7 @@ i810_drv_la_SOURCES = \
i830_xf86cvt.c \
i830_xf86Crtc.h \
i830_xf86Crtc.c \
+ i830_xf86Rotate.c \
i915_3d.c \
i915_3d.h \
i915_reg.h \
diff --git a/src/i830_crt.c b/src/i830_crt.c
index 4e9e3706..00e637ad 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -314,7 +314,7 @@ i830_crt_detect(xf86OutputPtr output)
if (intel_output->load_detect_temp)
{
xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
- i830PipeSetMode (crtc, &mode, FALSE);
+ xf86CrtcSetMode (crtc, &mode, RR_Rotate_0);
}
connected = i830_crt_detect_load (crtc, output);
diff --git a/src/i830_display.c b/src/i830_display.c
index f47a9dbf..d80eb4e0 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -465,23 +465,6 @@ i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode)
}
/**
- * Return whether any outputs are connected to the specified pipe
- */
-
-Bool
-i830PipeInUse (xf86CrtcPtr crtc)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int i;
-
- for (i = 0; i < xf86_config->num_output; i++)
- if (xf86_config->output[i]->crtc == crtc)
- return TRUE;
- return FALSE;
-}
-
-/**
* Sets the power management mode of the pipe and plane.
*
* This code should probably grow support for turning the cursor off and back
@@ -581,6 +564,27 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
}
static Bool
+i830_crtc_lock (xf86CrtcPtr crtc)
+{
+ /* Sync the engine before mode switch */
+ i830WaitSync(crtc->scrn);
+
+#ifdef XF86DRI
+ return I830DRILock(crtc->scrn);
+#else
+ return FALSE;
+#endif
+}
+
+static void
+i830_crtc_unlock (xf86CrtcPtr crtc)
+{
+#ifdef XF86DRI
+ I830DRIUnlock (crtc->scrn);
+#endif
+}
+
+static Bool
i830_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
DisplayModePtr adjusted_mode)
{
@@ -881,165 +885,11 @@ i830_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
}
/**
- * Sets the given video mode on the given pipe.
- *
- * Plane A is always output to pipe A, and plane B to pipe B. The plane
- * will not be enabled if plane_enable is FALSE, which is used for
- * load detection, when something else will be output to the pipe other than
- * display data.
- */
-Bool
-i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode,
- Bool plane_enable)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int i;
- Bool ret = FALSE;
-#ifdef XF86DRI
- Bool didLock = FALSE;
-#endif
- DisplayModePtr adjusted_mode;
-
- /* XXX: curMode */
-
- adjusted_mode = xf86DuplicateMode(pMode);
-
- crtc->enabled = i830PipeInUse (crtc);
-
- if (!crtc->enabled)
- {
- /* XXX disable crtc? */
- return TRUE;
- }
-
-#ifdef XF86DRI
- didLock = I830DRILock(pScrn);
-#endif
-
- /* Pass our mode to the outputs and the CRTC to give them a chance to
- * adjust it according to limitations or output properties, and also
- * a chance to reject the mode entirely.
- */
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
-
- if (output->crtc != crtc)
- continue;
-
- if (!output->funcs->mode_fixup(output, pMode, adjusted_mode)) {
- ret = FALSE;
- goto done;
- }
- }
-
- if (!crtc->funcs->mode_fixup(crtc, pMode, adjusted_mode)) {
- ret = FALSE;
- goto done;
- }
-
- /* Disable the outputs and CRTCs before setting the mode. */
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
-
- if (output->crtc != crtc)
- continue;
-
- /* Disable the output as the first thing we do. */
- output->funcs->dpms(output, DPMSModeOff);
- }
-
- crtc->funcs->dpms(crtc, DPMSModeOff);
-
- /* Set up the DPLL and any output state that needs to adjust or depend
- * on the DPLL.
- */
- crtc->funcs->mode_set(crtc, pMode, adjusted_mode);
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->mode_set(output, pMode, adjusted_mode);
- }
-
- /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
- crtc->funcs->dpms(crtc, DPMSModeOn);
- for (i = 0; i < xf86_config->num_output; i++) {
- xf86OutputPtr output = xf86_config->output[i];
- if (output->crtc == crtc)
- output->funcs->dpms(output, DPMSModeOn);
- }
-
-#if 0
- /*
- * If the display isn't solid, it may be running out
- * of memory bandwidth. This code will dump out the
- * pipe status, if bit 31 is on, the fifo underran
- */
- for (i = 0; i < 4; i++) {
- i830WaitForVblank(pScrn);
-
- OUTREG(pipestat_reg, INREG(pipestat_reg) | 0x80000000);
-
- i830WaitForVblank(pScrn);
-
- temp = INREG(pipestat_reg);
- ErrorF ("pipe status 0x%x\n", temp);
- }
-#endif
-
- crtc->curMode = *pMode;
-
- /* XXX free adjustedmode */
- ret = TRUE;
-done:
-#ifdef XF86DRI
- if (didLock)
- I830DRIUnlock(pScrn);
-#endif
- return ret;
-}
-
-void
-i830DisableUnusedFunctions(ScrnInfoPtr pScrn)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- int o, pipe;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling unused functions\n");
-
- for (o = 0; o < xf86_config->num_output; o++)
- {
- xf86OutputPtr output = xf86_config->output[o];
- if (!output->crtc) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling output %s\n",
- output->name);
- (*output->funcs->dpms)(output, DPMSModeOff);
- }
- }
-
- for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
- {
- xf86CrtcPtr crtc = xf86_config->crtc[pipe];
- I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
- int pipe = intel_crtc->pipe;
- char *pipe_name = pipe == 0 ? "A" : "B";
-
- if (!crtc->enabled) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling CRTC %s\n",
- pipe_name);
- crtc->funcs->dpms(crtc, DPMSModeOff);
-
- memset(&crtc->curMode, 0, sizeof(crtc->curMode));
- }
- }
-}
-
-/**
* This function configures the screens in clone mode on
* all active outputs using a mode similar to the specified mode.
*/
Bool
-i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
+i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool ok = TRUE;
@@ -1049,9 +899,9 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
if (crtc && crtc->enabled)
{
- ok = i830PipeSetMode(crtc,
- i830PipeFindClosestMode(crtc, pMode),
- TRUE);
+ ok = xf86CrtcSetMode(crtc,
+ i830PipeFindClosestMode(crtc, pMode),
+ rotation);
if (!ok)
goto done;
crtc->desiredMode = *pMode;
@@ -1061,7 +911,7 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
(int)(pMode->HDisplay * pMode->VDisplay *
pMode->VRefresh / 1000000));
- i830DisableUnusedFunctions(pScrn);
+ xf86DisableUnusedFunctions(pScrn);
i830DescribeOutputConfiguration(pScrn);
@@ -1153,7 +1003,7 @@ i830GetLoadDetectPipe(xf86OutputPtr output)
return output->crtc;
for (i = 0; i < xf86_config->num_crtc; i++)
- if (!i830PipeInUse(xf86_config->crtc[i]))
+ if (!xf86CrtcInUse (xf86_config->crtc[i]))
break;
if (i == xf86_config->num_crtc)
@@ -1177,7 +1027,7 @@ i830ReleaseLoadDetectPipe(xf86OutputPtr output)
{
output->crtc = NULL;
intel_output->load_detect_temp = FALSE;
- i830DisableUnusedFunctions(pScrn);
+ xf86DisableUnusedFunctions(pScrn);
}
}
@@ -1185,6 +1035,8 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = {
.dpms = i830_crtc_dpms,
.save = NULL, /* XXX */
.restore = NULL, /* XXX */
+ .lock = i830_crtc_lock,
+ .unlock = i830_crtc_unlock,
.mode_fixup = i830_crtc_mode_fixup,
.mode_set = i830_crtc_mode_set,
.gamma_set = i830_crtc_gamma_set,
diff --git a/src/i830_display.h b/src/i830_display.h
index 66ab17e8..dc800553 100644
--- a/src/i830_display.h
+++ b/src/i830_display.h
@@ -30,16 +30,12 @@
/* i830_display.c */
DisplayModePtr
i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode);
-Bool i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode,
- Bool plane_enable);
-void i830DisableUnusedFunctions(ScrnInfoPtr pScrn);
-Bool i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode);
+Bool i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode, Rotation rotation);
void i830PipeSetBase(xf86CrtcPtr crtc, int x, int y);
void i830WaitForVblank(ScrnInfoPtr pScrn);
void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn);
xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output);
void i830ReleaseLoadDetectPipe(xf86OutputPtr output);
-Bool i830PipeInUse(xf86CrtcPtr crtc);
void i830_crtc_init(ScrnInfoPtr pScrn, int pipe);
void i830_crtc_load_lut(xf86CrtcPtr crtc);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 29927985..daa5a3b2 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3131,7 +3131,7 @@ I830EnterVT(int scrnIndex, int flags)
ResetState(pScrn, FALSE);
SetHWOperatingState(pScrn);
- i830DisableUnusedFunctions(pScrn);
+ xf86DisableUnusedFunctions(pScrn);
for (i = 0; i < xf86_config->num_crtc; i++)
{
@@ -3140,9 +3140,12 @@ I830EnterVT(int scrnIndex, int flags)
/* Mark that we'll need to re-set the mode for sure */
memset(&crtc->curMode, 0, sizeof(crtc->curMode));
if (!crtc->desiredMode.CrtcHDisplay)
+ {
crtc->desiredMode = *i830PipeFindClosestMode (crtc, pScrn->currentMode);
+ crtc->desiredRotation = RR_Rotate_0;
+ }
- if (!i830PipeSetMode (crtc, &crtc->desiredMode, TRUE))
+ if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation))
return FALSE;
}
@@ -3223,45 +3226,11 @@ I830SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
I830Ptr pI830 = I830PTR(pScrn);
Bool ret = TRUE;
- PixmapPtr pspix = (*pScrn->pScreen->GetScreenPixmap) (pScrn->pScreen);
DPRINTF(PFX, "I830SwitchMode: mode == %p\n", mode);
- /* Sync the engine before mode switch */
- i830WaitSync(pScrn);
-
- /* Check if our currentmode is about to change. We do this so if we
- * are rotating, we don't need to call the mode setup again.
- */
- if (pI830->currentMode != mode) {
- if (!i830SetMode(pScrn, mode))
- ret = FALSE;
- }
-
- /* Kludge to detect Rotate or Vidmode switch. Not very elegant, but
- * workable given the implementation currently. We only need to call
- * the rotation function when we know that the framebuffer has been
- * disabled by the EnableDisableFBAccess() function.
- *
- * The extra WindowTable check detects a rotation at startup.
- */
- if ( (!WindowTable[pScrn->scrnIndex] || pspix->devPrivate.ptr == NULL) &&
- !pI830->DGAactive && (pScrn->PointerMoved == I830PointerMoved)) {
- if (!I830Rotate(pScrn, mode))
- ret = FALSE;
- }
-
- /* Either the original setmode or rotation failed, so restore the previous
- * video mode here, as we'll have already re-instated the original rotation.
- */
- if (!ret) {
- if (!i830SetMode(pScrn, pI830->currentMode)) {
- xf86DrvMsg(scrnIndex, X_INFO,
- "Failed to restore previous mode (SwitchMode)\n");
- }
- } else {
+ if (!i830SetMode(pScrn, mode, pI830->rotation))
pI830->currentMode = mode;
- }
return ret;
}
diff --git a/src/i830_lvds.c b/src/i830_lvds.c
index 18ac76bf..8abd4020 100644
--- a/src/i830_lvds.c
+++ b/src/i830_lvds.c
@@ -254,10 +254,10 @@ i830_lvds_get_modes(xf86OutputPtr output)
xf86MonPtr edid_mon;
DisplayModePtr modes;
- edid_mon = i830_xf86OutputGetEDID (output, intel_output->pDDCBus);
- i830_xf86OutputSetEDID (output, edid_mon);
+ edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
+ xf86OutputSetEDID (output, edid_mon);
- modes = i830_xf86OutputGetEDIDModes (output);
+ modes = xf86OutputGetEDIDModes (output);
if (modes != NULL)
return modes;
diff --git a/src/i830_modes.c b/src/i830_modes.c
index b4e22c35..405dcc61 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -62,9 +62,9 @@ i830_ddc_get_modes (xf86OutputPtr output)
xf86MonPtr edid_mon;
DisplayModePtr modes;
- edid_mon = i830_xf86OutputGetEDID (output, intel_output->pDDCBus);
- i830_xf86OutputSetEDID (output, edid_mon);
+ edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
+ xf86OutputSetEDID (output, edid_mon);
- modes = i830_xf86OutputGetEDIDModes (output);
+ modes = xf86OutputGetEDIDModes (output);
return modes;
}
diff --git a/src/i830_randr.c b/src/i830_randr.c
index 533322b2..d6df4190 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -541,7 +541,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
return FALSE;
x = crtc->x;
y = crtc->y;
- rotation = RR_Rotate_0;
+ rotation = crtc->curRotation;
numOutputs = 0;
randr_mode = NULL;
for (i = 0; i < config->num_output; i++)
@@ -638,7 +638,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
if (mode)
{
- if (!i830PipeSetMode (crtc, mode, TRUE))
+ if (!xf86CrtcSetMode (crtc, mode, rotation))
{
crtc->enabled = save_enabled;
for (o = 0; o < config->num_output; o++)
@@ -651,7 +651,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
}
crtc->desiredMode = *mode;
}
- i830DisableUnusedFunctions (pScrn);
+ xf86DisableUnusedFunctions (pScrn);
i830DumpRegs(pScrn);
}
diff --git a/src/i830_tv.c b/src/i830_tv.c
index 92e417e0..a76cbffa 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1065,7 +1065,7 @@ i830_tv_detect(xf86OutputPtr output)
/* we only need the pixel clock set correctly here */
mode = reported_modes[0];
xf86SetModeCrtc (&mode, INTERLACE_HALVE_V);
- i830PipeSetMode (crtc, &mode, FALSE);
+ xf86CrtcSetMode (crtc, &mode, RR_Rotate_0);
}
i830_tv_detect_type (crtc, output);
i830ReleaseLoadDetectPipe (output);
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index ceb8f2ef..5eb55e96 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -87,6 +87,8 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
#ifdef RANDR_12_INTERFACE
crtc->randr_crtc = NULL;
#endif
+ crtc->curRotation = RR_Rotate_0;
+ crtc->desiredRotation = RR_Rotate_0;
if (xf86_config->crtc)
crtcs = xrealloc (xf86_config->crtc,
(xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
@@ -121,6 +123,122 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
xfree (crtc);
}
+
+/**
+ * Return whether any outputs are connected to the specified pipe
+ */
+
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
+ return FALSE;
+}
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+
+ adjusted_mode = xf86DuplicateMode(mode);
+
+ crtc->enabled = xf86CrtcInUse (crtc);
+
+ if (!crtc->enabled)
+ {
+ /* XXX disable crtc? */
+ return TRUE;
+ }
+
+ didLock = crtc->funcs->lock (crtc);
+
+ /* Pass our mode to the outputs and the CRTC to give them a chance to
+ * adjust it according to limitations or output properties, and also
+ * a chance to reject the mode entirely.
+ */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ ret = FALSE;
+ goto done;
+ }
+ }
+
+ if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
+ ret = FALSE;
+ goto done;
+ }
+
+#if 0
+ if (!xf86CrtcRotate (crtc, mode, rotation))
+ {
+ ret = FALSE;
+ goto done;
+ }
+#endif
+
+ /* Disable the outputs and CRTCs before setting the mode. */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ /* Disable the output as the first thing we do. */
+ output->funcs->dpms(output, DPMSModeOff);
+ }
+
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+
+ /* Set up the DPLL and any output state that needs to adjust or depend
+ * on the DPLL.
+ */
+ crtc->funcs->mode_set(crtc, mode, adjusted_mode);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
+ }
+
+ /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
+ crtc->funcs->dpms(crtc, DPMSModeOn);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->dpms(output, DPMSModeOn);
+ }
+
+ crtc->curMode = *mode;
+
+ /* XXX free adjustedmode */
+ ret = TRUE;
+done:
+ if (didLock)
+ crtc->funcs->unlock (crtc);
+
+ return ret;
+}
+
/*
* Output functions
*/
@@ -362,14 +480,14 @@ xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
}
static int
-xf86PickCrtcs (ScrnInfoPtr pScrn,
+xf86PickCrtcs (ScrnInfoPtr scrn,
xf86CrtcPtr *best_crtcs,
DisplayModePtr *modes,
int n,
int width,
int height)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int c, o, l;
xf86OutputPtr output;
xf86CrtcPtr crtc;
@@ -388,7 +506,7 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
*/
best_crtcs[n] = NULL;
best_crtc = NULL;
- best_score = xf86PickCrtcs (pScrn, best_crtcs, modes, n+1, width, height);
+ best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
if (modes[n] == NULL)
return best_score;
@@ -442,7 +560,7 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
}
crtcs[n] = crtc;
memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
- score = my_score + xf86PickCrtcs (pScrn, crtcs, modes, n+1, width, height);
+ score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
if (score > best_score)
{
best_crtc = crtc;
@@ -462,9 +580,9 @@ xf86PickCrtcs (ScrnInfoPtr pScrn,
*/
static void
-xf86DefaultScreenLimits (ScrnInfoPtr pScrn, int *widthp, int *heightp)
+xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int width = 0, height = 0;
int o;
int c;
@@ -513,9 +631,9 @@ xf86DefaultScreenLimits (ScrnInfoPtr pScrn, int *widthp, int *heightp)
#define POSITION_UNSET -100000
static Bool
-xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
+xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
int min_x, min_y;
@@ -563,7 +681,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
}
else
{
- xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Output %s position not of form \"x y\"\n",
output->name);
output->initial_x = output->initial_y = 0;
@@ -606,7 +724,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
}
if (!relative)
{
- xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Cannot position output %s relative to unknown output %s\n",
output->name, relative_name);
output->initial_x = 0;
@@ -655,7 +773,7 @@ xf86InitialOutputPositions (ScrnInfoPtr pScrn, DisplayModePtr *modes)
xf86OutputPtr output = config->output[o];
if (output->initial_x == POSITION_UNSET)
{
- xf86DrvMsg (pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
"Output position loop. Moving %s to 0,0\n",
output->name);
output->initial_x = output->initial_y = 0;
@@ -778,16 +896,16 @@ i830xf86SortModes (DisplayModePtr input)
#define DEBUG_REPROBE 1
void
-xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
+xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o;
if (maxX == 0 || maxY == 0)
- xf86RandR12GetOriginalVirtualSize (pScrn, &maxX, &maxY);
+ xf86RandR12GetOriginalVirtualSize (scrn, &maxX, &maxY);
/* Elide duplicate modes before defaulting code uses them */
- xf86PruneDuplicateMonitorModes (pScrn->monitor);
+ xf86PruneDuplicateMonitorModes (scrn->monitor);
/* Probe the list of modes for each output. */
for (o = 0; o < config->num_output; o++)
@@ -837,7 +955,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
mon_rec.nVrefresh++;
sync_source = sync_config;
}
- config_modes = i830xf86GetMonitorModes (pScrn, conf_monitor);
+ config_modes = xf86GetMonitorModes (scrn, conf_monitor);
}
output_modes = (*output->funcs->get_modes) (output);
@@ -901,27 +1019,27 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
mon_rec.vrefresh[0].hi = 62.0;
mon_rec.nVrefresh = 1;
}
- default_modes = i830xf86GetDefaultModes (output->interlaceAllowed,
- output->doubleScanAllowed);
+ default_modes = xf86GetDefaultModes (output->interlaceAllowed,
+ output->doubleScanAllowed);
if (sync_source == sync_config)
{
/*
* Check output and config modes against sync range from config file
*/
- i830xf86ValidateModesSync (pScrn, output_modes, &mon_rec);
- i830xf86ValidateModesSync (pScrn, config_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, config_modes, &mon_rec);
}
/*
* Check default modes against sync range
*/
- i830xf86ValidateModesSync (pScrn, default_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, default_modes, &mon_rec);
/*
* Check default modes against monitor max clock
*/
if (max_clock)
- i830xf86ValidateModesClocks(pScrn, default_modes,
- &min_clock, &max_clock, 1);
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
output->probed_modes = NULL;
output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
@@ -932,7 +1050,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
* Check all modes against max size
*/
if (maxX && maxY)
- i830xf86ValidateModesSize (pScrn, output->probed_modes,
+ xf86ValidateModesSize (scrn, output->probed_modes,
maxX, maxY, 0);
/*
@@ -942,7 +1060,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
if (mode->status == MODE_OK)
mode->status = (*output->funcs->mode_valid)(output, mode);
- i830xf86PruneInvalidModes(pScrn, &output->probed_modes, TRUE);
+ xf86PruneInvalidModes(scrn, &output->probed_modes, TRUE);
output->probed_modes = i830xf86SortModes (output->probed_modes);
@@ -975,11 +1093,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
#ifdef DEBUG_REPROBE
if (output->probed_modes != NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Printing probed modes for output %s\n",
output->name);
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
"No remaining probed modes for output %s\n",
output->name);
}
@@ -993,7 +1111,7 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
#ifdef DEBUG_REPROBE
- xf86PrintModeline(pScrn->scrnIndex, mode);
+ xf86PrintModeline(scrn->scrnIndex, mode);
#endif
}
}
@@ -1006,12 +1124,12 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
/* XXX where does this function belong? Here? */
void
-xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
void
-xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
+xf86SetScrnInfoModes (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
xf86OutputPtr output;
xf86CrtcPtr crtc;
DisplayModePtr last, mode;
@@ -1035,31 +1153,31 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
}
crtc = output->crtc;
- /* Clear any existing modes from pScrn->modes */
- while (pScrn->modes != NULL)
- xf86DeleteMode(&pScrn->modes, pScrn->modes);
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
- /* Set pScrn->modes to the mode list for the 'compat' output */
- pScrn->modes = xf86DuplicateModes(pScrn, output->probed_modes);
+ /* Set scrn->modes to the mode list for the 'compat' output */
+ scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
- for (mode = pScrn->modes; mode; mode = mode->next)
+ for (mode = scrn->modes; mode; mode = mode->next)
if (xf86ModesEqual (mode, &crtc->desiredMode))
break;
- if (pScrn->modes != NULL) {
- /* For some reason, pScrn->modes is circular, unlike the other mode
+ if (scrn->modes != NULL) {
+ /* For some reason, scrn->modes is circular, unlike the other mode
* lists. How great is that?
*/
- for (last = pScrn->modes; last && last->next; last = last->next)
+ for (last = scrn->modes; last && last->next; last = last->next)
;
- last->next = pScrn->modes;
- pScrn->modes->prev = last;
+ last->next = scrn->modes;
+ scrn->modes->prev = last;
if (mode) {
- while (pScrn->modes != mode)
- pScrn->modes = pScrn->modes->next;
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
}
}
- pScrn->currentMode = pScrn->modes;
+ scrn->currentMode = scrn->modes;
}
/**
@@ -1070,9 +1188,9 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
*/
Bool
-xf86InitialConfiguration (ScrnInfoPtr pScrn)
+xf86InitialConfiguration (ScrnInfoPtr scrn)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
DisplayModePtr target_mode = NULL;
xf86CrtcPtr *crtcs;
@@ -1081,16 +1199,16 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
int width;
int height;
- if (pScrn->display->virtualX)
- width = pScrn->display->virtualX;
+ if (scrn->display->virtualX)
+ width = scrn->display->virtualX;
else
width = config->maxWidth;
- if (pScrn->display->virtualY)
- height = pScrn->display->virtualY;
+ if (scrn->display->virtualY)
+ height = scrn->display->virtualY;
else
height = config->maxHeight;
- xf86ProbeOutputModes (pScrn, width, height);
+ xf86ProbeOutputModes (scrn, width, height);
crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
@@ -1152,7 +1270,7 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/*
* Set the position of each output
*/
- if (!xf86InitialOutputPositions (pScrn, modes))
+ if (!xf86InitialOutputPositions (scrn, modes))
{
xfree (crtcs);
xfree (modes);
@@ -1162,7 +1280,7 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/*
* Assign CRTCs to fit output configuration
*/
- if (!xf86PickCrtcs (pScrn, crtcs, modes, 0, width, height))
+ if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
{
xfree (crtcs);
xfree (modes);
@@ -1171,8 +1289,8 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
/* XXX override xf86 common frame computation code */
- pScrn->display->frameX0 = 0;
- pScrn->display->frameY0 = 0;
+ scrn->display->frameX0 = 0;
+ scrn->display->frameY0 = 0;
for (c = 0; c < config->num_crtc; c++)
{
@@ -1201,24 +1319,24 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
}
}
- if (pScrn->display->virtualX == 0)
+ if (scrn->display->virtualX == 0)
{
/*
* Expand virtual size to cover potential mode switches
*/
- xf86DefaultScreenLimits (pScrn, &width, &height);
+ xf86DefaultScreenLimits (scrn, &width, &height);
- pScrn->display->virtualX = width;
- pScrn->display->virtualY = height;
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
}
- if (width > pScrn->virtualX)
- pScrn->virtualX = width;
- if (height > pScrn->virtualY)
- pScrn->virtualY = height;
+ if (width > scrn->virtualX)
+ scrn->virtualX = width;
+ if (height > scrn->virtualY)
+ scrn->virtualY = height;
- /* Mirror output modes to pScrn mode list */
- xf86SetScrnInfoModes (pScrn);
+ /* Mirror output modes to scrn mode list */
+ xf86SetScrnInfoModes (scrn);
xfree (crtcs);
xfree (modes);
@@ -1232,9 +1350,9 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn)
* Otherwise, it will affect CRTCs before outputs.
*/
void
-xf86DPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
+xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
if (mode == DPMSModeOff) {
@@ -1260,6 +1378,35 @@ xf86DPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
}
}
+/**
+ * Disable all inactive crtcs and outputs
+ */
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+ if (!output->crtc)
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->enabled)
+ {
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->curMode, 0, sizeof(crtc->curMode));
+ }
+ }
+}
+
+
#ifdef RANDR_12_INTERFACE
#define EDID_ATOM_NAME "EDID_DATA"
@@ -1290,10 +1437,10 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
* Set the EDID information for the specified output
*/
void
-i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
{
- ScrnInfoPtr pScrn = output->scrn;
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
#ifdef RANDR_12_INTERFACE
int size;
@@ -1305,12 +1452,12 @@ i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
output->MonInfo = edid_mon;
/* Debug info for now, at least */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name);
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name);
xf86PrintEDID(edid_mon);
/* Set the DDC properties for the 'compat' output */
if (output == config->output[config->compat_output])
- xf86SetDDCproperties(pScrn, edid_mon);
+ xf86SetDDCproperties(scrn, edid_mon);
#ifdef RANDR_12_INTERFACE
/* Set the RandR output properties */
@@ -1354,20 +1501,20 @@ i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
* stored in 'output'
*/
DisplayModePtr
-i830_xf86OutputGetEDIDModes (xf86OutputPtr output)
+xf86OutputGetEDIDModes (xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
+ ScrnInfoPtr scrn = output->scrn;
xf86MonPtr edid_mon = output->MonInfo;
if (!edid_mon)
return NULL;
- return xf86DDCGetModes(pScrn->scrnIndex, edid_mon);
+ return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
}
xf86MonPtr
-i830_xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
{
- ScrnInfoPtr pScrn = output->scrn;
+ ScrnInfoPtr scrn = output->scrn;
- return xf86DoEDID_DDC2 (pScrn->scrnIndex, pDDCBus);
+ return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
}
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 8fea162e..e72dda63 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -24,8 +24,10 @@
#include <edid.h>
#include "randrstr.h"
+#include "i830_xf86Rename.h"
#include "i830_xf86Modes.h"
#include "xf86Parser.h"
+#include "damage.h"
/* Compat definitions for older X Servers. */
#ifndef M_T_PREFERRED
@@ -70,6 +72,19 @@ typedef struct _xf86CrtcFuncs {
/**
+ * Lock CRTC prior to mode setting, mostly for DRI.
+ * Returns whether unlock is needed
+ */
+ Bool
+ (*lock) (xf86CrtcPtr crtc);
+
+ /**
+ * Unlock CRTC after mode setting, mostly for DRI
+ */
+ void
+ (*unlock) (xf86CrtcPtr crtc);
+
+ /**
* Callback to adjust the mode to be set in the CRTC.
*
* This allows a CRTC to adjust the clock or even the entire set of
@@ -95,6 +110,18 @@ typedef struct _xf86CrtcFuncs {
int size);
/**
+ * Create shadow pixmap for rotation support
+ */
+ PixmapPtr
+ (*shadow_create) (xf86CrtcPtr crtc, int width, int height);
+
+ /**
+ * Destroy shadow pixmap
+ */
+ void
+ (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap);
+
+ /**
* Clean up driver-specific bits of the crtc
*/
void
@@ -135,6 +162,8 @@ struct _xf86Crtc {
* during server startup
*/
DisplayModeRec curMode;
+ Rotation curRotation;
+ PixmapPtr rotatedPixmap;
/**
* Desired mode
@@ -145,6 +174,7 @@ struct _xf86Crtc {
* on VT switch.
*/
DisplayModeRec desiredMode;
+ Rotation desiredRotation;
/** crtc-specific functions */
const xf86CrtcFuncsRec *funcs;
@@ -363,6 +393,9 @@ typedef struct _xf86CrtcConfig {
int minWidth, minHeight;
int maxWidth, maxHeight;
+
+ /* For crtc-based rotation */
+ DamagePtr rotationDamage;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;
@@ -411,6 +444,24 @@ xf86AllocCrtc (xf86OutputPtr output);
void
xf86FreeCrtc (xf86CrtcPtr crtc);
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
+
+/*
+ * Assign crtc rotation during mode set
+ */
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
+
+/**
+ * Return whether any output is assigned to the crtc
+ */
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc);
+
/*
* Output functions
*/
@@ -437,20 +488,23 @@ xf86InitialConfiguration (ScrnInfoPtr pScrn);
void
xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
+
/**
* Set the EDID information for the specified output
*/
void
-i830_xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
DisplayModePtr
-i830_xf86OutputGetEDIDModes (xf86OutputPtr output);
+xf86OutputGetEDIDModes (xf86OutputPtr output);
xf86MonPtr
-i830_xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
#endif /* _XF86CRTC_H_ */
diff --git a/src/i830_xf86Modes.c b/src/i830_xf86Modes.c
index 482a3320..f37eaeb7 100644
--- a/src/i830_xf86Modes.c
+++ b/src/i830_xf86Modes.c
@@ -337,7 +337,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags)
{
DisplayModePtr mode;
@@ -358,7 +358,7 @@ i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch)
{
DisplayModePtr mode;
@@ -387,7 +387,7 @@ i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon)
{
DisplayModePtr mode;
@@ -434,7 +434,7 @@ i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges)
{
DisplayModePtr mode;
@@ -468,7 +468,7 @@ i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr mode;
@@ -502,7 +502,7 @@ i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
-i830xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose)
{
DisplayModePtr mode;
@@ -558,7 +558,7 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
* Build a mode list from a list of config file modes
*/
static DisplayModePtr
-i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
+xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
{
DisplayModePtr head = NULL, prev = NULL, mode;
@@ -604,7 +604,7 @@ i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
* Build a mode list from a monitor configuration
*/
DisplayModePtr
-i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
{
DisplayModePtr modes = NULL;
XF86ConfModesLinkPtr modes_link;
@@ -625,18 +625,18 @@ i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
xf86configptr->conf_modes_lst);
if (modes_link->ml_modes)
modes = xf86ModesAdd (modes,
- i830xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
+ xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
}
return xf86ModesAdd (modes,
- i830xf86GetConfigModes (conf_monitor->mon_modeline_lst));
+ xf86GetConfigModes (conf_monitor->mon_modeline_lst));
}
/**
* Build a mode list containing all of the default modes
*/
DisplayModePtr
-i830xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
{
DisplayModePtr head = NULL, prev = NULL, mode;
int i;
diff --git a/src/i830_xf86Modes.h b/src/i830_xf86Modes.h
index a7d0839d..d032199d 100644
--- a/src/i830_xf86Modes.h
+++ b/src/i830_xf86Modes.h
@@ -29,67 +29,54 @@
#define _I830_XF86MODES_H_
#include "xorgVersion.h"
#include "xf86Parser.h"
+#include "i830_xf86Rename.h"
-#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
-double i830_xf86ModeHSync(DisplayModePtr mode);
-double i830_xf86ModeVRefresh(DisplayModePtr mode);
-DisplayModePtr i830_xf86DuplicateMode(DisplayModePtr pMode);
-DisplayModePtr i830_xf86DuplicateModes(ScrnInfoPtr pScrn,
+double xf86ModeHSync(DisplayModePtr mode);
+double xf86ModeVRefresh(DisplayModePtr mode);
+DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
DisplayModePtr modeList);
-void i830_xf86SetModeDefaultName(DisplayModePtr mode);
-void i830_xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-Bool i830_xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
-void i830_xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
-DisplayModePtr i830_xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+void xf86SetModeDefaultName(DisplayModePtr mode);
+void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
-DisplayModePtr i830_xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-DisplayModePtr i830_xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced, Bool Interlaced);
-
-#define xf86ModeHSync i830_xf86ModeHSync
-#define xf86ModeVRefresh i830_xf86ModeVRefresh
-#define xf86DuplicateMode i830_xf86DuplicateMode
-#define xf86DuplicateModes i830_xf86DuplicateModes
-#define xf86SetModeDefaultName i830_xf86SetModeDefaultName
-#define xf86SetModeCrtc i830_xf86SetModeCrtc
-#define xf86ModesEqual i830_xf86ModesEqual
-#define xf86PrintModeline i830_xf86PrintModeline
-#define xf86ModesAdd i830_xf86ModesAdd
-#define xf86DDCGetModes i830_xf86DDCGetModes
-#define xf86CVTMode i830_xf86CVTMode
-#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
+DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
+DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced, Bool Interlaced);
void
-i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int flags);
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
void
-i830xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int *min, int *max, int n_ranges);
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int *min, int *max, int n_ranges);
void
-i830xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int maxX, int maxY, int maxPitch);
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int maxX, int maxY, int maxPitch);
void
-i830xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- MonPtr mon);
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ MonPtr mon);
void
-i830xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
- Bool verbose);
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+ Bool verbose);
void
-i830xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int flags);
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
void
-i830xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
DisplayModePtr
-i830xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
DisplayModePtr
-i830xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
#endif /* _I830_XF86MODES_H_ */
diff --git a/src/i830_xf86Rename.h b/src/i830_xf86Rename.h
new file mode 100644
index 00000000..cf8de622
--- /dev/null
+++ b/src/i830_xf86Rename.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XF86RENAME_H_
+#define _XF86RENAME_H_
+
+#include "local_xf86Rename.h"
+
+#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
+#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
+#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
+#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
+#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
+#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
+#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
+#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
+#define xf86CVTMode XF86NAME(xf86CVTMode)
+#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
+#define xf86DPMSSet XF86NAME(xf86DPMSSet)
+#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
+#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
+#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
+#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
+#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
+#define xf86ModeHSync XF86NAME(xf86ModeHSync)
+#define xf86ModesAdd XF86NAME(xf86ModesAdd)
+#define xf86ModesEqual XF86NAME(xf86ModesEqual)
+#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
+#define xf86OutputCreate XF86NAME(xf86OutputCreate)
+#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
+#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
+#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
+#define xf86OutputRename XF86NAME(xf86OutputRename)
+#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
+#define xf86PrintModeline XF86NAME(xf86PrintModeline)
+#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
+#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
+#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
+#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
+#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
+#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
+#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
+#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
+#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
+#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
+
+#endif /* _XF86RENAME_H_ */
diff --git a/src/i830_xf86Rotate.c b/src/i830_xf86Rotate.c
new file mode 100644
index 00000000..12b20919
--- /dev/null
+++ b/src/i830_xf86Rotate.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+/*#include "i830.h" */
+#include "i830_xf86Crtc.h"
+#include "i830_xf86Modes.h"
+#include "i830_randr.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+
+static int
+mode_height (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->VDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->HDisplay;
+ default:
+ return 0;
+ }
+}
+
+static int
+mode_width (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->HDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->VDisplay;
+ default:
+ return 0;
+ }
+}
+
+/* borrowed from composite extension, move to Render and publish? */
+
+static VisualPtr
+compGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PictFormatPtr
+compWindowFormat (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return PictureMatchVisual (pScreen, pWin->drawable.depth,
+ compGetWindowVisual (pWin));
+}
+
+static void
+xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ PixmapPtr src_pixmap = (*screen->GetScreenPixmap) (screen);
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
+ int error;
+ PicturePtr src, dst;
+ PictTransform transform;
+
+ src = CreatePicture (None,
+ &src_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!src)
+ return;
+ dst = CreatePicture (None,
+ &dst_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!dst)
+ return;
+ SetPictureClipRegion (src, 0, 0, region);
+ memset (&transform, '\0', sizeof (transform));
+ transform.matrix[2][2] = 1;
+ transform.matrix[0][2] = crtc->x;
+ transform.matrix[1][2] = crtc->y;
+ switch (crtc->curRotation & 0xf) {
+ case RR_Rotate_0:
+ transform.matrix[0][0] = 1;
+ transform.matrix[1][1] = 1;
+ break;
+ case RR_Rotate_90:
+ /* XXX probably wrong */
+ transform.matrix[0][1] = 1;
+ transform.matrix[1][0] = -1;
+ transform.matrix[1][2] += crtc->curMode.HDisplay;
+ break;
+ case RR_Rotate_180:
+ /* XXX probably wrong */
+ transform.matrix[0][0] = -1;
+ transform.matrix[1][1] = -1;
+ transform.matrix[0][2] += crtc->curMode.HDisplay;
+ transform.matrix[1][2] += crtc->curMode.VDisplay;
+ break;
+ case RR_Rotate_270:
+ /* XXX probably wrong */
+ transform.matrix[0][1] = -1;
+ transform.matrix[1][0] = 1;
+ transform.matrix[0][2] += crtc->curMode.VDisplay;
+ break;
+ }
+ /* handle reflection */
+ if (crtc->curRotation & RR_Reflect_X)
+ {
+ /* XXX figure this out */
+ }
+ if (crtc->curRotation & RR_Reflect_Y)
+ {
+ /* XXX figure this out too */
+ }
+ SetPictureTransform (src, &transform);
+ CompositePicture (PictOpSrc,
+ src, NULL, dst,
+ 0, 0, 0, 0, 0, 0,
+ dst_pixmap->drawable.width,
+ dst_pixmap->drawable.height);
+ FreePicture (src, None);
+ FreePicture (dst, None);
+}
+
+static void
+xf86RotateRedisplay(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ DamagePtr damage = xf86_config->rotationDamage;
+ RegionPtr region;
+
+ if (!damage)
+ return;
+ region = DamageRegion(damage);
+ if (REGION_NOTEMPTY(pScreen, region))
+ {
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->curRotation != RR_Rotate_0)
+ {
+ BoxRec box;
+ RegionRec crtc_damage;
+
+ /* compute portion of damage that overlaps crtc */
+ box.x1 = crtc->x;
+ box.x2 = crtc->x + mode_width (&crtc->curMode, crtc->curRotation);
+ box.y1 = crtc->y;
+ box.y2 = crtc->y + mode_height (&crtc->curMode, crtc->curRotation);
+ REGION_INIT(pScreen, &crtc_damage, &box, 1);
+ REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
+
+ /* update damaged region */
+ if (REGION_NOTEMPTY(pScreen, &crtc_damage))
+ xf86RotateCrtcRedisplay (crtc, &crtc_damage);
+
+ REGION_UNINIT (pScreen, &crtc_damage);
+ }
+ }
+ DamageEmpty(damage);
+ }
+}
+
+static void
+xf86RotateBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
+{
+ ScreenPtr pScreen = (ScreenPtr) data;
+
+ xf86RotateRedisplay(pScreen);
+}
+
+static void
+xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask)
+{
+}
+
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScreenPtr pScreen = pScrn->pScreen;
+
+ if (rotation == RR_Rotate_0)
+ {
+ /* Free memory from rotation */
+ if (crtc->rotatedPixmap)
+ {
+ crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap);
+ crtc->rotatedPixmap = NULL;
+ }
+
+ if (xf86_config->rotationDamage)
+ {
+ /* Free damage structure */
+ DamageDestroy (xf86_config->rotationDamage);
+ xf86_config->rotationDamage = NULL;
+ /* Free block/wakeup handler */
+ RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
+ xf86RotateWakeupHandler,
+ (pointer) pScreen);
+ }
+ }
+ else
+ {
+ int width = mode_width (mode, rotation);
+ int height = mode_height (mode, rotation);
+ PixmapPtr shadow = crtc->rotatedPixmap;
+ int old_width = shadow ? shadow->drawable.width : 0;
+ int old_height = shadow ? shadow->drawable.height : 0;
+
+ /* Allocate memory for rotation */
+ if (old_width != width || old_height != height)
+ {
+ if (shadow)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow);
+ crtc->rotatedPixmap = NULL;
+ }
+ shadow = crtc->funcs->shadow_create (crtc, width, height);
+ if (!shadow)
+ goto bail1;
+ }
+
+ if (!xf86_config->rotationDamage)
+ {
+ /* Create damage structure */
+ xf86_config->rotationDamage = DamageCreate (NULL, NULL,
+ DamageReportNone,
+ TRUE, pScreen, pScreen);
+ if (!xf86_config->rotationDamage)
+ goto bail2;
+
+ /* Hook damage to screen pixmap */
+ DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotationDamage);
+
+ /* Assign block/wakeup handler */
+ if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
+ xf86RotateWakeupHandler,
+ (pointer) pScreen))
+ {
+ goto bail3;
+ }
+ }
+ if (0)
+ {
+bail3:
+ DamageDestroy (xf86_config->rotationDamage);
+ xf86_config->rotationDamage = NULL;
+
+bail2:
+ if (shadow)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow);
+ crtc->rotatedPixmap = NULL;
+ }
+bail1:
+ if (old_width && old_height)
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ old_width,
+ old_height);
+ return FALSE;
+ }
+ }
+
+ /* All done */
+ crtc->curRotation = rotation;
+ return TRUE;
+}
diff --git a/src/local_xf86Rename.h b/src/local_xf86Rename.h
new file mode 100644
index 00000000..e1e788f3
--- /dev/null
+++ b/src/local_xf86Rename.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#define XF86NAME(x) intel_##x