From 3a7a20752fb410075a26b4fa95de0a00e49742b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Apr 2014 12:21:11 -0700 Subject: [PATCH] i965: Drop the global GEM name from regions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Once a buffer has been named, drm_intel_bo_flink() is just a getter. Reviewed-by: Kristian Høgsberg Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/brw_context.c | 11 ++++++++++- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 -- src/mesa/drivers/dri/i965/intel_regions.c | 15 --------------- src/mesa/drivers/dri/i965/intel_regions.h | 5 ----- src/mesa/drivers/dri/i965/intel_screen.c | 4 ++-- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index cad83e24c88..2dbc327ffe5 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1259,7 +1259,16 @@ intel_process_dri2_buffer(struct brw_context *brw, else last_mt = rb->singlesample_mt; - if (last_mt && last_mt->region->name == buffer->name) + /* Get the name for our previous RB mt. We know it had a name already (and + * thus the DRM call is just a getter), because it could only have been + * allocated by a previous intel_process_dri2_buffer(), so + * drm_intel_bo_flink() is just a getter. + */ + uint32_t old_name = 0; + if (last_mt) + drm_intel_bo_flink(last_mt->region->bo, &old_name); + + if (old_name == buffer->name) return; if (unlikely(INTEL_DEBUG & DEBUG_DRI)) { diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 58a6b86fce5..7a606716030 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -723,8 +723,6 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel, if (!singlesample_mt) goto fail; - singlesample_mt->region->name = region->name; - /* If this miptree is capable of supporting fast color clears, set * mcs_state appropriately to ensure that fast clears will occur. * Allocation of the MCS miptree will be deferred until the first fast diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c index 2fc57ed9267..311dc2ce900 100644 --- a/src/mesa/drivers/dri/i965/intel_regions.c +++ b/src/mesa/drivers/dri/i965/intel_regions.c @@ -158,19 +158,6 @@ intel_region_alloc(struct intel_screen *screen, return region; } -bool -intel_region_flink(struct intel_region *region, uint32_t *name) -{ - if (region->name == 0) { - if (drm_intel_bo_flink(region->bo, ®ion->name)) - return false; - } - - *name = region->name; - - return true; -} - struct intel_region * intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, @@ -200,8 +187,6 @@ intel_region_alloc_for_handle(struct intel_screen *screen, return NULL; } - region->name = handle; - return region; } diff --git a/src/mesa/drivers/dri/i965/intel_regions.h b/src/mesa/drivers/dri/i965/intel_regions.h index c4dd243e45c..0ad95a79ce5 100644 --- a/src/mesa/drivers/dri/i965/intel_regions.h +++ b/src/mesa/drivers/dri/i965/intel_regions.h @@ -68,8 +68,6 @@ struct intel_region GLuint pitch; /**< in bytes */ uint32_t tiling; /**< Which tiling mode the region is in */ - - uint32_t name; /**< Global name for the bo */ }; @@ -95,9 +93,6 @@ intel_region_alloc_for_fd(struct intel_screen *screen, GLuint size, int fd, const char *name); -bool -intel_region_flink(struct intel_region *region, uint32_t *name); - void intel_region_reference(struct intel_region **dst, struct intel_region *src); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 778d5008503..976af029d9f 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -525,7 +525,7 @@ intel_query_image(__DRIimage *image, int attrib, int *value) *value = image->region->bo->handle; return true; case __DRI_IMAGE_ATTRIB_NAME: - return intel_region_flink(image->region, (uint32_t *) value); + return !drm_intel_bo_flink(image->region->bo, (uint32_t *) value); case __DRI_IMAGE_ATTRIB_FORMAT: *value = image->dri_format; return true; @@ -1409,7 +1409,7 @@ intelAllocateBuffer(__DRIscreen *screen, return NULL; } - intel_region_flink(intelBuffer->region, &intelBuffer->base.name); + drm_intel_bo_flink(intelBuffer->region->bo, &intelBuffer->base.name); intelBuffer->base.attachment = attachment; intelBuffer->base.cpp = intelBuffer->region->cpp; -- 2.30.2