drm/exynos: add trace support
authorInki Dae <inki.dae@samsung.com>
Fri, 19 Aug 2016 11:46:09 +0000 (13:46 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:53:33 +0000 (13:53 +0900)
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 <inki.dae@samsung.com>
[squashed with bugfixes and ported to v4.1 Tizen kernel]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
drivers/gpu/drm/exynos/Makefile
drivers/gpu/drm/exynos/exynos_drm_crtc.c
drivers/gpu/drm/exynos/exynos_drm_plane.c
drivers/gpu/drm/exynos/exynos_trace.c [new file with mode: 0644]
drivers/gpu/drm/exynos/exynos_trace.h [new file with mode: 0644]

index 99bbfd3..2c38400 100644 (file)
@@ -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
index db47a51..37faad2 100644 (file)
@@ -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;
index 979108a..d8b398a 100644 (file)
@@ -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 (file)
index 0000000..696f5bf
--- /dev/null
@@ -0,0 +1,18 @@
+/* exynos_trace.c
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Authors:
+ *     Inki Dae <inki.dae@samsung.com>
+ *
+ * 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 (file)
index 0000000..cdf1206
--- /dev/null
@@ -0,0 +1,129 @@
+/* exynos_trace.h
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Authors:
+ *     Inki Dae <inki.dae@samsung.com>
+ *
+ * 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 <linux/stringify.h>
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+#include <linux/fence.h>
+
+#include <drm/drmP.h>
+#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 <trace/define_trace.h>