]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: stop allocating a page array for prime shared BOs
authorChristian König <christian.koenig@amd.com>
Fri, 23 Feb 2018 15:08:51 +0000 (16:08 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Mar 2018 19:38:24 +0000 (14:38 -0500)
We don't need the page array for prime shared BOs, stop allocating it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 137145dd14a998e2e9e06f1f26a6081e2cd256e4..dc8d9f3216fac05b6637ae254ff4ddf014ad8161 100644 (file)
@@ -315,7 +315,7 @@ int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
        t = offset / AMDGPU_GPU_PAGE_SIZE;
        p = t / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
        for (i = 0; i < pages; i++, p++)
-               adev->gart.pages[p] = pagelist[i];
+               adev->gart.pages[p] = pagelist ? pagelist[i] : NULL;
 #endif
 
        if (!adev->gart.ptr)
index c2fae04d769ab34adc5bfc4fa2b2b31c6b61bb62..7187457b20fb2cccce2eb639eb0c7d01c0c69ab7 100644 (file)
@@ -995,7 +995,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
                return NULL;
        }
        gtt->ttm.ttm.func = &amdgpu_backend_func;
-       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags)) {
+       if (ttm_sg_tt_init(&gtt->ttm, bdev, size, page_flags)) {
                kfree(gtt);
                return NULL;
        }
@@ -1021,7 +1021,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,
 
        if (slave && ttm->sg) {
                drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-                                                gtt->ttm.dma_address, ttm->num_pages);
+                                                gtt->ttm.dma_address,
+                                                ttm->num_pages);
                ttm->state = tt_unbound;
                return 0;
        }