diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2018-04-16 06:27:50 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 14:43:28 -0400 |
commit | 3216c6b71d1e6a7dce2fd29c531e8c99c1b88c95 (patch) | |
tree | 5c073e948136a4be7a70c64da3d97968747d9aa1 /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | a906dbb1e20f5791d728c7d9e2366b8acb4f1bb2 (diff) |
drm/amdgpu: use amdgpu_bo_param for amdgpu_bo_create v2
After that, we can easily add new parameter when need.
v2:
a) rebase.
b) Initialize struct amdgpu_bo_param, future new
member could only be used in some one case, but all member
should have its own initial value.
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com> (v1)
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Cc: christian.koenig@amd.com
Cc: Felix.Kuehling@amd.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 29efaac6e3ed..dfd22db13fb1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1316,6 +1316,7 @@ static void amdgpu_ttm_fw_reserve_vram_fini(struct amdgpu_device *adev) | |||
1316 | static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) | 1316 | static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) |
1317 | { | 1317 | { |
1318 | struct ttm_operation_ctx ctx = { false, false }; | 1318 | struct ttm_operation_ctx ctx = { false, false }; |
1319 | struct amdgpu_bo_param bp; | ||
1319 | int r = 0; | 1320 | int r = 0; |
1320 | int i; | 1321 | int i; |
1321 | u64 vram_size = adev->gmc.visible_vram_size; | 1322 | u64 vram_size = adev->gmc.visible_vram_size; |
@@ -1323,17 +1324,21 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) | |||
1323 | u64 size = adev->fw_vram_usage.size; | 1324 | u64 size = adev->fw_vram_usage.size; |
1324 | struct amdgpu_bo *bo; | 1325 | struct amdgpu_bo *bo; |
1325 | 1326 | ||
1327 | memset(&bp, 0, sizeof(bp)); | ||
1328 | bp.size = adev->fw_vram_usage.size; | ||
1329 | bp.byte_align = PAGE_SIZE; | ||
1330 | bp.domain = AMDGPU_GEM_DOMAIN_VRAM; | ||
1331 | bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | ||
1332 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS; | ||
1333 | bp.type = ttm_bo_type_kernel; | ||
1334 | bp.resv = NULL; | ||
1326 | adev->fw_vram_usage.va = NULL; | 1335 | adev->fw_vram_usage.va = NULL; |
1327 | adev->fw_vram_usage.reserved_bo = NULL; | 1336 | adev->fw_vram_usage.reserved_bo = NULL; |
1328 | 1337 | ||
1329 | if (adev->fw_vram_usage.size > 0 && | 1338 | if (adev->fw_vram_usage.size > 0 && |
1330 | adev->fw_vram_usage.size <= vram_size) { | 1339 | adev->fw_vram_usage.size <= vram_size) { |
1331 | 1340 | ||
1332 | r = amdgpu_bo_create(adev, adev->fw_vram_usage.size, PAGE_SIZE, | 1341 | r = amdgpu_bo_create(adev, &bp, |
1333 | AMDGPU_GEM_DOMAIN_VRAM, | ||
1334 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | ||
1335 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | ||
1336 | ttm_bo_type_kernel, NULL, | ||
1337 | &adev->fw_vram_usage.reserved_bo); | 1342 | &adev->fw_vram_usage.reserved_bo); |
1338 | if (r) | 1343 | if (r) |
1339 | goto error_create; | 1344 | goto error_create; |