diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-23 14:43:23 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-23 15:16:47 +0100 |
commit | e3f6c48d18c316899c71b6fc34971039c6f9e5f8 (patch) | |
tree | f01ff9a33e818eebba3751fcab37ec8809f84e1c | |
parent | 1af26ea4228a9d7768b475b4f9164d2c7620d4fd (diff) |
sna: Refactor PutImage to avoid calling drawable_gc_flags() too early
drawable_gc_flags() asserts that the gc has been moved to the CPU prior
to its calls so that it can read the reduced raster operation.
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 98a3e689..f51f7325 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3698,7 +3698,6 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth, struct sna_pixmap *priv = sna_pixmap(pixmap); RegionRec region; int16_t dx, dy; - unsigned hint; DBG(("%s((%d, %d)x(%d, %d), depth=%d, format=%d)\n", __FUNCTION__, x, y, w, h, depth, format)); @@ -3727,47 +3726,39 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth, if (priv == NULL) { DBG(("%s: fallback -- unattached(%d, %d, %d, %d)\n", __FUNCTION__, x, y, w, h)); -hint_and_fallback: - hint = (format == XYPixmap ? - MOVE_READ | MOVE_WRITE : - drawable_gc_flags(drawable, gc, false)); goto fallback; } RegionTranslate(®ion, dx, dy); if (FORCE_FALLBACK) - goto hint_and_fallback; + goto fallback; if (wedged(sna)) - goto hint_and_fallback; + goto fallback; if (!ACCEL_PUT_IMAGE) - goto hint_and_fallback; + goto fallback; switch (format) { case ZPixmap: if (!PM_IS_SOLID(drawable, gc->planemask)) - goto hint_and_fallback; + goto fallback; if (sna_put_zpixmap_blt(drawable, gc, ®ion, x, y, w, h, bits, PixmapBytePad(w, depth))) return; - - hint = drawable_gc_flags(drawable, gc, false); break; case XYBitmap: if (!PM_IS_SOLID(drawable, gc->planemask)) - goto hint_and_fallback; + goto fallback; if (sna_put_xybitmap_blt(drawable, gc, ®ion, x, y, w, h, bits)) return; - - hint = drawable_gc_flags(drawable, gc, false); break; case XYPixmap: @@ -3775,8 +3766,6 @@ hint_and_fallback: x, y, w, h, left, bits)) return; - - hint = MOVE_READ | MOVE_WRITE; break; default: @@ -3789,7 +3778,10 @@ fallback: if (!sna_gc_move_to_cpu(gc, drawable, ®ion)) goto out; - if (!sna_drawable_move_region_to_cpu(drawable, ®ion, hint)) + if (!sna_drawable_move_region_to_cpu(drawable, ®ion, + format == XYPixmap ? + MOVE_READ | MOVE_WRITE : + drawable_gc_flags(drawable, gc, false))) goto out_gc; DBG(("%s: fbPutImage(%d, %d, %d, %d)\n", |