xf86-video-intel: 3 commits - configure.ac src/i830.h src/i830_dri.c

Michel Daenzer daenzer at kemper.freedesktop.org
Mon Mar 12 14:04:17 EET 2007


 configure.ac   |    8 ++++++++
 src/i830.h     |    1 -
 src/i830_dri.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 56 insertions(+), 8 deletions(-)

New commits:
diff-tree fe59ab9f562fd10118563d80eb3351a4d3b48b3f (from ba55ff15df974197bebd871e28bb96d817ae41c7)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Mar 12 13:03:47 2007 +0100

    Disable page flipping if the DRM is older than 1.9.
    
    Older versions don't support the functionality we need.

diff --git a/src/i830_dri.c b/src/i830_dri.c
index 52c30eb..5a3aec0 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -687,6 +687,14 @@ I830DRIScreenInit(ScreenPtr pScreen)
 	       pI830->memory_manager = NULL;
 	    }
 	 }
+#ifdef DAMAGE
+	 if (pI830->allowPageFlip && pI830->drmMinor < 9) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		       "DRM version 1.9 or newer required for Page flipping. "
+		       "Disabling.\n");
+	    pI830->allowPageFlip = FALSE;
+	 }
+#endif	 
 	 drmFreeVersion(version);
       }
    }
diff-tree ba55ff15df974197bebd871e28bb96d817ae41c7 (from c4a23c5ef8ce56ee0fe547fbc7c6623c021f801b)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Mon Mar 12 13:01:00 2007 +0100

    Fix attempt to flip pages back to normal when the last 3D window disappears.
    
    When this succeeds, 2D rendering does not have to be synchronized to back
    buffers until the next 3D window appears.

diff --git a/configure.ac b/configure.ac
index fbb9c64..52cc07b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,6 +180,14 @@ if test "$DRI" = yes; then
 	if test "$have_damage_h" = yes; then
 		AC_DEFINE(DAMAGE,1,[Use Damage extension])
 	fi
+
+	save_CFLAGS="$CFLAGS"
+	CFLAGS="$DRI_CFLAGS"
+	AC_CHECK_TYPE(drm_i915_flip_t,
+		      [AC_DEFINE(HAVE_I915_FLIP, 1,
+			         [Have drm_i915_flip_t and related definitions])],
+		      [], [#include <i915_drm.h>])
+	CFLAGS="$save_CFLAGS"
 fi
 
 AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes)
diff --git a/src/i830_dri.c b/src/i830_dri.c
index f55fa71..52c30eb 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -81,6 +81,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i830.h"
 #include "i830_dri.h"
 
+#include "i915_drm.h"
+
 #include "dristruct.h"
 
 static char I830KernelDriverName[] = "i915";
@@ -563,12 +565,13 @@ I830DRIScreenInit(ScreenPtr pScreen)
 #endif
    }
 
+   pDRIInfo->TransitionTo2d = I830DRITransitionTo2d;
+
 #if DRIINFO_MAJOR_VERSION > 5 || \
     (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)
    if (!pDRIInfo->ClipNotify)
 #endif
    {
-      pDRIInfo->TransitionTo2d = I830DRITransitionTo2d;
       pDRIInfo->TransitionTo3d = I830DRITransitionTo3d;
       pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d;
       pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d;
@@ -1470,6 +1473,22 @@ I830DRITransitionTo3d(ScreenPtr pScreen)
    I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
 }
 
+/* This block and the corresponding configure test can be removed when
+ * libdrm >= 2.3.1 is required.
+ */
+#ifndef HAVE_I915_FLIP
+
+#define DRM_VBLANK_FLIP 0x8000000
+
+typedef struct drm_i915_flip {
+   int pipes;
+} drm_i915_flip_t;
+
+#undef DRM_IOCTL_I915_FLIP
+#define DRM_IOCTL_I915_FLIP DRM_IOW(DRM_COMMAND_BASE + DRM_I915_FLIP, \
+				    drm_i915_flip_t)
+
+#endif
 
 static void
 I830DRITransitionTo2d(ScreenPtr pScreen)
@@ -1479,10 +1498,27 @@ I830DRITransitionTo2d(ScreenPtr pScreen)
    drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
 
    /* Try flipping back to the front page if necessary */
-   if (sPriv->pf_current_page == 1)
-      drmCommandNone(pI830->drmSubFD, DRM_I830_FLIP);
+   if (sPriv->pf_current_page != 0) {
+      drm_i915_flip_t flip = { .pipes = 0 };
+
+      if (sPriv->pf_current_page & (0x3 << 2)) {
+	 sPriv->pf_current_page = sPriv->pf_current_page & 0x3;
+	 sPriv->pf_current_page |= (sPriv->third_handle ? 2 : 1) << 2;
+
+	 flip.pipes |= 0x2;
+      }
+
+      if (sPriv->pf_current_page & 0x3) {
+	 sPriv->pf_current_page = sPriv->pf_current_page & (0x3 << 2);
+	 sPriv->pf_current_page |= sPriv->third_handle ? 2 : 1;
+
+	 flip.pipes |= 0x1;
+      }
+
+      drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip));
+   }
 
-   if (sPriv->pf_current_page == 1)
+   if (sPriv->pf_current_page != 0)
       xf86DrvMsg(pScreen->myNum, X_WARNING,
 		 "[dri] %s: kernel failed to unflip buffers.\n", __func__);
 
diff-tree c4a23c5ef8ce56ee0fe547fbc7c6623c021f801b (from 797aa6fcb1231587bde1efb47bc8430c4c8d8110)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sat Mar 10 16:15:33 2007 +0100

    Remove unused have3DWindows from pI830.

diff --git a/src/i830.h b/src/i830.h
index 82a4166..dc8041c 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -306,7 +306,6 @@ typedef struct _I830Rec {
 
    int TexGranularity;
    int drmMinor;
-   Bool have3DWindows;
    int mmModeFlags;
    int mmSize;
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 38e11e7..f55fa71 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1468,7 +1468,6 @@ I830DRITransitionTo3d(ScreenPtr pScreen)
    I830Ptr pI830 = I830PTR(pScrn);
 
    I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
-   pI830->have3DWindows = 1;
 }
 
 
@@ -1488,8 +1487,6 @@ I830DRITransitionTo2d(ScreenPtr pScreen)
 		 "[dri] %s: kernel failed to unflip buffers.\n", __func__);
 
    I830DRISetPfMask(pScreen, 0);
-
-   pI830->have3DWindows = 0;
 }
 
 static void



More information about the xorg-commit mailing list