summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.h6
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
index 895d4fb7b5e..48bce54ec2f 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
@@ -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[];
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index bde2508847f..008894043a3 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -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;