exa: fixup exaAssertNotDirty.

- Do the right thing based on prepare access.
This commit is contained in:
Maarten Maathuis 2009-02-26 22:18:03 +01:00
parent 2e88b6004f
commit ed00515ec5
3 changed files with 27 additions and 8 deletions

View File

@ -517,7 +517,10 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
return NULL; return NULL;
} }
void /**
* Returns TRUE if pixmap can be accessed offscreen.
*/
Bool
ExaDoPrepareAccess(DrawablePtr pDrawable, int index) ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
{ {
ScreenPtr pScreen = pDrawable->pScreen; ScreenPtr pScreen = pDrawable->pScreen;
@ -531,12 +534,12 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
} }
if (!offscreen) if (!offscreen)
return; return FALSE;
exaWaitSync (pDrawable->pScreen); exaWaitSync (pDrawable->pScreen);
if (pExaScr->info->PrepareAccess == NULL) if (pExaScr->info->PrepareAccess == NULL)
return; return TRUE;
if (index >= EXA_PREPARE_AUX0 && if (index >= EXA_PREPARE_AUX0 &&
!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) { !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
@ -549,7 +552,11 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED) if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
FatalError("Driver failed PrepareAccess on a pinned pixmap\n"); FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
exaMoveOutPixmap (pPixmap); exaMoveOutPixmap (pPixmap);
return FALSE;
} }
return TRUE;
} }
void void

View File

@ -545,9 +545,9 @@ exaAssertNotDirty (PixmapPtr pPixmap)
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
CARD8 *dst, *src; CARD8 *dst, *src;
RegionRec ValidReg; RegionRec ValidReg;
int dst_pitch, src_pitch, cpp, y, nbox; int dst_pitch, src_pitch, cpp, y, nbox, save_pitch;
BoxPtr pBox; BoxPtr pBox;
Bool ret = TRUE; Bool ret = TRUE, save_offscreen;
if (exaPixmapIsPinned(pPixmap) || pExaPixmap->area == NULL) if (exaPixmapIsPinned(pPixmap) || pExaPixmap->area == NULL)
return ret; return ret;
@ -566,7 +566,14 @@ exaAssertNotDirty (PixmapPtr pPixmap)
src_pitch = pExaPixmap->fb_pitch; src_pitch = pExaPixmap->fb_pitch;
cpp = pPixmap->drawable.bitsPerPixel / 8; cpp = pPixmap->drawable.bitsPerPixel / 8;
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC); save_offscreen = pExaPixmap->offscreen;
save_pitch = pPixmap->devKind;
pExaPixmap->offscreen = TRUE;
pPixmap->devKind = pExaPixmap->fb_pitch;
if (!ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC))
goto skip;
while (nbox--) { while (nbox--) {
int rowbytes; int rowbytes;
@ -579,7 +586,7 @@ exaAssertNotDirty (PixmapPtr pPixmap)
continue; continue;
rowbytes = (pBox->x2 - pBox->x1) * cpp; rowbytes = (pBox->x2 - pBox->x1) * cpp;
src = pExaPixmap->fb_ptr + pBox->y1 * src_pitch + pBox->x1 * cpp; src = (CARD8 *) pPixmap->devPrivate.ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp; dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
for (y = pBox->y1; y < pBox->y2; for (y = pBox->y1; y < pBox->y2;
@ -592,8 +599,13 @@ exaAssertNotDirty (PixmapPtr pPixmap)
} }
} }
} }
skip:
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
pExaPixmap->offscreen = save_offscreen;
pPixmap->devKind = save_pitch;
out: out:
REGION_UNINIT(pScreen, &ValidReg); REGION_UNINIT(pScreen, &ValidReg);
return ret; return ret;

View File

@ -449,7 +449,7 @@ void
ExaOffscreenFini (ScreenPtr pScreen); ExaOffscreenFini (ScreenPtr pScreen);
/* exa.c */ /* exa.c */
void Bool
ExaDoPrepareAccess(DrawablePtr pDrawable, int index); ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
void void