winsys/amdgpu: move amdgpu_winsys_bo::is_shared to the u.real union

It's never true with slab and sparse buffers.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8849>
This commit is contained in:
Marek Olšák
2021-02-03 00:03:22 -05:00
committed by Marge Bot
parent 4bb9df366a
commit 96c188d023
2 changed files with 14 additions and 11 deletions
+9 -6
View File
@@ -66,9 +66,12 @@ static bool amdgpu_bo_wait(struct pb_buffer *_buf, uint64_t timeout,
return false;
}
simple_mtx_lock(&bo->lock);
bool is_shared = bo->is_shared;
simple_mtx_unlock(&bo->lock);
bool is_shared = false;
if (bo->bo) {
simple_mtx_lock(&bo->lock);
is_shared = bo->u.real.is_shared;
simple_mtx_unlock(&bo->lock);
}
if (is_shared) {
/* We can't use user fences for shared buffers, because user fences
@@ -1584,7 +1587,7 @@ static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
bo->base.placement = initial;
bo->base.usage = flags;
bo->unique_id = __sync_fetch_and_add(&ws->next_bo_unique_id, 1);
bo->is_shared = true;
bo->u.real.is_shared = true;
if (bo->base.placement & RADEON_DOMAIN_VRAM)
ws->allocated_vram += align64(bo->base.size, ws->info.gart_page_size);
@@ -1636,7 +1639,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
whandle->handle = bo->u.real.kms_handle;
simple_mtx_lock(&bo->lock);
bool is_shared = bo->is_shared;
bool is_shared = bo->u.real.is_shared;
simple_mtx_unlock(&bo->lock);
if (is_shared)
@@ -1686,7 +1689,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
simple_mtx_unlock(&ws->bo_export_table_lock);
simple_mtx_lock(&bo->lock);
bo->is_shared = true;
bo->u.real.is_shared = true;
simple_mtx_unlock(&bo->lock);
return true;
}
+5 -5
View File
@@ -66,6 +66,11 @@ struct amdgpu_winsys_bo {
void *cpu_ptr; /* for user_ptr and permanent maps */
uint32_t kms_handle;
int map_count;
/* Whether buffer_get_handle or buffer_from_handle has been called,
* it can only transition from false to true. Protected by lock.
*/
bool is_shared;
} real;
struct {
struct pb_slab_entry entry;
@@ -90,11 +95,6 @@ struct amdgpu_winsys_bo {
bool is_user_ptr;
bool use_reusable_pool;
/* Whether buffer_get_handle or buffer_from_handle has been called,
* it can only transition from false to true. Protected by lock.
*/
bool is_shared;
uint32_t unique_id;
uint64_t va;
simple_mtx_t lock;