xf86-video-intel: Branch 'modesetting' - src/i830_driver.c src/i830_randr.c src/i830_xf86Crtc.c src/i830_xf86Crtc.h

Keith Packard keithp at kemper.freedesktop.org
Tue Dec 5 00:04:55 EET 2006


 src/i830_driver.c   |    1 
 src/i830_randr.c    |    3 ++
 src/i830_xf86Crtc.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 src/i830_xf86Crtc.h |    6 +++++
 4 files changed, 66 insertions(+), 2 deletions(-)

New commits:
diff-tree 2e8c927f9308069a82f25b65bb0c62bc5a156832 (from 8fcf9a81179ee8577ddab5e904c58fbfd14cf59c)
Author: Keith Packard <keithp at bouzouki.jf.intel.com>
Date:   Mon Dec 4 14:02:30 2006 -0800

    Re-create RandR Crtc/output structures on server regen.
    
    RandR structures must be re-created when the server reinitializes,
    but the driver PreInit function is not re-invoked. Recreate them
    manually in this case during ScreenInit.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3aafe3a..c85fe4e 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3805,6 +3805,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr
    DPRINTF(PFX, "\nUnmapping memory\n");
    I830UnmapMem(pScrn);
    vgaHWUnmapMem(pScrn);
+   xf86CrtcCloseScreen (pScreen);
 
    if (pI830->ScanlineColorExpandBuffers) {
       xfree(pI830->ScanlineColorExpandBuffers);
diff --git a/src/i830_randr.c b/src/i830_randr.c
index da8d746..0077020 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -900,6 +900,9 @@ xf86RandR12Init12 (ScreenPtr pScreen)
     ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
     rrScrPrivPtr	rp = rrGetScrPriv(pScreen);
 
+    if (xf86CrtcScreenInit (pScreen))
+	return FALSE;
+
     rp->rrGetInfo = xf86RandR12GetInfo12;
     rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
     rp->rrCrtcSet = xf86RandR12CrtcSet;
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index 2eb775b..7eb581c 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -68,7 +68,8 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
     
     (*crtc->funcs->destroy) (crtc);
 #ifdef RANDR_12_INTERFACE
-    RRCrtcDestroy (crtc->randr_crtc);
+    if (crtc->randr_crtc)
+	RRCrtcDestroy (crtc->randr_crtc);
 #endif
     for (c = 0; c < xf86_config->num_crtc; c++)
 	if (xf86_config->crtc[c] == crtc)
@@ -122,7 +123,8 @@ xf86OutputDestroy (xf86OutputPtr output)
     
     (*output->funcs->destroy) (output);
 #ifdef RANDR_12_INTERFACE
-    RROutputDestroy (output->randr_output);
+    if (output->randr_output)
+	RROutputDestroy (output->randr_output);
 #endif
     while (output->probed_modes)
 	xf86DeleteMode (&output->probed_modes, output->probed_modes);
@@ -138,3 +140,55 @@ xf86OutputDestroy (xf86OutputPtr output)
     xfree (output);
 }
 
+Bool
+xf86CrtcScreenInit (ScreenPtr pScreen)
+{
+#ifdef RANDR_12_INTERFACE
+    ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int			i;
+
+    for (i = 0; i < xf86_config->num_crtc; i++)
+    {
+	xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+	if (!crtc->randr_crtc)
+	    crtc->randr_crtc = RRCrtcCreate (crtc);
+	if (!crtc->randr_crtc)
+	    return FALSE;
+    }
+    for (i = 0; i < xf86_config->num_output; i++)
+    {
+	xf86OutputPtr output = xf86_config->output[i];
+	
+	if (!output->randr_output)
+	    output->randr_output = RROutputCreate (output->name,
+						   strlen (output->name),
+						   output);
+	if (!output->randr_output)
+	    return FALSE;
+    }
+#endif
+    return TRUE;
+}
+
+void
+xf86CrtcCloseScreen (ScreenPtr pScreen)
+{
+#ifdef RANDR_12_INTERFACE
+    ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int			i;
+
+    for (i = 0; i < xf86_config->num_crtc; i++)
+    {
+	xf86CrtcPtr crtc = xf86_config->crtc[i];
+	crtc->randr_crtc = NULL;
+    }
+    for (i = 0; i < xf86_config->num_output; i++)
+    {
+	xf86OutputPtr output = xf86_config->output[i];
+	output->randr_output = NULL;
+    }
+#endif
+}
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 2952c8d..21ba1fc 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -307,4 +307,10 @@ xf86OutputCreate (ScrnInfoPtr		scrn,
 void
 xf86OutputDestroy (xf86OutputPtr	output);
 
+Bool
+xf86CrtcScreenInit (ScreenPtr pScreen);
+
+void
+xf86CrtcCloseScreen (ScreenPtr pScreen);
+
 #endif /* _XF86CRTC_H_ */



More information about the xorg-commit mailing list