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

drm/amdgpu: improve parse_cs handling a bit

This way we can use parse_cs and still keep VM mode enabled.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Christian König and committed by
Alex Deucher
45088efc 5e876c62

+11 -4
+5 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 822 822 823 823 /* Only for UVD/VCE VM emulation */ 824 824 if (ring->funcs->parse_cs) { 825 - p->job->vm = NULL; 826 825 for (i = 0; i < p->job->num_ibs; i++) { 827 826 r = amdgpu_ring_parse_cs(ring, p, i); 828 827 if (r) 829 828 return r; 830 829 } 831 - } else { 830 + } 831 + 832 + if (p->job->vm) { 832 833 p->job->vm_pd_addr = amdgpu_bo_gpu_offset(vm->page_directory); 833 834 834 835 r = amdgpu_bo_vm_update_pte(p, vm); ··· 918 917 offset = ((uint64_t)m->it.start) * AMDGPU_GPU_PAGE_SIZE; 919 918 kptr += chunk_ib->va_start - offset; 920 919 921 - r = amdgpu_ib_get(adev, NULL, chunk_ib->ib_bytes, ib); 920 + r = amdgpu_ib_get(adev, vm, chunk_ib->ib_bytes, ib); 922 921 if (r) { 923 922 DRM_ERROR("Failed to get ib !\n"); 924 923 return r; ··· 933 932 return r; 934 933 } 935 934 936 - ib->gpu_addr = chunk_ib->va_start; 937 935 } 938 936 937 + ib->gpu_addr = chunk_ib->va_start; 939 938 ib->length_dw = chunk_ib->ib_bytes / 4; 940 939 ib->flags = chunk_ib->flags; 941 940 j++;
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 876 876 struct amdgpu_ib *ib = &parser->job->ibs[ib_idx]; 877 877 int r; 878 878 879 + parser->job->vm = NULL; 880 + ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo); 881 + 879 882 if (ib->length_dw % 16) { 880 883 DRM_ERROR("UVD IB length (%d) not 16 dwords aligned!\n", 881 884 ib->length_dw);
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
··· 642 642 uint32_t *size = &tmp; 643 643 int i, r, idx = 0; 644 644 645 + p->job->vm = NULL; 646 + ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo); 647 + 645 648 r = amdgpu_cs_sysvm_access_required(p); 646 649 if (r) 647 650 return r;