winsys/amdgpu: remove another 8 bytes from amdgpu_winsys_bo by packing better

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9809>
This commit is contained in:
Marek Olšák 2021-03-28 06:49:55 -04:00 committed by Marge Bot
parent 815d98c22d
commit c105c8ad2c
2 changed files with 8 additions and 5 deletions

View File

@ -93,9 +93,9 @@ struct amdgpu_winsys_bo {
} u;
amdgpu_bo_handle bo; /* NULL for slab entries and sparse buffers */
uint64_t va;
uint32_t unique_id;
uint64_t va;
simple_mtx_t lock;
/* how many command streams, which are being emitted in a separate
@ -103,8 +103,8 @@ struct amdgpu_winsys_bo {
volatile int num_active_ioctls;
/* Fences for buffer synchronization. */
unsigned num_fences;
unsigned max_fences;
uint16_t num_fences;
uint16_t max_fences;
struct pipe_fence_handle **fences;
struct pb_cache_entry cache_entry[];

View File

@ -1334,13 +1334,16 @@ void amdgpu_add_fences(struct amdgpu_winsys_bo *bo,
REALLOC(bo->fences,
bo->num_fences * sizeof(*new_fences),
new_max_fences * sizeof(*new_fences));
if (likely(new_fences)) {
if (likely(new_fences && new_max_fences < UINT16_MAX)) {
bo->fences = new_fences;
bo->max_fences = new_max_fences;
} else {
unsigned drop;
fprintf(stderr, "amdgpu_add_fences: allocation failure, dropping fence(s)\n");
fprintf(stderr, new_fences ? "amdgpu_add_fences: too many fences, dropping some\n"
: "amdgpu_add_fences: allocation failure, dropping fence(s)\n");
free(new_fences);
if (!bo->num_fences)
return;