summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/radeon_dri.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c
index 0ad0f7f..24018e8 100644
--- a/src/radeon_dri.c
+++ b/src/radeon_dri.c
@@ -69,7 +69,7 @@ static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen);
static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen);
#ifdef DAMAGE
-static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, RegionPtr pReg);
#if (DRIINFO_MAJOR_VERSION > 5 || \
(DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1))
@@ -406,16 +406,7 @@ static void RADEONLeaveServer(ScreenPtr pScreen)
int nrects = pDamageReg ? REGION_NUM_RECTS(pDamageReg) : 0;
if (nrects) {
- RegionRec region;
-
- REGION_NULL(pScreen, &region);
- REGION_SUBTRACT(pScreen, &region, pDamageReg, &info->driRegion);
-
- nrects = REGION_NUM_RECTS(&region);
-
- if (nrects) {
- RADEONDRIRefreshArea(pScrn, nrects, REGION_RECTS(&region));
- }
+ RADEONDRIRefreshArea(pScrn, pDamageReg);
}
}
#endif
@@ -1871,15 +1862,17 @@ void RADEONDRICloseScreen(ScreenPtr pScreen)
*/
-static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, RegionPtr pReg)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
- int i;
+ int i, num;
ScreenPtr pScreen = pScrn->pScreen;
RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
#ifdef USE_EXA
PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen);
#endif
+ RegionRec region;
+ BoxPtr pbox;
if (!info->directRenderingInited || !info->CPStarted)
return;
@@ -1890,6 +1883,17 @@ static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
if (!pSAREAPriv->pfAllowPageFlip && pSAREAPriv->pfCurrentPage == 0)
return;
+ REGION_NULL(pScreen, &region);
+ REGION_SUBTRACT(pScreen, &region, pReg, &info->driRegion);
+
+ num = REGION_NUM_RECTS(&region);
+
+ if (!num) {
+ goto out;
+ }
+
+ pbox = REGION_RECTS(&region);
+
/* pretty much a hack. */
#ifdef USE_EXA
@@ -1910,7 +1914,7 @@ static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
if (!info->useEXA) {
/* Make sure accel has been properly inited */
if (info->accel == NULL || info->accel->SetupForScreenToScreenCopy == NULL)
- return;
+ goto out;
if (info->tilingEnabled)
info->dst_pitch_offset |= RADEON_DST_TILE_MACRO;
(*info->accel->SetupForScreenToScreenCopy)(pScrn,
@@ -1946,6 +1950,8 @@ static void RADEONDRIRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
info->dst_pitch_offset &= ~RADEON_DST_TILE_MACRO;
#endif
+out:
+ REGION_NULL(pScreen, &region);
DamageEmpty(info->pDamage);
}
@@ -1959,16 +1965,13 @@ static void RADEONEnablePageFlip(ScreenPtr pScreen)
if (info->allowPageFlip) {
RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen);
+ BoxRec box = { .x1 = 0, .y1 = 0, .x2 = pScrn->virtualX - 1,
+ .y2 = pScrn->virtualY - 1 };
+ RegionPtr pReg = REGION_CREATE(pScreen, &box, 1);
pSAREAPriv->pfAllowPageFlip = 1;
-
-#ifdef USE_XAA
- if (!info->useEXA) {
- BoxRec box = { .x1 = 0, .y1 = 0, .x2 = pScrn->virtualX - 1,
- .y2 = pScrn->virtualY - 1 };
- RADEONDRIRefreshArea(pScrn, 1, &box);
- }
-#endif
+ RADEONDRIRefreshArea(pScrn, pReg);
+ REGION_DESTROY(pScreen, pReg);
}
#endif
}