drm/amdgpu: Add helper function to get buffer domain
Subsystems (2)
Move logic of getting supported domain to a helper function
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3 -7
@@ -750,19 +750,15 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,struct amdgpu_device *adev = dev->dev_private;struct drm_gem_object *gobj;uint32_t handle; -u32 domain =amdgpu_display_supported_domains (adev); +u32 domain;int r; args->pitch =amdgpu_align_pitch (adev, args->width,DIV_ROUND_UP (args->bpp,8 ),0 ); args->size = (u64 )args->pitch * args->height; args->size =ALIGN (args->size,PAGE_SIZE ); -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } - + domain =amdgpu_bo_get_preferred_pin_domain (adev, +amdgpu_display_supported_domains (adev)); r =amdgpu_gem_object_create (adev, args->size,0 , domain,AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED , false,NULL , &gobj);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +12 -5
@@ -703,11 +703,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,/* This assumes only APU display buffers are pinned with (VRAM|GTT). * See function amdgpu_display_supported_domains() */ -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } + domain =amdgpu_bo_get_preferred_pin_domain (adev, domain);if (bo->pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type;
@@ -1066,3 +1062,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)return bo->tbo.offset; } + +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain) +{ +if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { + domain =AMDGPU_GEM_DOMAIN_VRAM ; +if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) + domain =AMDGPU_GEM_DOMAIN_GTT ; + } +return domain; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -1
@@ -289,7 +289,8 @@ int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,struct reservation_object *resv, struct dma_fence **fence, bool direct); - +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain);/* * sub allocation
Signature · 6 lines
2.15.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180526001229.15509-1-Deepak.Sharma-5C7GfCeVMHo@public.gmane.org
If look fine , please give rb for this and https://patchwork.freedesktop.org/patch/224850/
Thanks,
Deepak
Quoted 75 lines · Deepak Sharma
Move logic of getting supported domain to a helper function
Signed-off-by Deepak Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-7@@ -750,19 +750,15 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,struct amdgpu_device *adev = dev->dev_private;struct drm_gem_object *gobj;uint32_t handle; -u32 domain =amdgpu_display_supported_domains (adev); +u32 domain;int r; args->pitch =amdgpu_align_pitch (adev, args->width,DIV_ROUND_UP (args->bpp,8 ),0 ); args->size = (u64 )args->pitch * args->height; args->size =ALIGN (args->size,PAGE_SIZE ); -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } - + domain =amdgpu_bo_get_preferred_pin_domain (adev, +amdgpu_display_supported_domains (adev)); r =amdgpu_gem_object_create (adev, args->size,0 , domain,AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED , false,NULL , &gobj);drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +12
-5@@ -703,11 +703,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,/* This assumes only APU display buffers are pinned with (VRAM|GTT). * See function amdgpu_display_supported_domains() */ -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } + domain =amdgpu_bo_get_preferred_pin_domain (adev, domain);if (bo->pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type;@@ -1066,3 +1062,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)return bo->tbo.offset; } + +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain) +{ +if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { + domain =AMDGPU_GEM_DOMAIN_VRAM ; +if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) + domain =AMDGPU_GEM_DOMAIN_GTT ; + } +return domain; +}drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, · line 296
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2
-1@@ -289,7 +289,8 @@ int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,struct reservation_object *resv, struct dma_fence **fence, bool direct); - +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain);/* * sub allocation
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): f58bea93-8f1a-bc97-a0c6-a3d2f324275c-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-byBoth patches are:
________________________________
From: Sharma, Deepak
Sent: Friday, May 25, 2018 8:19:26 PM
To: [email protected]; Deucher, Alexander; [email protected]; Koenig, Christian
Subject: Re: drm/amdgpu: Add helper function to get buffer domain
If look fine , please give rb for this and
https://patchwork.freedesktop.org/patch/224850/
Thanks,
Deepak
Quoted 75 lines · Deepak Sharma
Move logic of getting supported domain to a helper function
Signed-off-by Deepak Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-7@@ -750,19 +750,15 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,struct amdgpu_device *adev = dev->dev_private;struct drm_gem_object *gobj;uint32_t handle; -u32 domain =amdgpu_display_supported_domains (adev); +u32 domain;int r; args->pitch =amdgpu_align_pitch (adev, args->width,DIV_ROUND_UP (args->bpp,8 ),0 ); args->size = (u64 )args->pitch * args->height; args->size =ALIGN (args->size,PAGE_SIZE ); -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } - + domain =amdgpu_bo_get_preferred_pin_domain (adev, +amdgpu_display_supported_domains (adev)); r =amdgpu_gem_object_create (adev, args->size,0 , domain,AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED , false,NULL , &gobj);drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +12
-5@@ -703,11 +703,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,/* This assumes only APU display buffers are pinned with (VRAM|GTT). * See function amdgpu_display_supported_domains() */ -if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { - domain =AMDGPU_GEM_DOMAIN_VRAM ; -if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) - domain =AMDGPU_GEM_DOMAIN_GTT ; - } + domain =amdgpu_bo_get_preferred_pin_domain (adev, domain);if (bo->pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type;@@ -1066,3 +1062,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)return bo->tbo.offset; } + +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain) +{ +if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { + domain =AMDGPU_GEM_DOMAIN_VRAM ; +if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) + domain =AMDGPU_GEM_DOMAIN_GTT ; + } +return domain; +}drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, · line 296
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2
-1@@ -289,7 +289,8 @@ int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,struct reservation_object *resv, struct dma_fence **fence, bool direct); - +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, +uint32_t domain);/* * sub allocation
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB18092E2599E79AA9FCE2BB48F7680-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Christian König
Reviewed-byChristian.
Am 26.05.2018 um 15:23 schrieb Deucher, Alexander:
Quoted 105 lines
Both patches are:
Reviewed-by Alex Deucher <[email protected]>------------------------------------------------------------------------
*From:* Sharma, Deepak
*Sent:* Friday, May 25, 2018 8:19:26 PM
*To:* [email protected]; Deucher, Alexander; [email protected]; Koenig, Christian *Subject:* Re: drm/amdgpu: Add helper function to get buffer domain
If look fine , please give rb for this and
https://patchwork.freedesktop.org/patch/224850/Thanks,
DeepakReview
Quoted 11 lines · Deepak Sharma
Move logic of getting supported domain to a helper function
Signed-off-by Deepak Sharma <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 +++-------drivers/gpu/drm/amd/amdgpu/amdgpu_object.c| 17 ++++++++++++-----drivers/gpu/drm/amd/amdgpu/amdgpu_object.h| 3 ++-3 files changed, 17 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.cdrivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_mode_dumb_create(struct drm_file
Quoted 4 lines
index
63758db5e2ea..556406a44da3100644drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0
-0@@ -750,19 +750,15 @@ int amdgpu_mode_dumb_create(struct drm_file
*file_priv,Review
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +3
-7struct amdgpu_device *adev = dev->dev_private; struct drm_gem_object *gobj; uint32_t handle; - u32 domain = amdgpu_display_supported_domains(adev); + u32 domain; int r; args->pitch = amdgpu_align_pitch(adev, args->width,DIV_ROUND_UP (args->bpp,8 ),0 ); args->size = (u64)args->pitch * args->height; args->size = ALIGN(args->size, PAGE_SIZE); - if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { - domain = AMDGPU_GEM_DOMAIN_VRAM; - if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) - domain = AMDGPU_GEM_DOMAIN_GTT; - } - + domain = amdgpu_bo_get_preferred_pin_domain(adev, +amdgpu_display_supported_domains (adev)); r = amdgpu_gem_object_create(adev, args->size, 0, domain,AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED , false, NULL, &gobj);(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.cdrivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo
Quoted 4 lines
index
6a9e46ae7f0a..5e4e1bd90383100644drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0@@ -703,11 +703,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo*bo, u32 domain,
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo · line 703
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0/* This assumes only APU display buffers are pinned with(VRAM|GTT).
Review
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +12
-5* See function amdgpu_display_supported_domains() */ - if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { - domain = AMDGPU_GEM_DOMAIN_VRAM; - if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) - domain = AMDGPU_GEM_DOMAIN_GTT; - } + domain = amdgpu_bo_get_preferred_pin_domain(adev, domain); if (bo->pin_count) { uint32_t mem_type = bo->tbo.mem.mem_type;@@ -1066,3 +1062,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo) return bo->tbo.offset; } + +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, + uint32_t domain) +{ + if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { + domain = AMDGPU_GEM_DOMAIN_VRAM; + if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) + domain = AMDGPU_GEM_DOMAIN_GTT; + } + return domain; +}(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.hdrivers/gpu/drm/amd/amdgpu/amdgpu_object.h int amdgpu_bo_restore_from_shadow(struct
Quoted 4 lines
index 540e03fa159f..731748033878 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0
-0@@ -289,7 +289,8 @@ int amdgpu_bo_restore_from_shadow(struct
amdgpu_device*adev,Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2
-1struct reservation_object *resv, struct dma_fence **fence, bool direct); - +uint32_t amdgpu_bo_get_preferred_pin_domain (struct amdgpu_device *adev, + uint32_t domain);
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, · line 296
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +0
-0/** sub allocation _______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx