All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 5/5] drm/shmem-helper: Clarify drm_gem_shmem_v[un]map() usage
Date: Mon, 26 Jun 2023 14:02:47 +0200	[thread overview]
Message-ID: <20230626120247.1337962-6-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20230626120247.1337962-1-boris.brezillon@collabora.com>

Drivers are not supposed to call these functions directly when they
want to map/unamp a GEM in kernel space. They should instead go
through drm_gem_v[un]map[_unlocked]() that will forward the request
to drm_gem_object_funcs::v[un]map() which in turn will call
drm_gem_shmem_v[un]map().

Let's clarify that in the functions doc.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 drivers/gpu/drm/drm_gem_shmem_helper.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 2b8a32f6b656..daada172fe70 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -279,6 +279,11 @@ EXPORT_SYMBOL(drm_gem_shmem_unpin);
  *
  * Acquired mappings should be cleaned up by calling drm_gem_shmem_vunmap().
  *
+ * This function is not meant to be used directly, but rather used as a helper
+ * to implement driver-specific versions of drm_gem_object_funcs::vmap(). If
+ * you need to vmap() a GEM object from your driver, use
+ * drm_gem_vmap[_unlocked]() instead.
+ *
  * Returns:
  * 0 on success or a negative error code on failure.
  */
@@ -348,6 +353,11 @@ EXPORT_SYMBOL(drm_gem_shmem_vmap);
  *
  * This function hides the differences between dma-buf imported and natively
  * allocated objects.
+ *
+ * This function is not meant to be used directly, but rather used as a helper
+ * to implement driver-specific versions of drm_gem_object_funcs::vunmap(). If
+ * you need to vunmap() a GEM object from your driver, use
+ * drm_gem_vunmap[_unlocked]() instead.
  */
 void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
 			  struct iosys_map *map)
-- 
2.41.0


      parent reply	other threads:[~2023-06-26 12:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 12:02 [PATCH 0/5] drm/shmem-helper: Follow-up on 'Switch to reservation lock' Boris Brezillon
2023-06-26 12:02 ` [PATCH 1/5] drm/panfrost: Stop using drm_gem_shmem_put_pages() Boris Brezillon
2023-06-26 13:20   ` Dmitry Osipenko
2023-06-26 13:38     ` Boris Brezillon
2023-06-26 15:43     ` Boris Brezillon
2023-06-26 16:06       ` Dmitry Osipenko
2023-06-26 16:21         ` Boris Brezillon
2023-06-26 12:02 ` [PATCH 2/5] drm/shmem-helper: Stop exposing drm_gem_shmem_put_pages() Boris Brezillon
2023-06-26 12:02 ` [PATCH 3/5] drm/shmem-helper: Inline drm_gem_shmem_{get,put}_pages() Boris Brezillon
2023-06-26 15:34   ` Boris Brezillon
2023-06-26 12:02 ` [PATCH 4/5] drm/shmem-helper: Make dma_resv_assert_held() unconditional in drm_gem_shmem_v[un]map() Boris Brezillon
2023-06-26 12:02 ` Boris Brezillon [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=20230626120247.1337962-6-boris.brezillon@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.