[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220729170744.1301044-3-robdclark@gmail.com>
Date: Fri, 29 Jul 2022 10:07:41 -0700
From: Rob Clark <robdclark@...il.com>
To: dri-devel@...ts.freedesktop.org
Cc: freedreno@...ts.freedesktop.org,
Rob Clark <robdclark@...omium.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
linux-kernel@...r.kernel.org (open list),
linux-media@...r.kernel.org (open list:DMA BUFFER SHARING FRAMEWORK),
linaro-mm-sig@...ts.linaro.org (moderated list:DMA BUFFER SHARING
FRAMEWORK)
Subject: [PATCH 2/3] drm/prime: Wire up mmap_info support
From: Rob Clark <robdclark@...omium.org>
Just plumbing the thing thru an extra layer.
Signed-off-by: Rob Clark <robdclark@...omium.org>
---
drivers/gpu/drm/drm_prime.c | 12 ++++++++++++
include/drm/drm_drv.h | 7 +++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index e3f09f18110c..f58586e131c5 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -784,6 +784,17 @@ int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
}
EXPORT_SYMBOL(drm_gem_dmabuf_mmap);
+static int drm_gem_dmabuf_mmap_info(struct dma_buf *dma_buf)
+{
+ struct drm_gem_object *obj = dma_buf->priv;
+ struct drm_device *dev = obj->dev;
+
+ if (!dev->driver->gem_prime_mmap_info)
+ return -ENOSYS;
+
+ return dev->driver->gem_prime_mmap_info(obj);
+}
+
static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
.cache_sgt_mapping = true,
.attach = drm_gem_map_attach,
@@ -792,6 +803,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
.unmap_dma_buf = drm_gem_unmap_dma_buf,
.release = drm_gem_dmabuf_release,
.mmap = drm_gem_dmabuf_mmap,
+ .mmap_info = drm_gem_dmabuf_mmap_info,
.vmap = drm_gem_dmabuf_vmap,
.vunmap = drm_gem_dmabuf_vunmap,
};
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index f6159acb8856..797c0f8c2dd0 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -355,6 +355,13 @@ struct drm_driver {
*/
int (*gem_prime_mmap)(struct drm_gem_object *obj, struct vm_area_struct *vma);
+ /**
+ * @gem_prim_mmap_info:
+ *
+ * Get info about mmap setup by gem_prime_mmap. See dma_buf_ops:mmap_info.
+ */
+ int (*gem_prime_mmap_info)(struct drm_gem_object *obj);
+
/**
* @dumb_create:
*
--
2.36.1
Powered by blists - more mailing lists