~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/driver_trace/tr_dump.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************
2
 
 *
3
 
 * Copyright 2008 VMware, Inc.
4
 
 * All Rights Reserved.
5
 
 *
6
 
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 
 * copy of this software and associated documentation files (the
8
 
 * "Software"), to deal in the Software without restriction, including
9
 
 * without limitation the rights to use, copy, modify, merge, publish,
10
 
 * distribute, sub license, and/or sell copies of the Software, and to
11
 
 * permit persons to whom the Software is furnished to do so, subject to
12
 
 * the following conditions:
13
 
 *
14
 
 * The above copyright notice and this permission notice (including the
15
 
 * next paragraph) shall be included in all copies or substantial portions
16
 
 * of the Software.
17
 
 *
18
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21
 
 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22
 
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
 
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
 
 *
26
 
 **************************************************************************/
27
 
 
28
 
/**
29
 
 * @file
30
 
 * Trace data dumping primitives.
31
 
 */
32
 
 
33
 
#ifndef TR_DUMP_H
34
 
#define TR_DUMP_H
35
 
 
36
 
 
37
 
#include "pipe/p_compiler.h"
38
 
#include "pipe/p_format.h"
39
 
 
40
 
struct pipe_resource;
41
 
struct pipe_surface;
42
 
struct pipe_transfer;
43
 
struct pipe_box;
44
 
 
45
 
/*
46
 
 * Low level dumping controls.
47
 
 *
48
 
 * Opening the trace file and checking if that is opened.
49
 
 */
50
 
bool trace_dump_trace_begin(void);
51
 
bool trace_dump_trace_enabled(void);
52
 
void trace_dump_trace_flush(void);
53
 
 
54
 
/*
55
 
 * Lock and unlock the call mutex.
56
 
 *
57
 
 * It used by the none locked version of dumping control
58
 
 * and begin/end call dump functions.
59
 
 *
60
 
 * Begin takes the lock while end unlocks it. Use the _locked
61
 
 * version to avoid locking/unlocking it.
62
 
 */
63
 
void trace_dump_call_lock(void);
64
 
void trace_dump_call_unlock(void);
65
 
 
66
 
/*
67
 
 * High level dumping control.
68
 
 */
69
 
void trace_dumping_start_locked(void);
70
 
void trace_dumping_stop_locked(void);
71
 
bool trace_dumping_enabled_locked(void);
72
 
void trace_dumping_start(void);
73
 
void trace_dumping_stop(void);
74
 
bool trace_dumping_enabled(void);
75
 
 
76
 
void trace_dump_call_begin_locked(const char *klass, const char *method);
77
 
void trace_dump_call_end_locked(void);
78
 
void trace_dump_call_begin(const char *klass, const char *method);
79
 
void trace_dump_call_end(void);
80
 
 
81
 
void trace_dump_arg_begin(const char *name);
82
 
void trace_dump_arg_end(void);
83
 
void trace_dump_ret_begin(void);
84
 
void trace_dump_ret_end(void);
85
 
void trace_dump_bool(int value);
86
 
void trace_dump_int(long long int value);
87
 
void trace_dump_uint(long long unsigned value);
88
 
void trace_dump_float(double value);
89
 
void trace_dump_bytes(const void *data, size_t size);
90
 
void trace_dump_box_bytes(const void *data,
91
 
                          struct pipe_resource *resource,
92
 
                          const struct pipe_box *box,
93
 
                          unsigned stride,
94
 
                          unsigned slice_stride);
95
 
void trace_dump_string(const char *str);
96
 
void trace_dump_enum(const char *value);
97
 
void trace_dump_array_begin(void);
98
 
void trace_dump_array_end(void);
99
 
void trace_dump_elem_begin(void);
100
 
void trace_dump_elem_end(void);
101
 
void trace_dump_struct_begin(const char *name);
102
 
void trace_dump_struct_end(void);
103
 
void trace_dump_member_begin(const char *name);
104
 
void trace_dump_member_end(void);
105
 
void trace_dump_null(void);
106
 
void trace_dump_ptr(const void *value);
107
 
/* will turn a wrapped object into the real one and dump ptr */
108
 
void trace_dump_surface_ptr(struct pipe_surface *_surface);
109
 
void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
110
 
 
111
 
void trace_dump_trigger_active(bool active);
112
 
void trace_dump_check_trigger(void);
113
 
bool trace_dump_is_triggered(void);
114
 
 
115
 
/*
116
 
 * Code saving macros.
117
 
 */
118
 
 
119
 
#define trace_dump_arg(_type, _arg) \
120
 
   do { \
121
 
      trace_dump_arg_begin(#_arg); \
122
 
      trace_dump_##_type(_arg); \
123
 
      trace_dump_arg_end(); \
124
 
   } while(0)
125
 
 
126
 
#define trace_dump_arg_enum(_arg, _value) \
127
 
   do { \
128
 
      trace_dump_arg_begin(#_arg); \
129
 
      trace_dump_enum(_value); \
130
 
      trace_dump_arg_end(); \
131
 
   } while(0)
132
 
 
133
 
#define trace_dump_arg_struct(_type, _arg) \
134
 
   do { \
135
 
      trace_dump_arg_begin(#_arg); \
136
 
      trace_dump_##_type(&_arg); \
137
 
      trace_dump_arg_end(); \
138
 
   } while(0)
139
 
 
140
 
#define trace_dump_ret(_type, _arg) \
141
 
   do { \
142
 
      trace_dump_ret_begin(); \
143
 
      trace_dump_##_type(_arg); \
144
 
      trace_dump_ret_end(); \
145
 
   } while(0)
146
 
 
147
 
#define trace_dump_array(_type, _obj, _size) \
148
 
   do { \
149
 
      if (_obj) { \
150
 
         size_t idx; \
151
 
         trace_dump_array_begin(); \
152
 
         for(idx = 0; idx < (_size); ++idx) { \
153
 
            trace_dump_elem_begin(); \
154
 
            trace_dump_##_type((_obj)[idx]); \
155
 
            trace_dump_elem_end(); \
156
 
         } \
157
 
         trace_dump_array_end(); \
158
 
      } else { \
159
 
         trace_dump_null(); \
160
 
      } \
161
 
   } while(0)
162
 
 
163
 
#define trace_dump_struct_array(_type, _obj, _size) \
164
 
   do { \
165
 
      if (_obj) { \
166
 
         size_t idx; \
167
 
         trace_dump_array_begin(); \
168
 
         for(idx = 0; idx < (_size); ++idx) { \
169
 
            trace_dump_elem_begin(); \
170
 
            trace_dump_##_type(&(_obj)[idx]); \
171
 
            trace_dump_elem_end(); \
172
 
         } \
173
 
         trace_dump_array_end(); \
174
 
      } else { \
175
 
         trace_dump_null(); \
176
 
      } \
177
 
   } while(0)
178
 
 
179
 
#define trace_dump_member(_type, _obj, _member) \
180
 
   do { \
181
 
      trace_dump_member_begin(#_member); \
182
 
      trace_dump_##_type((_obj)->_member); \
183
 
      trace_dump_member_end(); \
184
 
   } while(0)
185
 
 
186
 
#define trace_dump_arg_array(_type, _arg, _size) \
187
 
   do { \
188
 
      trace_dump_arg_begin(#_arg); \
189
 
      trace_dump_array(_type, _arg, _size); \
190
 
      trace_dump_arg_end(); \
191
 
   } while(0)
192
 
 
193
 
#define trace_dump_member_array(_type, _obj, _member) \
194
 
   do { \
195
 
      trace_dump_member_begin(#_member); \
196
 
      trace_dump_array(_type, (_obj)->_member, sizeof((_obj)->_member)/sizeof((_obj)->_member[0])); \
197
 
      trace_dump_member_end(); \
198
 
   } while(0)
199
 
 
200
 
 
201
 
#endif /* TR_DUMP_H */