diff options
author | Yong Zhao <Yong.Zhao@amd.com> | 2017-07-20 18:49:09 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-15 14:45:58 -0400 |
commit | 2046d46db9166bddc84778f0b3477f6d1e9068ea (patch) | |
tree | 93269d90c5382f0988b3872ccff6b1b53ba9e9bf /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
parent | 078af1a3e9d7b47f3e37ea25640023cf2e8b4d51 (diff) |
drm/amdgpu: Add a parameter to amdgpu_bo_create()
The parameter init_value contains the value to which we initialized
VRAM bo when AMDGPU_GEM_CREATE_VRAM_CLEARED flag is set.
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 494b79374828..16f31cbd9147 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -247,7 +247,7 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | |||
247 | r = amdgpu_bo_create(adev, size, align, true, domain, | 247 | r = amdgpu_bo_create(adev, size, align, true, domain, |
248 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | 248 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
249 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | 249 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
250 | NULL, NULL, bo_ptr); | 250 | NULL, NULL, 0, bo_ptr); |
251 | if (r) { | 251 | if (r) { |
252 | dev_err(adev->dev, "(%d) failed to allocate kernel bo\n", | 252 | dev_err(adev->dev, "(%d) failed to allocate kernel bo\n", |
253 | r); | 253 | r); |
@@ -356,6 +356,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
356 | struct sg_table *sg, | 356 | struct sg_table *sg, |
357 | struct ttm_placement *placement, | 357 | struct ttm_placement *placement, |
358 | struct reservation_object *resv, | 358 | struct reservation_object *resv, |
359 | uint64_t init_value, | ||
359 | struct amdgpu_bo **bo_ptr) | 360 | struct amdgpu_bo **bo_ptr) |
360 | { | 361 | { |
361 | struct amdgpu_bo *bo; | 362 | struct amdgpu_bo *bo; |
@@ -456,7 +457,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
456 | bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) { | 457 | bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) { |
457 | struct dma_fence *fence; | 458 | struct dma_fence *fence; |
458 | 459 | ||
459 | r = amdgpu_fill_buffer(bo, 0, bo->tbo.resv, &fence); | 460 | r = amdgpu_fill_buffer(bo, init_value, bo->tbo.resv, &fence); |
460 | if (unlikely(r)) | 461 | if (unlikely(r)) |
461 | goto fail_unreserve; | 462 | goto fail_unreserve; |
462 | 463 | ||
@@ -508,6 +509,7 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
508 | AMDGPU_GEM_CREATE_CPU_GTT_USWC, | 509 | AMDGPU_GEM_CREATE_CPU_GTT_USWC, |
509 | NULL, &placement, | 510 | NULL, &placement, |
510 | bo->tbo.resv, | 511 | bo->tbo.resv, |
512 | 0, | ||
511 | &bo->shadow); | 513 | &bo->shadow); |
512 | if (!r) { | 514 | if (!r) { |
513 | bo->shadow->parent = amdgpu_bo_ref(bo); | 515 | bo->shadow->parent = amdgpu_bo_ref(bo); |
@@ -519,11 +521,15 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
519 | return r; | 521 | return r; |
520 | } | 522 | } |
521 | 523 | ||
524 | /* init_value will only take effect when flags contains | ||
525 | * AMDGPU_GEM_CREATE_VRAM_CLEARED. | ||
526 | */ | ||
522 | int amdgpu_bo_create(struct amdgpu_device *adev, | 527 | int amdgpu_bo_create(struct amdgpu_device *adev, |
523 | unsigned long size, int byte_align, | 528 | unsigned long size, int byte_align, |
524 | bool kernel, u32 domain, u64 flags, | 529 | bool kernel, u32 domain, u64 flags, |
525 | struct sg_table *sg, | 530 | struct sg_table *sg, |
526 | struct reservation_object *resv, | 531 | struct reservation_object *resv, |
532 | uint64_t init_value, | ||
527 | struct amdgpu_bo **bo_ptr) | 533 | struct amdgpu_bo **bo_ptr) |
528 | { | 534 | { |
529 | struct ttm_placement placement = {0}; | 535 | struct ttm_placement placement = {0}; |
@@ -538,7 +544,7 @@ int amdgpu_bo_create(struct amdgpu_device *adev, | |||
538 | 544 | ||
539 | r = amdgpu_bo_create_restricted(adev, size, byte_align, kernel, | 545 | r = amdgpu_bo_create_restricted(adev, size, byte_align, kernel, |
540 | domain, flags, sg, &placement, | 546 | domain, flags, sg, &placement, |
541 | resv, bo_ptr); | 547 | resv, init_value, bo_ptr); |
542 | if (r) | 548 | if (r) |
543 | return r; | 549 | return r; |
544 | 550 | ||