summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830_crt.c4
-rw-r--r--src/i830_driver.c32
-rw-r--r--src/i830_randr.c14
-rw-r--r--src/i830_xf86Crtc.c5
-rw-r--r--src/i830_xf86Crtc.h2
5 files changed, 43 insertions, 14 deletions
diff --git a/src/i830_crt.c b/src/i830_crt.c
index 615e96a3..3d755876 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -292,13 +292,13 @@ i830_crt_detect(I830_xf86OutputPtr output)
return OUTPUT_STATUS_CONNECTED;
/* Use the load-detect method if we have no other way of telling. */
- crtc = i830xf86AllocCrtc (output);
+ crtc = i830GetLoadDetectPipe (output);
if (crtc)
{
Bool connected = i830_crt_detect_load(crtc, output);
- i830xf86FreeCrtc (crtc);
+ i830ReleaseLoadDetectPipe (output);
if (connected)
return OUTPUT_STATUS_CONNECTED;
else
diff --git a/src/i830_driver.c b/src/i830_driver.c
index d4d5fbc3..4d6e8168 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -667,6 +667,34 @@ I830SetupOutputs(ScrnInfoPtr pScrn)
i830_tv_init(pScrn);
}
+/**
+ * Setup the CRTCs
+ */
+
+static const I830_xf86CrtcFuncsRec i830_crtc_funcs = {
+};
+
+static void
+I830SetupCrtcs(ScrnInfoPtr pScrn)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+ int p;
+
+ for (p = 0; p < pI830->num_pipes; p++)
+ {
+ I830_xf86CrtcPtr crtc = i830xf86CrtcCreate (pScrn, &i830_crtc_funcs);
+ I830CrtcPrivatePtr intel_crtc;
+
+ if (!crtc)
+ break;
+ intel_crtc = xnfcalloc (sizeof (I830CrtcPrivateRec), 1);
+ intel_crtc->pipe = p;
+
+ crtc->driver_private = intel_crtc;
+ pI830->xf86_crtc[p] = crtc;
+ }
+}
+
static void
I830PreInitDDC(ScrnInfoPtr pScrn)
{
@@ -685,8 +713,6 @@ I830PreInitDDC(ScrnInfoPtr pScrn)
if (xf86LoadSubModule(pScrn, "i2c")) {
xf86LoaderReqSymLists(I810i2cSymbols, NULL);
- I830SetupOutputs(pScrn);
-
pI830->ddc2 = TRUE;
} else {
pI830->ddc2 = FALSE;
@@ -1241,6 +1267,8 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
}
I830PreInitDDC(pScrn);
+ I830SetupOutputs(pScrn);
+ I830SetupCrtcs(pScrn);
if (xf86ReturnOptValBool(pI830->Options, OPTION_CLONE, FALSE)) {
if (pI830->num_pipes == 1) {
diff --git a/src/i830_randr.c b/src/i830_randr.c
index d6a3131c..59c07ffc 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -1215,17 +1215,17 @@ I830RandRPreInit (ScrnInfoPtr pScrn)
{
I830_xf86OutputPtr output = pI830->xf86_output[o];
RRModePtr randr_mode = output_modes[o];
+ RRCrtcPtr randr_crtc = output_crtcs[o];
DisplayModePtr mode;
- RRCrtcPtr randr_crtc = output_crtcs[o];
- I830_xf86CrtcPtr crtc = randr_crtc->devPrivate;
- if (randr_mode)
+ if (randr_mode && randr_crtc)
+ {
+ I830_xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
mode = (DisplayModePtr) randr_mode->devPrivate;
- else
- mode = NULL;
- if (mode)
crtc->desiredMode = *mode;
- output->crtc = crtc;
+ output->crtc = crtc;
+ }
}
#endif
i830_set_xf86_modes_from_outputs (pScrn);
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index d0a3119e..630f3fad 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -39,8 +39,8 @@
* Crtc functions
*/
I830_xf86CrtcPtr
-i830xf86CrtcCreate (ScrnInfoPtr scrn,
- I830_xf86CrtcFuncsPtr funcs)
+i830xf86CrtcCreate (ScrnInfoPtr scrn,
+ const I830_xf86CrtcFuncsRec *funcs)
{
I830_xf86CrtcPtr xf86_crtc;
@@ -119,6 +119,7 @@ i830xf86OutputDestroy (I830_xf86OutputPtr output)
memmove (&pI830->xf86_output[o],
&pI830->xf86_output[o+1],
pI830->num_outputs - (o + 1));
+ pI830->num_outputs--;
break;
}
xfree (output);
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 6a525179..32f84aff 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -257,7 +257,7 @@ struct _I830_xf86Output {
*/
I830_xf86CrtcPtr
i830xf86CrtcCreate (ScrnInfoPtr scrn,
- const I830_xf86CrtcFuncsPtr funcs);
+ const I830_xf86CrtcFuncsRec *funcs);
void
i830xf86CrtcDestroy (I830_xf86CrtcPtr xf86_crtc);