diff options
Diffstat (limited to 'uxa')
-rw-r--r-- | uxa/uxa-priv.h | 4 | ||||
-rw-r--r-- | uxa/uxa-render.c | 16 | ||||
-rw-r--r-- | uxa/uxa-unaccel.c | 50 |
3 files changed, 48 insertions, 22 deletions
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h index ac206af2..6b9a9c11 100644 --- a/uxa/uxa-priv.h +++ b/uxa/uxa-priv.h @@ -325,9 +325,11 @@ uxa_check_composite(CARD8 op, /* uxa.c */ Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access); - void uxa_finish_access(DrawablePtr pDrawable); +Bool uxa_picture_prepare_access(PicturePtr picture, int mode); +void uxa_picture_finish_access(PicturePtr picture); + void uxa_get_drawable_deltas(DrawablePtr pDrawable, PixmapPtr pPixmap, int *xp, int *yp); diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index b26be802..34257c6e 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -568,10 +568,10 @@ uxa_picture_from_pixman_image(ScreenPtr screen, } ValidatePicture(src); - if (uxa_prepare_access(picture->pDrawable, UXA_ACCESS_RW)) { + if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) { fbComposite(PictOpSrc, src, NULL, picture, 0, 0, 0, 0, 0, 0, width, height); - uxa_finish_access(picture->pDrawable); + uxa_picture_finish_access(picture); } FreePicture(src, 0); @@ -699,10 +699,10 @@ uxa_acquire_pattern(ScreenPtr pScreen, if (!pDst) return 0; - if (uxa_prepare_access(pDst->pDrawable, UXA_ACCESS_RW)) { + if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) { fbComposite(PictOpSrc, pSrc, NULL, pDst, x, y, 0, 0, 0, 0, width, height); - uxa_finish_access(pDst->pDrawable); + uxa_picture_finish_access(pDst); return pDst; } else { FreePicture(pDst, 0); @@ -756,14 +756,14 @@ uxa_render_picture(ScreenPtr screen, if (!picture) return 0; - if (uxa_prepare_access(picture->pDrawable, UXA_ACCESS_RW)) { - if (uxa_prepare_access(src->pDrawable, UXA_ACCESS_RO)) { + if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) { + if (uxa_picture_prepare_access(src, UXA_ACCESS_RO)) { ret = 1; fbComposite(PictOpSrc, src, NULL, picture, x, y, 0, 0, 0, 0, width, height); - uxa_finish_access(src->pDrawable); + uxa_picture_finish_access(src); } - uxa_finish_access(picture->pDrawable); + uxa_picture_finish_access(picture); } if (!ret) { diff --git a/uxa/uxa-unaccel.c b/uxa/uxa-unaccel.c index 15be821a..1d4b2c02 100644 --- a/uxa/uxa-unaccel.c +++ b/uxa/uxa-unaccel.c @@ -67,6 +67,34 @@ void uxa_finish_access_gc(GCPtr pGC) uxa_finish_access(&pGC->stipple->drawable); } +Bool uxa_picture_prepare_access(PicturePtr picture, int mode) +{ + if (picture->pDrawable == NULL) + return TRUE; + + if (!uxa_prepare_access(picture->pDrawable, mode)) + return FALSE; + + if (picture->alphaMap && + !uxa_prepare_access(picture->alphaMap->pDrawable, mode)) { + uxa_finish_access(picture->pDrawable); + return FALSE; + } + + return TRUE; +} + +void uxa_picture_finish_access(PicturePtr picture) +{ + if (picture->pDrawable == NULL) + return; + + uxa_finish_access(picture->pDrawable); + if (picture->alphaMap) + uxa_finish_access(picture->alphaMap->pDrawable); +} + + char uxa_drawable_location(DrawablePtr pDrawable) { return uxa_drawable_is_offscreen(pDrawable) ? 's' : 'm'; @@ -362,24 +390,20 @@ uxa_check_composite(CARD8 op, UXA_FALLBACK(("from picts %p/%p to pict %p\n", pSrc, pMask, pDst)); - if (uxa_prepare_access(pDst->pDrawable, UXA_ACCESS_RW)) { - if (pSrc->pDrawable == NULL || - uxa_prepare_access(pSrc->pDrawable, UXA_ACCESS_RO)) { - if (!pMask || pMask->pDrawable == NULL || - uxa_prepare_access(pMask->pDrawable, UXA_ACCESS_RO)) - { + if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) { + if (uxa_picture_prepare_access(pSrc, UXA_ACCESS_RO)) { + if (!pMask || uxa_picture_prepare_access(pMask, UXA_ACCESS_RO)) { fbComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); - if (pMask && pMask->pDrawable != NULL) - uxa_finish_access(pMask->pDrawable); + if (pMask) + uxa_picture_finish_access(pMask); } - if (pSrc->pDrawable != NULL) - uxa_finish_access(pSrc->pDrawable); + uxa_picture_finish_access(pSrc); } - uxa_finish_access(pDst->pDrawable); + uxa_picture_finish_access(pDst); } } @@ -391,9 +415,9 @@ uxa_check_add_traps(PicturePtr pPicture, UXA_FALLBACK(("to pict %p (%c)\n", pPicture, uxa_drawable_location(pPicture->pDrawable))); - if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) { + if (uxa_picture_prepare_access(pPicture, UXA_ACCESS_RW)) { fbAddTraps(pPicture, x_off, y_off, ntrap, traps); - uxa_finish_access(pPicture->pDrawable); + uxa_picture_finish_access(pPicture); } } |