@@ -114,6 +114,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
bp.type = type;
bp.resv = resv;
bp.preferred_domain = initial_domain;
+ bp.priority = 4;
bp.flags = flags;
bp.domain = initial_domain;
bp.bo_ptr_size = sizeof(struct amdgpu_bo);
@@ -621,9 +621,9 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
else
amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);
if (bp->type == ttm_bo_type_kernel)
- bo->tbo.priority = 2;
+ bo->tbo.priority = AMDGPU_BO_PRIORITY_KERNEL;
else if (!(bp->flags & AMDGPU_GEM_CREATE_DISCARDABLE))
- bo->tbo.priority = 1;
+ bo->tbo.priority = bp->priority;
if (!bp->destroy)
bp->destroy = &amdgpu_bo_destroy;
@@ -42,6 +42,9 @@
/* BO flag to indicate a KFD userptr BO */
#define AMDGPU_AMDKFD_CREATE_USERPTR_BO (1ULL << 63)
+#define AMDGPU_BO_PRIORITY_KERNEL (TTM_MAX_BO_PRIORITY - 1)
+#define AMDGPU_BO_PRIORITY_MAX_USER (TTM_MAX_BO_PRIORITY - 2)
+
#define to_amdgpu_bo_user(abo) container_of((abo), struct amdgpu_bo_user, bo)
#define to_amdgpu_bo_vm(abo) container_of((abo), struct amdgpu_bo_vm, bo)
@@ -52,6 +55,7 @@ struct amdgpu_bo_param {
u32 domain;
u32 preferred_domain;
u64 flags;
+ unsigned int priority;
enum ttm_bo_type type;
bool no_wait_gpu;
struct dma_resv *resv;
Reserve the highest priority for the kernel, and choose a balanced value as userspace default. Userspace is intended to be able to modify these later to mark buffers as important/unimportant. Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) -- 2.44.0