1 /*************************************************************************/ /*!
2 @Title Timed Trace header
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description Timed Trace common header. Contains shared defines and
5 structures which are shared with the post processing tool.
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43 #include "img_types.h"
45 #ifndef __TTRACE_COMMON_H__
46 #define __TTRACE_COMMON_H__
48 /*
49 * Trace item
50 * ==========
51 *
52 * A trace item contains a trace header, a timestamp, a UID and a
53 * data header all of which are 32-bit and mandatory. If there
54 * is no data then the data header size is set to 0.
55 *
56 * Trace header
57 * ------------
58 * 31 27 23 19 15 11 7 3
59 * GGGG GGGG CCCC CCCC TTTT TTTT TTTT TTTT
60 *
61 * G = group
62 * Note:
63 * Group 0xff means the message is padding
64 *
65 * C = class
66 * T = Token
67 *
68 * Data header
69 *-----------
70 * 31 27 23 19 15 11 7 3
71 * SSSS SSSS SSSS SSSS TTTT CCCC CCCC CCCC
72 *
73 * S = data packet size
74 * T = Type
75 * 0000 - 8 bit
76 * 0001 - 16 bit
77 * 0010 - 32 bit
78 * 0011 - 64 bit
79 *
80 * C = data item count
81 *
82 * Note: It might look strange having both the packet
83 * size and the data item count, but the idea
84 * is the you might have a "special" data type
85 * who's size might not be known by the post
86 * processing program and rather then fail
87 * processing the buffer after that point if we
88 * know the size we can just skip it and move to
89 * the next item.
90 */
93 #define PVRSRV_TRACE_HEADER 0
94 #define PVRSRV_TRACE_TIMESTAMP 1
95 #define PVRSRV_TRACE_HOSTUID 2
96 #define PVRSRV_TRACE_DATA_HEADER 3
97 #define PVRSRV_TRACE_DATA_PAYLOAD 4
99 #define PVRSRV_TRACE_ITEM_SIZE 16
101 #define PVRSRV_TRACE_GROUP_MASK 0xff
102 #define PVRSRV_TRACE_CLASS_MASK 0xff
103 #define PVRSRV_TRACE_TOKEN_MASK 0xffff
105 #define PVRSRV_TRACE_GROUP_SHIFT 24
106 #define PVRSRV_TRACE_CLASS_SHIFT 16
107 #define PVRSRV_TRACE_TOKEN_SHIFT 0
109 #define PVRSRV_TRACE_SIZE_MASK 0xffff
110 #define PVRSRV_TRACE_TYPE_MASK 0xf
111 #define PVRSRV_TRACE_COUNT_MASK 0xfff
113 #define PVRSRV_TRACE_SIZE_SHIFT 16
114 #define PVRSRV_TRACE_TYPE_SHIFT 12
115 #define PVRSRV_TRACE_COUNT_SHIFT 0
118 #define WRITE_HEADER(n,m) \
119 ((m & PVRSRV_TRACE_##n##_MASK) << PVRSRV_TRACE_##n##_SHIFT)
121 #define READ_HEADER(n,m) \
122 ((m & (PVRSRV_TRACE_##n##_MASK << PVRSRV_TRACE_##n##_SHIFT)) >> PVRSRV_TRACE_##n##_SHIFT)
125 #if defined(TTRACE_LARGE_BUFFER)
126 #define TIME_TRACE_BUFFER_SIZE 8192
127 #else
128 #define TIME_TRACE_BUFFER_SIZE 4096
129 #endif
131 /* Type defines for trace items */
132 #define PVRSRV_TRACE_TYPE_UI8 0
133 #define PVRSRV_TRACE_TYPE_UI16 1
134 #define PVRSRV_TRACE_TYPE_UI32 2
135 #define PVRSRV_TRACE_TYPE_UI64 3
137 #define PVRSRV_TRACE_TYPE_SYNC 15
138 #define PVRSRV_TRACE_SYNC_UID 0
139 #define PVRSRV_TRACE_SYNC_WOP 1
140 #define PVRSRV_TRACE_SYNC_WOC 2
141 #define PVRSRV_TRACE_SYNC_ROP 3
142 #define PVRSRV_TRACE_SYNC_ROC 4
143 #define PVRSRV_TRACE_SYNC_WO_DEV_VADDR 5
144 #define PVRSRV_TRACE_SYNC_RO_DEV_VADDR 6
145 #define PVRSRV_TRACE_SYNC_OP 7
146 #define PVRSRV_TRACE_SYNC_RO2P 8
147 #define PVRSRV_TRACE_SYNC_RO2C 9
148 #define PVRSRV_TRACE_SYNC_RO2_DEV_VADDR 10
149 #define PVRSRV_TRACE_TYPE_SYNC_SIZE ((PVRSRV_TRACE_SYNC_RO2_DEV_VADDR + 1) * sizeof(IMG_UINT32))
151 #endif /* __TTRACE_COMMON_H__*/