mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 08:20:12 +01:00
radeonsi: determine VM_ALWAYS_VALID accurately
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34491>
This commit is contained in:
parent
480c8addd8
commit
dc70e1c198
4 changed files with 21 additions and 6 deletions
|
|
@ -791,9 +791,9 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex
|
|||
}
|
||||
|
||||
/* Move a suballocated texture into a non-suballocated allocation. */
|
||||
if (sscreen->ws->buffer_is_suballocated(res->buf) || tex->surface.tile_swizzle ||
|
||||
(tex->buffer.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
|
||||
sscreen->info.has_local_buffers)) {
|
||||
if (sscreen->ws->buffer_is_suballocated(res->buf) ||
|
||||
sscreen->ws->buffer_has_vm_always_valid(res->buf) ||
|
||||
tex->surface.tile_swizzle) {
|
||||
assert(!res->b.is_shared);
|
||||
si_reallocate_texture_inplace(sctx, tex, PIPE_BIND_SHARED, false);
|
||||
flush = true;
|
||||
|
|
@ -868,9 +868,7 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex
|
|||
/* Buffer exports are for the OpenCL interop. */
|
||||
/* Move a suballocated buffer into a non-suballocated allocation. */
|
||||
if (sscreen->ws->buffer_is_suballocated(res->buf) ||
|
||||
/* A DMABUF export always fails if the BO is local. */
|
||||
(tex->buffer.flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
|
||||
sscreen->info.has_local_buffers)) {
|
||||
sscreen->ws->buffer_has_vm_always_valid(res->buf)) {
|
||||
assert(!res->b.is_shared);
|
||||
|
||||
/* Allocate a new buffer with PIPE_BIND_SHARED. */
|
||||
|
|
|
|||
|
|
@ -446,6 +446,9 @@ struct radeon_winsys {
|
|||
/** Whether the buffer was suballocated. */
|
||||
bool (*buffer_is_suballocated)(struct pb_buffer_lean *buf);
|
||||
|
||||
/** Whether the buffer has AMDGPU_GEM_CREATE_VM_ALWAYS_VALID. */
|
||||
bool (*buffer_has_vm_always_valid)(struct pb_buffer_lean *buf);
|
||||
|
||||
/**
|
||||
* Get a winsys handle from a winsys buffer. The internal structure
|
||||
* of the handle is platform-specific and only a winsys should access it.
|
||||
|
|
|
|||
|
|
@ -1899,6 +1899,13 @@ static bool amdgpu_bo_is_suballocated(struct pb_buffer_lean *buf)
|
|||
return bo->type == AMDGPU_BO_SLAB_ENTRY;
|
||||
}
|
||||
|
||||
static bool amdgpu_bo_has_vm_always_valid(struct pb_buffer_lean *buf)
|
||||
{
|
||||
struct amdgpu_winsys_bo *bo = (struct amdgpu_winsys_bo*)buf;
|
||||
|
||||
return get_real_bo(bo)->vm_always_valid;
|
||||
}
|
||||
|
||||
uint64_t amdgpu_bo_get_va(struct pb_buffer_lean *buf)
|
||||
{
|
||||
struct amdgpu_winsys_bo *bo = amdgpu_winsys_bo(buf);
|
||||
|
|
@ -1940,6 +1947,7 @@ void amdgpu_bo_init_functions(struct amdgpu_screen_winsys *sws)
|
|||
sws->base.buffer_from_ptr = amdgpu_bo_from_ptr;
|
||||
sws->base.buffer_is_user_ptr = amdgpu_bo_is_user_ptr;
|
||||
sws->base.buffer_is_suballocated = amdgpu_bo_is_suballocated;
|
||||
sws->base.buffer_has_vm_always_valid = amdgpu_bo_has_vm_always_valid;
|
||||
sws->base.buffer_get_handle = amdgpu_bo_get_handle;
|
||||
sws->base.buffer_commit = amdgpu_bo_sparse_commit;
|
||||
sws->base.buffer_find_next_committed_memory = amdgpu_bo_find_next_committed_memory;
|
||||
|
|
|
|||
|
|
@ -1344,6 +1344,11 @@ static bool radeon_winsys_bo_is_suballocated(struct pb_buffer_lean *buf)
|
|||
return !((struct radeon_bo*)buf)->handle;
|
||||
}
|
||||
|
||||
static bool radeon_winsys_bo_has_vm_always_valid(struct pb_buffer_lean *buf)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint64_t radeon_winsys_bo_va(struct pb_buffer_lean *buf)
|
||||
{
|
||||
return ((struct radeon_bo*)buf)->va;
|
||||
|
|
@ -1372,6 +1377,7 @@ void radeon_drm_bo_init_functions(struct radeon_drm_winsys *ws)
|
|||
ws->base.buffer_from_ptr = radeon_winsys_bo_from_ptr;
|
||||
ws->base.buffer_is_user_ptr = radeon_winsys_bo_is_user_ptr;
|
||||
ws->base.buffer_is_suballocated = radeon_winsys_bo_is_suballocated;
|
||||
ws->base.buffer_has_vm_always_valid = radeon_winsys_bo_has_vm_always_valid;
|
||||
ws->base.buffer_get_handle = radeon_winsys_bo_get_handle;
|
||||
ws->base.buffer_get_virtual_address = radeon_winsys_bo_va;
|
||||
ws->base.buffer_get_reloc_offset = radeon_winsys_bo_get_reloc_offset;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue