linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse@codeaurora.org>
To: freedreno@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH 05/13] drm/msm: Add hint to DRM_IOCTL_MSM_GEM_INFO to return an object IOVA
Date: Mon,  8 May 2017 14:35:01 -0600	[thread overview]
Message-ID: <1494275709-25782-6-git-send-email-jcrouse@codeaurora.org> (raw)
In-Reply-To: <1494275709-25782-1-git-send-email-jcrouse@codeaurora.org>

Modify the 'pad' member of struct drm_msm_gem_info to 'hint'. If the
user sets 'hint' to non-zero it means that they want a IOVA for the
GEM object instead of a mmap() offset. Return the iova in the 'offset'
member.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
 drivers/gpu/drm/msm/msm_drv.c | 23 +++++++++++++++++++++--
 include/uapi/drm/msm_drm.h    |  8 ++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 66a3a05..257ee81 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -699,6 +699,17 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
 	return ret;
 }
 
+static int msm_ioctl_gem_info_iova(struct drm_device *dev,
+		struct drm_gem_object *obj, uint64_t *iova)
+{
+	struct msm_drm_private *priv = dev->dev_private;
+
+	if (!priv->gpu)
+		return -EINVAL;
+
+	return msm_gem_get_iova(obj, priv->gpu->id, iova);
+}
+
 static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
 		struct drm_file *file)
 {
@@ -706,14 +717,22 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
 	struct drm_gem_object *obj;
 	int ret = 0;
 
-	if (args->pad)
+	if (args->flags & ~MSM_INFO_FLAGS)
 		return -EINVAL;
 
 	obj = drm_gem_object_lookup(file, args->handle);
 	if (!obj)
 		return -ENOENT;
 
-	args->offset = msm_gem_mmap_offset(obj);
+	if (args->flags & MSM_INFO_IOVA) {
+		uint64_t iova;
+
+		ret = msm_ioctl_gem_info_iova(dev, obj, &iova);
+		if (!ret)
+			args->offset = iova;
+	} else {
+		args->offset = msm_gem_mmap_offset(obj);
+	}
 
 	drm_gem_object_unreference_unlocked(obj);
 
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index a9985fe..26c54f6 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -104,10 +104,14 @@ struct drm_msm_gem_new {
 	__u32 handle;         /* out */
 };
 
+#define MSM_INFO_IOVA	0x01
+
+#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
+
 struct drm_msm_gem_info {
 	__u32 handle;         /* in */
-	__u32 pad;
-	__u64 offset;         /* out, offset to pass to mmap() */
+	__u32 flags;	      /* in - combination of MSM_INFO_* flags */
+	__u64 offset;         /* out, mmap() offset or iova */
 };
 
 #define MSM_PREP_READ        0x01
-- 
1.9.1

  parent reply	other threads:[~2017-05-08 20:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 20:34 [PATCH 00/13] Adreno code for 4.13 Jordan Crouse
2017-05-08 20:34 ` [PATCH 01/13] drm/msm: Take the mutex before calling msm_gem_new_impl Jordan Crouse
2017-05-08 20:39   ` [Freedreno] " Rob Clark
2017-05-08 20:34 ` [PATCH 02/13] drm/msm: Fix the check for the command size Jordan Crouse
2017-05-08 20:34 ` [PATCH 03/13] drm/msm: Remove DRM_MSM_NUM_IOCTLS Jordan Crouse
2017-05-08 20:35 ` [PATCH 04/13] drm/msm: Remove idle function hook Jordan Crouse
2017-05-08 20:35 ` Jordan Crouse [this message]
2017-05-08 20:35 ` [PATCH 06/13] drm/msm: get an iova from the address space instead of an id Jordan Crouse
2017-05-08 20:35 ` [PATCH 07/13] drm/msm: Add a struct to pass configuration to msm_gpu_init() Jordan Crouse
2017-05-08 20:35 ` [PATCH 08/13] drm/msm: Remove memptrs->wptr Jordan Crouse
2017-05-08 20:35 ` [PATCH 09/13] drm/msm: Add drawqueues Jordan Crouse
2017-05-08 20:35 ` [PATCH 10/13] drm/msm: Support multiple ringbuffers Jordan Crouse
2017-05-25 17:25   ` Jordan Crouse
2017-05-25 17:37     ` [Freedreno] " Rob Clark
     [not found]   ` <1494275709-25782-11-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-05-28 13:43     ` Rob Clark
     [not found]       ` <CAF6AEGtiw4yBEZyDhLrQhCFPHVPi9ukD4MkKfkT0_AvTtCeCfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-30 16:20         ` Jordan Crouse
2017-05-30 16:34           ` [Freedreno] " Alex Deucher
2017-05-31  7:21             ` Daniel Vetter
2017-05-08 20:35 ` [PATCH 11/13] drm/msm: Shadow current pointer in the ring until command is complete Jordan Crouse
     [not found] ` <1494275709-25782-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-05-08 20:35   ` [PATCH 12/13] drm/msm: Make the value of RB_CNTL (almost) generic Jordan Crouse
2017-05-08 20:35 ` [PATCH 13/13] drm/msm: Implement preemption for A5XX targets Jordan Crouse

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=1494275709-25782-6-git-send-email-jcrouse@codeaurora.org \
    --to=jcrouse@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).