sna: Mark proxies as dirty on first relocation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-11-08 23:42:10 +00:00
parent 1d2fa5731b
commit 4bfc5e90f5
2 changed files with 20 additions and 10 deletions

View File

@ -111,7 +111,6 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags);
#define LOCAL_I915_PARAM_HAS_NO_RELOC 24
#define LOCAL_I915_PARAM_HAS_HANDLE_LUT 25
#define LOCAL_EXEC_OBJECT_WRITE (1<<2)
#define LOCAL_I915_EXEC_NO_RELOC (1<<10)
#define LOCAL_I915_EXEC_HANDLE_LUT (1<<11)
@ -3907,6 +3906,9 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
bo->exec = &_kgem_dummy_exec;
}
if (read_write_domain & 0x7fff && !bo->dirty)
__kgem_bo_mark_dirty(bo);
bo = bo->proxy;
assert(bo->refcnt);
assert(!bo->purged);
@ -3931,10 +3933,9 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
kgem->reloc[index].target_handle = bo->target_handle;
kgem->reloc[index].presumed_offset = bo->presumed_offset;
if (read_write_domain & 0x7fff) {
if (read_write_domain & 0x7fff && !bo->dirty) {
assert(!bo->snoop || kgem->can_blt_cpu);
bo->exec->flags |= LOCAL_EXEC_OBJECT_WRITE;
kgem_bo_mark_dirty(bo);
__kgem_bo_mark_dirty(bo);
}
delta += bo->presumed_offset;

View File

@ -141,6 +141,7 @@ struct kgem {
uint32_t batch_flags;
#define I915_EXEC_SECURE (1<<9)
#define LOCAL_EXEC_OBJECT_WRITE (1<<2)
uint16_t nbatch;
uint16_t surface;
@ -571,19 +572,27 @@ static inline bool kgem_bo_is_dirty(struct kgem_bo *bo)
return bo->dirty;
}
static inline void __kgem_bo_mark_dirty(struct kgem_bo *bo)
{
DBG(("%s: handle=%d (proxy? %d)\n", __FUNCTION__,
bo->handle, bo->proxy != NULL));
bo->exec->flags |= LOCAL_EXEC_OBJECT_WRITE;
bo->needs_flush = bo->dirty = true;
list_move(&bo->request, &bo->rq->buffers);
}
static inline void kgem_bo_mark_dirty(struct kgem_bo *bo)
{
assert(bo->refcnt);
do {
if (bo->dirty)
return;
DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
assert(bo->exec);
assert(bo->rq);
bo->needs_flush = bo->dirty = true;
list_move(&bo->request, &bo->rq->buffers);
if (bo->dirty)
return;
__kgem_bo_mark_dirty(bo);
} while ((bo = bo->proxy));
}