xf86-video-intel: Branch 'exa' - 2 commits - src/i830_accel.c src/i830_dri.c src/i830_driver.c src/i830_exa.c src/i830.h src/i830_rotate.c src/i830_xaa.c

Eric Anholt anholt at kemper.freedesktop.org
Sun Jun 18 10:41:04 EEST 2006


 src/i830.h        |    2 +
 src/i830_accel.c  |    5 ---
 src/i830_dri.c    |   10 +-----
 src/i830_driver.c |   80 ++++++++++++++++++++++++++++--------------------------
 src/i830_exa.c    |    4 +-
 src/i830_rotate.c |   33 ++++++++++++----------
 src/i830_xaa.c    |   22 ++++++++++++++
 7 files changed, 90 insertions(+), 66 deletions(-)

New commits:
diff-tree 89a5a0024a7e077a0726ffe1427e573df3bcbef5 (from f2ab3aa3199e1c4b0edec72b5acea6d725cc514a)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Jun 18 00:25:34 2006 -0700

    Fix crash with EXA during randr, when XAA structures were being accessed.  EXA
    shouldn't have any issues with there also being pixmaps in framebuffer while
    rotation is active.

diff --git a/src/i830_rotate.c b/src/i830_rotate.c
index e4a8064..ad4c484 100644
--- a/src/i830_rotate.c
+++ b/src/i830_rotate.c
@@ -959,21 +959,26 @@ I830Rotate(ScrnInfoPtr pScrn, DisplayMod
       }
    }
 
-   /* Don't allow pixmap cache or offscreen pixmaps when rotated */
-   /* XAA needs some serious fixing for this to happen */
-   if (pI830->rotation == RR_Rotate_0) {
-      pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE;
-      pI830->AccelInfoRec->UsingPixmapCache = TRUE;
-      /* funny as it seems this will enable XAA's createpixmap */
-      pI830->AccelInfoRec->maxOffPixWidth = 0;
-      pI830->AccelInfoRec->maxOffPixHeight = 0;
-   } else {
-      pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER;
-      pI830->AccelInfoRec->UsingPixmapCache = FALSE;
-      /* funny as it seems this will disable XAA's createpixmap */
-      pI830->AccelInfoRec->maxOffPixWidth = 1;
-      pI830->AccelInfoRec->maxOffPixHeight = 1;
+#ifdef I830_USE_XAA
+   if (pI830->AccelInfoRec != NULL) {
+      /* Don't allow pixmap cache or offscreen pixmaps when rotated */
+      /* XAA needs some serious fixing for this to happen */
+      if (pI830->rotation == RR_Rotate_0) {
+	 pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS |
+				      PIXMAP_CACHE;
+	 pI830->AccelInfoRec->UsingPixmapCache = TRUE;
+	 /* funny as it seems this will enable XAA's createpixmap */
+	 pI830->AccelInfoRec->maxOffPixWidth = 0;
+	 pI830->AccelInfoRec->maxOffPixHeight = 0;
+      } else {
+	 pI830->AccelInfoRec->Flags = LINEAR_FRAMEBUFFER;
+	 pI830->AccelInfoRec->UsingPixmapCache = FALSE;
+	 /* funny as it seems this will disable XAA's createpixmap */
+	 pI830->AccelInfoRec->maxOffPixWidth = 1;
+	 pI830->AccelInfoRec->maxOffPixHeight = 1;
+      }
    }
+#endif
 
    return TRUE;
 
diff-tree f2ab3aa3199e1c4b0edec72b5acea6d725cc514a (from bc42dbe07cbd61b357d8eed02608e026c4cf4485)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Jun 18 00:32:01 2006 -0700

    Fix DRI in EXA mode: Don't attempt to use XAA symbols (use the driver's internal
    ones for EXA support when available).  Also, add an abstraction of XAA/EXA
    MarkSync and WaitSync functionality so we don't need to sprinkle the ifdefs all
    over, and correctly use them.

diff --git a/src/i830.h b/src/i830.h
index edc485b..9a8ecf8 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -491,6 +491,8 @@ extern Bool I830CheckModeSupport(ScrnInf
 extern Bool I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode);
 extern Bool I830FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem);
 
+extern void i830MarkSync(ScrnInfoPtr pScrn);
+extern void i830WaitSync(ScrnInfoPtr pScrn);
 /*
  * 12288 is set as the maximum, chosen because it is enough for
  * 1920x1440 at 32bpp with a 2048 pixel line pitch with some to spare.
diff --git a/src/i830_accel.c b/src/i830_accel.c
index a1a6488..f299398 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -208,10 +208,7 @@ I830RefreshRing(ScrnInfoPtr pScrn)
    pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
    if (pI830->LpRing->space < 0)
       pI830->LpRing->space += pI830->LpRing->mem.Size;
-#ifdef I830_USE_XAA
-   if (pI830->AccelInfoRec)
-      pI830->AccelInfoRec->NeedToSync = TRUE;
-#endif
+   i830MarkSync(pScrn);
 }
 
 /* The following function sets up the supported acceleration. Call it
diff --git a/src/i830_dri.c b/src/i830_dri.c
index c159686..76298a3 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -979,7 +979,6 @@ I830DRIInitBuffers(WindowPtr pWin, Regio
 {
    ScreenPtr pScreen = pWin->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
    BoxPtr pbox = REGION_RECTS(prgn);
    int nbox = REGION_NUM_RECTS(prgn);
 
@@ -1017,9 +1016,7 @@ I830DRIInitBuffers(WindowPtr pWin, Regio
    }
 
    I830SelectBuffer(pScrn, I830_SELECT_FRONT);
-#ifdef I830_USE_XAA
-   pI830->AccelInfoRec->NeedToSync = TRUE;
-#endif
+   i830MarkSync(pScrn);
 }
 
 /* This routine is a modified form of XAADoBitBlt with the calls to
@@ -1033,7 +1030,6 @@ I830DRIMoveBuffers(WindowPtr pParent, DD
 {
    ScreenPtr pScreen = pParent->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
    BoxPtr pboxTmp, pboxNext, pboxBase;
    DDXPointPtr pptTmp, pptNew2;
    int xdir, ydir;
@@ -1180,9 +1176,7 @@ I830DRIMoveBuffers(WindowPtr pParent, DD
       DEALLOCATE_LOCAL(pptNew1);
       DEALLOCATE_LOCAL(pboxNew1);
    }
-#ifdef I830_USE_XAA
-   pI830->AccelInfoRec->NeedToSync = TRUE;
-#endif
+   i830MarkSync(pScrn);
 }
 
 /* Initialize the first context */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 5cfb6fc..fe61884 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -5258,18 +5258,8 @@ I830BIOSAdjustFrame(int scrnIndex, int x
 	   x, pI830->xoffset, y, pI830->yoffset);
 
    /* Sync the engine before adjust frame */
-#ifdef I830_USE_XAA
-   if (!pI830->noAccel && !pI830->useEXA && pI830->AccelInfoRec->NeedToSync) {
-      (*pI830->AccelInfoRec->Sync)(pScrn);
-      pI830->AccelInfoRec->NeedToSync = FALSE;
-   }
-#endif
-#ifdef I830_USE_EXA
-   if (!pI830->noAccel && pI830->useEXA) {
-	ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-	exaWaitSync(pScreen);
-   }
-#endif
+   i830WaitSync(pScrn);
+
    if (I830IsPrimary(pScrn))
       Start = pI830->FrontBuffer.Start;
    else {
@@ -5398,16 +5388,11 @@ I830BIOSLeaveVT(int scrnIndex, int flags
    RestoreBIOSMemSize(pScrn);
    if (I830IsPrimary(pScrn))
       I830UnbindAGPMemory(pScrn);
+
 #ifdef I830_USE_XAA
    if (!pI830->useEXA && pI830->AccelInfoRec)
       pI830->AccelInfoRec->NeedToSync = FALSE;
 #endif
-#ifdef I830_USE_EXA
-   if (pI830->useEXA && pI830->EXADriverPtr) {
-      ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-      exaMarkSync(pScreen);
-   }
-#endif
 
    /* DO IT AGAIN! AS IT SEEMS THAT SOME LFPs FLICKER OTHERWISE */
    if (I830IsPrimary(pScrn)) {
@@ -5741,18 +5726,7 @@ I830BIOSSwitchMode(int scrnIndex, Displa
 #endif
 
    /* Sync the engine before mode switch */
-#ifdef I830_USE_XAA
-   if (!pI830->noAccel && !pI830->useEXA) {
-      (*pI830->AccelInfoRec->Sync)(pScrn);
-      pI830->AccelInfoRec->NeedToSync = FALSE;
-   }
-#endif
-#ifdef I830_USE_EXA
-   if (!pI830->noAccel && pI830->useEXA) {
-      ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
-      exaWaitSync(pScreen);
-   }
-#endif
+   i830WaitSync(pScrn);
 
    /* Check if our currentmode is about to change. We do this so if we
     * are rotating, we don't need to call the mode setup again.
@@ -6122,14 +6096,8 @@ I830CheckDevicesTimer(OsTimerPtr timer, 
          xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
 		    "Hotkey switch to 0x%lx.\n", (unsigned long) temp);
 
-#ifdef I830_USE_XAA
-         if (!pI830->useEXA && pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) {
-            (*pI830->AccelInfoRec->Sync)(pScrn);
-            pI830->AccelInfoRec->NeedToSync = FALSE;
-            if (xf86IsEntityShared(pScrn->entityList[0]))
-               pI8302->AccelInfoRec->NeedToSync = FALSE;
-         }
-#endif
+	 i830WaitSync(pScrn);
+
          GetAttachableDisplayDeviceList(pScrn);
          
 	 pI8301->lastDevice0 = pI8301->lastDevice1;
@@ -6399,6 +6367,42 @@ I830CheckDevicesTimer(OsTimerPtr timer, 
 }
 
 void
+i830WaitSync(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+
+#ifdef I830_USE_XAA
+   if (!pI830->noAccel && !pI830->useEXA && pI830->AccelInfoRec->NeedToSync) {
+      (*pI830->AccelInfoRec->Sync)(pScrn);
+      pI830->AccelInfoRec->NeedToSync = FALSE;
+   }
+#endif
+#ifdef I830_USE_EXA
+   if (!pI830->noAccel && pI830->useEXA && pI830->EXADriverPtr) {
+	ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+	exaWaitSync(pScreen);
+   }
+#endif
+}
+
+void
+i830MarkSync(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+
+#ifdef I830_USE_XAA
+   if (!pI830->useEXA && pI830->AccelInfoRec)
+      pI830->AccelInfoRec->NeedToSync = FALSE;
+#endif
+#ifdef I830_USE_EXA
+   if (pI830->useEXA && pI830->EXADriverPtr) {
+      ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+      exaMarkSync(pScreen);
+   }
+#endif
+}
+
+void
 I830InitpScrn(ScrnInfoPtr pScrn)
 {
    pScrn->PreInit = I830BIOSPreInit;
diff --git a/src/i830_exa.c b/src/i830_exa.c
index b22430a..7212972 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -51,7 +51,7 @@ do {							\
 #define I830FALLBACK(s, arg...) { return FALSE; }
 #endif
 
-int I830CopyROP[16] =
+const int I830CopyROP[16] =
 {
    ROP_0,               /* GXclear */
    ROP_DSa,             /* GXand */
@@ -71,7 +71,7 @@ int I830CopyROP[16] =
    ROP_1                /* GXset */
 };
 
-static int I830PatternROP[16] =
+const int I830PatternROP[16] =
 {
     ROP_0,
     ROP_DPa,
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index 68ba4c7..9f3a391 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -92,6 +92,11 @@ static void I830SubsequentImageWriteScan
 #endif
 static void I830RestoreAccelState(ScrnInfoPtr pScrn);
 
+#ifdef I830_USE_EXA
+extern const int I830PatternROP[16];
+extern const int I830CopyROP[16];
+#endif
+
 Bool
 I830XAAInit(ScreenPtr pScreen)
 {
@@ -235,8 +240,17 @@ I830SetupForSolidFill(ScrnInfoPtr pScrn,
 	ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n",
 	       color, rop, planemask);
 
+#ifdef I830_USE_EXA
+    /* This function gets used by I830DRIInitBuffers(), and we might not have
+     * XAAGetPatternROP() available.  So just use the ROPs from our EXA code
+     * if available.
+     */
+    pI830->BR[13] = ((I830PatternROP[rop] << 16) |
+		     (pScrn->displayWidth * pI830->cpp));
+#else
     pI830->BR[13] = ((XAAGetPatternROP(rop) << 16) |
 		     (pScrn->displayWidth * pI830->cpp));
+#endif
 
     pI830->BR[16] = color;
 
@@ -291,7 +305,15 @@ I830SetupForScreenToScreenCopy(ScrnInfoP
 	       xdir, ydir, rop, planemask, transparency_color);
 
     pI830->BR[13] = (pScrn->displayWidth * pI830->cpp);
+#ifdef I830_USE_EXA
+    /* This function gets used by I830DRIInitBuffers(), and we might not have
+     * XAAGetCopyROP() available.  So just use the ROPs from our EXA code
+     * if available.
+     */
+    pI830->BR[13] |= I830CopyROP[rop] << 16;
+#else
     pI830->BR[13] |= XAAGetCopyROP(rop) << 16;
+#endif
 
     switch (pScrn->bitsPerPixel) {
     case 8:



More information about the xorg-commit mailing list