aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-08-11 08:06:54 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-16 10:43:44 -0400
commitb0456f93063ec8629cfeee6d03758f92793d96cb (patch)
tree59f9cef61f1d68cf3bb6b4baa70b47ba610d4b6a /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parent478feaf6cc420e66c071c0a743b334abfe8f18c9 (diff)
drm/amdgpu: write PTEs directly into the IB.
Write the PTEs at the end of the IB instead of directly into the SDMA commands. This can save quite some CPU cycles building the entries. This doesn't change the DW estimation because PTEs where embedded into the IB before as well. It just moves them to the end of the IB. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1a474fa1f441..e5095b5e10e5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -911,15 +911,15 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
911 /* padding, etc. */ 911 /* padding, etc. */
912 ndw = 64; 912 ndw = 64;
913 913
914 if (params.src) { 914 if (src) {
915 /* only copy commands needed */ 915 /* only copy commands needed */
916 ndw += ncmds * 7; 916 ndw += ncmds * 7;
917 917
918 } else if (params.pages_addr) { 918 } else if (pages_addr) {
919 /* header for write data commands */ 919 /* copy commands needed */
920 ndw += ncmds * 4; 920 ndw += ncmds * 7;
921 921
922 /* body of write data command */ 922 /* and also PTEs */
923 ndw += nptes * 2; 923 ndw += nptes * 2;
924 924
925 } else { 925 } else {
@@ -936,6 +936,22 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
936 936
937 params.ib = &job->ibs[0]; 937 params.ib = &job->ibs[0];
938 938
939 if (!src && pages_addr) {
940 uint64_t *pte;
941 unsigned i;
942
943 /* Put the PTEs at the end of the IB. */
944 i = ndw - nptes * 2;
945 pte= (uint64_t *)&(job->ibs->ptr[i]);
946 params.src = job->ibs->gpu_addr + i * 4;
947
948 for (i = 0; i < nptes; ++i) {
949 pte[i] = amdgpu_vm_map_gart(pages_addr, addr + i *
950 AMDGPU_GPU_PAGE_SIZE);
951 pte[i] |= flags;
952 }
953 }
954
939 r = amdgpu_sync_fence(adev, &job->sync, exclusive); 955 r = amdgpu_sync_fence(adev, &job->sync, exclusive);
940 if (r) 956 if (r)
941 goto error_free; 957 goto error_free;