Skip to content

Commit 9deb0b3

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: use the preferred pin domain after the check
For some reason we run into an use case where a BO is already pinned into GTT, but should be pinned into VRAM|GTT again. Handle that case gracefully as well. Reviewed-by: Shashank Sharma <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 8ac1696 commit 9deb0b3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -920,11 +920,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
920920
return -EINVAL;
921921
}
922922

923-
/* This assumes only APU display buffers are pinned with (VRAM|GTT).
924-
* See function amdgpu_display_supported_domains()
925-
*/
926-
domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
927-
928923
if (bo->tbo.pin_count) {
929924
uint32_t mem_type = bo->tbo.resource->mem_type;
930925
uint32_t mem_flags = bo->tbo.resource->placement;
@@ -949,6 +944,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
949944
return 0;
950945
}
951946

947+
/* This assumes only APU display buffers are pinned with (VRAM|GTT).
948+
* See function amdgpu_display_supported_domains()
949+
*/
950+
domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
951+
952952
if (bo->tbo.base.import_attach)
953953
dma_buf_pin(bo->tbo.base.import_attach);
954954

0 commit comments

Comments
 (0)