mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
radv/amdgpu: Separate the concept of residency from use_global_list.
A BO can be always resident by two ways: 1. Through kernel bookkeeping. The BO is created with AMDGPU_GEM_CREATE_VM_ALWAYS_VALID and bo->is_local gets set to true. 2. Through the driver global BO list. On every submission, the global BO list is added to the CS's BO list. Until now, use_global_list reflected either 1. or 2. . This commit changes it to reflect 2. only, and update callsites that checks for residency to use a new helper. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26591>
This commit is contained in:
parent
63120a55b8
commit
c3c3a8926a
2 changed files with 11 additions and 3 deletions
|
|
@ -184,8 +184,10 @@ struct radeon_winsys_ctx;
|
|||
|
||||
struct radeon_winsys_bo {
|
||||
uint64_t va;
|
||||
/* buffer is created with AMDGPU_GEM_CREATE_VM_ALWAYS_VALID */
|
||||
bool is_local;
|
||||
bool vram_no_cpu_access;
|
||||
/* buffer is added to the BO list of all submissions */
|
||||
bool use_global_list;
|
||||
enum radeon_bo_domain initial_domain;
|
||||
};
|
||||
|
|
@ -345,10 +347,16 @@ radv_buffer_get_va(const struct radeon_winsys_bo *bo)
|
|||
return bo->va;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
radv_buffer_is_resident(const struct radeon_winsys_bo *bo)
|
||||
{
|
||||
return bo->use_global_list || bo->is_local;
|
||||
}
|
||||
|
||||
static inline void
|
||||
radv_cs_add_buffer(struct radeon_winsys *ws, struct radeon_cmdbuf *cs, struct radeon_winsys_bo *bo)
|
||||
{
|
||||
if (bo->use_global_list)
|
||||
if (radv_buffer_is_resident(bo))
|
||||
return;
|
||||
|
||||
ws->cs_add_buffer(cs, bo);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ radv_amdgpu_winsys_bo_virtual_bind(struct radeon_winsys *_ws, struct radeon_wins
|
|||
* The issue still exists for non-global BO but it will be addressed later, once we are 100% it's
|
||||
* RADV fault (mostly because the solution looks more complicated).
|
||||
*/
|
||||
if (bo && bo->base.use_global_list) {
|
||||
if (bo && radv_buffer_is_resident(&bo->base)) {
|
||||
bo = NULL;
|
||||
bo_offset = 0;
|
||||
}
|
||||
|
|
@ -514,7 +514,7 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws, uint64_t size, unsigned
|
|||
|
||||
bo->bo = buf_handle;
|
||||
bo->base.initial_domain = initial_domain;
|
||||
bo->base.use_global_list = bo->base.is_local;
|
||||
bo->base.use_global_list = false;
|
||||
bo->priority = priority;
|
||||
|
||||
r = amdgpu_bo_export(buf_handle, amdgpu_bo_handle_type_kms, &bo->bo_handle);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue