public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Das, Nirmoy" <nirmoy.das@linux.intel.com>
To: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: thomas.hellstrom@linux.intel.com, matthew.auld@intel.com,
	daniel.vetter@intel.com
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/dmabuf: Fix prime_mmap to work when using LMEM
Date: Wed, 2 Mar 2022 12:56:45 +0100	[thread overview]
Message-ID: <91f4f6b1-8ac8-c761-921f-dcf7afaa30fe@linux.intel.com> (raw)
In-Reply-To: <20220225131316.1433515-3-gwan-gyeong.mun@intel.com>

LGTM Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 25/02/2022 14:13, Gwan-gyeong Mun wrote:
> The current implementation of i915 prime mmap only works when initializing
> drm_i915_gem_object with shmem_region.
> When using LMEM, drm_i915_gem_object is initialized with ttm_system_region.
> In order to make prime mmap work even this case, when using LMEM
> (when using ttm in i915), dma_buf_ops.mmap callback function calls
> drm_gem_prime_mmap(). drm_gem_prime_mmap() of drm core calls internally
> i915_gem_mmap() so that prime mmap can perform normally.
> The fake offset is processed inside drm_gem_prime_mmap().
>
> Testcase: igt/prime_mmap
>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> index af899ae1f3c7..f5062d0c6333 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> @@ -93,11 +93,15 @@ static void i915_gem_dmabuf_vunmap(struct dma_buf *dma_buf,
>   static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
>   {
>   	struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
> +	struct drm_i915_private *i915 = to_i915(obj->base.dev);
>   	int ret;
>   
>   	if (obj->base.size < vma->vm_end - vma->vm_start)
>   		return -EINVAL;
>   
> +	if (HAS_LMEM(i915))
> +		return drm_gem_prime_mmap(&obj->base, vma);
> +
>   	if (!obj->base.filp)
>   		return -ENODEV;
>   

  reply	other threads:[~2022-03-02 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 13:13 [Intel-gfx] [PATCH 0/2] Fix prime_mmap to work when using LMEM Gwan-gyeong Mun
2022-02-25 13:13 ` [Intel-gfx] [PATCH 1/2] drm/i915/dmabuf: Update dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf() Gwan-gyeong Mun
2022-02-28 15:23   ` Das, Nirmoy
2022-02-25 13:13 ` [Intel-gfx] [PATCH 2/2] drm/i915/dmabuf: Fix prime_mmap to work when using LMEM Gwan-gyeong Mun
2022-03-02 11:56   ` Das, Nirmoy [this message]
2022-02-25 16:02 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2022-02-25 16:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-26 13:12 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-28 14:08 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Fix prime_mmap to work when using LMEM (rev2) Patchwork
2022-02-28 14:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-28 18:25 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-03-02 14:29   ` Gwan-gyeong Mun

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=91f4f6b1-8ac8-c761-921f-dcf7afaa30fe@linux.intel.com \
    --to=nirmoy.das@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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