diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-02-22 17:00:38 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-02-22 17:12:24 +0000 |
commit | f6392048e3e761b35644268ef161045524cfa369 (patch) | |
tree | d8d0507277c4c3207f6bdb58906aade0b5df20ad /src | |
parent | 4e86da64be947fe4b8b5f285d26d200827847a8c (diff) |
sna/blt: Avoid clobbering the composite state if we fail to setup the BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/gen3_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 15 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 19 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 7 |
4 files changed, 19 insertions, 24 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 03b80c5c..5253a8c4 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -2282,7 +2282,7 @@ source_use_blt(struct sna *sna, PicturePtr picture) if (sna->kgem.has_vmap) return false; - return is_cpu(picture->pDrawable); + return is_cpu(picture->pDrawable) || is_dirty(picture->pDrawable); } static Bool diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index ff9e4628..64be24b3 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -2012,7 +2012,7 @@ picture_is_cpu(PicturePtr picture) if (too_large(picture->pDrawable->width, picture->pDrawable->height)) return TRUE; - return is_cpu(picture->pDrawable); + return is_cpu(picture->pDrawable) || is_dirty(picture->pDrawable); } static Bool @@ -2377,19 +2377,6 @@ gen5_render_composite(struct sna *sna, goto cleanup_mask; } - if (kgem_bo_is_dirty(tmp->src.bo) || kgem_bo_is_dirty(tmp->mask.bo)) { - if (mask == NULL && - tmp->redirect.real_bo == NULL && - sna_blt_composite(sna, op, - src, dst, - src_x, src_y, - dst_x, dst_y, - width, height, tmp)) { - kgem_bo_destroy(&sna->kgem, tmp->src.bo); - return TRUE; - } - } - gen5_bind_surfaces(sna, tmp); gen5_align_vertex(sna, tmp); return TRUE; diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index a7ea95c0..a672c46d 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -1552,8 +1552,8 @@ sna_blt_composite(struct sna *sna, int16_t width, int16_t height, struct sna_composite_op *tmp) { - struct sna_blt_state *blt = &tmp->u.blt; PictFormat src_format = src->format; + PixmapPtr src_pixmap; struct sna_pixmap *priv; int16_t tx, ty; uint32_t alpha_fixup; @@ -1688,30 +1688,31 @@ sna_blt_composite(struct sna *sna, return FALSE; } - blt->src_pixmap = get_drawable_pixmap(src->pDrawable); - get_drawable_deltas(src->pDrawable, blt->src_pixmap, &tx, &ty); + src_pixmap = get_drawable_pixmap(src->pDrawable); + get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty); x += tx + src->pDrawable->x; y += ty + src->pDrawable->y; if (x < 0 || y < 0 || - x + width > blt->src_pixmap->drawable.width || - y + height > blt->src_pixmap->drawable.height) { + x + width > src_pixmap->drawable.width || + y + height > src_pixmap->drawable.height) { DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid pixmap %dx%d\n", __FUNCTION__, - x, y, x+width, y+width, blt->src_pixmap->drawable.width, blt->src_pixmap->drawable.height)); + x, y, x+width, y+width, src_pixmap->drawable.width, src_pixmap->drawable.height)); return FALSE; } + tmp->u.blt.src_pixmap = src_pixmap; tmp->u.blt.sx = x - dst_x; tmp->u.blt.sy = y - dst_y; DBG(("%s: blt dst offset (%d, %d), source offset (%d, %d), with alpha fixup? %x\n", __FUNCTION__, tmp->dst.x, tmp->dst.y, tmp->u.blt.sx, tmp->u.blt.sy, alpha_fixup)); - if (has_gpu_area(blt->src_pixmap, x, y, width, height)) + if (has_gpu_area(src_pixmap, x, y, width, height)) ret = prepare_blt_copy(sna, tmp, alpha_fixup); - else if (has_cpu_area(blt->src_pixmap, x, y, width, height)) + else if (has_cpu_area(src_pixmap, x, y, width, height)) ret = prepare_blt_put(sna, tmp, alpha_fixup); - else if (sna_pixmap_move_to_gpu(blt->src_pixmap, MOVE_READ)) + else if (sna_pixmap_move_to_gpu(src_pixmap, MOVE_READ)) ret = prepare_blt_copy(sna, tmp, alpha_fixup); else ret = prepare_blt_put(sna, tmp, alpha_fixup); diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index 2805a017..6c8f66ab 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -89,6 +89,13 @@ is_cpu(DrawablePtr drawable) } static inline Bool +is_dirty(DrawablePtr drawable) +{ + struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable); + return priv == NULL || kgem_bo_is_dirty(priv->gpu_bo); +} + +static inline Bool too_small(DrawablePtr drawable) { struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable); |