Linux-libre 5.4.47-gnu
[librecmc/linux-libre.git] / drivers / gpu / drm / amd / display / amdgpu_dm / amdgpu_dm_trace.h
1 /*
2  * Copyright 2018 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25
26 #undef TRACE_SYSTEM
27 #define TRACE_SYSTEM amdgpu_dm
28
29 #if !defined(_AMDGPU_DM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
30 #define _AMDGPU_DM_TRACE_H_
31
32 #include <linux/tracepoint.h>
33
34 TRACE_EVENT(amdgpu_dc_rreg,
35         TP_PROTO(unsigned long *read_count, uint32_t reg, uint32_t value),
36         TP_ARGS(read_count, reg, value),
37         TP_STRUCT__entry(
38                         __field(uint32_t, reg)
39                         __field(uint32_t, value)
40                 ),
41         TP_fast_assign(
42                         __entry->reg = reg;
43                         __entry->value = value;
44                         *read_count = *read_count + 1;
45                 ),
46         TP_printk("reg=0x%08lx, value=0x%08lx",
47                         (unsigned long)__entry->reg,
48                         (unsigned long)__entry->value)
49 );
50
51 TRACE_EVENT(amdgpu_dc_wreg,
52         TP_PROTO(unsigned long *write_count, uint32_t reg, uint32_t value),
53         TP_ARGS(write_count, reg, value),
54         TP_STRUCT__entry(
55                         __field(uint32_t, reg)
56                         __field(uint32_t, value)
57                 ),
58         TP_fast_assign(
59                         __entry->reg = reg;
60                         __entry->value = value;
61                         *write_count = *write_count + 1;
62                 ),
63         TP_printk("reg=0x%08lx, value=0x%08lx",
64                         (unsigned long)__entry->reg,
65                         (unsigned long)__entry->value)
66 );
67
68
69 TRACE_EVENT(amdgpu_dc_performance,
70         TP_PROTO(unsigned long read_count, unsigned long write_count,
71                 unsigned long *last_read, unsigned long *last_write,
72                 const char *func, unsigned int line),
73         TP_ARGS(read_count, write_count, last_read, last_write, func, line),
74         TP_STRUCT__entry(
75                         __field(uint32_t, reads)
76                         __field(uint32_t, writes)
77                         __field(uint32_t, read_delta)
78                         __field(uint32_t, write_delta)
79                         __string(func, func)
80                         __field(uint32_t, line)
81                         ),
82         TP_fast_assign(
83                         __entry->reads = read_count;
84                         __entry->writes = write_count;
85                         __entry->read_delta = read_count - *last_read;
86                         __entry->write_delta = write_count - *last_write;
87                         __assign_str(func, func);
88                         __entry->line = line;
89                         *last_read = read_count;
90                         *last_write = write_count;
91                         ),
92         TP_printk("%s:%d reads=%08ld (%08ld total), writes=%08ld (%08ld total)",
93                         __get_str(func), __entry->line,
94                         (unsigned long)__entry->read_delta,
95                         (unsigned long)__entry->reads,
96                         (unsigned long)__entry->write_delta,
97                         (unsigned long)__entry->writes)
98 );
99 #endif /* _AMDGPU_DM_TRACE_H_ */
100
101 #undef TRACE_INCLUDE_PATH
102 #define TRACE_INCLUDE_PATH .
103 #define TRACE_INCLUDE_FILE amdgpu_dm_trace
104 #include <trace/define_trace.h>