summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c15
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.h10
2 files changed, 14 insertions, 11 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index fab526da6cf..a0e1d4d8074 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -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;
}
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
index 9eb69ea7f72..98fb609153c 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
@@ -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;