radeonsi: stop using the VM_ALWAYS_VALID flag
Allocation all the bo as ALWAYS_VALID means they must all fit in memory (vram + gtt) at each command submission. This causes some trouble when the total allocated memory is greater than the available memory. Possible solutions: - being able to tag/untag a bo as ALWAYS_VALID: would require kernel changes - disable VM_ALWAYS_VALID when memory usage is more than a percentage of the available memory - disable VM_ALWAYS_VALID entirely v1 of this patch implemented option 2. v2 (this version) implements option 3. Related issues: - https://gitlab.freedesktop.org/drm/amd/issues/607 - https://gitlab.freedesktop.org/mesa/mesa/issues/1257 It also helps with some piglit tests (-t maxsize -t "max[_-].*size" -t maxuniformblocksize): instead of crashing the machine, the tests fail cleanly. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2190 Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3430> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3430>
This commit is contained in:
@@ -36,10 +36,6 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef AMDGPU_GEM_CREATE_VM_ALWAYS_VALID
|
||||
#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
|
||||
#endif
|
||||
|
||||
#ifndef AMDGPU_VA_RANGE_HIGH
|
||||
#define AMDGPU_VA_RANGE_HIGH 0x2
|
||||
#endif
|
||||
@@ -504,9 +500,6 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
|
||||
request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
|
||||
if (flags & RADEON_FLAG_GTT_WC)
|
||||
request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
|
||||
if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
|
||||
ws->info.has_local_buffers)
|
||||
request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;
|
||||
if (ws->zero_all_vram_allocs &&
|
||||
(request.preferred_heap & AMDGPU_GEM_DOMAIN_VRAM))
|
||||
request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
|
||||
@@ -556,7 +549,6 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
|
||||
bo->u.real.va_handle = va_handle;
|
||||
bo->initial_domain = initial_domain;
|
||||
bo->unique_id = __sync_fetch_and_add(&ws->next_bo_unique_id, 1);
|
||||
bo->is_local = !!(request.flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID);
|
||||
|
||||
if (initial_domain & RADEON_DOMAIN_VRAM)
|
||||
ws->allocated_vram += align64(size, ws->info.gart_page_size);
|
||||
|
@@ -93,7 +93,6 @@ struct amdgpu_winsys_bo {
|
||||
amdgpu_bo_handle bo; /* NULL for slab entries and sparse buffers */
|
||||
bool sparse;
|
||||
bool is_user_ptr;
|
||||
bool is_local;
|
||||
uint32_t unique_id;
|
||||
uint64_t va;
|
||||
enum radeon_bo_domain initial_domain;
|
||||
|
@@ -1398,9 +1398,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
||||
|
||||
simple_mtx_lock(&ws->global_bo_list_lock);
|
||||
LIST_FOR_EACH_ENTRY(bo, &ws->global_bo_list, u.real.global_list_item) {
|
||||
if (bo->is_local)
|
||||
continue;
|
||||
|
||||
list[num_handles].bo_handle = bo->u.real.kms_handle;
|
||||
list[num_handles].bo_priority = 0;
|
||||
++num_handles;
|
||||
@@ -1425,10 +1422,6 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
|
||||
unsigned 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);
|
||||
|
||||
list[num_handles].bo_handle = buffer->bo->u.real.kms_handle;
|
||||
|
Reference in New Issue
Block a user