winsys/amdgpu: use the new BO list API
This commit is contained in:
@@ -87,7 +87,7 @@ AC_SUBST([OPENCL_VERSION])
|
|||||||
# in the first entry.
|
# in the first entry.
|
||||||
LIBDRM_REQUIRED=2.4.75
|
LIBDRM_REQUIRED=2.4.75
|
||||||
LIBDRM_RADEON_REQUIRED=2.4.71
|
LIBDRM_RADEON_REQUIRED=2.4.71
|
||||||
LIBDRM_AMDGPU_REQUIRED=2.4.95
|
LIBDRM_AMDGPU_REQUIRED=2.4.97
|
||||||
LIBDRM_INTEL_REQUIRED=2.4.75
|
LIBDRM_INTEL_REQUIRED=2.4.75
|
||||||
LIBDRM_NVVIEUX_REQUIRED=2.4.66
|
LIBDRM_NVVIEUX_REQUIRED=2.4.66
|
||||||
LIBDRM_NOUVEAU_REQUIRED=2.4.66
|
LIBDRM_NOUVEAU_REQUIRED=2.4.66
|
||||||
|
@@ -1109,7 +1109,7 @@ dep_libdrm_nouveau = null_dep
|
|||||||
dep_libdrm_etnaviv = null_dep
|
dep_libdrm_etnaviv = null_dep
|
||||||
dep_libdrm_intel = null_dep
|
dep_libdrm_intel = null_dep
|
||||||
|
|
||||||
_drm_amdgpu_ver = '2.4.95'
|
_drm_amdgpu_ver = '2.4.97'
|
||||||
_drm_radeon_ver = '2.4.71'
|
_drm_radeon_ver = '2.4.71'
|
||||||
_drm_nouveau_ver = '2.4.66'
|
_drm_nouveau_ver = '2.4.66'
|
||||||
_drm_etnaviv_ver = '2.4.89'
|
_drm_etnaviv_ver = '2.4.89'
|
||||||
|
@@ -1297,7 +1297,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
|||||||
struct amdgpu_winsys *ws = acs->ctx->ws;
|
struct amdgpu_winsys *ws = acs->ctx->ws;
|
||||||
struct amdgpu_cs_context *cs = acs->cst;
|
struct amdgpu_cs_context *cs = acs->cst;
|
||||||
int i, r;
|
int i, r;
|
||||||
amdgpu_bo_list_handle bo_list = NULL;
|
uint32_t bo_list = 0;
|
||||||
uint64_t seq_no = 0;
|
uint64_t seq_no = 0;
|
||||||
bool has_user_fence = amdgpu_cs_has_user_fence(cs);
|
bool has_user_fence = amdgpu_cs_has_user_fence(cs);
|
||||||
bool use_bo_list_create = ws->info.drm_minor < 27;
|
bool use_bo_list_create = ws->info.drm_minor < 27;
|
||||||
@@ -1308,27 +1308,28 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
|||||||
/* The buffer list contains all buffers. This is a slow path that
|
/* The buffer list contains all buffers. This is a slow path that
|
||||||
* ensures that no buffer is missing in the BO list.
|
* ensures that no buffer is missing in the BO list.
|
||||||
*/
|
*/
|
||||||
|
unsigned num_handles = 0;
|
||||||
|
struct drm_amdgpu_bo_list_entry *list =
|
||||||
|
alloca(ws->num_buffers * sizeof(struct drm_amdgpu_bo_list_entry));
|
||||||
struct amdgpu_winsys_bo *bo;
|
struct amdgpu_winsys_bo *bo;
|
||||||
amdgpu_bo_handle *handles;
|
|
||||||
unsigned num = 0;
|
|
||||||
|
|
||||||
simple_mtx_lock(&ws->global_bo_list_lock);
|
simple_mtx_lock(&ws->global_bo_list_lock);
|
||||||
handles = alloca(sizeof(handles[0]) * ws->num_buffers);
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(bo, &ws->global_bo_list, u.real.global_list_item) {
|
LIST_FOR_EACH_ENTRY(bo, &ws->global_bo_list, u.real.global_list_item) {
|
||||||
assert(num < ws->num_buffers);
|
if (bo->is_local)
|
||||||
handles[num++] = bo->bo;
|
continue;
|
||||||
|
|
||||||
|
list[num_handles].bo_handle = bo->u.real.kms_handle;
|
||||||
|
list[num_handles].bo_priority = 0;
|
||||||
|
++num_handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = amdgpu_bo_list_create(ws->dev, ws->num_buffers,
|
r = amdgpu_bo_list_create_raw(ws->dev, ws->num_buffers, list, &bo_list);
|
||||||
handles, NULL, &bo_list);
|
|
||||||
simple_mtx_unlock(&ws->global_bo_list_lock);
|
simple_mtx_unlock(&ws->global_bo_list_lock);
|
||||||
if (r) {
|
if (r) {
|
||||||
fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
|
fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (!use_bo_list_create) {
|
} else {
|
||||||
/* Standard path passing the buffer list via the CS ioctl. */
|
|
||||||
if (!amdgpu_add_sparse_backing_buffers(cs)) {
|
if (!amdgpu_add_sparse_backing_buffers(cs)) {
|
||||||
fprintf(stderr, "amdgpu: amdgpu_add_sparse_backing_buffers failed\n");
|
fprintf(stderr, "amdgpu: amdgpu_add_sparse_backing_buffers failed\n");
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
@@ -1352,45 +1353,20 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
|||||||
++num_handles;
|
++num_handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo_list_in.operation = ~0;
|
if (use_bo_list_create) {
|
||||||
bo_list_in.list_handle = ~0;
|
/* Legacy path creating the buffer list handle and passing it to the CS ioctl. */
|
||||||
bo_list_in.bo_number = num_handles;
|
r = amdgpu_bo_list_create_raw(ws->dev, num_handles, list, &bo_list);
|
||||||
bo_list_in.bo_info_size = sizeof(struct drm_amdgpu_bo_list_entry);
|
|
||||||
bo_list_in.bo_info_ptr = (uint64_t)(uintptr_t)list;
|
|
||||||
} else {
|
|
||||||
/* Legacy path creating the buffer list handle and passing it to the CS ioctl. */
|
|
||||||
unsigned num_handles;
|
|
||||||
|
|
||||||
if (!amdgpu_add_sparse_backing_buffers(cs)) {
|
|
||||||
fprintf(stderr, "amdgpu: amdgpu_add_sparse_backing_buffers failed\n");
|
|
||||||
r = -ENOMEM;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
struct amdgpu_cs_buffer *buffer = &cs->real_buffers[i];
|
|
||||||
|
|
||||||
if (buffer->bo->is_local)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
assert(buffer->u.real.priority_usage != 0);
|
|
||||||
|
|
||||||
handles[num_handles] = buffer->bo->bo;
|
|
||||||
flags[num_handles] = (util_last_bit(buffer->u.real.priority_usage) - 1) / 2;
|
|
||||||
++num_handles;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_handles) {
|
|
||||||
r = amdgpu_bo_list_create(ws->dev, num_handles,
|
|
||||||
handles, flags, &bo_list);
|
|
||||||
if (r) {
|
if (r) {
|
||||||
fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
|
fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Standard path passing the buffer list via the CS ioctl. */
|
||||||
|
bo_list_in.operation = ~0;
|
||||||
|
bo_list_in.list_handle = ~0;
|
||||||
|
bo_list_in.bo_number = num_handles;
|
||||||
|
bo_list_in.bo_info_size = sizeof(struct drm_amdgpu_bo_list_entry);
|
||||||
|
bo_list_in.bo_info_ptr = (uint64_t)(uintptr_t)list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1501,8 +1477,8 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
|||||||
|
|
||||||
assert(num_chunks <= ARRAY_SIZE(chunks));
|
assert(num_chunks <= ARRAY_SIZE(chunks));
|
||||||
|
|
||||||
r = amdgpu_cs_submit_raw(ws->dev, acs->ctx->ctx, bo_list,
|
r = amdgpu_cs_submit_raw2(ws->dev, acs->ctx->ctx, bo_list,
|
||||||
num_chunks, chunks, &seq_no);
|
num_chunks, chunks, &seq_no);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r) {
|
if (r) {
|
||||||
@@ -1527,7 +1503,7 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
|||||||
|
|
||||||
/* Cleanup. */
|
/* Cleanup. */
|
||||||
if (bo_list)
|
if (bo_list)
|
||||||
amdgpu_bo_list_destroy(bo_list);
|
amdgpu_bo_list_destroy_raw(ws->dev, bo_list);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/* If there was an error, signal the fence, because it won't be signalled
|
/* If there was an error, signal the fence, because it won't be signalled
|
||||||
|
Reference in New Issue
Block a user