diff mbox series

[03/13] drm/msm: Save the ring name in the ring structure

Message ID 1538397105-19581-4-git-send-email-smasetty@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series drm/msm: Hook up the DRM gpu scheduler | expand

Commit Message

Sharat Masetty Oct. 1, 2018, 12:31 p.m. UTC
The scheduler needs an instance name mostly for debug purposes. Save the
name in the ringbuffer instead of a stack variable, so that the name
can be shared with the scheduler.

Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
---
 drivers/gpu/drm/msm/msm_ringbuffer.c | 5 ++---
 drivers/gpu/drm/msm/msm_ringbuffer.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Jordan Crouse Oct. 1, 2018, 6:01 p.m. UTC | #1
On Mon, Oct 01, 2018 at 06:01:35PM +0530, Sharat Masetty wrote:
> The scheduler needs an instance name mostly for debug purposes. Save the
> name in the ringbuffer instead of a stack variable, so that the name
> can be shared with the scheduler.
> 
> Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/msm_ringbuffer.c | 5 ++---
>  drivers/gpu/drm/msm/msm_ringbuffer.h | 1 +
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
> index 734f2b8..0889766 100644
> --- a/drivers/gpu/drm/msm/msm_ringbuffer.c
> +++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
> @@ -22,7 +22,6 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
>  		void *memptrs, uint64_t memptrs_iova)
>  {
>  	struct msm_ringbuffer *ring;
> -	char name[32];
>  	int ret;
>  
>  	/* We assume everwhere that MSM_GPU_RINGBUFFER_SZ is a power of 2 */
> @@ -55,9 +54,9 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
>  	INIT_LIST_HEAD(&ring->submits);
>  	spin_lock_init(&ring->lock);
>  
> -	snprintf(name, sizeof(name), "gpu-ring-%d", ring->id);
> +	snprintf(ring->name, sizeof(ring->name), "msm-gpu-ring-%d", ring->id);

Okay I guess, but can't we just generate this on the fly when the
scheduler needs it? Its not like the name is random or anything.

> -	ring->fctx = msm_fence_context_alloc(gpu->dev, name);
> +	ring->fctx = msm_fence_context_alloc(gpu->dev, ring->name);
>  
>  	idr_init(&ring->fence_idr);
>  
> diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.h b/drivers/gpu/drm/msm/msm_ringbuffer.h
> index b74a0a9..523373b 100644
> --- a/drivers/gpu/drm/msm/msm_ringbuffer.h
> +++ b/drivers/gpu/drm/msm/msm_ringbuffer.h
> @@ -31,6 +31,7 @@ struct msm_rbmemptrs {
>  struct msm_ringbuffer {
>  	struct msm_gpu *gpu;
>  	int id;
> +	char name[16];
>  	struct drm_gem_object *bo;
>  	uint32_t *start, *end, *cur, *next;
>  	struct list_head submits;
> -- 
> 1.9.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 734f2b8..0889766 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -22,7 +22,6 @@  struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
 		void *memptrs, uint64_t memptrs_iova)
 {
 	struct msm_ringbuffer *ring;
-	char name[32];
 	int ret;
 
 	/* We assume everwhere that MSM_GPU_RINGBUFFER_SZ is a power of 2 */
@@ -55,9 +54,9 @@  struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
 	INIT_LIST_HEAD(&ring->submits);
 	spin_lock_init(&ring->lock);
 
-	snprintf(name, sizeof(name), "gpu-ring-%d", ring->id);
+	snprintf(ring->name, sizeof(ring->name), "msm-gpu-ring-%d", ring->id);
 
-	ring->fctx = msm_fence_context_alloc(gpu->dev, name);
+	ring->fctx = msm_fence_context_alloc(gpu->dev, ring->name);
 
 	idr_init(&ring->fence_idr);
 
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.h b/drivers/gpu/drm/msm/msm_ringbuffer.h
index b74a0a9..523373b 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.h
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.h
@@ -31,6 +31,7 @@  struct msm_rbmemptrs {
 struct msm_ringbuffer {
 	struct msm_gpu *gpu;
 	int id;
+	char name[16];
 	struct drm_gem_object *bo;
 	uint32_t *start, *end, *cur, *next;
 	struct list_head submits;