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

Eric Anholt anholt at kemper.freedesktop.org
Wed Dec 13 04:09:14 EET 2006


 src/i830_display.c  |    6 +++++
 src/i830_driver.c   |   53 ----------------------------------------------------
 src/i830_xf86Crtc.c |   35 ++++++++++++++++++++++++++++++++++
 src/i830_xf86Crtc.h |    3 ++
 4 files changed, 45 insertions(+), 52 deletions(-)

New commits:
diff-tree 41444183b59ed84c09749ca89afbef036d42ec5f (from 7ed1b05922c07ff45a5794a992fd3d59ab55aa73)
Author: Eric Anholt <eric at anholt.net>
Date:   Tue Dec 12 18:08:57 2006 -0800

    Replace custom, partially broken DPMS implementation with a generic one.

diff --git a/src/i830_display.c b/src/i830_display.c
index f0aac15..8da5131 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -478,6 +478,12 @@ i830PipeInUse (xf86CrtcPtr crtc)
     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
+ * on appropriately at the same time as we're turning the pipe off/on.
+ */
 static void
 i830_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
diff --git a/src/i830_driver.c b/src/i830_driver.c
index d8a9c9b..7ec5559 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -314,8 +314,6 @@ const char *i830_output_type_names[] = {
    "TVOUT",
 };
 
-static void I830DisplayPowerManagementSet(ScrnInfoPtr pScrn,
-					  int PowerManagementMode, int flags);
 static void i830AdjustFrame(int scrnIndex, int x, int y, int flags);
 static Bool I830CloseScreen(int scrnIndex, ScreenPtr pScreen);
 static Bool I830SaveScreen(ScreenPtr pScreen, int unblack);
@@ -2863,7 +2861,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr 
       return FALSE;
    }
 
-   xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0);
+   xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
 #ifdef I830_XV
    /* Init video */
@@ -3319,55 +3317,6 @@ I830SaveScreen(ScreenPtr pScreen, int mo
    return TRUE;
 }
 
-/* Use the VBE version when available. */
-static void
-I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
-			      int flags)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   int i;
-   CARD32 temp, ctrl, base;
-
-   for (i = 0; i < pI830->xf86_config.num_output; i++) {
-      xf86OutputPtr   output = pI830->xf86_config.output[i];
-      
-      (*output->funcs->dpms) (output, PowerManagementMode);
-   }
-
-   for (i = 0; i < pI830->xf86_config.num_crtc; i++) 
-   {
-      xf86CrtcPtr	   crtc = pI830->xf86_config.crtc[i];
-      
-      if (i == 0) {
-         ctrl = DSPACNTR;
-         base = DSPABASE;
-      } else {
-         ctrl = DSPBCNTR;
-         base = DSPBADDR;
-      }
-      /* XXX pipe disable too? */
-      if (crtc->enabled) {
-	   temp = INREG(ctrl);
-	   if (PowerManagementMode == DPMSModeOn)
-	      temp |= DISPLAY_PLANE_ENABLE;
-	   else
-	      temp &= ~DISPLAY_PLANE_ENABLE;
-	   OUTREG(ctrl, temp);
-	   /* Flush changes */
-	   temp = INREG(base);
-	   OUTREG(base, temp);
-      }
-   }
-
-   if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn) {
-      if (PowerManagementMode == DPMSModeOn)
-         pI830->CursorInfoRec->ShowCursor(pScrn);
-      else
-         pI830->CursorInfoRec->HideCursor(pScrn);
-      pI830->cursorOn = TRUE;
-   }
-}
-
 static Bool
 I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 {
diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index 448d4f9..a222382 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -590,3 +590,38 @@ xf86InitialConfiguration (ScrnInfoPtr	  
     xfree (modes);
     return TRUE;
 }
+
+/**
+ * Set the DPMS power mode of all outputs and CRTCs.
+ *
+ * If the new mode is off, it will turn off outputs and then CRTCs.
+ * Otherwise, it will affect CRTCs before outputs.
+ */
+void
+xf86DPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
+{
+    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(pScrn);
+    int			i;
+
+    if (mode == DPMSModeOff) {
+	for (i = 0; i < config->num_output; i++) {
+	    xf86OutputPtr output = config->output[i];
+	    if (output->crtc != NULL)
+		(*output->funcs->dpms) (output, mode);
+	}
+    }
+
+    for (i = 0; i < config->num_crtc; i++) {
+	xf86CrtcPtr crtc = config->crtc[i];
+	if (crtc->enabled)
+	    (*crtc->funcs->dpms) (crtc, mode);
+    }
+
+    if (mode != DPMSModeOff) {
+	for (i = 0; i < config->num_output; i++) {
+	    xf86OutputPtr output = config->output[i];
+	    if (output->crtc != NULL)
+		(*output->funcs->dpms) (output, mode);
+	}
+    }
+}
diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h
index 21fc244..042cb2f 100644
--- a/src/i830_xf86Crtc.h
+++ b/src/i830_xf86Crtc.h
@@ -378,4 +378,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
 Bool
 xf86InitialConfiguration (ScrnInfoPtr pScrn);
 
+void
+xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+
 #endif /* _XF86CRTC_H_ */



More information about the xorg-commit mailing list