<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Reviewed-by: Christian König
<a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a> for both as well.<br>
<br>
Christian.<br>
<br>
Am 26.05.2018 um 15:23 schrieb Deucher, Alexander:<br>
</div>
<blockquote type="cite"
cite="mid:BN6PR12MB18092E2599E79AA9FCE2BB48F7680@BN6PR12MB1809.namprd12.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
dir="ltr">
<p style="margin-top:0;margin-bottom:0">Both patches are:</p>
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex
Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
Sharma, Deepak<br>
<b>Sent:</b> Friday, May 25, 2018 8:19:26 PM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; Deucher, Alexander;
<a class="moz-txt-link-abbreviated" href="mailto:michel@daenzer.net">michel@daenzer.net</a>; Koenig, Christian<br>
<b>Subject:</b> Re: drm/amdgpu: Add helper function to get
buffer domain</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt;">
<div class="PlainText">If look fine , please give rb for
this and <br>
<a href="https://patchwork.freedesktop.org/patch/224850/"
moz-do-not-send="true">https://patchwork.freedesktop.org/patch/224850/</a><br>
<br>
Thanks,<br>
Deepak<br>
<br>
On 05/25/2018 05:12 PM, Deepak Sharma wrote:<br>
> Move logic of getting supported domain to a helper<br>
> function<br>
> <br>
> Signed-off-by: Deepak Sharma
<a class="moz-txt-link-rfc2396E" href="mailto:Deepak.Sharma@amd.com"><Deepak.Sharma@amd.com></a><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10
+++-------<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17
++++++++++++-----<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 ++-<br>
> 3 files changed, 17 insertions(+), 13 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
> index 63758db5e2ea..556406a44da3 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
> @@ -750,19 +750,15 @@ int
amdgpu_mode_dumb_create(struct drm_file *file_priv,<br>
> struct amdgpu_device *adev =
dev->dev_private;<br>
> struct drm_gem_object *gobj;<br>
> uint32_t handle;<br>
> - u32 domain =
amdgpu_display_supported_domains(adev);<br>
> + u32 domain;<br>
> int r;<br>
> <br>
> args->pitch = amdgpu_align_pitch(adev,
args->width,<br>
>
DIV_ROUND_UP(args->bpp, 8), 0);<br>
> args->size = (u64)args->pitch *
args->height;<br>
> args->size = ALIGN(args->size,
PAGE_SIZE);<br>
> - if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
AMDGPU_GEM_DOMAIN_GTT)) {<br>
> - domain = AMDGPU_GEM_DOMAIN_VRAM;<br>
> - if (adev->gmc.real_vram_size <=
AMDGPU_SG_THRESHOLD)<br>
> - domain = AMDGPU_GEM_DOMAIN_GTT;<br>
> - }<br>
> -<br>
> + domain =
amdgpu_bo_get_preferred_pin_domain(adev,<br>
> +
amdgpu_display_supported_domains(adev));<br>
> r = amdgpu_gem_object_create(adev,
args->size, 0, domain,<br>
>
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,<br>
> false, NULL,
&gobj);<br>
> diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> index 6a9e46ae7f0a..5e4e1bd90383 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> @@ -703,11 +703,7 @@ int
amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,<br>
> /* This assumes only APU display buffers are
pinned with (VRAM|GTT).<br>
> * See function
amdgpu_display_supported_domains()<br>
> */<br>
> - if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
AMDGPU_GEM_DOMAIN_GTT)) {<br>
> - domain = AMDGPU_GEM_DOMAIN_VRAM;<br>
> - if (adev->gmc.real_vram_size <=
AMDGPU_SG_THRESHOLD)<br>
> - domain = AMDGPU_GEM_DOMAIN_GTT;<br>
> - }<br>
> + domain =
amdgpu_bo_get_preferred_pin_domain(adev, domain);<br>
> <br>
> if (bo->pin_count) {<br>
> uint32_t mem_type =
bo->tbo.mem.mem_type;<br>
> @@ -1066,3 +1062,14 @@ u64
amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)<br>
> <br>
> return bo->tbo.offset;<br>
> }<br>
> +<br>
> +uint32_t amdgpu_bo_get_preferred_pin_domain(struct
amdgpu_device *adev,<br>
> + uint32_t
domain)<br>
> +{<br>
> + if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
AMDGPU_GEM_DOMAIN_GTT)) {<br>
> + domain = AMDGPU_GEM_DOMAIN_VRAM;<br>
> + if (adev->gmc.real_vram_size <=
AMDGPU_SG_THRESHOLD)<br>
> + domain = AMDGPU_GEM_DOMAIN_GTT;<br>
> + }<br>
> + return domain;<br>
> +}<br>
> diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h<br>
> index 540e03fa159f..731748033878 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h<br>
> @@ -289,7 +289,8 @@ int
amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev,<br>
> struct
reservation_object *resv,<br>
> struct dma_fence
**fence,<br>
> bool direct);<br>
> -<br>
> +uint32_t amdgpu_bo_get_preferred_pin_domain(struct
amdgpu_device *adev,<br>
> + uint32_t
domain);<br>
> <br>
> /*<br>
> * sub allocation<br>
> <br>
</div>
</span></font></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
</blockquote>
<br>
</body>
</html>