xf86-video-intel: Branch 'modesetting' - 3 commits - src/i830_cursor.c src/i830_display.c src/i830_driver.c src/i830.h src/i830_modes.c src/i830_video.c

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 11 20:28:24 EEST 2006


 src/i830.h         |    2 +
 src/i830_cursor.c  |   20 +++++------
 src/i830_display.c |    8 +++-
 src/i830_driver.c  |   96 +++++++++++++++++++++++------------------------------
 src/i830_modes.c   |    4 ++
 src/i830_video.c   |   22 ++++++++++--
 6 files changed, 84 insertions(+), 68 deletions(-)

New commits:
diff-tree 5a2e04bd1b700a8a6e26136b8831ef5e4d11b565 (from f9499a68da0ce459fed0b29b998678fd81898a51)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Tue Jul 11 10:21:51 2006 -0700

    Fix crash with DDC when there are no user modes to add.

diff --git a/src/i830_modes.c b/src/i830_modes.c
index 1a572d1..ac25864 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 4 -*- */
 
 #define DEBUG_VERB 2
 /*
@@ -548,6 +549,9 @@ i830AppendModes(ScrnInfoPtr pScrn, Displ
     DisplayModePtr first = *modeList;
     DisplayModePtr last = i830GetModeListTail(first);
 
+    if (addModes == NULL)
+      return;
+
     if (first == NULL) {
 	*modeList = addModes;
     } else {
diff-tree f9499a68da0ce459fed0b29b998678fd81898a51 (from 7068468ac1951bfca0071bb9b1a99df4f37368a0)
Author: Luká\u0161 Hejtmánek <xhejtman at mail.muni.cz>
Date:   Tue Jul 11 10:13:18 2006 -0700

    Make gamma settings apply to the cursor as well, and fix clone-mode gamma.

diff --git a/src/i830.h b/src/i830.h
index 1123001..3a93931 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -231,6 +231,8 @@ typedef struct _I830Rec {
     */
    DisplayModePtr savedCurrentMode;
 
+   Bool gammaEnabled[MAX_DISPLAY_PIPES];
+
    Bool Clone;
    int CloneRefresh;
    int CloneHDisplay;
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 79d950e..b373649 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -93,8 +93,6 @@ I830InitHWCursor(ScrnInfoPtr pScrn)
 		MCURSOR_PIPE_SELECT);
       temp |= CURSOR_MODE_DISABLE;
       temp |= (pI830->pipe << 28);
-/*      if(pI830->CursorIsARGB)
-         temp |= MCURSOR_GAMMA_ENABLE; */
       /* Need to set control, then address. */
       OUTREG(CURSOR_A_CONTROL, temp);
       if (pI830->CursorIsARGB)
@@ -115,8 +113,6 @@ I830InitHWCursor(ScrnInfoPtr pScrn)
       temp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
 		CURSOR_ENABLE  | CURSOR_STRIDE_MASK);
       temp |= (CURSOR_FORMAT_3C);
-/*      if (pI830->CursorIsARGB)
-         temp |= CURSOR_GAMMA_ENABLE;*/
       /* This initialises the format and leave the cursor disabled. */
       OUTREG(CURSOR_CONTROL, temp);
       /* Need to set address and size after disabling. */
@@ -484,9 +480,11 @@ I830ShowCursor(ScrnInfoPtr pScrn)
    if (IS_MOBILE(pI830) || IS_I9XX(pI830)) {
       temp = INREG(CURSOR_A_CONTROL);
       temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
-      if (pI830->CursorIsARGB)
-         temp |= CURSOR_MODE_64_ARGB_AX /* | MCURSOR_GAMMA_ENABLE*/;
-      else
+      if (pI830->CursorIsARGB) {
+         temp |= CURSOR_MODE_64_ARGB_AX;
+	 if (pI830->gammaEnabled[pI830->pipe])
+	    temp |= MCURSOR_GAMMA_ENABLE;
+      } else
          temp |= CURSOR_MODE_64_4C_AX;
       temp |= (pI830->pipe << 28); /* Connect to correct pipe */
       /* Need to set mode, then address. */
@@ -508,9 +506,11 @@ I830ShowCursor(ScrnInfoPtr pScrn)
       temp = INREG(CURSOR_CONTROL);
       temp &= ~(CURSOR_FORMAT_MASK);
       temp |= CURSOR_ENABLE;
-      if (pI830->CursorIsARGB)
-         temp |= CURSOR_FORMAT_ARGB /* | CURSOR_GAMMA_ENABLE*/;
-      else 
+      if (pI830->CursorIsARGB) {
+         temp |= CURSOR_FORMAT_ARGB;
+	 if (pI830->gammaEnabled[pI830->pipe])
+	    temp |= CURSOR_GAMMA_ENABLE;
+      } else
          temp |= CURSOR_FORMAT_3C;
       OUTREG(CURSOR_CONTROL, temp);
       if (pI830->CursorIsARGB)
diff --git a/src/i830_display.c b/src/i830_display.c
index e8c8509..1496c3a 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -476,7 +476,9 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
 
     if (outputs & (PIPE_TV_ACTIVE | PIPE_TV2_ACTIVE))
 	dpll |= PLL_REF_INPUT_TVCLKINBC;
-    else
+    else if (outputs & (PIPE_LCD_ACTIVE))
+	dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN;
+    else	
 	dpll |= PLL_REF_INPUT_DREFCLK;
 
     if (is_dvo) {
@@ -556,6 +558,10 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
 	FatalError("unknown display bpp\n");
     }
 
+    if (pI830->gammaEnabled[pipe]) {
+ 	dspcntr |= DISPPLANE_GAMMA_ENABLE;
+    }
+
     if (is_sdvo)
 	adpa = ADPA_DAC_DISABLE;
     else
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7815c57..396685a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -870,8 +870,6 @@ I830UnmapMem(ScrnInfoPtr pScrn)
    return TRUE;
 }
 
-static CARD32 val8[256];
-
 static void
 I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 		LOCO * colors, VisualPtr pVisual)
@@ -882,33 +880,41 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
    CARD32 val, temp;
    int palreg;
    int dspreg, dspbase;
+   int p;
 
    DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors);
    pI830 = I830PTR(pScrn);
 
-   if (pI830->pipe == 0) {
-      palreg = PALETTE_A;
-      dspreg = DSPACNTR;
-      dspbase = DSPABASE;
-   } else {
-      palreg = PALETTE_B;
-      dspreg = DSPBCNTR;
-      dspbase = DSPBBASE;
-   }
-
-   /* To ensure gamma is enabled we need to turn off and on the plane */
-   temp = INREG(dspreg);
-   OUTREG(dspreg, temp & ~(1<<31));
-   OUTREG(dspbase, INREG(dspbase));
-   OUTREG(dspreg, temp | DISPPLANE_GAMMA_ENABLE);
-   OUTREG(dspbase, INREG(dspbase));
+   for(p=0; p < pI830->availablePipes; p++) {
+
+      if (p == 0) {
+         palreg = PALETTE_A;
+         dspreg = DSPACNTR;
+         dspbase = DSPABASE;
+      } else {
+         palreg = PALETTE_B;
+         dspreg = DSPBCNTR;
+         dspbase = DSPBBASE;
+      }
 
-   /* It seems that an initial read is needed. */
-   temp = INREG(palreg);
+      if (pI830->planeEnabled[p] == 0)
+	 continue;  
 
-   switch(pScrn->depth) {
-   case 15:
-      for (i = 0; i < numColors; i++) {
+      pI830->gammaEnabled[p] = 1;
+      
+      /* To ensure gamma is enabled we need to turn off and on the plane */
+      temp = INREG(dspreg);
+      OUTREG(dspreg, temp & ~(1<<31));
+      OUTREG(dspbase, INREG(dspbase));
+      OUTREG(dspreg, temp | DISPPLANE_GAMMA_ENABLE);
+      OUTREG(dspbase, INREG(dspbase));
+
+      /* It seems that an initial read is needed. */
+      temp = INREG(palreg);
+
+      switch(pScrn->depth) {
+      case 15:
+        for (i = 0; i < numColors; i++) {
          index = indices[i];
          r = colors[index].red;
          g = colors[index].green;
@@ -917,10 +923,10 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
          for (j = 0; j < 8; j++) {
 	    OUTREG(palreg + index * 32 + (j * 4), val);
          }
-      }
+        }
       break;
-   case 16:
-      for (i = 0; i < numColors; i++) {
+      case 16:
+        for (i = 0; i < numColors; i++) {
          index = indices[i];
 	 r   = colors[index / 2].red;
 	 g   = colors[index].green;
@@ -943,42 +949,24 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
 	    OUTREG(palreg + index * 32 + 8, val);
 	    OUTREG(palreg + index * 32 + 12, val);
 	 }
-      }
-      break;
-   default:
-#if 1
-      /* Dual head 8bpp modes seem to squish the primary's cmap - reload */
-      if (I830IsPrimary(pScrn) && xf86IsEntityShared(pScrn->entityList[0]) &&
-          pScrn->depth == 8) {
-         for(i = 0; i < numColors; i++) {
-	    index = indices[i];
-	    r = colors[index].red;
-	    g = colors[index].green;
-	    b = colors[index].blue;
-	    val8[index] = (r << 16) | (g << 8) | b;
         }
-      }
-#endif
-      for(i = 0; i < numColors; i++) {
+        break;
+      default:
+        for(i = 0; i < numColors; i++) {
 	 index = indices[i];
 	 r = colors[index].red;
 	 g = colors[index].green;
 	 b = colors[index].blue;
 	 val = (r << 16) | (g << 8) | b;
 	 OUTREG(palreg + index * 4, val);
-#if 1
-         /* Dual head 8bpp modes seem to squish the primary's cmap - reload */
-         if (!I830IsPrimary(pScrn) && xf86IsEntityShared(pScrn->entityList[0]) &&
-             pScrn->depth == 8) {
-  	    if (palreg == PALETTE_A)
-	       OUTREG(PALETTE_B + index * 4, val8[index]);
-	    else
-	       OUTREG(PALETTE_A + index * 4, val8[index]);
-         }
-#endif
-      }
-      break;
+        }
+        break;
+     }
    }
+   
+   /* Enable gamma for Cursor if ARGB */
+   if (pI830->CursorInfoRec && !pI830->SWCursor && pI830->cursorOn)
+      pI830->CursorInfoRec->ShowCursor(pScrn);
 }
 
 #if 0
diff-tree 7068468ac1951bfca0071bb9b1a99df4f37368a0 (from b912bf5673e38e03b0b25c2f5d05fe7e26994ba1)
Author: Luká\u0161 Hejtmánek <xhejtman at mail.muni.cz>
Date:   Tue Jul 11 09:51:26 2006 -0700

    Add support for adjusting saturation value of overlay video.

diff --git a/src/i830_video.c b/src/i830_video.c
index a608a7e..05f7f46 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -116,7 +116,7 @@ static void I830BlockHandler(int, pointe
 
 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
 
-static Atom xvBrightness, xvContrast, xvColorKey, xvPipe, xvDoubleBuffer;
+static Atom xvBrightness, xvContrast, xvSaturation, xvColorKey, xvPipe, xvDoubleBuffer;
 static Atom xvGamma0, xvGamma1, xvGamma2, xvGamma3, xvGamma4, xvGamma5;
 
 #define IMAGE_MAX_WIDTH		1920
@@ -278,11 +278,12 @@ static XF86AttributeRec CloneAttributes[
    {XvSettable | XvGettable, 0, 1, "XV_PIPE"}
 };
 
-#define NUM_ATTRIBUTES 4
+#define NUM_ATTRIBUTES 5
 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
    {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
    {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
    {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"},
+   {XvSettable | XvGettable, 0, 1023, "XV_SATURATION"},
    {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}
 };
 
@@ -373,6 +374,7 @@ typedef struct {
 
    int brightness;
    int contrast;
+   int saturation;
    int pipe;
    int doubleBuffer;
 
@@ -500,7 +502,7 @@ I830ResetVideo(ScrnInfoPtr pScrn)
    overlay->SWIDTHSW = 0;
    overlay->SHEIGHT = 0;
    overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff);
-   overlay->OCLRC1 = 0x00000080;	/* saturation: bypass */
+   overlay->OCLRC1 = pPriv->saturation;
    overlay->AWINPOS = 0;
    overlay->AWINSZ = 0;
    overlay->FASTHSCALE = 0;
@@ -709,6 +711,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
    pPriv->videoStatus = 0;
    pPriv->brightness = 0;
    pPriv->contrast = 64;
+   pPriv->saturation = 128;
    pPriv->pipe = pI830->pipe; /* default to current pipe */
    pPriv->linear = NULL;
    pPriv->currentBuf = 0;
@@ -744,6 +747,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
    xvColorKey = MAKE_ATOM("XV_COLORKEY");
    xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
    xvContrast = MAKE_ATOM("XV_CONTRAST");
+   xvSaturation = MAKE_ATOM("XV_SATURATION");
    xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER");
 
    /* Allow the pipe to be switched from pipe A to B when in clone mode */
@@ -864,6 +868,16 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
 #if 1
       OVERLAY_OFF;
 #endif
+   } else if (attribute == xvSaturation) {
+      if ((value < 0) || (value > 1023))
+	 return BadValue;
+      pPriv->saturation = value;
+      overlay->OCLRC1 = pPriv->saturation;
+      overlay->OCMD &= ~OVERLAY_ENABLE;
+      OVERLAY_UPDATE;
+#if 1
+      OVERLAY_OFF;
+#endif
    } else if (pI830->Clone && attribute == xvPipe) {
       if ((value < 0) || (value > 1))
          return BadValue;
@@ -953,6 +967,8 @@ I830GetPortAttribute(ScrnInfoPtr pScrn,
       *value = pPriv->brightness;
    } else if (attribute == xvContrast) {
       *value = pPriv->contrast;
+   } else if (attribute == xvSaturation) {
+      *value = pPriv->saturation;
    } else if (pI830->Clone && attribute == xvPipe) {
       *value = pPriv->pipe;
    } else if (attribute == xvGamma0 && (IS_I9XX(pI830))) {



More information about the xorg-commit mailing list