summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-01-28 05:37:43 +1000
committerEric Anholt <[email protected]>2013-03-05 16:02:37 -0800
commit3c9532314c6d1bd0dd9ce0e0ee58925569c450ee (patch)
tree557bfd506e04cbca776bb443eba35115708c38f3 /src
parente77234be390157b620a8a751df6fae563b8b87f4 (diff)
intel: Remove the struct intel_region reuse hash table.
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. Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c24
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h1
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 7f535d7cdc4..049af43ca9f 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, &region->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 93181414c91..750b89ba629 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 109cba8b719..0d39b9d3b30 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -680,7 +680,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_setup_image_from_dimensions(image);
@@ -743,11 +742,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;
@@ -755,12 +749,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;
}
@@ -968,8 +956,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 b9c96be5b39..7da98950aca 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.