xf86-video-intel: Branch 'exa' - 9 commits - configure.ac src/common.h src/i810_dri.c src/i830_3d.c src/i830_common.h src/i830_dri.c src/i830_driver.c src/i830_exa.c src/i830.h src/i830_memory.c src/i830_randr.c src/i915_3d.c

Eric Anholt anholt at kemper.freedesktop.org
Mon Jun 26 17:30:39 EEST 2006


 configure.ac      |   12 +++++++++
 src/common.h      |   15 +++++++----
 src/i810_dri.c    |    4 +--
 src/i830.h        |   14 ++++++++++
 src/i830_3d.c     |    1 
 src/i830_common.h |    9 ++++++
 src/i830_dri.c    |   70 ++++++++++++++++++++++++++----------------------------
 src/i830_driver.c |   32 ++++++++++++++++++++++++
 src/i830_exa.c    |    4 +--
 src/i830_memory.c |    2 -
 src/i830_randr.c  |    1 
 src/i915_3d.c     |    1 
 12 files changed, 116 insertions(+), 49 deletions(-)

New commits:
diff-tree b85f268051a785f90e4c55bd1cac80d673388f16 (from 6a3f89f4b6035534c7b93a4c05fd704305349785)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 16:26:58 2006 +0200

    Fix remaining warning.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index 50bbde5..c1c7cb7 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -874,7 +874,7 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, 
 	 return FALSE;
       } else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Successful allocate "
-		       "offscreen memory at 0x%lx, size %d KB\n", 
+		       "offscreen memory at 0x%lx, size %ld KB\n", 
 			pI830->Offscreen.Start, pI830->Offscreen.Size/1024);
       }
 #endif
diff-tree 6a3f89f4b6035534c7b93a4c05fd704305349785 (from parents)
Merge: 3cdc53797bf6fdbfbcb53e07b269a5071f5ec97d e7723a4e5725147d3bd9ba22c5a3314b0556e440
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 16:25:58 2006 +0200

    Merge branch 'master' into exa
    
    Conflicts:
    
    	src/i830.h

diff --cc src/i830.h
index ff82c73,79eb310..d0f8bc0
@@@ -491,8 -474,16 +494,19 @@@
  extern Bool I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode);
  extern Bool I830FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem);
  
 +extern void i830MarkSync(ScrnInfoPtr pScrn);
 +extern void i830WaitSync(ScrnInfoPtr pScrn);
++
+ /* i830_memory.c */
+ Bool I830BindAGPMemory(ScrnInfoPtr pScrn);
+ Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn);
+ 
+ /* i830_randr.c */
+ Bool I830RandRInit(ScreenPtr pScreen, int rotation);
+ Bool I830RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
+ 			RRScreenSizePtr pSize);
+ Rotation I830GetRotation(ScreenPtr pScreen);
+ 
  /*
   * 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 --cc src/i830_dri.c
index d73c84a,7c5f795..5653434
@@@ -1176,38 -1180,10 +1178,9 @@@
        DEALLOCATE_LOCAL(pptNew1);
        DEALLOCATE_LOCAL(pboxNew1);
     }
 -
 -   pI830->AccelInfoRec->NeedToSync = TRUE;
 +   i830MarkSync(pScrn);
  }
  
- extern I830EmitInvarientState(ScrnInfoPtr pScrn);
- extern I915EmitInvarientState(ScrnInfoPtr pScrn);
- 
- /* Initialize the first context */
- void
- IntelEmitInvarientState(ScrnInfoPtr pScrn)
- {
-    I830Ptr pI830 = I830PTR(pScrn);
-    CARD32 ctx_addr;
- 
-    ctx_addr = pI830->ContextMem.Start;
-    /* Align to a 2k boundry */
-    ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048;
- 
-    {
-       BEGIN_LP_RING(2);
-       OUT_RING(MI_SET_CONTEXT);
-       OUT_RING(ctx_addr |
- 	       CTXT_NO_RESTORE |
- 	       CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE);
-       ADVANCE_LP_RING();
-    }
- 
-    if (IS_I9XX(pI830))
-       I915EmitInvarientState(pScrn);
-    else
-       I830EmitInvarientState(pScrn);
- }
- 
  /* Use callbacks from dri.c to support pageflipping mode for a single
   * 3d context without need for any specific full-screen extension.
   *
diff-tree 3cdc53797bf6fdbfbcb53e07b269a5071f5ec97d (from d7e5d996aa123e52857362fa8a1e69f709bfe218)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 16:23:55 2006 +0200

    Fix build with new EXA headers.

diff --git a/src/i830_exa.c b/src/i830_exa.c
index 7212972..665c4d7 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -149,7 +149,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, i
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned long offset, pitch;
 
-    if (planemask != (Pixel)~0 && !EXA_PM_IS_SOLID(pPixmap, planemask))
+    if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
 
     offset = exaGetPixmapOffset(pPixmap);
@@ -234,7 +234,7 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap,
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
 
-    if (planemask != (Pixel)~0 && !EXA_PM_IS_SOLID(pSrcPixmap, planemask))
+    if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
 
     pI830->copy_src_pitch = exaGetPixmapPitch(pSrcPixmap);
diff-tree e7723a4e5725147d3bd9ba22c5a3314b0556e440 (from parents)
Merge: 5111b883480a5a9cc82200f2684cba67b515aa73 dae9cb7712d5d8f88697ca83808c59af08364c0e
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 16:04:33 2006 +0200

    Merge branch 'origin'

diff-tree 5111b883480a5a9cc82200f2684cba67b515aa73 (from f2967a2f5f47b636b2445fa69dbc3ec79e065c90)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 14:53:10 2006 +0200

    Turn on extra warning flags for GCC, and clean up the resulting fallout.

diff --git a/configure.ac b/configure.ac
index a5f8e77..82d3e55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,18 @@ if test x$DRI = xauto; then
 fi
 AC_MSG_RESULT([$DRI])
 
+dnl Use lots of warning flags with GCC
+
+WARN_CFLAGS=""
+
+if test "x$GCC" = "xyes"; then
+	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
+	-Wmissing-prototypes -Wmissing-declarations \
+	-Wnested-externs -fno-strict-aliasing"
+fi
+
+CFLAGS="$CFLAGS $WARN_CFLAGS"
+
 AM_CONDITIONAL(DRI, test x$DRI = xyes)
 if test "$DRI" = yes; then
         PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto])
diff --git a/src/i810_dri.c b/src/i810_dri.c
index 8c05980..a8c10ff 100644
--- a/src/i810_dri.c
+++ b/src/i810_dri.c
@@ -492,7 +492,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
       return FALSE;
    }
    xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08x\n",
-	      pI810DRI->regs);
+	      (int)pI810DRI->regs);
 
    pI810->backHandle = DRM_AGP_NO_HANDLE;
    pI810->zHandle = DRM_AGP_NO_HANDLE;
@@ -532,7 +532,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
    pI810->dcacheHandle = dcacheHandle;
 
    xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : 0x%x\n",
-	      dcacheHandle);
+	      (int)dcacheHandle);
 
 #define Elements(x) sizeof(x)/sizeof(*x)
    for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
diff --git a/src/i830.h b/src/i830.h
index d227662..5315dff 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -471,6 +471,16 @@ extern Bool I830CheckModeSupport(ScrnInf
 extern Bool I830Rotate(ScrnInfoPtr pScrn, DisplayModePtr mode);
 extern Bool I830FixOffset(ScrnInfoPtr pScrn, I830MemRange *mem);
 
+/* i830_memory.c */
+Bool I830BindAGPMemory(ScrnInfoPtr pScrn);
+Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn);
+
+/* i830_randr.c */
+Bool I830RandRInit(ScreenPtr pScreen, int rotation);
+Bool I830RandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
+			RRScreenSizePtr pSize);
+Rotation I830GetRotation(ScreenPtr pScreen);
+
 /*
  * 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_dri.c b/src/i830_dri.c
index 13d2cfd..52c83cf 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -104,7 +104,9 @@ static void I830DRITransitionTo3d(Screen
 static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen);
 static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen);
 
+#if 0
 static void I830DRIShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
+#endif
 
 extern void GlxSetVisualConfigs(int nconfigs,
 				__GLXvisualConfig * configs,
@@ -487,7 +489,7 @@ I830DRIScreenInit(ScreenPtr pScreen)
    pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION;
    pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL;
 #if 1 /* temporary until this gets removed from the libdri layer */
-   pDRIInfo->frameBufferPhysicalAddress = (pointer) pI830->LinearAddr +
+   pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr +
 					  pI830->FrontBuffer.Start;
    pDRIInfo->frameBufferSize = ROUND_TO_PAGE(pScrn->displayWidth *
 					     pScrn->virtualY * pI830->cpp);
@@ -635,7 +637,7 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScr
       return FALSE;
    }
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Front Buffer = 0x%08x\n",
-              sarea->front_handle);
+              (int)sarea->front_handle);
 
    if (drmAddMap(pI830->drmSubFD,
                  (drm_handle_t)(sarea->back_offset + pI830->LinearAddr),
@@ -647,7 +649,7 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScr
       return FALSE;
    }
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Back Buffer = 0x%08x\n",
-              sarea->back_handle);
+              (int)sarea->back_handle);
 
    if (drmAddMap(pI830->drmSubFD,
                  (drm_handle_t)sarea->depth_offset + pI830->LinearAddr,
@@ -659,7 +661,7 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScr
       return FALSE;
    }
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Depth Buffer = 0x%08x\n",
-              sarea->depth_handle);
+              (int)sarea->depth_handle);
 
    if (drmAddMap(pI830->drmSubFD,
 		 (drm_handle_t)sarea->tex_offset + pI830->LinearAddr,
@@ -671,7 +673,7 @@ I830DRIMapScreenRegions(ScrnInfoPtr pScr
       return FALSE;
    }
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] textures = 0x%08x\n",
-	      sarea->tex_handle);
+	      (int)sarea->tex_handle);
 
    return TRUE;
 }
@@ -746,7 +748,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
       return FALSE;
    }
    xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08x\n",
-	      pI830DRI->regs);
+	      (int)pI830DRI->regs);
 
    if (drmAddMap(pI830->drmSubFD,
 		 (drm_handle_t)pI830->LpRing->mem.Start + pI830->LinearAddr,
@@ -758,7 +760,7 @@ I830DRIDoMappings(ScreenPtr pScreen)
       return FALSE;
    }
    xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] ring buffer = 0x%08x\n",
-	      pI830->ring_map);
+	      (int)pI830->ring_map);
 
    if (!I830InitDma(pScrn)) {
       DRICloseScreen(pScreen);
diff --git a/src/i830_randr.c b/src/i830_randr.c
index be790c9..0311f2b 100644
--- a/src/i830_randr.c
+++ b/src/i830_randr.c
@@ -313,7 +313,6 @@ I830RandRInit (ScreenPtr    pScreen, int
 {
     rrScrPrivPtr	rp;
     XF86RandRInfoPtr	randrp;
-    ScrnInfoPtr		scrp = XF86SCRNINFO(pScreen);
     
 #ifdef PANORAMIX
     /* XXX disable RandR when using Xinerama */
diff-tree dae9cb7712d5d8f88697ca83808c59af08364c0e (from 5a1b68993f3a3a2e8dcd428a7118e29c36703cd6)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Thu Jun 22 15:07:16 2006 -0700

    Provide definitions of __FUNCTION__ for non-gcc compilers

diff --git a/src/common.h b/src/common.h
index a6e4ca3..31e67b9 100644
--- a/src/common.h
+++ b/src/common.h
@@ -39,13 +39,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 #ifndef _INTEL_COMMON_H_
 #define _INTEL_COMMON_H_
 
-#ifdef __GNUC__
+/* Provide substitutes for gcc's __FUNCTION__ on other compilers */
+#ifndef __GNUC__
+# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */
+#  define __FUNCTION__ __func__
+# else
+#  define __FUNCTION__ ""
+# endif
+#endif
+
+
 #define PFX __FILE__,__LINE__,__FUNCTION__
 #define FUNCTION_NAME __FUNCTION__
-#else
-#define PFX __FILE__,__LINE__,""
-#define FUNCTION_NAME ""
-#endif
 
 #ifdef I830DEBUG
 #define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \
diff-tree 5a1b68993f3a3a2e8dcd428a7118e29c36703cd6 (from 16b310823bacab6be4947da234b3a081b0a3cd62)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date:   Wed Jun 21 08:41:16 2006 +0100

    Fix build without DRI

diff --git a/src/Makefile.am b/src/Makefile.am
index ef8fc64..2745e8c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,16 +55,16 @@ i810_drv_la_SOURCES = \
          i830_video.c \
          i830_rotate.c \
 	 i830_randr.c \
+	 i830_3d.c \
 	 i830_reg.h \
+	 i915_3d.c \
 	 i915_reg.h
 
 if DRI
 i810_drv_la_SOURCES += \
-	 i830_3d.c \
          i810_dri.c \
          i810_dri.h \
          i830_dri.c \
          i810_hwmc.c \
-	 i915_3d.c \
          i830_dri.h 
 endif
diff --git a/src/i830.h b/src/i830.h
index 4fc3987..ac95e36 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -395,6 +395,8 @@ extern void I830Sync(ScrnInfoPtr pScrn);
 extern void I830InitHWCursor(ScrnInfoPtr pScrn);
 extern Bool I830CursorInit(ScreenPtr pScreen);
 extern void IntelEmitInvarientState(ScrnInfoPtr pScrn);
+extern void I830EmitInvarientState(ScrnInfoPtr pScrn);
+extern void I915EmitInvarientState(ScrnInfoPtr pScrn);
 extern void I830SelectBuffer(ScrnInfoPtr pScrn, int buffer);
 
 extern void I830RefreshRing(ScrnInfoPtr pScrn);
diff --git a/src/i830_3d.c b/src/i830_3d.c
index 547e556..0efd6e4 100644
--- a/src/i830_3d.c
+++ b/src/i830_3d.c
@@ -30,7 +30,6 @@
 #endif
 
 #include "i830.h"
-#include "i830_dri.h"
 
 #include "i830_reg.h"
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 7c65f65..6f9a3ee 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1182,35 +1182,6 @@ I830DRIMoveBuffers(WindowPtr pParent, DD
    pI830->AccelInfoRec->NeedToSync = TRUE;
 }
 
-extern I830EmitInvarientState(ScrnInfoPtr pScrn);
-extern I915EmitInvarientState(ScrnInfoPtr pScrn);
-
-/* Initialize the first context */
-void
-IntelEmitInvarientState(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   CARD32 ctx_addr;
-
-   ctx_addr = pI830->ContextMem.Start;
-   /* Align to a 2k boundry */
-   ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048;
-
-   {
-      BEGIN_LP_RING(2);
-      OUT_RING(MI_SET_CONTEXT);
-      OUT_RING(ctx_addr |
-	       CTXT_NO_RESTORE |
-	       CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE);
-      ADVANCE_LP_RING();
-   }
-
-   if (IS_I9XX(pI830))
-      I915EmitInvarientState(pScrn);
-   else
-      I830EmitInvarientState(pScrn);
-}
-
 /* Use callbacks from dri.c to support pageflipping mode for a single
  * 3d context without need for any specific full-screen extension.
  *
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 907b204..80a46a4 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -4755,6 +4755,32 @@ I830InitFBManager(
    return ret;
 }
 
+/* Initialize the first context */
+void
+IntelEmitInvarientState(ScrnInfoPtr pScrn)
+{
+   I830Ptr pI830 = I830PTR(pScrn);
+   CARD32 ctx_addr;
+
+   ctx_addr = pI830->ContextMem.Start;
+   /* Align to a 2k boundry */
+   ctx_addr = ((ctx_addr + 2048 - 1) / 2048) * 2048;
+
+   {
+      BEGIN_LP_RING(2);
+      OUT_RING(MI_SET_CONTEXT);
+      OUT_RING(ctx_addr |
+	       CTXT_NO_RESTORE |
+	       CTXT_PALETTE_SAVE_DISABLE | CTXT_PALETTE_RESTORE_DISABLE);
+      ADVANCE_LP_RING();
+   }
+
+   if (IS_I9XX(pI830))
+      I915EmitInvarientState(pScrn);
+   else
+      I830EmitInvarientState(pScrn);
+}
+
 static Bool
 I830BIOSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 {
diff --git a/src/i915_3d.c b/src/i915_3d.c
index f6e7219..d8edb18 100644
--- a/src/i915_3d.c
+++ b/src/i915_3d.c
@@ -30,7 +30,6 @@
 #endif
 
 #include "i830.h"
-#include "i830_dri.h"
 
 #include "i915_reg.h"
 
diff-tree 16b310823bacab6be4947da234b3a081b0a3cd62 (from 8a6edba33213911cc2210b5e903428b81d45862f)
Author: Matthieu Herrb <matthieu at deville.herrb.com>
Date:   Wed Jun 21 00:12:27 2006 +0200

    Fix build without DRI

diff --git a/src/Makefile.am b/src/Makefile.am
index 2745e8c..ef8fc64 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,16 +55,16 @@ i810_drv_la_SOURCES = \
          i830_video.c \
          i830_rotate.c \
 	 i830_randr.c \
-	 i830_3d.c \
 	 i830_reg.h \
-	 i915_3d.c \
 	 i915_reg.h
 
 if DRI
 i810_drv_la_SOURCES += \
+	 i830_3d.c \
          i810_dri.c \
          i810_dri.h \
          i830_dri.c \
          i810_hwmc.c \
+	 i915_3d.c \
          i830_dri.h 
 endif
diff-tree 8a6edba33213911cc2210b5e903428b81d45862f (from a73ab7f0e6e3b0462e05c0031ffd602ed3e2bcd4)
Author: Keith Packard <keithp at neko.keithp.com>
Date:   Mon Jun 19 13:47:28 2006 -0700

    Set vblank interrupt configuration to match pipe configuration
    
    New i915 drm ioctl (in version 1.5) allows the X server to select
    which pipe drives vblank interrupts. Use this to drive from the 'preferred'
    pipe. Yes, per-window vblanks would be nice in a shared fb environment.
    Maybe someday.
    (cherry picked from 2fb375b665f4802819b89f2277fd6154006c11ee commit)

diff --git a/src/i830.h b/src/i830.h
index 4fa3328..4fc3987 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -427,6 +427,7 @@ extern void I830DRIUnmapScreenRegions(Sc
 extern Bool I830DRIMapScreenRegions(ScrnInfoPtr pScrn, drmI830Sarea *sarea);
 extern void I830DRIUnlock(ScrnInfoPtr pScrn);
 extern Bool I830DRILock(ScrnInfoPtr pScrn);
+extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on);
 #endif
 
 extern Bool I830AccelInit(ScreenPtr pScreen);
diff --git a/src/i830_common.h b/src/i830_common.h
index 41b5cc3..a27bc01 100644
--- a/src/i830_common.h
+++ b/src/i830_common.h
@@ -52,6 +52,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define DRM_I830_INIT_HEAP                0x0a
 #define DRM_I830_CMDBUFFER                0x0b
 #define DRM_I830_DESTROY_HEAP             0x0c
+#define DRM_I830_SET_VBLANK_PIPE	  0x0d
+#define DRM_I830_GET_VBLANK_PIPE	  0x0e
+
 
 typedef struct {
    enum {
@@ -193,5 +196,11 @@ typedef struct {
 	int region;
 } drmI830MemDestroyHeap;
 
+#define	DRM_I830_VBLANK_PIPE_A	1
+#define	DRM_I830_VBLANK_PIPE_B	2
+
+typedef struct {
+	int pipe;
+} drmI830VBlankPipe;
 
 #endif /* _I830_DRM_H_ */
diff --git a/src/i830_dri.c b/src/i830_dri.c
index ed5e685..7c65f65 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1454,6 +1454,31 @@ I830UpdateDRIBuffers(ScrnInfoPtr pScrn, 
 }
 
 Bool
+I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on)
+{
+    I830Ptr pI830 = I830PTR(pScrn);
+    drmI830VBlankPipe pipe;
+
+    if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) {
+	if (on) {
+	    if (pI830->planeEnabled[1])
+		pipe.pipe = DRM_I830_VBLANK_PIPE_B;
+	    else
+		pipe.pipe = DRM_I830_VBLANK_PIPE_A;
+	} else {
+	    pipe.pipe = 0;
+	}
+	if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE,
+			    &pipe, sizeof (pipe))) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Vblank Pipe Setup Failed\n");
+	    return FALSE;
+	}
+    }
+
+    return TRUE;
+}
+
+Bool
 I830DRILock(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a4b891b..907b204 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3826,6 +3826,9 @@ RestoreHWState(ScrnInfoPtr pScrn)
 
    DPRINTF(PFX, "RestoreHWState\n");
 
+#ifdef XF86DRI
+   I830DRISetVBlankInterrupt (pScrn, FALSE);
+#endif
    if (I830IsPrimary(pScrn) && pI830->pipe != pI830->origPipe)
       SetBIOSPipe(pScrn, pI830->origPipe);
    else
@@ -4411,6 +4414,9 @@ I830VESASetMode(ScrnInfoPtr pScrn, Displ
 #endif
 
 #ifdef XF86DRI
+   I830DRISetVBlankInterrupt (pScrn, TRUE);
+#endif
+#ifdef XF86DRI
    if (didLock)
       I830DRIUnlock(pScrn);
 #endif



More information about the xorg-commit mailing list