summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-12-17 23:42:30 +0100
committerMaarten Maathuis <madman2003@gmail.com>2008-12-17 23:46:31 +0100
commit9fa15bef59881bdcf087889f16ab3c8d953da8f1 (patch)
treebb3f355ef7346a8699f62253b3530c55451a3ec0 /hw/xfree86
parentbf65523ab0b39774f07a7ae478ff3f5653fad469 (diff)
randr: some improvements, fixes and crtc abi bump
- Add active field to crtc. - Set gamma (only) whenever a crtc becomes active. - Check for xf86_config being NULL. - Increase crtc abi to 3. - A few other fixes.
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/modes/xf86Crtc.c35
-rw-r--r--hw/xfree86/modes/xf86Crtc.h15
-rw-r--r--hw/xfree86/modes/xf86RandR12.c9
3 files changed, 38 insertions, 21 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 824edfd4a..7c9bb5a10 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -267,9 +267,11 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
crtc->enabled = xf86CrtcInUse (crtc);
+ /* We only hit this if someone explicitly sends a "disabled" modeset. */
if (!crtc->enabled)
{
- /* XXX disable crtc? */
+ /* Check everything for stuff that should be off. */
+ xf86DisableUnusedFunctions(scrn);
return TRUE;
}
@@ -378,6 +380,11 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
output->funcs->mode_set(output, mode, adjusted_mode);
}
+ /* Only upload when needed, to avoid unneeded delays. */
+ if (!crtc->active)
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
+
/* Now, enable the clocks, plane, pipe, and outputs that we set up. */
crtc->funcs->commit(crtc);
for (i = 0; i < xf86_config->num_output; i++)
@@ -387,8 +394,8 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
output->funcs->commit(output);
}
- /* XXX free adjustedmode */
ret = TRUE;
+ crtc->active = TRUE;
if (scrn->pScreen)
xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
@@ -403,6 +410,8 @@ done:
crtc->transformPresent = saved_transform_present;
}
+ free(adjusted_mode);
+
if (didLock)
crtc->funcs->unlock (crtc);
@@ -2265,8 +2274,7 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
memcpy (crtc->gamma_blue, blue, crtc->gamma_size * sizeof (CARD16));
/* Use copied values, the perfect way to test if all went well. */
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+
free(red);
@@ -2440,8 +2448,6 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
crtc->desiredY = output->initial_y;
crtc->desiredTransformPresent = FALSE;
crtc->enabled = TRUE;
- crtc->x = output->initial_x;
- crtc->y = output->initial_y;
memcpy (&crtc->panningTotalArea, &output->initialTotalArea, sizeof(BoxRec));
memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
memcpy (crtc->panningBorder, output->initialBorder, 4*sizeof(INT16));
@@ -2846,6 +2852,7 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
crtc->funcs->dpms(crtc, DPMSModeOff);
memset(&crtc->mode, 0, sizeof(crtc->mode));
xf86RotateDestroy(crtc);
+ crtc->active = FALSE;
}
}
if (pScrn->pScreen)
@@ -3141,15 +3148,13 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcPtr crtc;
- int c;
- for (c = 0; c < xf86_config->num_crtc; c++) {
- crtc = xf86_config->crtc[c];
- if (crtc->funcs->gamma_set)
- return TRUE;
- else
- return FALSE;
- }
+ if (!xf86_config)
+ return FALSE;
- return FALSE;
+ if (xf86_config->num_crtc == 0)
+ return FALSE;
+ crtc = xf86_config->crtc[0];
+
+ return (crtc->funcs->gamma_set != NULL);
}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index fb9f77df0..581550f66 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -222,7 +222,7 @@ typedef struct _xf86CrtcFuncs {
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
-#define XF86_CRTC_VERSION 2
+#define XF86_CRTC_VERSION 3
struct _xf86Crtc {
/**
@@ -236,9 +236,9 @@ struct _xf86Crtc {
ScrnInfoPtr scrn;
/**
- * Active state of this CRTC
+ * Desired state of this CRTC
*
- * Set when this CRTC is driving one or more outputs
+ * Set when this CRTC should be driving one or more outputs
*/
Bool enabled;
@@ -340,11 +340,20 @@ struct _xf86Crtc {
/**
* Current gamma, especially useful after initial config.
+ * Added in ABI version 3
*/
CARD16 *gamma_red;
CARD16 *gamma_green;
CARD16 *gamma_blue;
int gamma_size;
+
+ /**
+ * Actual state of this CRTC
+ *
+ * Set to TRUE after modesetting, set to FALSE if no outputs are connected
+ * Added in ABI version 3
+ */
+ Bool active;
};
typedef struct _xf86OutputFuncs {
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 8deb64cdf..a378e3aed 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1062,9 +1062,12 @@ xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
memcpy (crtc->gamma_green, randr_crtc->gammaGreen, crtc->gamma_size * sizeof (CARD16));
memcpy (crtc->gamma_blue, randr_crtc->gammaBlue, crtc->gamma_size * sizeof (CARD16));
- /* Use copied values, the perfect way to test if all went well. */
- crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
- crtc->gamma_blue, crtc->gamma_size);
+ /* Only set it when the crtc is actually running.
+ * Otherwise it will be set when it's activated.
+ */
+ if (crtc->active)
+ crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
+ crtc->gamma_blue, crtc->gamma_size);
return TRUE;
}