diff options
author | Keith Packard <keithp@keithp.com> | 2008-12-15 15:43:34 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-06 09:31:39 -0800 |
commit | 632f816c72cb4b48b690fd92d1cc1d5a9c9285c7 (patch) | |
tree | 80af87672f9a8ad3978a76bf0d6c951abe4b1b3d /uxa/uxa-render.c | |
parent | 90b28a56553d809374fa6d9b9529b7a8b583488c (diff) |
uxa: handle uxa_prepare_access failure
uxa_prepare_access may fail to map the pixmap into user space. Recover from
this without crashing.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'uxa/uxa-render.c')
-rw-r--r-- | uxa/uxa-render.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index b2d32976..13635f83 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -889,12 +889,12 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, xoff += pDraw->x; yoff += pDraw->y; - uxa_prepare_access(pDraw, UXA_ACCESS_RW); - - for (; ntrap; ntrap--, traps++) - (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0); - - uxa_finish_access(pDraw); + if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) + { + for (; ntrap; ntrap--, traps++) + (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0); + uxa_finish_access(pDraw); + } } else if (maskFormat) { @@ -911,11 +911,12 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (!pPicture) return; - uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW); - for (; ntrap; ntrap--, traps++) - (*ps->RasterizeTrapezoid) (pPicture, traps, - -bounds.x1, -bounds.y1); - uxa_finish_access(pPicture->pDrawable); + if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) { + for (; ntrap; ntrap--, traps++) + (*ps->RasterizeTrapezoid) (pPicture, traps, + -bounds.x1, -bounds.y1); + uxa_finish_access(pPicture->pDrawable); + } xRel = bounds.x1 + xSrc - xDst; yRel = bounds.y1 + ySrc - yDst; @@ -972,9 +973,10 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (direct) { DrawablePtr pDraw = pDst->pDrawable; - uxa_prepare_access(pDraw, UXA_ACCESS_RW); - (*ps->AddTriangles) (pDst, 0, 0, ntri, tris); - uxa_finish_access(pDraw); + if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) { + (*ps->AddTriangles) (pDst, 0, 0, ntri, tris); + uxa_finish_access(pDraw); + } } else if (maskFormat) { @@ -991,9 +993,10 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (!pPicture) return; - uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW); - (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris); - uxa_finish_access(pPicture->pDrawable); + if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) { + (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris); + uxa_finish_access(pPicture->pDrawable); + } xRel = bounds.x1 + xSrc - xDst; yRel = bounds.y1 + ySrc - yDst; |