[PATCH 5/8] drm/client: Return I/O memory flag from drm_client_buffer_vmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch, drm_client_buffer_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@xxxxxxx>
---
 drivers/gpu/drm/drm_client.c    | 15 ++++++++++++---
 drivers/gpu/drm/drm_fb_helper.c |  4 ++--
 include/drm/drm_client.h        |  7 ++++++-
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 0ecb588778c5..44af56fc4b4d 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -290,6 +290,8 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
 /**
  * drm_client_buffer_vmap - Map DRM client buffer into address space
  * @buffer: DRM client buffer
+ * @is_iomem: Returns true if the mapped memory is I/O memory, or false
+ *            otherwise; can be NULL
  *
  * This function maps a client buffer into kernel address space. If the
  * buffer is already mapped, it returns the mapping's address.
@@ -302,12 +304,16 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
  * Returns:
  *	The mapped memory's address
  */
-void *drm_client_buffer_vmap(struct drm_client_buffer *buffer)
+void *drm_client_buffer_vmap(struct drm_client_buffer *buffer, bool *is_iomem)
 {
 	void *vaddr;
+	bool vaddr_is_iomem;
 
-	if (buffer->vaddr)
+	if (buffer->vaddr) {
+		if (is_iomem)
+			*is_iomem = buffer->vaddr_is_iomem;
 		return buffer->vaddr;
+	}
 
 	/*
 	 * FIXME: The dependency on GEM here isn't required, we could
@@ -317,12 +323,15 @@ 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, NULL);
+	vaddr = drm_gem_vmap(buffer->gem, &vaddr_is_iomem);
 	if (IS_ERR(vaddr))
 		return vaddr;
 
 	buffer->vaddr = vaddr;
+	buffer->vaddr_is_iomem = vaddr_is_iomem;
 
+	if (is_iomem)
+		*is_iomem = vaddr_is_iomem;
 	return vaddr;
 }
 EXPORT_SYMBOL(drm_client_buffer_vmap);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 8ebeccdeed23..eff75fad7cab 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -422,7 +422,7 @@ static void drm_fb_helper_dirty_work(struct work_struct *work)
 
 		/* Generic fbdev uses a shadow buffer */
 		if (helper->buffer) {
-			vaddr = drm_client_buffer_vmap(helper->buffer);
+			vaddr = drm_client_buffer_vmap(helper->buffer, NULL);
 			if (IS_ERR(vaddr))
 				return;
 			drm_fb_helper_dirty_blit_real(helper, &clip_copy);
@@ -2212,7 +2212,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
 		fb_deferred_io_init(fbi);
 	} else {
 		/* buffer is mapped for HW framebuffer */
-		vaddr = drm_client_buffer_vmap(fb_helper->buffer);
+		vaddr = drm_client_buffer_vmap(fb_helper->buffer, NULL);
 		if (IS_ERR(vaddr))
 			return PTR_ERR(vaddr);
 
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 5cf2c5dd8b1e..053d58215be7 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -140,6 +140,11 @@ struct drm_client_buffer {
 	 */
 	void *vaddr;
 
+	/**
+	 * @vaddr_is_iomem: True if vaddr points to I/O memory, false otherwise
+	 */
+	bool vaddr_is_iomem;
+
 	/**
 	 * @fb: DRM framebuffer
 	 */
@@ -149,7 +154,7 @@ struct drm_client_buffer {
 struct drm_client_buffer *
 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
-void *drm_client_buffer_vmap(struct drm_client_buffer *buffer);
+void *drm_client_buffer_vmap(struct drm_client_buffer *buffer, bool *is_iomem);
 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
 
 int drm_client_modeset_create(struct drm_client_dev *client);
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux