From: Pierre-Eric Pelloux-Prayer Date: Thu, 16 Jan 2020 11:31:24 +0000 (+0100) Subject: radeonsi: stop using the VM_ALWAYS_VALID flag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab54624d0d52d88da7fb7f4df61f33f600a1dfd7;p=mesa.git 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 Tested-by: Marge Bot Part-of: --- diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index e6a5a7773e0..3762b9d0c44 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -36,10 +36,6 @@ #include #include -#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); diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h index 18ef7e1fa51..fa8aabbeede 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h @@ -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; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index 47973d00d1d..4308cfb3f96 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -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;