summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-07-11 23:19:15 -0400
committerMarek Olšák <[email protected]>2018-07-16 13:32:33 -0400
commitcaf41fb96d7e376a25499cf5e8f8c2ec89848439 (patch)
treefe6eee5b3da1d98a7d26e6f6e27fd176a6978cf9 /src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
parent78887e99e3fdc1933c9fd185e38d4e61d05672a4 (diff)
winsys/amdgpu: make amdgpu_cs_context::flags & handles local
Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/winsys/amdgpu/drm/amdgpu_cs.c')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 6628ff9f170..9aa489adaa4 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -902,9 +902,7 @@ static void amdgpu_cs_context_cleanup(struct amdgpu_cs_context *cs)
static void amdgpu_destroy_cs_context(struct amdgpu_cs_context *cs)
{
amdgpu_cs_context_cleanup(cs);
- FREE(cs->flags);
FREE(cs->real_buffers);
- FREE(cs->handles);
FREE(cs->slab_buffers);
FREE(cs->sparse_buffers);
FREE(cs->fence_dependencies);
@@ -1328,19 +1326,8 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
goto bo_list_error;
}
- if (cs->max_real_submit < cs->num_real_buffers) {
- FREE(cs->handles);
- FREE(cs->flags);
-
- cs->handles = MALLOC(sizeof(*cs->handles) * cs->num_real_buffers);
- cs->flags = MALLOC(sizeof(*cs->flags) * cs->num_real_buffers);
-
- if (!cs->handles || !cs->flags) {
- cs->max_real_submit = 0;
- r = -ENOMEM;
- goto bo_list_error;
- }
- }
+ amdgpu_bo_handle *handles = alloca(sizeof(*handles) * cs->num_real_buffers);
+ uint8_t *flags = alloca(sizeof(*flags) * cs->num_real_buffers);
num_handles = 0;
for (i = 0; i < cs->num_real_buffers; ++i) {
@@ -1351,8 +1338,8 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
assert(buffer->u.real.priority_usage != 0);
- cs->handles[num_handles] = buffer->bo->bo;
- cs->flags[num_handles] = (util_last_bit64(buffer->u.real.priority_usage) - 1) / 4;
+ handles[num_handles] = buffer->bo->bo;
+ flags[num_handles] = (util_last_bit64(buffer->u.real.priority_usage) - 1) / 4;
++num_handles;
}
@@ -1361,7 +1348,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
if (num_handles) {
r = amdgpu_bo_list_create(ws->dev, num_handles,
- cs->handles, cs->flags, &bo_list);
+ handles, flags, &bo_list);
} else {
r = 0;
}