From f91dcc44dcc15850f82666b1bcdd27182400e7dc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 18 May 2012 20:09:41 +0100 Subject: sna: Give the proxy a unique name So that if we cache the current destination bo (for example, gen3) then a new proxy (or even just a new batchbuffer) will indeed cause the destination buffer to be updated. Reported-and-tested-by: Clemens Eisserer Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48636 Signed-off-by: Chris Wilson --- src/sna/kgem.c | 6 ++++-- src/sna/kgem.h | 3 ++- src/sna/sna_gradient.c | 11 +++++++---- src/sna/sna_render.c | 6 +++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index df69b903..470dd243 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3499,7 +3499,8 @@ void kgem_clear_dirty(struct kgem *kgem) } } -struct kgem_bo *kgem_create_proxy(struct kgem_bo *target, +struct kgem_bo *kgem_create_proxy(struct kgem *kgem, + struct kgem_bo *target, int offset, int length) { struct kgem_bo *bo; @@ -3512,6 +3513,7 @@ struct kgem_bo *kgem_create_proxy(struct kgem_bo *target, if (bo == NULL) return NULL; + bo->unique_id = kgem_get_unique_id(kgem); bo->reusable = false; bo->size.bytes = length; @@ -3903,7 +3905,7 @@ done: bo->used = ALIGN(bo->used, 64); assert(bo->mem); *ret = (char *)bo->mem + offset; - return kgem_create_proxy(&bo->base, offset, size); + return kgem_create_proxy(kgem, &bo->base, offset, size); } bool kgem_buffer_is_inplace(struct kgem_bo *_bo) diff --git a/src/sna/kgem.h b/src/sna/kgem.h index 0c266300..0a95da74 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -195,7 +195,8 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem, struct kgem_bo *kgem_create_for_name(struct kgem *kgem, uint32_t name); struct kgem_bo *kgem_create_linear(struct kgem *kgem, int size, unsigned flags); -struct kgem_bo *kgem_create_proxy(struct kgem_bo *target, +struct kgem_bo *kgem_create_proxy(struct kgem *kgem, + struct kgem_bo *target, int offset, int length); struct kgem_bo *kgem_upload_source_image(struct kgem *kgem, diff --git a/src/sna/sna_gradient.c b/src/sna/sna_gradient.c index 32d26c8d..a52cfb51 100644 --- a/src/sna/sna_gradient.c +++ b/src/sna/sna_gradient.c @@ -258,7 +258,8 @@ sna_render_finish_solid(struct sna *sna, bool force) DBG(("sna_render_finish_solid reset\n")); cache->cache_bo = kgem_create_linear(&sna->kgem, sizeof(cache->color), 0); - cache->bo[0] = kgem_create_proxy(cache->cache_bo, 0, sizeof(uint32_t)); + cache->bo[0] = kgem_create_proxy(&sna->kgem, cache->cache_bo, + 0, sizeof(uint32_t)); cache->bo[0]->pitch = 4; if (force) cache->size = 1; @@ -308,7 +309,7 @@ sna_render_get_solid(struct sna *sna, uint32_t color) DBG(("sna_render_get_solid(%d) = %x (new)\n", i, color)); create: - cache->bo[i] = kgem_create_proxy(cache->cache_bo, + cache->bo[i] = kgem_create_proxy(&sna->kgem, cache->cache_bo, i*sizeof(uint32_t), sizeof(uint32_t)); cache->bo[i]->pitch = 4; @@ -331,7 +332,8 @@ static Bool sna_alpha_cache_init(struct sna *sna) for (i = 0; i < 256; i++) { color[i] = i << 24; - cache->bo[i] = kgem_create_proxy(cache->cache_bo, + cache->bo[i] = kgem_create_proxy(&sna->kgem, + cache->cache_bo, sizeof(uint32_t)*i, sizeof(uint32_t)); cache->bo[i]->pitch = 4; @@ -356,7 +358,8 @@ static Bool sna_solid_cache_init(struct sna *sna) * zeroth slot simplifies some of the checks. */ cache->color[0] = 0xffffffff; - cache->bo[0] = kgem_create_proxy(cache->cache_bo, 0, sizeof(uint32_t)); + cache->bo[0] = kgem_create_proxy(&sna->kgem, cache->cache_bo, + 0, sizeof(uint32_t)); cache->bo[0]->pitch = 4; cache->dirty = 1; cache->size = 1; diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 880e1734..7feaa24f 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -870,7 +870,7 @@ sna_render_pixmap_partial(struct sna *sna, } /* How many tiles across are we? */ - channel->bo = kgem_create_proxy(bo, + channel->bo = kgem_create_proxy(&sna->kgem, bo, box.y1 * bo->pitch + offset, h * bo->pitch); if (channel->bo == NULL) @@ -989,7 +989,7 @@ sna_render_picture_partial(struct sna *sna, return 0; /* How many tiles across are we? */ - channel->bo = kgem_create_proxy(bo, + channel->bo = kgem_create_proxy(&sna->kgem, bo, box.y1 * bo->pitch + offset, h * bo->pitch); if (channel->bo == NULL) @@ -1821,7 +1821,7 @@ sna_render_composite_redirect(struct sna *sna, } /* How many tiles across are we? */ - op->dst.bo = kgem_create_proxy(op->dst.bo, + op->dst.bo = kgem_create_proxy(&sna->kgem, op->dst.bo, box.y1 * op->dst.bo->pitch + offset, h * op->dst.bo->pitch); if (!op->dst.bo) { -- cgit v1.2.3