From fccc427aac17b3fa17160332e6e6f3c2cef25ca5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 May 2008 15:12:15 -0700 Subject: [PATCH] [intel-gem] Remember last offset of reused BOs to avoid more kernel relocs. This is good for about 5% on ipers on 965, and should help any cpu-bound app. --- src/mesa/drivers/dri/intel/intel_bufmgr_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_gem.c b/src/mesa/drivers/dri/intel/intel_bufmgr_gem.c index f762b485f6e..3c1c3157e13 100644 --- a/src/mesa/drivers/dri/intel/intel_bufmgr_gem.c +++ b/src/mesa/drivers/dri/intel/intel_bufmgr_gem.c @@ -65,6 +65,7 @@ struct intel_validate_entry { struct dri_gem_bo_bucket_entry { uint32_t gem_handle; + uint32_t last_offset; struct dri_gem_bo_bucket_entry *next; }; @@ -306,6 +307,7 @@ dri_gem_bo_alloc(dri_bufmgr *bufmgr, const char *name, bucket->num_entries--; bo_gem->gem_handle = entry->gem_handle; + bo_gem->bo.offset = entry->last_offset; free(entry); } } @@ -324,7 +326,6 @@ dri_gem_bo_alloc(dri_bufmgr *bufmgr, const char *name, } } - bo_gem->bo.offset = 0; bo_gem->bo.virtual = NULL; bo_gem->bo.bufmgr = bufmgr; bo_gem->name = name; @@ -436,6 +437,7 @@ dri_gem_bo_unreference(dri_bo *bo) entry = calloc(1, sizeof(*entry)); entry->gem_handle = bo_gem->gem_handle; + entry->last_offset = bo->offset; entry->next = NULL; *bucket->tail = entry; -- 2.30.2