MALI: utgard: upgrade DDK to r6p1-01rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / linux / mali_linux_trace.h
1 /*
2  * Copyright (C) 2012-2014, 2016 ARM Limited. All rights reserved.
3  * 
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  * 
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10
11 #if !defined (MALI_LINUX_TRACE_H) || defined (TRACE_HEADER_MULTI_READ)
12 #define MALI_LINUX_TRACE_H
13
14 #include <linux/types.h>
15
16 #include <linux/stringify.h>
17 #include <linux/tracepoint.h>
18
19 #undef  TRACE_SYSTEM
20 #define TRACE_SYSTEM mali
21 #define TRACE_SYSTEM_STRING __stringfy(TRACE_SYSTEM)
22
23 #define TRACE_INCLUDE_PATH .
24 #define TRACE_INCLUDE_FILE mali_linux_trace
25
26 /**
27  * Define the tracepoint used to communicate the status of a GPU. Called
28  * when a GPU turns on or turns off.
29  *
30  * @param event_id The type of the event. This parameter is a bitfield
31  *  encoding the type of the event.
32  *
33  * @param d0 First data parameter.
34  * @param d1 Second data parameter.
35  * @param d2 Third data parameter.
36  * @param d3 Fourth data parameter.
37  * @param d4 Fifth data parameter.
38  */
39 TRACE_EVENT(mali_timeline_event,
40
41             TP_PROTO(unsigned int event_id, unsigned int d0, unsigned int d1,
42                      unsigned int d2, unsigned int d3, unsigned int d4),
43
44             TP_ARGS(event_id, d0, d1, d2, d3, d4),
45
46             TP_STRUCT__entry(
47                     __field(unsigned int, event_id)
48                     __field(unsigned int, d0)
49                     __field(unsigned int, d1)
50                     __field(unsigned int, d2)
51                     __field(unsigned int, d3)
52                     __field(unsigned int, d4)
53             ),
54
55             TP_fast_assign(
56                     __entry->event_id = event_id;
57                     __entry->d0 = d0;
58                     __entry->d1 = d1;
59                     __entry->d2 = d2;
60                     __entry->d3 = d3;
61                     __entry->d4 = d4;
62             ),
63
64             TP_printk("event=%d", __entry->event_id)
65            );
66
67 /**
68  * Define a tracepoint used to regsiter the value of a hardware counter.
69  * Hardware counters belonging to the vertex or fragment processor are
70  * reported via this tracepoint each frame, whilst L2 cache hardware
71  * counters are reported continuously.
72  *
73  * @param counter_id The counter ID.
74  * @param value The value of the counter.
75  */
76 TRACE_EVENT(mali_hw_counter,
77
78             TP_PROTO(unsigned int counter_id, unsigned int value),
79
80             TP_ARGS(counter_id, value),
81
82             TP_STRUCT__entry(
83                     __field(unsigned int, counter_id)
84                     __field(unsigned int, value)
85             ),
86
87             TP_fast_assign(
88                     __entry->counter_id = counter_id;
89             ),
90
91             TP_printk("event %d = %d", __entry->counter_id, __entry->value)
92            );
93
94 /**
95  * Define a tracepoint used to send a bundle of software counters.
96  *
97  * @param counters The bundle of counters.
98  */
99 TRACE_EVENT(mali_sw_counters,
100
101             TP_PROTO(pid_t pid, pid_t tid, void *surface_id, unsigned int *counters),
102
103             TP_ARGS(pid, tid, surface_id, counters),
104
105             TP_STRUCT__entry(
106                     __field(pid_t, pid)
107                     __field(pid_t, tid)
108                     __field(void *, surface_id)
109                     __field(unsigned int *, counters)
110             ),
111
112             TP_fast_assign(
113                     __entry->pid = pid;
114                     __entry->tid = tid;
115                     __entry->surface_id = surface_id;
116                     __entry->counters = counters;
117             ),
118
119             TP_printk("counters were %s", __entry->counters == NULL ? "NULL" : "not NULL")
120            );
121
122 /**
123  * Define a tracepoint used to gather core activity for systrace
124  * @param pid The process id for which the core activity originates from
125  * @param active If the core is active (1) or not (0)
126  * @param core_type The type of core active, either GP (1) or PP (0)
127  * @param core_id The core id that is active for the core_type
128  * @param frame_builder_id The frame builder id associated with this core activity
129  * @param flush_id The flush id associated with this core activity
130  */
131 TRACE_EVENT(mali_core_active,
132
133             TP_PROTO(pid_t pid, unsigned int active, unsigned int core_type, unsigned int core_id, unsigned int frame_builder_id, unsigned int flush_id),
134
135             TP_ARGS(pid, active, core_type, core_id, frame_builder_id, flush_id),
136
137             TP_STRUCT__entry(
138                     __field(pid_t, pid)
139                     __field(unsigned int, active)
140                     __field(unsigned int, core_type)
141                     __field(unsigned int, core_id)
142                     __field(unsigned int, frame_builder_id)
143                     __field(unsigned int, flush_id)
144             ),
145
146             TP_fast_assign(
147                     __entry->pid = pid;
148                     __entry->active = active;
149                     __entry->core_type = core_type;
150                     __entry->core_id = core_id;
151                     __entry->frame_builder_id = frame_builder_id;
152                     __entry->flush_id = flush_id;
153             ),
154
155             TP_printk("%s|%d|%s%i:%x|%d", __entry->active ? "S" : "F", __entry->pid, __entry->core_type ? "GP" : "PP", __entry->core_id, __entry->flush_id, __entry->frame_builder_id)
156            );
157
158 #endif /* MALI_LINUX_TRACE_H */
159
160 /* This part must exist outside the header guard. */
161 #include <trace/define_trace.h>
162