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

drm/amdgpu: send UVD IB tests directly to the ring again

We need the IB test for GPU resets as well and
the scheduler should be stoped then.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Christian König and committed by
Alex Deucher
d7af97db 0856cab1

+25 -15
+21 -11
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 241 241 242 242 amdgpu_uvd_note_usage(adev); 243 243 244 - r = amdgpu_uvd_get_destroy_msg(ring, handle, &fence); 244 + r = amdgpu_uvd_get_destroy_msg(ring, handle, false, &fence); 245 245 if (r) { 246 246 DRM_ERROR("Error destroying UVD (%d)!\n", r); 247 247 continue; ··· 295 295 296 296 amdgpu_uvd_note_usage(adev); 297 297 298 - r = amdgpu_uvd_get_destroy_msg(ring, handle, &fence); 298 + r = amdgpu_uvd_get_destroy_msg(ring, handle, 299 + false, &fence); 299 300 if (r) { 300 301 DRM_ERROR("Error destroying UVD (%d)!\n", r); 301 302 continue; ··· 824 823 return 0; 825 824 } 826 825 827 - static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, 828 - struct amdgpu_bo *bo, 829 - struct fence **fence) 826 + static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, 827 + bool direct, struct fence **fence) 830 828 { 831 829 struct ttm_validate_buffer tv; 832 830 struct ww_acquire_ctx ticket; ··· 872 872 ib->ptr[i] = PACKET2(0); 873 873 ib->length_dw = 16; 874 874 875 - r = amdgpu_job_submit(job, ring, AMDGPU_FENCE_OWNER_UNDEFINED, &f); 876 - if (r) 877 - goto err_free; 875 + if (direct) { 876 + r = amdgpu_ib_schedule(ring, 1, ib, 877 + AMDGPU_FENCE_OWNER_UNDEFINED, &f); 878 + if (r) 879 + goto err_free; 880 + 881 + amdgpu_job_free(job); 882 + } else { 883 + r = amdgpu_job_submit(job, ring, 884 + AMDGPU_FENCE_OWNER_UNDEFINED, &f); 885 + if (r) 886 + goto err_free; 887 + } 878 888 879 889 ttm_eu_fence_buffer_objects(&ticket, &head, f); 880 890 ··· 952 942 amdgpu_bo_kunmap(bo); 953 943 amdgpu_bo_unreserve(bo); 954 944 955 - return amdgpu_uvd_send_msg(ring, bo, fence); 945 + return amdgpu_uvd_send_msg(ring, bo, true, fence); 956 946 } 957 947 958 948 int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, 959 - struct fence **fence) 949 + bool direct, struct fence **fence) 960 950 { 961 951 struct amdgpu_device *adev = ring->adev; 962 952 struct amdgpu_bo *bo; ··· 994 984 amdgpu_bo_kunmap(bo); 995 985 amdgpu_bo_unreserve(bo); 996 986 997 - return amdgpu_uvd_send_msg(ring, bo, fence); 987 + return amdgpu_uvd_send_msg(ring, bo, direct, fence); 998 988 } 999 989 1000 990 static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
··· 31 31 int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, 32 32 struct fence **fence); 33 33 int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, 34 - struct fence **fence); 34 + bool direct, struct fence **fence); 35 35 void amdgpu_uvd_free_handles(struct amdgpu_device *adev, 36 36 struct drm_file *filp); 37 37 int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx);
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
··· 522 522 goto error; 523 523 } 524 524 525 - r = amdgpu_uvd_get_destroy_msg(ring, 1, &fence); 525 + r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); 526 526 if (r) { 527 527 DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); 528 528 goto error;
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
··· 568 568 goto error; 569 569 } 570 570 571 - r = amdgpu_uvd_get_destroy_msg(ring, 1, &fence); 571 + r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); 572 572 if (r) { 573 573 DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); 574 574 goto error;
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
··· 800 800 goto error; 801 801 } 802 802 803 - r = amdgpu_uvd_get_destroy_msg(ring, 1, &fence); 803 + r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); 804 804 if (r) { 805 805 DRM_ERROR("amdgpu: failed to get destroy ib (%d).\n", r); 806 806 goto error;