[PATCH] drm/amdgpu: use ttm pool first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dma path is low than ttm pool.

Question:
But why need two path? What spicific problem can be solved by dma path?

Change-Id: I4a9fc7103658e643f33e267616fc69743b20b09e
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index d32f48259c40..8d8a616bf4f5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -996,6 +996,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,
 	struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
 	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
+	int r;
 
 	if (ttm->state != tt_unpopulated)
 		return 0;
@@ -1017,13 +1018,14 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm,
 		return 0;
 	}
 
+	r = ttm_populate_and_map_pages(adev->dev, &gtt->ttm, ctx);
+
 #ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
-		return ttm_dma_populate(&gtt->ttm, adev->dev, ctx);
+	if ((r == -EFAULT) && swiotlb_nr_tbl()) {
+		r = ttm_dma_populate(&gtt->ttm, adev->dev, ctx);
 	}
 #endif
-
-	return ttm_populate_and_map_pages(adev->dev, &gtt->ttm, ctx);
+	return r;
 }
 
 static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm)
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux