diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2006-10-15 17:03:13 +0200 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2006-10-15 17:03:13 +0200 |
commit | 4edbfb9eb952f9b3f5f597749192c17baf15cdce (patch) | |
tree | 2471b8bfa1eaf9c0ed945066117a5a9f850eaea9 /src/radeon_dri.c | |
parent | c9c2ac2b42398f5bfad909f3289e2545bb7b3888 (diff) |
radeon: Track screen damage all the time for page flipping.
This way we don't ever have to forcedly synchronize the pages so we hopefully
never clobber one page's contents when we shouldn't.
Diffstat (limited to 'src/radeon_dri.c')
-rw-r--r-- | src/radeon_dri.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/radeon_dri.c b/src/radeon_dri.c index 4f39e5c..be8e74f 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -402,7 +402,24 @@ static void RADEONEnterServer(ScreenPtr pScreen) if (info->ChipFamily>=CHIP_FAMILY_R300) drmCommandNone(info->drmFD, DRM_RADEON_CP_IDLE); +#ifdef DAMAGE + if (!info->pDamage && info->allowPageFlip) { + PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); + info->pDamage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, + pScreen, pPix); + + if (info->pDamage == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No screen damage record, page flipping disabled\n"); + info->allowPageFlip = 0; + } else { + DamageRegister(&pPix->drawable, info->pDamage); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Damage tracking initialized for page flipping\n"); + } + } +#endif } /* Called when the X server goes to sleep to allow the X server's @@ -1890,30 +1907,9 @@ static void RADEONEnablePageFlip(ScreenPtr pScreen) RADEONInfoPtr info = RADEONPTR(pScrn); if (info->allowPageFlip) { - BoxRec box = { .x1 = 0, .y1 = 0, .x2 = pScrn->virtualX - 1, - .y2 = pScrn->virtualY - 1 }; RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); - if (!info->pDamage) { - PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); - - /* Have damage run only while there is 3d active. - */ - info->pDamage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, - pScreen, pPix); - - if (info->pDamage == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No screen damage record, page flipping disabled\n"); - info->allowPageFlip = 0; - return; - } - - DamageRegister(&pPix->drawable, info->pDamage); - } - pSAREAPriv->pfAllowPageFlip = 1; - RADEONDRIRefreshArea(pScrn, 1, &box); } #endif } @@ -1925,17 +1921,6 @@ static void RADEONDisablePageFlip(ScreenPtr pScreen) * -- DRM needs to cope with Front-to-Back swapbuffers. */ RADEONSAREAPrivPtr pSAREAPriv = DRIGetSAREAPrivate(pScreen); -#ifdef DAMAGE - RADEONInfoPtr info = RADEONPTR(xf86Screens[pScreen->myNum]); - - if (info->pDamage) { - PixmapPtr pPix = pScreen->GetScreenPixmap(pScreen); - - DamageUnregister(&pPix->drawable, info->pDamage); - DamageDestroy(info->pDamage); - info->pDamage = NULL; - } -#endif pSAREAPriv->pfAllowPageFlip = 0; } |