Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <Shashank.sharma@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

authored by

Christian König and committed by
Alex Deucher
2a7b9a84 daa7772d

+5 -5
+5 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
··· 920 920 return -EINVAL; 921 921 } 922 922 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 - 928 923 if (bo->tbo.pin_count) { 929 924 uint32_t mem_type = bo->tbo.resource->mem_type; 930 925 uint32_t mem_flags = bo->tbo.resource->placement; ··· 943 948 944 949 return 0; 945 950 } 951 + 952 + /* This assumes only APU display buffers are pinned with (VRAM|GTT). 953 + * See function amdgpu_display_supported_domains() 954 + */ 955 + domain = amdgpu_bo_get_preferred_pin_domain(adev, domain); 946 956 947 957 if (bo->tbo.base.import_attach) 948 958 dma_buf_pin(bo->tbo.base.import_attach);