public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org
Subject: [PATCH 8/9] drm/msm: Add a name field to struct drm_msm_gem_new
Date: Wed,  7 Nov 2018 15:35:53 -0700	[thread overview]
Message-ID: <20181107223554.27308-9-jcrouse@codeaurora.org> (raw)
In-Reply-To: <20181107223554.27308-1-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

Add a name field to struct drm_msm_gem_new to allow userspace
to specify a name/description for gem buffers to improve
debugging and tracking.

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

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f2ebfb9ba0e4..8fb86edd30fa 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -35,9 +35,10 @@
  * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW +
  *           SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for
  *           MSM_GEM_INFO ioctl.
+ * - 1.4.0 - Add char name[32] to MSM_GEM_BO_NEW for tracking purposes
  */
 #define MSM_VERSION_MAJOR	1
-#define MSM_VERSION_MINOR	3
+#define MSM_VERSION_MINOR	4
 #define MSM_VERSION_PATCHLEVEL	0
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
@@ -791,7 +792,7 @@ static int msm_ioctl_gem_new(struct drm_device *dev, void *data,
 	}
 
 	return msm_gem_new_handle(dev, file, args->size,
-			args->flags, &args->handle);
+			args->flags, &args->handle, args->name);
 }
 
 static inline ktime_t to_ktime(struct drm_msm_timespec timeout)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index df920b13a8a4..71a03ce21da5 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -309,7 +309,7 @@ int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op, ktime_t *timeout);
 int msm_gem_cpu_fini(struct drm_gem_object *obj);
 void msm_gem_free_object(struct drm_gem_object *obj);
 int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file,
-		uint32_t size, uint32_t flags, uint32_t *handle);
+		uint32_t size, uint32_t flags, uint32_t *handle, char *name);
 struct drm_gem_object *msm_gem_new(struct drm_device *dev,
 		uint32_t size, uint32_t flags);
 struct drm_gem_object *msm_gem_new_locked(struct drm_device *dev,
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 35c9d4048b37..3d53e8765a7f 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -890,16 +890,28 @@ void msm_gem_free_object(struct drm_gem_object *obj)
 
 /* convenience method to construct a GEM buffer object, and userspace handle */
 int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file,
-		uint32_t size, uint32_t flags, uint32_t *handle)
+		uint32_t size, uint32_t flags, uint32_t *handle,
+		char *name)
 {
 	struct drm_gem_object *obj;
-	int ret;
+	struct msm_gem_object *msm_obj;
+	int ret, i;
 
 	obj = msm_gem_new(dev, size, flags);
 
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
+	msm_obj = to_msm_bo(obj);
+
+	/* Copy the buffer name stopping at the first non printable character */
+	for(i = 0; i < sizeof(msm_obj->name) - 1; i++) {
+		if (!isprint(name[i]))
+			break;
+
+		msm_obj->name[i] = name[i];
+	}
+
 	ret = drm_gem_handle_create(file, obj, handle);
 
 	/* drop reference from allocate - handle holds it now */
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index c06d0a5bdd80..0d89e9875faf 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -103,6 +103,7 @@ struct drm_msm_gem_new {
 	__u64 size;           /* in */
 	__u32 flags;          /* in, mask of MSM_BO_x */
 	__u32 handle;         /* out */
+	char name[32];        /* in, name of the bo for tracking */
 };
 
 #define MSM_INFO_IOVA	0x01
-- 
2.18.0

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-11-07 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 22:35 [PATCH v2 0/9] drm/msm: separate iova allocation and mapping Jordan Crouse
2018-11-07 22:35 ` [PATCH 6/9] drm/msm: Count how many times iova memory is pinned Jordan Crouse
     [not found] ` <20181107223554.27308-1-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-07 22:35   ` [PATCH 1/9] drm/msm: Add a common function to free kernel buffer objects Jordan Crouse
2018-11-07 22:35   ` [PATCH 2/9] drm/msm: Remove sgt from the mmu unmap function Jordan Crouse
2018-11-07 22:35   ` [PATCH 3/9] drm/msm: Split msm_gem_get_iova into two steps Jordan Crouse
2018-11-07 22:35   ` [PATCH 4/9] drm/msm: Clean up and enhance the output of the 'gem' debugfs node Jordan Crouse
2018-11-07 22:35   ` [PATCH 5/9] drm/msm: Add msm_gem_get_and_pin_iova() Jordan Crouse
2018-11-07 22:35   ` [PATCH 7/9] drm/msm: Add a name field for gem objects Jordan Crouse
2018-11-07 22:35   ` Jordan Crouse [this message]
2018-11-07 22:35   ` [PATCH 9/9] drm/msm/gpu: Map the ringbuffer in the iova at create time 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=20181107223554.27308-9-jcrouse@codeaurora.org \
    --to=jcrouse-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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