xf86-video-intel: Branch 'restructure-outputs' - src/i830_crt.c src/i830_driver.c src/i830_randr.c src/i830_xf86Crtc.c src/i830_xf86Crtc.h

Keith Packard keithp at kemper.freedesktop.org
Mon Nov 27 04:27:24 EET 2006


 src/i830_crt.c      |    4 ++--
 src/i830_driver.c   |   32 ++++++++++++++++++++++++++++++--
 src/i830_randr.c    |   14 +++++++-------
 src/i830_xf86Crtc.c |    5 +++--
 src/i830_xf86Crtc.h |    2 +-
 5 files changed, 43 insertions(+), 14 deletions(-)

New commits:
diff-tree a47c549df036990e29f05bc3df80e1a2ab9f3b3c (from 2529863a1ade782819d76be2d0dc16e89028c1e3)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Sun Nov 26 18:26:26 2006 -0800

    Clean up reworked data structure code so the server actually starts.
    
    Use i830GeLoadDetectPipe again (instead of missing xf86AllocCrtc).  Actually
    create new Crtc structures. Fix a few other NULL pointer dereferences.

diff --git a/src/i830_crt.c b/src/i830_crt.c
index 615e96a..3d75587 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -292,13 +292,13 @@ i830_crt_detect(I830_xf86OutputPtr outpu
 	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 d4d5fbc..4d6e816 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 d6a3131..59c07ff 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 d0a3119..630f3fa 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_xf86OutputPt
 	    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 6a52517..32f84af 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);



More information about the xorg-commit mailing list