[Intel-gfx] [PATCH] Intel DDX pageflipping code removal

Owain Ainsworth zerooa at googlemail.com
Wed Jan 14 04:04:46 CET 2009


[ the first iteration of this mail appears to have vanished, so here's a
resend ]
Hi,

The following patch series removes the pageflipping infrastructure from
the Intel DDX, since it has been deprecated and broken for quite some
time. Some build fixes for non-linux and one bugfix are also attached.
The equvalent patch for mesa should be going out just after this.

jbarnes has had a look at these, but some more eyes would be nice. I'd
like this to get in before 2.6 is released (preferably as part of that
release).

Patch series is attached since i'm having some perl-module problems here
which break git send-email

Any comments? If no problems could someone push it for me

Cheers,

-0-
-- 
Why is the alphabet in that order?  Is it because of that song?
		-- Stephen Wright
-------------- next part --------------
>From 9792c20e6de544cea7232c41a8ec4c88aef671ab Mon Sep 17 00:00:00 2001
From: Owain G. Ainsworth <oga at openbsd.org>
Date: Tue, 13 Jan 2009 17:02:59 +0000
Subject: [PATCH] use ifdef __linux__ where needed.

since modesetting is compiled by default now, ifdef __linux__ the linux
only includes and ioctls.
---
 src/i830_driver.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3e27b07..1ddea00 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1228,7 +1228,9 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode)
  * DRM mode setting Linux only at this point... later on we could
  * add a wrapper here.
  */
+#ifdef __linux__
 #include <linux/kd.h>
+#endif
 
 static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
 {
@@ -1254,7 +1256,9 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn)
     if (ret)
 	return FALSE;
 
+#ifdef __linux__
     ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
+#endif
 
     return TRUE;
 }
-- 
1.6.0.5

-------------- next part --------------
>From e9860d4fc088bb78fd684d9996ef9185b647a1b4 Mon Sep 17 00:00:00 2001
From: Owain G. Ainsworth <oga at openbsd.org>
Date: Tue, 13 Jan 2009 17:09:00 +0000
Subject: [PATCH] Remove triple-buffering support

It never worked with any upstream linux kernel, and is quite heavily
deprecated. A new solution based around DRI2 will probably be
forthcoming. Pageflipping itself is next.
---
 man/intel.man     |   15 +--------------
 src/i830.h        |    2 --
 src/i830_accel.c  |    5 -----
 src/i830_dri.c    |   32 +++++---------------------------
 src/i830_driver.c |    8 --------
 src/i830_memory.c |   11 -----------
 src/i830_xaa.c    |    6 ------
 7 files changed, 6 insertions(+), 73 deletions(-)

diff --git a/man/intel.man b/man/intel.man
index 00aa1be..2359624 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -153,23 +153,10 @@ Default for i810: this option is not used.
 .BI "Option \*qPageFlip\*q \*q" boolean \*q
 Enable support for page flipping. This should improve 3D performance at the
 potential cost of worse performance with mixed 2D/3D. Also note that this gives
-no benefit without corresponding support in the Mesa 3D driver and may not give
-the full benefit without triple buffering (see
-.B "Option \*qTripleBuffer\*q"
-).
+no benefit without corresponding support in the Mesa 3D driver
 Default for i810: The option is not used.
 Default for i830 and above: Disabled (This option is currently unstable).
 .TP
-.BI "Option \*qTripleBuffer\*q \*q" boolean \*q
-Enable support for triple buffering. This should improve 3D performance at the
-potential cost of worse performance with mixed 2D/3D. Also note that this gives
-no benefit without corresponding support in the Mesa 3D driver and may not give
-any benefit without page flipping either (see
-.B "Option \*qPageFlip\*q"
-).
-Default for i810: The option is not used.
-Default for i830 and above: Disabled.
-.TP
 .BI "Option \*qAccelMethod\*q \*q" string \*q
 Choose acceleration architecture, either "XAA" or "EXA".  XAA is the old
 XFree86 based acceleration architecture.  EXA is a newer and simpler
diff --git a/src/i830.h b/src/i830.h
index 25bf482..94bcce7 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -461,7 +461,6 @@ typedef struct _I830Rec {
 
 #ifdef XF86DRI
    i830_memory *back_buffer;
-   i830_memory *third_buffer;
    i830_memory *depth_buffer;
    i830_memory *textures;		/**< Compatibility texture memory */
    i830_memory *memory_manager;		/**< DRI memory manager aperture */
@@ -484,7 +483,6 @@ typedef struct _I830Rec {
 
    Bool NeedRingBufferLow;
    Bool allowPageFlip;
-   Bool TripleBuffer;
    Bool tiling;
    Bool fb_compression;
 
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 7dff714..1c8b7aa 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -255,11 +255,6 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
       if (pI830->back_buffer->tiling == TILE_YMAJOR)
 	 return FALSE;
       break;
-   case I830_SELECT_THIRD:
-      pI830->bufferOffset = pI830->third_buffer->offset;
-      if (pI830->third_buffer->tiling == TILE_YMAJOR)
-	 return FALSE;
-      break;
    case I830_SELECT_DEPTH:
       pI830->bufferOffset = pI830->depth_buffer->offset;
       if (pI830->depth_buffer->tiling == TILE_YMAJOR)
diff --git a/src/i830_dri.c b/src/i830_dri.c
index c4440ce..98df2ac 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -848,7 +848,6 @@ I830DRIDoMappings(ScreenPtr pScreen)
    /* init to zero to be safe */
    sarea->front_handle = 0;
    sarea->back_handle = 0;
-   sarea->third_handle = 0;
    sarea->depth_handle = 0;
    sarea->tex_handle = 0;
 
@@ -1079,10 +1078,6 @@ I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 
    I830DRIDoRefreshArea(pScrn, num, pbox, pI830->back_buffer->offset);
 
-   if (pI830->third_buffer) {
-      I830DRIDoRefreshArea(pScrn, num, pbox, pI830->third_buffer->offset);
-   }
-
    DamageEmpty(pI830->pDamage);
 }
 #endif
@@ -1169,14 +1164,14 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
 
 	 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;
+	    sPriv->pf_current_page |= 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;
+	    sPriv->pf_current_page |= 1;
 
 	    flip.pipes |= 0x1;
 	 }
@@ -1208,8 +1203,6 @@ I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
 
    first_buffer = I830_SELECT_BACK;
    last_buffer = I830_SELECT_DEPTH;
-   if (I830PTR(pScrn)->third_buffer)
-      last_buffer = I830_SELECT_THIRD;
 
    for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
       pbox = REGION_RECTS(prgn);
@@ -1358,8 +1351,6 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
    I830EmitFlush(pScrn);
    first_buffer = I830_SELECT_BACK;
    last_buffer = I830_SELECT_DEPTH;
-   if (pI830->third_buffer)
-      last_buffer = I830_SELECT_THIRD;
 
    for (buffer = first_buffer; buffer <= last_buffer; buffer++) {
       if (!I830SelectBuffer(pScrn, buffer))
@@ -1591,10 +1582,6 @@ i830_update_sarea(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
 
    sarea->front_tiled = (pI830->front_buffer->tiling != TILE_NONE);
    sarea->back_tiled = (pI830->back_buffer->tiling != TILE_NONE);
-   if (pI830->third_buffer != NULL)
-       sarea->third_tiled = (pI830->third_buffer->tiling != TILE_NONE);
-   else
-       sarea->third_tiled = FALSE;
    sarea->depth_tiled = (pI830->depth_buffer->tiling != TILE_NONE);
    sarea->rotated_tiled = FALSE;
 
@@ -1602,7 +1589,6 @@ i830_update_sarea(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
 
    sarea->front_bo_handle = i830_name_buffer (pScrn, pI830->front_buffer);
    sarea->back_bo_handle = i830_name_buffer (pScrn, pI830->back_buffer);
-   sarea->third_bo_handle = i830_name_buffer (pScrn, pI830->third_buffer);
    sarea->depth_bo_handle = i830_name_buffer (pScrn, pI830->depth_buffer);
 
    /* The rotation is now handled entirely by the X Server, so just leave the
@@ -1695,17 +1681,9 @@ i830_update_dri_mappings(ScrnInfoPtr pScrn, drmI830Sarea *sarea)
        return FALSE;
    }
 
-   if (pI830->third_buffer) {
-       if (!i830_do_addmap(pScrn, pI830->third_buffer, &sarea->third_handle,
-			   &sarea->third_size, &sarea->third_offset)) {
-	   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n");
-	   return FALSE;
-       }
-   } else {
-       sarea->third_handle = 0;
-       sarea->third_offset = 0;
-       sarea->third_size = 0;
-   }
+   sarea->third_handle = 0;
+   sarea->third_offset = 0;
+   sarea->third_size = 0;
 
    if (!i830_do_addmap(pScrn, pI830->depth_buffer, &sarea->depth_handle,
 		       &sarea->depth_size, &sarea->depth_offset)) {
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 1ddea00..23f3757 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -336,7 +336,6 @@ static OptionInfoRec I830Options[] = {
    {OPTION_LEGACY3D,	"Legacy3D",     OPTV_BOOLEAN,	{0},	FALSE},
 #endif
    {OPTION_LVDSFIXEDMODE, "LVDSFixedMode", OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN,	{0},	FALSE},
    {OPTION_FORCEENABLEPIPEA, "ForceEnablePipeA", OPTV_BOOLEAN,	{0},	FALSE},
 #ifdef INTEL_XVMC
    {OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	TRUE},
@@ -1810,13 +1809,6 @@ I830DriOptsInit(ScrnInfoPtr pScrn)
     xf86DrvMsg(pScrn->scrnIndex, from, "Will%s try to enable page flipping\n",
 	       pI830->allowPageFlip ? "" : " not");
 
-    pI830->TripleBuffer = FALSE;
-    from =  (pI830->directRenderingType != DRI_DISABLED &&
-	     xf86GetOptValBool(pI830->Options, OPTION_TRIPLEBUFFER,
-			       &pI830->TripleBuffer)) ? X_CONFIG : X_DEFAULT;
-
-    xf86DrvMsg(pScrn->scrnIndex, from, "Triple buffering %sabled\n",
-	       pI830->TripleBuffer ? "en" : "dis");
 #endif /* XF86DRI */
 }
 
diff --git a/src/i830_memory.c b/src/i830_memory.c
index b6d8026..ab4e5ce 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -351,7 +351,6 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
     pI830->power_context = NULL;
 #ifdef XF86DRI
     pI830->back_buffer = NULL;
-    pI830->third_buffer = NULL;
     pI830->depth_buffer = NULL;
     pI830->textures = NULL;
 #endif
@@ -367,8 +366,6 @@ i830_free_3d_memory(ScrnInfoPtr pScrn)
 #ifdef XF86DRI
     i830_free_memory(pScrn, pI830->back_buffer);
     pI830->back_buffer = NULL;
-    i830_free_memory(pScrn, pI830->third_buffer);
-    pI830->third_buffer = NULL;
     i830_free_memory(pScrn, pI830->depth_buffer);
     pI830->depth_buffer = NULL;
     i830_free_memory(pScrn, pI830->textures);
@@ -1753,14 +1750,6 @@ i830_allocate_3d_memory(ScrnInfoPtr pScrn)
     if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer, "back buffer"))
 	return FALSE;
 
-    if (pI830->TripleBuffer && !i830_allocate_backbuffer(pScrn,
-							 &pI830->third_buffer,
-							 "third buffer")) {
-       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		  "Failed to allocate third buffer, triple buffering "
-		  "inactive\n");
-    }
-
     if (!i830_allocate_depthbuffer(pScrn))
 	return FALSE;
 
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index e5e849d..7684978 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -292,12 +292,6 @@ I830CheckTiling(ScrnInfoPtr pScrn)
    {
        return TRUE;
    }
-   if (pI830->third_buffer != NULL &&
-       pI830->bufferOffset == pI830->third_buffer->offset &&
-       pI830->third_buffer->tiling != TILE_NONE)
-   {
-       return TRUE;
-   }
 #endif
 
    return FALSE;
-- 
1.6.0.5

-------------- next part --------------
>From f5f12cc0e4f1cff0ef706a14f82c1ca27d9ab29f Mon Sep 17 00:00:00 2001
From: Owain G. Ainsworth <oga at openbsd.org>
Date: Tue, 13 Jan 2009 18:42:44 +0000
Subject: [PATCH] Fix ioctl type.

I915_EMIT_IRQ is a read/write ioctl, not a write only. Found by OpenBSd's
kernel code which checks these things a long more strongly than Linux.
---
 src/i830_accel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/i830_accel.c b/src/i830_accel.c
index 1c8b7aa..9155c92 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -205,7 +205,7 @@ I830Sync(ScrnInfoPtr pScrn)
 	* register reads for idle.
 	*/
        emit.irq_seq = &wait.irq_seq;
-       ret = drmCommandWrite(pI830->drmSubFD, DRM_I830_IRQ_EMIT, &emit,
+       ret = drmCommandWriteRead(pI830->drmSubFD, DRM_I830_IRQ_EMIT, &emit,
 			    sizeof(emit));
        if (ret != 0)
 	   FatalError("Failure to emit IRQ: %s\n", strerror(-ret));
-- 
1.6.0.5

-------------- next part --------------
>From ccce68bcfa1166f387ebe79d7b96207f9fb2d383 Mon Sep 17 00:00:00 2001
From: Owain G. Ainsworth <oga at openbsd.org>
Date: Tue, 13 Jan 2009 18:46:41 +0000
Subject: [PATCH] Remove the pageflipping infrastructure.

It was broken on current kernels, and deprecated anyway.
---
 configure.ac      |    5 -
 man/intel.man     |    7 --
 src/i830.h        |    8 --
 src/i830_dri.c    |  278 -----------------------------------------------------
 src/i830_driver.c |   40 --------
 5 files changed, 0 insertions(+), 338 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6c4ba57..38d373e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,8 +105,6 @@ if test x$DRI != xno; then
                       [have_sarea_h="yes"], [have_sarea_h="no"])
         AC_CHECK_FILE([${sdkdir}/dristruct.h],
                       [have_dristruct_h="yes"], [have_dristruct_h="no"])
-	AC_CHECK_FILE([${sdkdir}/damage.h],
-                      [have_damage_h="yes"], [have_damage_h="no"])
 fi
 AC_MSG_CHECKING([whether to include DRI support])
 if test x$DRI = xauto; then
@@ -215,9 +213,6 @@ if test "$DRI" = yes; then
         PKG_CHECK_MODULES(DRI, [xf86driproto glproto])
         AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
         AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
-	if test "$have_damage_h" = yes; then
-		AC_DEFINE(DAMAGE,1,[Use Damage extension])
-	fi
 fi
 
 dnl exaGetPixmapDriverPrivate required for DRM_MODE.
diff --git a/man/intel.man b/man/intel.man
index 2359624..65d1114 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -150,13 +150,6 @@ pool.  On systems with a working GEM environment, this can be disabled to
 increase the memory pool available to other graphics tasks.
 Default for i830 and newer: Enabled.
 Default for i810: this option is not used.
-.BI "Option \*qPageFlip\*q \*q" boolean \*q
-Enable support for page flipping. This should improve 3D performance at the
-potential cost of worse performance with mixed 2D/3D. Also note that this gives
-no benefit without corresponding support in the Mesa 3D driver
-Default for i810: The option is not used.
-Default for i830 and above: Disabled (This option is currently unstable).
-.TP
 .BI "Option \*qAccelMethod\*q \*q" string \*q
 Choose acceleration architecture, either "XAA" or "EXA".  XAA is the old
 XFree86 based acceleration architecture.  EXA is a newer and simpler
diff --git a/src/i830.h b/src/i830.h
index 94bcce7..a5bd440 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -72,9 +72,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dri.h"
 #include "GL/glxint.h"
 #include "i830_dri.h"
-#ifdef DAMAGE
-#include "damage.h"
-#endif
 #include "drmmode_display.h"
 #endif
 #include "intel_bufmgr.h"
@@ -473,16 +470,11 @@ typedef struct _I830Rec {
    Bool can_resize;
 
    Bool want_vblank_interrupts;
-#ifdef DAMAGE
-   DamagePtr pDamage;
-   RegionRec driRegion;
-#endif
 #endif
 
    Bool need_mi_flush;
 
    Bool NeedRingBufferLow;
-   Bool allowPageFlip;
    Bool tiling;
    Bool fb_compression;
 
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 98df2ac..d6698da 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -111,14 +111,6 @@ static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
 
 static void I830DRITransitionTo2d(ScreenPtr pScreen);
 static void I830DRITransitionTo3d(ScreenPtr pScreen);
-#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 ||		\
-			(DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1))
-#define DRI_SUPPORTS_CLIP_NOTIFY 1
-#else
-#define DRI_SUPPORTS_CLIP_NOTIFY 0
-static void I830DRITransitionMultiToSingle3d(ScreenPtr pScreen);
-static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen);
-#endif
 
 #if (DRIINFO_MAJOR_VERSION > 5 || \
      (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 4))
@@ -127,10 +119,6 @@ static void I830DRITransitionSingleToMulti3d(ScreenPtr pScreen);
 #define DRI_DRIVER_FRAMEBUFFER_MAP 0
 #endif
 
-#if DRI_SUPPORTS_CLIP_NOTIFY
-static void I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num);
-#endif
-
 extern void GlxSetVisualConfigs(int nconfigs,
 				__GLXvisualConfig * configs,
 				void **configprivs);
@@ -599,10 +587,6 @@ I830DRIScreenInit(ScreenPtr pScreen)
 	 pDRIInfo->texOffsetStart = I830TexOffsetStart;
 #endif
 
-#if DRI_SUPPORTS_CLIP_NOTIFY
-      pDRIInfo->ClipNotify = I830DRIClipNotify;
-#endif
-
 #if DRI_DRIVER_FRAMEBUFFER_MAP
    /* DRI version is high enough that we can get the DRI code to not
     * try to manage the framebuffer.
@@ -622,11 +606,6 @@ I830DRIScreenInit(ScreenPtr pScreen)
    pDRIInfo->TransitionTo2d = I830DRITransitionTo2d;
    pDRIInfo->TransitionTo3d = I830DRITransitionTo3d;
 
-#if !DRI_SUPPORTS_CLIP_NOTIFY
-   pDRIInfo->TransitionSingleToMulti3D = I830DRITransitionSingleToMulti3d;
-   pDRIInfo->TransitionMultiToSingle3D = I830DRITransitionMultiToSingle3d;
-#endif
-
    /* do driver-independent DRI screen initialization here */
    if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) {
       xf86DrvMsg(pScreen->myNum, X_ERROR,
@@ -729,14 +708,6 @@ I830DRIScreenInit(ScreenPtr pScreen)
 	    return FALSE;
 	 }
 	 pI830->drmMinor = version->version_minor;
-#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);
       }
    }
@@ -965,10 +936,6 @@ I830DRICloseScreen(ScreenPtr pScreen)
 
    DPRINTF(PFX, "I830DRICloseScreen\n");
 
-#ifdef DAMAGE
-   REGION_UNINIT(pScreen, &pI830->driRegion);
-#endif
-
    if (!pI830->memory_manager && pI830DRI->irq) {
        drmCtlUninstHandler(pI830->drmSubFD);
        pI830DRI->irq = 0;
@@ -1022,66 +989,6 @@ I830DRIFinishScreenInit(ScreenPtr pScreen)
    return TRUE;
 }
 
-#ifdef DAMAGE
-/* This should be done *before* XAA syncs,
- * Otherwise will have to sync again???
- */
-static void
-I830DRIDoRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox, uint32_t dst)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   unsigned int i, cmd, pitch, flags;
-
-   pitch = pScrn->displayWidth * pI830->cpp;
-   flags = 0xcc << 16; /* ROP_S */
-
-   if (pScrn->bitsPerPixel == 32) {
-      cmd = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
-	     XY_SRC_COPY_BLT_WRITE_RGB);
-      flags |= 3 << 24;
-   } else {
-      cmd = (XY_SRC_COPY_BLT_CMD);
-      flags |= 1 << 24;
-   }
-
-   /* We can assume tiled buffers if page flipping is on */
-   if (IS_I965G(pI830)) {
-       cmd |= XY_SRC_COPY_BLT_DST_TILED | XY_SRC_COPY_BLT_SRC_TILED;
-       pitch >>= 2;
-   }
-
-   for (i = 0 ; i < num ; i++, pbox++) {
-      BEGIN_BATCH(8);
-      OUT_BATCH(cmd);
-      OUT_BATCH(flags | pitch);
-      OUT_BATCH((pbox->y1 << 16) | pbox->x1);
-      OUT_BATCH((pbox->y2 << 16) | pbox->x2);
-      OUT_BATCH(dst);
-      OUT_BATCH((pbox->y1 << 16) | pbox->x1);
-      OUT_BATCH(pitch);
-      OUT_BATCH(pI830->front_buffer->offset);
-      ADVANCE_BATCH();
-   }
-}
-
-static void
-I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
-
-   /* Don't want to do this when no 3d is active and pages are
-    * right-way-round :
-    */
-   if (!pSAREAPriv->pf_active && pSAREAPriv->pf_current_page == 0)
-      return;
-
-   I830DRIDoRefreshArea(pScrn, num, pbox, pI830->back_buffer->offset);
-
-   DamageEmpty(pI830->pDamage);
-}
-#endif
-
 static void
 I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
 		   DRIContextType oldContextType, void *oldContext,
@@ -1104,86 +1011,14 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
       if (!pI830->memory_manager)
 	  i830_refresh_ring(pScrn);
 
-#ifdef DAMAGE
-      if (!pI830->pDamage && pI830->allowPageFlip) {
-	 PixmapPtr pPix  = pScreen->GetScreenPixmap(pScreen);
-	 pI830->pDamage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
-				       pScreen, pPix);
-
-	 if (pI830->pDamage == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "No screen damage record, page flipping disabled\n");
-            pI830->allowPageFlip = FALSE;
-	 } else {
-	    DamageRegister(&pPix->drawable, pI830->pDamage);
-
-	    DamageDamageRegion(&pPix->drawable,
-			       &WindowTable[pScreen->myNum]->winSize);
-
-            xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                       "Damage tracking initialized for page flipping\n");
-	 }
-    }
-#endif
    } else if (syncType == DRI_2D_SYNC &&
 	      oldContextType == DRI_NO_CONTEXT &&
 	      newContextType == DRI_2D_CONTEXT) {
-#ifdef DAMAGE
-      drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-#endif
-
       if (I810_DEBUG & DEBUG_VERBOSE_DRI)
 	 ErrorF("i830DRISwapContext (out)\n");
 
       if (!pScrn->vtSema)
      	 return;
-
-#ifdef DAMAGE
-      if (pI830->pDamage) {
-	 RegionPtr pDamageReg = DamageRegion(pI830->pDamage);
-
-	 if (pDamageReg) {
-	    RegionRec region;
-	    int nrects;
-
-	    REGION_NULL(pScreen, &region);
-	    REGION_SUBTRACT(pScreen, &region, pDamageReg, &pI830->driRegion);
-
-	    if ((nrects = REGION_NUM_RECTS(&region)))
-	       I830DRIRefreshArea(pScrn, nrects, REGION_RECTS(&region));
-
-	    REGION_UNINIT(pScreen, &region);
-	 }
-      }
-#endif
-
-#ifdef DAMAGE
-      /* Try flipping back to the front page if necessary */
-      if (sPriv && !sPriv->pf_enabled && 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 |= 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 |= 1;
-
-	    flip.pipes |= 0x1;
-	 }
-
-	 drmCommandWrite(pI830->drmSubFD, DRM_I915_FLIP, &flip, sizeof(flip));
-
-	 if (sPriv->pf_current_page != 0)
-	    xf86DrvMsg(pScreen->myNum, X_WARNING,
-		       "[dri] %s: kernel failed to unflip buffers.\n", __func__);
-      }
-#endif
-
       pI830->LockHeld = 0;
    } else if (I810_DEBUG & DEBUG_VERBOSE_DRI)
       ErrorF("i830DRISwapContext (other)\n");
@@ -1402,70 +1237,12 @@ I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
    i830MarkSync(pScrn);
 }
 
-/* Use callbacks from dri.c to support pageflipping mode for a single
- * 3d context without need for any specific full-screen extension.
- *
- * Also see tdfx driver for example of using these callbacks to
- * allocate and free 3d-specific memory on demand.
- */
-
-/* Use the miext/shadow module to maintain a list of dirty rectangles.
- * These are blitted to the back buffer to keep both buffers clean
- * during page-flipping when the 3d application isn't fullscreen.
- *
- * Unlike most use of the shadow code, both buffers are in video
- * memory.
- *
- * An alternative to this would be to organize for all on-screen
- * drawing operations to be duplicated for the two buffers.  That
- * might be faster, but seems like a lot more work...
- */
-
-static void
-I830DRISetPfMask(ScreenPtr pScreen, int pfMask)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   drmI830Sarea *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
-
-   if (pI830->allowPageFlip && pfMask) {
-      pSAREAPriv->pf_enabled = pI830->allowPageFlip;
-      pSAREAPriv->pf_active = pfMask;
-   } else
-      pSAREAPriv->pf_active = 0;
-}
-
-#if !DRI_SUPPORTS_CLIP_NOTIFY
-static void
-I830DRITransitionSingleToMulti3d(ScreenPtr pScreen)
-{
-   /* Tell the clients not to pageflip.  How?
-    *   -- Field in sarea, plus bumping the window counters.
-    *   -- DRM needs to cope with Front-to-Back swapbuffers.
-    */
-   I830DRISetPfMask(pScreen, 0);
-}
-
-static void
-I830DRITransitionMultiToSingle3d(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   /* Let the remaining 3d app start page flipping again.
-    */
-   I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
-}
-#endif /* !DRI_SUPPORTS_CLIP_NOTIFY */
-
 static void
 I830DRITransitionTo3d(ScreenPtr pScreen)
 {
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    I830Ptr pI830 = I830PTR(pScrn);
 
-   I830DRISetPfMask(pScreen, pI830->allowPageFlip ? 0x3 : 0);
-
    pI830->want_vblank_interrupts = TRUE;
    I830DRISetVBlankInterrupt(pScrn, TRUE);
 }
@@ -1477,65 +1254,10 @@ I830DRITransitionTo2d(ScreenPtr pScreen)
    I830Ptr pI830 = I830PTR(pScrn);
    drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
 
-   I830DRISetPfMask(pScreen, 0);
-
-   sPriv->pf_enabled = 0;
-
    pI830->want_vblank_interrupts = FALSE;
    I830DRISetVBlankInterrupt(pScrn, FALSE);
 }
 
-#if DRI_SUPPORTS_CLIP_NOTIFY
-static void
-I830DRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num)
-{
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-   I830Ptr pI830 = I830PTR(pScrn);
-   unsigned pfMask = 0;
-
-   REGION_UNINIT(pScreen, &pI830->driRegion);
-   REGION_NULL(pScreen, &pI830->driRegion);
-
-   if (num > 0) {
-      drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
-      BoxRec crtcBox[2];
-      unsigned numvisible[2] = { 0, 0 };
-      int i, j;
-
-      crtcBox[0].x1 = sPriv->pipeA_x;
-      crtcBox[0].y1 = sPriv->pipeA_y;
-      crtcBox[0].x2 = crtcBox[0].x1 + sPriv->pipeA_w;
-      crtcBox[0].y2 = crtcBox[0].y1 + sPriv->pipeA_h;
-      crtcBox[1].x1 = sPriv->pipeB_x;
-      crtcBox[1].y1 = sPriv->pipeB_y;
-      crtcBox[1].x2 = crtcBox[1].x1 + sPriv->pipeB_w;
-      crtcBox[1].y2 = crtcBox[1].y1 + sPriv->pipeB_h;
-
-      for (i = 0; i < 2; i++) {
-	 for (j = 0; j < num; j++) {
-	    WindowPtr pWin = ppWin[j];
-
-	    if (pWin) {
-	       if (RECT_IN_REGION(pScreen, &pWin->clipList, &crtcBox[i]) !=
-		   rgnOUT)
-		  numvisible[i]++;
-
-	       if (i == 0)
-		  REGION_UNION(pScreen, &pI830->driRegion, &pWin->clipList,
-			       &pI830->driRegion);
-	    }
-	 }
-
-	 if (numvisible[i] == 1)
-	    pfMask |= 1 << i;
-      }
-   } else
-      REGION_NULL(pScreen, &pI830->driRegion);
-
-   I830DRISetPfMask(pScreen, pfMask);
-}
-#endif /* DRI_SUPPORTS_CLIP_NOTIFY */
-
 static int
 i830_name_buffer (ScrnInfoPtr pScrn, i830_memory *mem)
 {
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 23f3757..432e0a8 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -323,7 +323,6 @@ static OptionInfoRec I830Options[] = {
    {OPTION_SW_CURSOR,	"SWcursor",	OPTV_BOOLEAN,	{0},	FALSE},
    {OPTION_CACHE_LINES,	"CacheLines",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
-   {OPTION_PAGEFLIP,	"PageFlip",	OPTV_BOOLEAN,	{0},	FALSE},
    {OPTION_XVIDEO,	"XVideo",	OPTV_BOOLEAN,	{0},	TRUE},
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
@@ -1794,24 +1793,6 @@ I830XvInit(ScrnInfoPtr pScrn)
 #endif
 }
 
-static void
-I830DriOptsInit(ScrnInfoPtr pScrn)
-{
-#ifdef XF86DRI
-    I830Ptr pI830 = I830PTR(pScrn);
-    MessageType from = X_PROBED;
-
-    pI830->allowPageFlip = FALSE;
-    from = (pI830->directRenderingType != DRI_DISABLED &&
-	    xf86GetOptValBool(pI830->Options, OPTION_PAGEFLIP,
-			      &pI830->allowPageFlip)) ? X_CONFIG : X_DEFAULT;
-
-    xf86DrvMsg(pScrn->scrnIndex, from, "Will%s try to enable page flipping\n",
-	       pI830->allowPageFlip ? "" : " not");
-
-#endif /* XF86DRI */
-}
-
 /**
  * This is called per zaphod head (so usually just once) to do initialization
  * before the Screen is created.
@@ -1965,8 +1946,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
 
    I830XvInit(pScrn);
 
-   I830DriOptsInit(pScrn);
-
    if (!xf86SetGamma(pScrn, zeros)) {
        PreInitCleanup(pScrn);
        return FALSE;
@@ -2879,11 +2858,6 @@ i830_memory_init(ScrnInfoPtr pScrn)
 
     /* If tiling fails we have to disable page flipping & FBC */
     pScrn->displayWidth = savedDisplayWidth;
-    if (pI830->allowPageFlip)
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		"Couldn't allocate tiled memory, page flipping "
-		"disabled\n");
-    pI830->allowPageFlip = FALSE;
     if (pI830->fb_compression)
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		"Couldn't allocate tiled memory, fb compression "
@@ -3314,11 +3288,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
        I830SwapPipes(pScrn);
 #endif
 
-#ifdef XF86DRI
-   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Page Flipping %sabled\n",
-	      pI830->allowPageFlip ? "en" : "dis");
-#endif
-
    if (I830IsPrimary(pScrn)) {
         pScrn->fbOffset = pI830->front_buffer->offset;
    } else {
@@ -3869,15 +3838,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 #ifdef XF86DRI
    if (pI830->directRenderingOpen &&
        pI830->directRenderingType == DRI_XF86DRI) {
-#ifdef DAMAGE
-      if (pI830->pDamage) {
-	 PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen);
-
-	 DamageUnregister(&pPix->drawable, pI830->pDamage);
-	 DamageDestroy(pI830->pDamage);
-	 pI830->pDamage = NULL;
-      }
-#endif
       pI830->directRenderingOpen = FALSE;
       I830DRICloseScreen(pScreen);
    }
-- 
1.6.0.5



More information about the Intel-gfx mailing list