From 95bc30fa225ca17bd589606bc7fc58f3c5305a08 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Fri, 19 Aug 2016 13:46:09 +0200 Subject: drm/exynos: add trace support This patch adds trace support and also inserts two trace points, one is win_commit and other is finish_pageflip. These would give us help to trace pageflip operation. Change-Id: I1cd912f03703ae40d3fe45a4b329eddfce5178e4 Signed-off-by: Inki Dae [squashed with bugfixes and ported to v4.1 Tizen kernel] Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/Makefile | 2 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 5 ++ drivers/gpu/drm/exynos/exynos_drm_plane.c | 6 ++ drivers/gpu/drm/exynos/exynos_trace.c | 18 +++++ drivers/gpu/drm/exynos/exynos_trace.h | 129 ++++++++++++++++++++++++++++++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/exynos/exynos_trace.c create mode 100644 drivers/gpu/drm/exynos/exynos_trace.h (limited to 'drivers/gpu/drm/exynos') diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 99bbfd3674f7..2c38400f2757 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -6,7 +6,7 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \ exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \ exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \ - exynos_drm_plane.o exynos_drm_dmabuf.o + exynos_drm_plane.o exynos_drm_dmabuf.o exynos_trace.o exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index db47a5138005..37faad2de1a6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -19,6 +19,7 @@ #include "exynos_drm_drv.h" #include "exynos_drm_encoder.h" #include "exynos_drm_plane.h" +#include "exynos_trace.h" static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) { @@ -178,6 +179,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, if (!event) return -EINVAL; + trace_exynos_request_pageflip(exynos_crtc); + + spin_lock_irq(&dev->event_lock); if (exynos_crtc->event) { ret = -EBUSY; @@ -324,6 +328,7 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe) drm_vblank_put(dev, pipe); wake_up(&exynos_crtc->pending_flip_queue); + trace_exynos_finish_vsync(exynos_crtc); } exynos_crtc->event = NULL; diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 979108a52dcc..d8b398a9d68c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -18,6 +18,7 @@ #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" #include "exynos_drm_plane.h" +#include "exynos_trace.h" /* * This function is to get X or Y size shown via screen. This needs length and @@ -145,6 +146,7 @@ static void exynos_plane_update_cb(struct drm_reservation_cb *rcb, void *params) struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(exynos_plane->base.crtc); + trace_exynos_update_cb(exynos_crtc, exynos_plane); if (exynos_crtc->ops->win_commit) exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos); @@ -193,18 +195,22 @@ static int exynos_plane_fence(struct exynos_drm_plane *plane, plane->update_pending = true; plane->pending_fence = fence; + trace_exynos_add_shared_fence(exynos_crtc, plane); reservation_object_add_shared_fence(resv, plane->pending_fence); if (!reservation_object_test_signaled_rcu(resv, false)) { drm_reservation_cb_init(&plane->rcb, exynos_plane_update_cb, plane); + trace_exynos_cb_add(exynos_crtc, plane); ret = drm_reservation_cb_add(&plane->rcb, resv, false); if (ret < 0) { DRM_ERROR("Adding reservation to callback failed: %d\n", ret); goto err_fence; } + trace_exynos_cb_done(exynos_crtc, plane); drm_reservation_cb_done(&plane->rcb); } else { + trace_exynos_cb_fast_path(exynos_crtc, plane); exynos_plane_update_cb(&plane->rcb, plane); } diff --git a/drivers/gpu/drm/exynos/exynos_trace.c b/drivers/gpu/drm/exynos/exynos_trace.c new file mode 100644 index 000000000000..696f5bfc8b59 --- /dev/null +++ b/drivers/gpu/drm/exynos/exynos_trace.c @@ -0,0 +1,18 @@ +/* exynos_trace.c + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Authors: + * Inki Dae + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include "exynos_drm_drv.h" + +#ifndef __CHECKER__ +#define CREATE_TRACE_POINTS +#include "exynos_trace.h" +#endif diff --git a/drivers/gpu/drm/exynos/exynos_trace.h b/drivers/gpu/drm/exynos/exynos_trace.h new file mode 100644 index 000000000000..cdf1206bf3ea --- /dev/null +++ b/drivers/gpu/drm/exynos/exynos_trace.h @@ -0,0 +1,129 @@ +/* exynos_trace.h + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Authors: + * Inki Dae + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#if !defined(_EXYNOS_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) +#define _EXYNOS_TRACE_H_ + +#include +#include +#include +#include + +#include +#include "exynos_drm_drv.h" + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM exynos + +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE exynos_trace + +#ifdef CONFIG_DRM_DMA_SYNC +DECLARE_EVENT_CLASS(exynos_fence, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane), + + TP_STRUCT__entry( + __field(u32, seqno) + __field(u32, context) + __field(u32, count) + __field(u32, type) + __field(u32, zpos) + ), + + TP_fast_assign( + __entry->seqno = plane->pending_fence->seqno; + __entry->context = plane->pending_fence->context; + __entry->count = atomic_read(&plane->rcb.count); + __entry->type = crtc->type; + __entry->zpos = plane->zpos; + ), + + TP_printk("fence(%d) rcb(%d), crtc type(%d), plane zpos(%d)", + __entry->seqno, __entry->count, + __entry->type, __entry->zpos) +); + +DEFINE_EVENT(exynos_fence, exynos_cb_add, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane) +); + +DEFINE_EVENT(exynos_fence, exynos_add_shared_fence, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane) +); + +DEFINE_EVENT(exynos_fence, exynos_cb_done, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane) +); + +DEFINE_EVENT(exynos_fence, exynos_cb_fast_path, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane) +); + +DEFINE_EVENT(exynos_fence, exynos_update_cb, + TP_PROTO(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane), + + TP_ARGS(crtc, plane) +); +#endif + +DECLARE_EVENT_CLASS(exynos_modeset, + TP_PROTO(struct exynos_drm_crtc *crtc), + + TP_ARGS(crtc), + + TP_STRUCT__entry( + __field(u32, pipe) + __field(u32, type) + ), + + TP_fast_assign( + __entry->pipe = crtc->pipe; + __entry->type = crtc->type; + ), + + TP_printk("crtc pipe = %d, crtc type = %d", + __entry->pipe, __entry->type) +); + + +DEFINE_EVENT(exynos_modeset, exynos_finish_vsync, + TP_PROTO(struct exynos_drm_crtc *crtc), + + TP_ARGS(crtc) +); + +DEFINE_EVENT(exynos_modeset, exynos_request_pageflip, + TP_PROTO(struct exynos_drm_crtc *crtc), + + TP_ARGS(crtc) +); + +#endif /* _EXYNOS_TRACE_H_ */ + +/* This part must be outside protection */ +#include -- cgit v1.2.3