All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, christian.koenig@amd.com, noralf@tronnes.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 5/8] drm/client: Return I/O memory flag from drm_client_buffer_vmap()
Date: Wed,  6 Nov 2019 10:31:18 +0100	[thread overview]
Message-ID: <20191106093121.21762-6-tzimmermann@suse.de> (raw)
In-Reply-To: <20191106093121.21762-1-tzimmermann@suse.de>

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@suse.de>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-11-06  9:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06  9:31 [RFC][PATCH 0/8] Support I/O memory in generic fbdev emulation Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 1/8] drm/vram-helper: Tell caller if vmap() returned I/O memory Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 2/8] drm/qxl: Tell caller if kmap() " Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 3/8] drm: Add is_iomem return parameter to struct drm_gem_object_funcs.vmap Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 4/8] drm/gem: Return I/O-memory flag from drm_gem_vram() Thomas Zimmermann
2019-11-06  9:31 ` Thomas Zimmermann [this message]
2019-11-06  9:31 ` [PATCH 6/8] fbdev: Export default read and write operations as fb_cfb_{read, write}() Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 7/8] drm/fb-helper: Select between fb_{sys, cfb}_read() and _write() Thomas Zimmermann
2019-11-06  9:31 ` [PATCH 8/8] drm/fb-helper: Handle I/O memory correctly when flushing shadow fb Thomas Zimmermann
2019-11-06 10:05 ` [RFC][PATCH 0/8] Support I/O memory in generic fbdev emulation Daniel Vetter

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=20191106093121.21762-6-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=noralf@tronnes.org \
    /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.