Fair enough. Nevermind then. This patch looks good to me, but I'd like somebody who understands DRI image 7 to take a look at the whole series.
Marek On Thu, Oct 10, 2013 at 3:11 AM, Christopher James Halse Rogers <[email protected]> wrote: > On Wed, Oct 9, 2013 at 8:40 PM, Marek Olšák <[email protected]> wrote: >> >> bo_handles_mutex should also be renamed. >> > > The next patch uses this mutex to protect both the bo_names map and a new > bo_handles map. > > I could rename the mutex in this patch, and then unrename in the subsequent > patch if you'd prefer, but this seems like a bit of busywork. > Alternatively, if you can suggest a better name for ‘the mutex that protects > the GEM name→bo and GEM handle→bo maps’, I'd be happy to use that instead. > > >> >> Marek >> >> On Tue, Oct 8, 2013 at 12:48 AM, >> <[email protected]> wrote: >>> >>> From: Christopher James Halse Rogers <[email protected]> >>> >>> It's a map of GEM name->bo, so identify it as such >>> --- >>> src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 16 ++++++++-------- >>> 1 file changed, 8 insertions(+), 8 deletions(-) >>> >>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c >>> b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c >>> index 44fb503..5ddbc00 100644 >>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c >>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c >>> @@ -114,8 +114,8 @@ struct radeon_bomgr { >>> /* Winsys. */ >>> struct radeon_drm_winsys *rws; >>> >>> - /* List of buffer handles and its mutex. */ >>> - struct util_hash_table *bo_handles; >>> + /* List of buffer GEM names. Protected by bo_handles_mutex. */ >>> + struct util_hash_table *bo_names; >>> pipe_mutex bo_handles_mutex; >>> pipe_mutex bo_va_mutex; >>> >>> @@ -372,7 +372,7 @@ static void radeon_bo_destroy(struct pb_buffer >>> *_buf) >>> >>> if (bo->name) { >>> pipe_mutex_lock(bo->mgr->bo_handles_mutex); >>> - util_hash_table_remove(bo->mgr->bo_handles, >>> + util_hash_table_remove(bo->mgr->bo_names, >>> (void*)(uintptr_t)bo->name); >>> pipe_mutex_unlock(bo->mgr->bo_handles_mutex); >>> } >>> @@ -660,7 +660,7 @@ static boolean radeon_bomgr_is_buffer_busy(struct >>> pb_manager *_mgr, >>> static void radeon_bomgr_destroy(struct pb_manager *_mgr) >>> { >>> struct radeon_bomgr *mgr = radeon_bomgr(_mgr); >>> - util_hash_table_destroy(mgr->bo_handles); >>> + util_hash_table_destroy(mgr->bo_names); >>> pipe_mutex_destroy(mgr->bo_handles_mutex); >>> pipe_mutex_destroy(mgr->bo_va_mutex); >>> FREE(mgr); >>> @@ -692,7 +692,7 @@ struct pb_manager *radeon_bomgr_create(struct >>> radeon_drm_winsys *rws) >>> mgr->base.is_buffer_busy = radeon_bomgr_is_buffer_busy; >>> >>> mgr->rws = rws; >>> - mgr->bo_handles = util_hash_table_create(handle_hash, >>> handle_compare); >>> + mgr->bo_names = util_hash_table_create(handle_hash, >>> handle_compare); >>> pipe_mutex_init(mgr->bo_handles_mutex); >>> pipe_mutex_init(mgr->bo_va_mutex); >>> >>> @@ -889,7 +889,7 @@ static struct pb_buffer >>> *radeon_winsys_bo_from_handle(struct radeon_winsys *rws, >>> pipe_mutex_lock(mgr->bo_handles_mutex); >>> >>> /* First check if there already is an existing bo for the handle. >>> */ >>> - bo = util_hash_table_get(mgr->bo_handles, >>> (void*)(uintptr_t)whandle->handle); >>> + bo = util_hash_table_get(mgr->bo_names, >>> (void*)(uintptr_t)whandle->handle); >>> if (bo) { >>> /* Increase the refcount. */ >>> struct pb_buffer *b = NULL; >>> @@ -923,7 +923,7 @@ static struct pb_buffer >>> *radeon_winsys_bo_from_handle(struct radeon_winsys *rws, >>> bo->va = 0; >>> pipe_mutex_init(bo->map_mutex); >>> >>> - util_hash_table_set(mgr->bo_handles, >>> (void*)(uintptr_t)whandle->handle, bo); >>> + util_hash_table_set(mgr->bo_names, >>> (void*)(uintptr_t)whandle->handle, bo); >>> >>> done: >>> pipe_mutex_unlock(mgr->bo_handles_mutex); >>> @@ -989,7 +989,7 @@ static boolean radeon_winsys_bo_get_handle(struct >>> pb_buffer *buffer, >>> bo->flink = flink.name; >>> >>> pipe_mutex_lock(bo->mgr->bo_handles_mutex); >>> - util_hash_table_set(bo->mgr->bo_handles, >>> (void*)(uintptr_t)bo->flink, bo); >>> + util_hash_table_set(bo->mgr->bo_names, >>> (void*)(uintptr_t)bo->flink, bo); >>> pipe_mutex_unlock(bo->mgr->bo_handles_mutex); >>> } >>> whandle->handle = bo->flink; >>> -- >>> 1.8.3.2 >>> >>> _______________________________________________ >>> mesa-dev mailing list >>> [email protected] >>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev >>> > _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
