Index: xserver-xorg-video-intel/configure.ac =================================================================== --- xserver-xorg-video-intel.orig/configure.ac 2009-01-16 15:44:53.000000000 +0200 +++ xserver-xorg-video-intel/configure.ac 2009-01-17 01:00:23.000000000 +0200 @@ -105,8 +105,6 @@ [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 @@ 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. Index: xserver-xorg-video-intel/man/intel.man =================================================================== --- xserver-xorg-video-intel.orig/man/intel.man 2009-01-16 15:44:53.000000000 +0200 +++ xserver-xorg-video-intel/man/intel.man 2009-01-17 11:00:21.000000000 +0200 @@ -150,23 +150,11 @@ 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 and may not give -the full benefit without triple buffering (see -.B "Option \*qTripleBuffer\*q" -). -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" -). +no benefit without corresponding support in the Mesa 3D driver. Default for i810: The option is not used. Default for i830 and above: Disabled. .TP Index: xserver-xorg-video-intel/src/i830.h =================================================================== --- xserver-xorg-video-intel.orig/src/i830.h 2009-01-13 14:57:30.000000000 +0200 +++ xserver-xorg-video-intel/src/i830.h 2009-01-17 11:06:41.000000000 +0200 @@ -72,9 +72,6 @@ #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" @@ -469,16 +466,11 @@ Bool allocate_classic_textures; Bool want_vblank_interrupts; -#ifdef DAMAGE - DamagePtr pDamage; - RegionRec driRegion; -#endif #endif Bool need_mi_flush; Bool NeedRingBufferLow; - Bool allowPageFlip; Bool TripleBuffer; Bool tiling; Bool fb_compression; Index: xserver-xorg-video-intel/src/i830_dri.c =================================================================== --- xserver-xorg-video-intel.orig/src/i830_dri.c 2009-01-13 14:57:30.000000000 +0200 +++ xserver-xorg-video-intel/src/i830_dri.c 2009-01-17 11:31:27.000000000 +0200 @@ -111,14 +111,6 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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); } } @@ -966,10 +937,6 @@ DPRINTF(PFX, "I830DRICloseScreen\n"); -#ifdef DAMAGE - REGION_UNINIT(pScreen, &pI830->driRegion); -#endif - if (!pI830->memory_manager && pI830DRI->irq) { drmCtlUninstHandler(pI830->drmSubFD); pI830DRI->irq = 0; @@ -1023,70 +990,6 @@ 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); - - if (pI830->third_buffer) { - I830DRIDoRefreshArea(pScrn, num, pbox, pI830->third_buffer->offset); - } - - DamageEmpty(pI830->pDamage); -} -#endif - static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, @@ -1108,87 +1011,14 @@ pI830->LockHeld = 1; 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, ®ion); - REGION_SUBTRACT(pScreen, ®ion, pDamageReg, &pI830->driRegion); - - if ((nrects = REGION_NUM_RECTS(®ion))) - I830DRIRefreshArea(pScrn, nrects, REGION_RECTS(®ion)); - - REGION_UNINIT(pScreen, ®ion); - } - } -#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 |= (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 != 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"); @@ -1411,70 +1241,12 @@ 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); } @@ -1486,65 +1258,10 @@ 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) { Index: xserver-xorg-video-intel/src/i830_driver.c =================================================================== --- xserver-xorg-video-intel.orig/src/i830_driver.c 2009-01-16 15:44:53.000000000 +0200 +++ xserver-xorg-video-intel/src/i830_driver.c 2009-01-17 11:42:50.000000000 +0200 @@ -323,7 +323,6 @@ {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}, @@ -1690,31 +1689,6 @@ #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"); - - 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 */ -} - /** * This is called per zaphod head (so usually just once) to do initialization * before the Screen is created. @@ -1868,8 +1842,6 @@ I830XvInit(pScrn); - I830DriOptsInit(pScrn); - if (!xf86SetGamma(pScrn, zeros)) { PreInitCleanup(pScrn); return FALSE; @@ -2825,11 +2797,6 @@ /* 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 " @@ -3261,11 +3228,6 @@ 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 { @@ -3816,15 +3778,6 @@ #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); }