From 4f8010ce22043c0f8d60c0f49d270ce98c9d2466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 23 Aug 2007 12:11:12 +0200 Subject: radeon: Don't synchronize DRI windows between pages when possible. --- src/radeon.h | 1 + src/radeon_dri.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/radeon.h b/src/radeon.h index 1a91cfd..bf1444c 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -605,6 +605,7 @@ typedef struct { Bool allowPageFlip; /* Enable 3d page flipping */ #ifdef DAMAGE DamagePtr pDamage; + RegionRec driRegion; #endif Bool have3DWindows; /* Are there any 3d clients? */ diff --git a/src/radeon_dri.c b/src/radeon_dri.c index f057bdf..0ad0f7f 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -70,6 +70,11 @@ static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen); #ifdef DAMAGE static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +#if (DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)) +static void RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num); +#endif #endif /* Initialize the visual configs that are supported by the hardware. @@ -401,7 +406,16 @@ static void RADEONLeaveServer(ScreenPtr pScreen) int nrects = pDamageReg ? REGION_NUM_RECTS(pDamageReg) : 0; if (nrects) { - RADEONDRIRefreshArea(pScrn, nrects, REGION_RECTS(pDamageReg)); + RegionRec region; + + REGION_NULL(pScreen, ®ion); + REGION_SUBTRACT(pScreen, ®ion, pDamageReg, &info->driRegion); + + nrects = REGION_NUM_RECTS(®ion); + + if (nrects) { + RADEONDRIRefreshArea(pScrn, nrects, REGION_RECTS(®ion)); + } } } #endif @@ -1490,6 +1504,11 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) pDRIInfo->TransitionTo3d = RADEONDRITransitionTo3d; pDRIInfo->TransitionSingleToMulti3D = RADEONDRITransitionSingleToMulti3d; pDRIInfo->TransitionMultiToSingle3D = RADEONDRITransitionMultiToSingle3d; +#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && \ + DRIINFO_MINOR_VERSION >= 1)) + pDRIInfo->ClipNotify = RADEONDRIClipNotify; +#endif pDRIInfo->createDummyCtx = TRUE; pDRIInfo->createDummyCtxPriv = FALSE; @@ -1753,7 +1772,11 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "RADEONDRICloseScreen\n"); - + +#ifdef DAMAGE + REGION_UNINIT(pScreen, &info->driRegion); +#endif + if (info->irq) { RADEONDRISetVBlankInterrupt (pScrn, FALSE); drmCtlUninstHandler(info->drmFD); @@ -2101,6 +2124,33 @@ static void RADEONDRITransitionTo2d(ScreenPtr pScreen) xf86ForceHWCursor (pScreen, FALSE); } +#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \ + (DRIINFO_MAJOR_VERSION == 5 && \ + DRIINFO_MINOR_VERSION >= 1)) +static void +RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + REGION_UNINIT(pScreen, &info->driRegion); + REGION_NULL(pScreen, &info->driRegion); + + if (num > 0) { + int i; + + for (i = 0; i < num; i++) { + WindowPtr pWin = ppWin[i]; + + if (pWin) { + REGION_UNION(pScreen, &info->driRegion, &pWin->clipList, + &info->driRegion); + } + } + } +} +#endif + void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; -- cgit v1.2.3