Commit d934a712 authored by Rob Clark's avatar Rob Clark

drm/msm: add atomic traces

This was useful for debugging fps drops.  I suspect it will be useful
again.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarSean Paul <sean@poorly.run>
parent cd6d9231
...@@ -75,6 +75,7 @@ msm-y := \ ...@@ -75,6 +75,7 @@ msm-y := \
disp/dpu1/dpu_rm.o \ disp/dpu1/dpu_rm.o \
disp/dpu1/dpu_vbif.o \ disp/dpu1/dpu_vbif.o \
msm_atomic.o \ msm_atomic.o \
msm_atomic_tracepoints.o \
msm_debugfs.o \ msm_debugfs.o \
msm_drv.o \ msm_drv.o \
msm_fb.o \ msm_fb.o \
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
#include "msm_atomic_trace.h"
#include "msm_drv.h" #include "msm_drv.h"
#include "msm_gem.h" #include "msm_gem.h"
#include "msm_kms.h" #include "msm_kms.h"
...@@ -30,11 +31,13 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) ...@@ -30,11 +31,13 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
{ {
unsigned crtc_mask = BIT(crtc_idx); unsigned crtc_mask = BIT(crtc_idx);
trace_msm_atomic_async_commit_start(crtc_mask);
mutex_lock(&kms->commit_lock); mutex_lock(&kms->commit_lock);
if (!(kms->pending_crtc_mask & crtc_mask)) { if (!(kms->pending_crtc_mask & crtc_mask)) {
mutex_unlock(&kms->commit_lock); mutex_unlock(&kms->commit_lock);
return; goto out;
} }
kms->pending_crtc_mask &= ~crtc_mask; kms->pending_crtc_mask &= ~crtc_mask;
...@@ -44,19 +47,24 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx) ...@@ -44,19 +47,24 @@ static void msm_atomic_async_commit(struct msm_kms *kms, int crtc_idx)
/* /*
* Flush hardware updates: * Flush hardware updates:
*/ */
DRM_DEBUG_ATOMIC("triggering async commit\n"); trace_msm_atomic_flush_commit(crtc_mask);
kms->funcs->flush_commit(kms, crtc_mask); kms->funcs->flush_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock); mutex_unlock(&kms->commit_lock);
/* /*
* Wait for flush to complete: * Wait for flush to complete:
*/ */
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask); kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock); mutex_lock(&kms->commit_lock);
kms->funcs->complete_commit(kms, crtc_mask); kms->funcs->complete_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock); mutex_unlock(&kms->commit_lock);
kms->funcs->disable_commit(kms); kms->funcs->disable_commit(kms);
out:
trace_msm_atomic_async_commit_finish(crtc_mask);
} }
static enum hrtimer_restart msm_atomic_pending_timer(struct hrtimer *t) static enum hrtimer_restart msm_atomic_pending_timer(struct hrtimer *t)
...@@ -141,13 +149,17 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -141,13 +149,17 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
bool async = kms->funcs->vsync_time && bool async = kms->funcs->vsync_time &&
can_do_async(state, &async_crtc); can_do_async(state, &async_crtc);
trace_msm_atomic_commit_tail_start(async, crtc_mask);
kms->funcs->enable_commit(kms); kms->funcs->enable_commit(kms);
/* /*
* Ensure any previous (potentially async) commit has * Ensure any previous (potentially async) commit has
* completed: * completed:
*/ */
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask); kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock); mutex_lock(&kms->commit_lock);
...@@ -198,6 +210,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -198,6 +210,8 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_commit_hw_done(state); drm_atomic_helper_commit_hw_done(state);
drm_atomic_helper_cleanup_planes(dev, state); drm_atomic_helper_cleanup_planes(dev, state);
trace_msm_atomic_commit_tail_finish(async, crtc_mask);
return; return;
} }
...@@ -210,14 +224,16 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -210,14 +224,16 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
/* /*
* Flush hardware updates: * Flush hardware updates:
*/ */
DRM_DEBUG_ATOMIC("triggering commit\n"); trace_msm_atomic_flush_commit(crtc_mask);
kms->funcs->flush_commit(kms, crtc_mask); kms->funcs->flush_commit(kms, crtc_mask);
mutex_unlock(&kms->commit_lock); mutex_unlock(&kms->commit_lock);
/* /*
* Wait for flush to complete: * Wait for flush to complete:
*/ */
trace_msm_atomic_wait_flush_start(crtc_mask);
kms->funcs->wait_flush(kms, crtc_mask); kms->funcs->wait_flush(kms, crtc_mask);
trace_msm_atomic_wait_flush_finish(crtc_mask);
mutex_lock(&kms->commit_lock); mutex_lock(&kms->commit_lock);
kms->funcs->complete_commit(kms, crtc_mask); kms->funcs->complete_commit(kms, crtc_mask);
...@@ -226,4 +242,6 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -226,4 +242,6 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_commit_hw_done(state); drm_atomic_helper_commit_hw_done(state);
drm_atomic_helper_cleanup_planes(dev, state); drm_atomic_helper_cleanup_planes(dev, state);
trace_msm_atomic_commit_tail_finish(async, crtc_mask);
} }
/* SPDX-License-Identifier: GPL-2.0 */
#if !defined(_MSM_GPU_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _MSM_GPU_TRACE_H_
#include <linux/tracepoint.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM drm_msm_atomic
#define TRACE_INCLUDE_FILE msm_atomic_trace
TRACE_EVENT(msm_atomic_commit_tail_start,
TP_PROTO(bool async, unsigned crtc_mask),
TP_ARGS(async, crtc_mask),
TP_STRUCT__entry(
__field(bool, async)
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->async = async;
__entry->crtc_mask = crtc_mask;
),
TP_printk("async=%d crtc_mask=%x",
__entry->async, __entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_commit_tail_finish,
TP_PROTO(bool async, unsigned crtc_mask),
TP_ARGS(async, crtc_mask),
TP_STRUCT__entry(
__field(bool, async)
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->async = async;
__entry->crtc_mask = crtc_mask;
),
TP_printk("async=%d crtc_mask=%x",
__entry->async, __entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_async_commit_start,
TP_PROTO(unsigned crtc_mask),
TP_ARGS(crtc_mask),
TP_STRUCT__entry(
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->crtc_mask = crtc_mask;
),
TP_printk("crtc_mask=%x",
__entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_async_commit_finish,
TP_PROTO(unsigned crtc_mask),
TP_ARGS(crtc_mask),
TP_STRUCT__entry(
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->crtc_mask = crtc_mask;
),
TP_printk("crtc_mask=%x",
__entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_wait_flush_start,
TP_PROTO(unsigned crtc_mask),
TP_ARGS(crtc_mask),
TP_STRUCT__entry(
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->crtc_mask = crtc_mask;
),
TP_printk("crtc_mask=%x",
__entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_wait_flush_finish,
TP_PROTO(unsigned crtc_mask),
TP_ARGS(crtc_mask),
TP_STRUCT__entry(
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->crtc_mask = crtc_mask;
),
TP_printk("crtc_mask=%x",
__entry->crtc_mask)
);
TRACE_EVENT(msm_atomic_flush_commit,
TP_PROTO(unsigned crtc_mask),
TP_ARGS(crtc_mask),
TP_STRUCT__entry(
__field(u32, crtc_mask)
),
TP_fast_assign(
__entry->crtc_mask = crtc_mask;
),
TP_printk("crtc_mask=%x",
__entry->crtc_mask)
);
#endif
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/msm
#include <trace/define_trace.h>
// SPDX-License-Identifier: GPL-2.0
#define CREATE_TRACE_POINTS
#include "msm_atomic_trace.h"
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#undef TRACE_SYSTEM #undef TRACE_SYSTEM
#define TRACE_SYSTEM drm_msm #define TRACE_SYSTEM drm_msm_gpu
#define TRACE_INCLUDE_FILE msm_gpu_trace #define TRACE_INCLUDE_FILE msm_gpu_trace
TRACE_EVENT(msm_gpu_submit, TRACE_EVENT(msm_gpu_submit,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment