[Mesa-dev] [PATCH 03/10] intel: Remove the struct intel_region reuse hash table.
Eric Anholt
eric at anholt.net
Mon Jan 28 21:00:31 PST 2013
I don't see any reason for it -- it was introduced with the DRI2
invalidate work by krh in 2010 with no explanation. I suspect it was
something about wanting the same drm_intel_bo struct underneath multiple
openings of the BO within one process, but that's covered by libdrm at
this point. As far as the struct region goes, it is not threadsafe, so
multiple contexts sharing a region could have mixed up the map_count and
assertion failed or worse.
---
src/mesa/drivers/dri/intel/intel_regions.c | 24 +-----------------------
src/mesa/drivers/dri/intel/intel_regions.h | 2 +-
src/mesa/drivers/dri/intel/intel_screen.c | 14 --------------
src/mesa/drivers/dri/intel/intel_screen.h | 1 -
4 files changed, 2 insertions(+), 39 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 89d91b0..2efe724 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -183,7 +183,6 @@ intel_region_alloc_internal(struct intel_screen *screen,
region->refcount = 1;
region->bo = buffer;
region->tiling = tiling;
- region->screen = screen;
_DBG("%s <-- %p\n", __FUNCTION__, region);
return region;
@@ -225,9 +224,6 @@ 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;
-
- _mesa_HashInsert(region->screen->named_regions,
- region->name, region);
}
*name = region->name;
@@ -241,25 +237,11 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
GLuint width, GLuint height, GLuint pitch,
GLuint handle, const char *name)
{
- struct intel_region *region, *dummy;
+ struct intel_region *region;
drm_intel_bo *buffer;
int ret;
uint32_t bit_6_swizzle, tiling;
- region = _mesa_HashLookup(screen->named_regions, handle);
- if (region != NULL) {
- dummy = NULL;
- if (region->width != width || region->height != height ||
- region->cpp != cpp || region->pitch != pitch) {
- fprintf(stderr,
- "Region for name %d already exists but is not compatible\n",
- handle);
- return NULL;
- }
- intel_region_reference(&dummy, region);
- return dummy;
- }
-
buffer = intel_bo_gem_create_from_name(screen->bufmgr, name, handle);
if (buffer == NULL)
return NULL;
@@ -279,7 +261,6 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
}
region->name = handle;
- _mesa_HashInsert(screen->named_regions, handle, region);
return region;
}
@@ -320,9 +301,6 @@ intel_region_release(struct intel_region **region_handle)
drm_intel_bo_unreference(region->bo);
- if (region->name > 0)
- _mesa_HashRemove(region->screen->named_regions, region->name);
-
free(region);
}
*region_handle = NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 1aff5d9..236d16e 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -46,6 +46,7 @@ extern "C" {
#endif
struct intel_context;
+struct intel_screen;
struct intel_buffer_object;
/**
@@ -70,7 +71,6 @@ struct intel_region
uint32_t tiling; /**< Which tiling mode the region is in */
uint32_t name; /**< Global name for the bo */
- struct intel_screen *screen;
};
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index b39bc46..d54d3ba 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -564,7 +564,6 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
image->region->bo = parent->region->bo;
drm_intel_bo_reference(image->region->bo);
image->region->tiling = parent->region->tiling;
- image->region->screen = parent->region->screen;
image->offset = offset;
intel_region_get_tile_masks(image->region, &mask_x, &mask_y, false);
@@ -625,11 +624,6 @@ intel_get_boolean(__DRIscreen *psp, int param)
}
static void
-nop_callback(GLuint key, void *data, void *userData)
-{
-}
-
-static void
intelDestroyScreen(__DRIscreen * sPriv)
{
struct intel_screen *intelScreen = sPriv->driverPrivate;
@@ -637,12 +631,6 @@ intelDestroyScreen(__DRIscreen * sPriv)
dri_bufmgr_destroy(intelScreen->bufmgr);
driDestroyOptionInfo(&intelScreen->optionCache);
- /* Some regions may still have references to them at this point, so
- * flush the hash table to prevent _mesa_DeleteHashTable() from
- * complaining about the hash not being empty; */
- _mesa_HashDeleteAll(intelScreen->named_regions, nop_callback, NULL);
- _mesa_DeleteHashTable(intelScreen->named_regions);
-
free(intelScreen);
sPriv->driverPrivate = NULL;
}
@@ -843,8 +831,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
drm_intel_bufmgr_gem_enable_fenced_relocs(intelScreen->bufmgr);
- intelScreen->named_regions = _mesa_NewHashTable();
-
intelScreen->relaxed_relocations = 0;
intelScreen->relaxed_relocations |=
intel_get_boolean(spriv, I915_PARAM_HAS_RELAXED_DELTA) << 0;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index b9c96be..7da9895 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -67,7 +67,6 @@ struct intel_screen
bool no_vbo;
dri_bufmgr *bufmgr;
- struct _mesa_HashTable *named_regions;
/**
* A unique ID for shader programs.
--
1.7.10.4
More information about the mesa-dev
mailing list