glamor: Add missing prepares on the GC during fb fallbacks.

We had regressions in CopyPlane reported by xts5, because we were
(successfully!) dereferencing the null pixmap->devPrivate.ptr for a
tile or stipple without having done a prepare.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
This commit is contained in:
Eric Anholt 2014-01-11 00:06:21 +08:00
parent 93f1824a0b
commit ab68982dcc
4 changed files with 12 additions and 4 deletions

View File

@ -571,10 +571,12 @@ _glamor_copy_n_to_n(DrawablePtr src,
glamor_get_drawable_location(dst));
if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW) &&
glamor_prepare_access(src, GLAMOR_ACCESS_RO)) {
glamor_prepare_access(src, GLAMOR_ACCESS_RO) &&
glamor_prepare_access_gc(gc)) {
fbCopyNtoN(src, dst, gc, box, nbox,
dx, dy, reverse, upsidedown, bitplane, closure);
}
glamor_finish_access_gc(gc);
glamor_finish_access(src);
glamor_finish_access(dst);
ok = TRUE;

View File

@ -39,10 +39,12 @@ _glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
goto fail;
if (glamor_prepare_access(pDst, GLAMOR_ACCESS_RW) &&
glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO)) {
glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO) &&
glamor_prepare_access_gc(pGC)) {
*pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane);
}
glamor_finish_access_gc(pGC);
glamor_finish_access(pSrc);
glamor_finish_access(pDst);
return TRUE;

View File

@ -227,9 +227,11 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
glamor_fallback(": to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
fail:
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) &&
glamor_prepare_access_gc(gc)) {
fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap, bits);
}
glamor_finish_access_gc(gc);
glamor_finish_access(drawable);
}
#endif

View File

@ -86,9 +86,11 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
glamor_fallback("to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
glamor_prepare_access_gc(gc)) {
fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
}
glamor_finish_access_gc(gc);
glamor_finish_access(drawable);
ret = TRUE;