xf86-video-intel: Branch 'mergedfb' - src/i830_cursor.c src/i830_driver.c

Alan Hourihane alanh at kemper.freedesktop.org
Tue Aug 8 12:23:44 EEST 2006


 src/i830_cursor.c |    7 ++---
 src/i830_driver.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 3 deletions(-)

New commits:
diff-tree 633a683a4adcb9a44a54519fd7ff66aab2d12f97 (from e71108f1e05b7a8d8edd174eb64edd6cccacbcdc)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date:   Tue Aug 8 10:23:29 2006 +0100

    Ensure palette is updated in mergedfb & clone modes

diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index 1d7808b..1657f7c 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -116,9 +116,10 @@ I830InitHWCursor(ScrnInfoPtr pScrn)
       temp = INREG(CURSOR_CONTROL);
       temp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
 		CURSOR_ENABLE  | CURSOR_STRIDE_MASK);
-      temp |= (CURSOR_FORMAT_3C);
       if (pI830->CursorIsARGB)
-         temp |= CURSOR_GAMMA_ENABLE;
+         temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE;
+      else 
+         temp |= CURSOR_FORMAT_3C;
       /* This initialises the format and leave the cursor disabled. */
       OUTREG(CURSOR_CONTROL, temp);
       /* Need to set address and size after disabling. */
@@ -588,7 +589,7 @@ I830ShowCursor(ScrnInfoPtr pScrn)
       temp = INREG(CURSOR_A_CONTROL);
       temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT | MCURSOR_GAMMA_ENABLE);
       if (pI830->CursorIsARGB)
-         temp |= CURSOR_MODE_64_ARGB_AX;
+         temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
       else
          temp |= CURSOR_MODE_64_4C_AX;
       temp |= (pI830->pipe << 28); /* Connect to correct pipe */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 256ae22..84fb21a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3486,6 +3486,79 @@ I830LoadPalette(ScrnInfoPtr pScrn, int n
    DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors);
    pI830 = I830PTR(pScrn);
 
+   if (pI830->Clone || pI830->MergedFB) {
+      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));
+
+      /* 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;
+         b = colors[index].blue;
+	 val = (r << 16) | (g << 8) | b;
+         for (j = 0; j < 8; j++) {
+	    OUTREG(palreg + index * 32 + (j * 4), val);
+         }
+       }
+       break;
+      case 16:
+       for (i = 0; i < numColors; i++) {
+         index = indices[i];
+	 r   = colors[index / 2].red;
+	 g   = colors[index].green;
+	 b   = colors[index / 2].blue;
+
+	 val = (r << 16) | (g << 8) | b;
+	 OUTREG(palreg + index * 16, val);
+	 OUTREG(palreg + index * 16 + 4, val);
+	 OUTREG(palreg + index * 16 + 8, val);
+	 OUTREG(palreg + index * 16 + 12, val);
+
+   	 if (index <= 31) {
+            r   = colors[index].red;
+	    g   = colors[(index * 2) + 1].green;
+	    b   = colors[index].blue;
+
+	    val = (r << 16) | (g << 8) | b;
+	    OUTREG(palreg + index * 32, val);
+	    OUTREG(palreg + index * 32 + 4, val);
+	    OUTREG(palreg + index * 32 + 8, val);
+	    OUTREG(palreg + index * 32 + 12, val);
+	 }
+       }
+       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);
+       }
+       break;
+      }
+   }
+
    if (pI830->pipe == 0) {
       palreg = PALETTE_A;
       dspreg = DSPACNTR;



More information about the xorg-commit mailing list