From: "Christian König" <christian.koenig@amd.com>
To: Felix Kuehling <Felix.Kuehling@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/1] drm/amdgpu: Make contiguous pinning optional
Date: Thu, 21 Jan 2021 09:03:56 +0100 [thread overview]
Message-ID: <6fffd201-4fd9-255f-9449-e1d6c7904fa8@amd.com> (raw)
In-Reply-To: <20210121050830.30888-1-Felix.Kuehling@amd.com>
Am 21.01.21 um 06:08 schrieb Felix Kuehling:
> Enable pinning of VRAM without forcing it to be contiguous. When memory is
> already pinned, make sure it's contiguous if requested.
>
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index d026cef8e520..137f275f90ee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -914,10 +914,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>
> if (bo->pin_count) {
> uint32_t mem_type = bo->tbo.mem.mem_type;
> + uint32_t mem_flags = bo->tbo.mem.placement;
>
> if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
> return -EINVAL;
>
> + if ((bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS) &&
> + !(mem_flags & TTM_PL_FLAG_CONTIGUOUS))
> + return -EINVAL;
> +
> bo->pin_count++;
>
> if (max_offset != 0) {
> @@ -933,7 +938,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
> if (bo->tbo.base.import_attach)
> dma_buf_pin(bo->tbo.base.import_attach);
>
> - bo->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
> /* force to pin into visible video ram */
> if (!(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS))
> bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
> @@ -987,6 +991,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
> */
> int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain)
> {
> + bo->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS;
> return amdgpu_bo_pin_restricted(bo, domain, 0, 0);
> }
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2021-01-21 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 5:08 [PATCH 1/1] drm/amdgpu: Make contiguous pinning optional Felix Kuehling
2021-01-21 8:03 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fffd201-4fd9-255f-9449-e1d6c7904fa8@amd.com \
--to=christian.koenig@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox