[PATCH 4/8] drm/gem: Return I/O-memory flag from drm_gem_vram()

Thomas Zimmermann tzimmermann at suse.de
Wed Nov 6 09:31:17 UTC 2019


With this patch, drm_gem_vmap() forwards the io_mem parameter
from the vmap implementation to its caller. By default, is_iomem
is assumed to be false. This matches the return type and the
old behaviour.

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/drm_client.c   | 2 +-
 drivers/gpu/drm/drm_gem.c      | 9 ++++++---
 drivers/gpu/drm/drm_internal.h | 2 +-
 drivers/gpu/drm/drm_prime.c    | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index d9a2e3695525..0ecb588778c5 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -317,7 +317,7 @@ void *drm_client_buffer_vmap(struct drm_client_buffer *buffer)
 	 * fd_install step out of the driver backend hooks, to make that
 	 * final step optional for internal users.
 	 */
-	vaddr = drm_gem_vmap(buffer->gem);
+	vaddr = drm_gem_vmap(buffer->gem, NULL);
 	if (IS_ERR(vaddr))
 		return vaddr;
 
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 0acfbd134e04..6b1ae482dfa9 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -1246,14 +1246,17 @@ void drm_gem_unpin(struct drm_gem_object *obj)
 		obj->dev->driver->gem_prime_unpin(obj);
 }
 
-void *drm_gem_vmap(struct drm_gem_object *obj)
+void *drm_gem_vmap(struct drm_gem_object *obj, bool *is_iomem)
 {
 	void *vaddr;
 
+	if (is_iomem)
+		*is_iomem = false; /* default value matches return type */
+
 	if (obj->funcs && obj->funcs->vmap)
-		vaddr = obj->funcs->vmap(obj, NULL);
+		vaddr = obj->funcs->vmap(obj, is_iomem);
 	else if (obj->dev->driver->gem_prime_vmap)
-		vaddr = obj->dev->driver->gem_prime_vmap(obj, NULL);
+		vaddr = obj->dev->driver->gem_prime_vmap(obj, is_iomem);
 	else
 		vaddr = ERR_PTR(-EOPNOTSUPP);
 
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 51a2055c8f18..78578e6e1197 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -135,7 +135,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
 
 int drm_gem_pin(struct drm_gem_object *obj);
 void drm_gem_unpin(struct drm_gem_object *obj);
-void *drm_gem_vmap(struct drm_gem_object *obj);
+void *drm_gem_vmap(struct drm_gem_object *obj, bool *is_iomem);
 void drm_gem_vunmap(struct drm_gem_object *obj, void *vaddr);
 
 /* drm_debugfs.c drm_debugfs_crc.c */
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 0814211b0f3f..68492ca418ec 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -671,7 +671,7 @@ void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)
 	struct drm_gem_object *obj = dma_buf->priv;
 	void *vaddr;
 
-	vaddr = drm_gem_vmap(obj);
+	vaddr = drm_gem_vmap(obj, NULL);
 	if (IS_ERR(vaddr))
 		vaddr = NULL;
 
-- 
2.23.0



More information about the dri-devel mailing list