From 37a0c3378e2ee5759e6b27a46c61bd2aaed944ad Mon Sep 17 00:00:00 2001 From: Aman Mehta Date: Tue, 18 Aug 2020 14:02:16 +0530 Subject: [PATCH] msm: kgsl: Sending KGSL events to msm perf module Add msm performance module function calls to send kgsl queue, submit and retired events. These events will be accessed by userspace through msm performance module to apply dynamic performance boosts. Change-Id: I6d93831e5fe821032b8e32c52e88b72ab102f6a2 Signed-off-by: Aman Mehta --- drivers/gpu/msm/adreno_dispatch.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c index 4e0f82e9c917..d62d6face8df 100644 --- a/drivers/gpu/msm/adreno_dispatch.c +++ b/drivers/gpu/msm/adreno_dispatch.c @@ -4,7 +4,7 @@ */ #include - +#include #include "adreno.h" #include "adreno_trace.h" #include "kgsl_gmu_core.h" @@ -294,6 +294,10 @@ static void _retire_timestamp(struct kgsl_drawobj *drawobj) info.wptr = rb->wptr; info.timestamp = drawobj->timestamp; + msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_RETIRED, + context->proc_priv->pid, + context->id, drawobj->timestamp); + /* * For A3xx we still get the rptr from the CP_RB_RPTR instead of * rptr scratch out address. At this point GPU clocks turned off. @@ -546,6 +550,7 @@ static int sendcmd(struct adreno_device *adreno_dev, struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); struct adreno_dispatcher *dispatcher = &adreno_dev->dispatcher; struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); + struct kgsl_context *context = drawobj->context; struct adreno_dispatcher_drawqueue *dispatch_q = ADRENO_DRAWOBJ_DISPATCH_DRAWQUEUE(drawobj); struct adreno_submit_time time; @@ -667,6 +672,10 @@ static int sendcmd(struct adreno_device *adreno_dev, info.wptr = drawctxt->rb->wptr; info.gmu_dispatch_queue = -1; + msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_SUBMIT, + context->proc_priv->pid, + context->id, drawobj->timestamp); + trace_adreno_cmdbatch_submitted(drawobj, &info, time.ticks, (unsigned long) secs, nsecs / 1000, dispatch_q->inflight); @@ -1242,11 +1251,16 @@ static unsigned int _check_context_state_to_queue_cmds( static void _queue_drawobj(struct adreno_context *drawctxt, struct kgsl_drawobj *drawobj) { + struct kgsl_context *context = drawobj->context; + /* Put the command into the queue */ drawctxt->drawqueue[drawctxt->drawqueue_tail] = drawobj; drawctxt->drawqueue_tail = (drawctxt->drawqueue_tail + 1) % ADRENO_CONTEXT_DRAWQUEUE_SIZE; drawctxt->queued++; + msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_QUEUE, + context->proc_priv->pid, + context->id, drawobj->timestamp); trace_adreno_cmdbatch_queued(drawobj, drawctxt->queued); } @@ -2347,6 +2361,7 @@ static void retire_cmdobj(struct adreno_device *adreno_dev, struct kgsl_drawobj *drawobj = DRAWOBJ(cmdobj); struct adreno_context *drawctxt = ADRENO_CONTEXT(drawobj->context); struct adreno_ringbuffer *rb = drawctxt->rb; + struct kgsl_context *context = drawobj->context; uint64_t start = 0, end = 0; struct retire_info info = {0}; @@ -2365,6 +2380,10 @@ static void retire_cmdobj(struct adreno_device *adreno_dev, info.sop = start; info.eop = end; + msm_perf_events_update(MSM_PERF_GFX, MSM_PERF_RETIRED, + context->proc_priv->pid, + context->id, drawobj->timestamp); + /* * For A3xx we still get the rptr from the CP_RB_RPTR instead of * rptr scratch out address. At this point GPU clocks turned off.