summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2021-02-02 23:57:28 -0500
committerMarge Bot <eric+marge@anholt.net>2021-02-06 05:41:22 +0000
commit4bb9df366a74b0f691c971a674357beebad4e86d (patch)
tree698c7999474a22b1018c0e4b8542b4010f638fdd /src/gallium
parentc3778b8fe147e7ac09cc55e3e59c0f642ce5cbc2 (diff)
winsys/amdgpu: move amdgpu_winsys_bo::cpu_ptr into the u.real union
It's never used 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>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c16
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 75bfe6e2aff..fab526da6cf 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -174,8 +174,8 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf)
assert(bo->bo && "must not be called for slab entries");
- if (!bo->is_user_ptr && bo->cpu_ptr) {
- bo->cpu_ptr = NULL;
+ if (!bo->is_user_ptr && bo->u.real.cpu_ptr) {
+ bo->u.real.cpu_ptr = NULL;
amdgpu_bo_unmap(&bo->base);
}
assert(bo->is_user_ptr || bo->u.real.map_count == 0);
@@ -378,24 +378,24 @@ void *amdgpu_bo_map(struct pb_buffer *buf,
if (usage & RADEON_MAP_TEMPORARY) {
if (real->is_user_ptr) {
- cpu = real->cpu_ptr;
+ cpu = real->u.real.cpu_ptr;
} else {
if (!amdgpu_bo_do_map(real, &cpu))
return NULL;
}
} else {
- cpu = p_atomic_read(&real->cpu_ptr);
+ cpu = p_atomic_read(&real->u.real.cpu_ptr);
if (!cpu) {
simple_mtx_lock(&real->lock);
/* Must re-check due to the possibility of a race. Re-check need not
* be atomic thanks to the lock. */
- cpu = real->cpu_ptr;
+ cpu = real->u.real.cpu_ptr;
if (!cpu) {
if (!amdgpu_bo_do_map(real, &cpu)) {
simple_mtx_unlock(&real->lock);
return NULL;
}
- p_atomic_set(&real->cpu_ptr, cpu);
+ p_atomic_set(&real->u.real.cpu_ptr, cpu);
}
simple_mtx_unlock(&real->lock);
}
@@ -417,7 +417,7 @@ void amdgpu_bo_unmap(struct pb_buffer *buf)
real = bo->bo ? bo : bo->u.slab.real;
assert(real->u.real.map_count != 0 && "too many unmaps");
if (p_atomic_dec_zero(&real->u.real.map_count)) {
- assert(!real->cpu_ptr &&
+ assert(!real->u.real.cpu_ptr &&
"too many unmaps or forgot RADEON_MAP_TEMPORARY flag");
if (real->base.placement & RADEON_DOMAIN_VRAM)
@@ -1729,7 +1729,7 @@ static struct pb_buffer *amdgpu_bo_from_ptr(struct radeon_winsys *rws,
bo->base.size = size;
bo->base.vtbl = &amdgpu_winsys_bo_vtbl;
bo->ws = ws;
- bo->cpu_ptr = pointer;
+ bo->u.real.cpu_ptr = pointer;
bo->va = va;
bo->u.real.va_handle = va_handle;
bo->base.placement = RADEON_DOMAIN_GTT;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
index 9bf23a6f88a..9eb69ea7f72 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
@@ -63,6 +63,7 @@ struct amdgpu_winsys_bo {
#if DEBUG
struct list_head global_list_item;
#endif
+ void *cpu_ptr; /* for user_ptr and permanent maps */
uint32_t kms_handle;
int map_count;
} real;
@@ -84,7 +85,6 @@ struct amdgpu_winsys_bo {
} u;
struct amdgpu_winsys *ws;
- void *cpu_ptr; /* for user_ptr and permanent maps */
amdgpu_bo_handle bo; /* NULL for slab entries and sparse buffers */
bool is_user_ptr;