Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/freedreno/decode/redump.h
4565 views
1
/*
2
* Copyright © 2012 Rob Clark <[email protected]>
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 (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
* SOFTWARE.
22
*/
23
24
#ifndef REDUMP_H_
25
#define REDUMP_H_
26
27
enum rd_sect_type {
28
RD_NONE,
29
RD_TEST, /* ascii text */
30
RD_CMD, /* ascii text */
31
RD_GPUADDR, /* u32 gpuaddr, u32 size */
32
RD_CONTEXT, /* raw dump */
33
RD_CMDSTREAM, /* raw dump */
34
RD_CMDSTREAM_ADDR, /* gpu addr of cmdstream */
35
RD_PARAM, /* u32 param_type, u32 param_val, u32 bitlen */
36
RD_FLUSH, /* empty, clear previous params */
37
RD_PROGRAM, /* shader program, raw dump */
38
RD_VERT_SHADER,
39
RD_FRAG_SHADER,
40
RD_BUFFER_CONTENTS,
41
RD_GPU_ID,
42
};
43
44
/* RD_PARAM types: */
45
enum rd_param_type {
46
RD_PARAM_SURFACE_WIDTH,
47
RD_PARAM_SURFACE_HEIGHT,
48
RD_PARAM_SURFACE_PITCH,
49
RD_PARAM_COLOR,
50
RD_PARAM_BLIT_X,
51
RD_PARAM_BLIT_Y,
52
RD_PARAM_BLIT_WIDTH,
53
RD_PARAM_BLIT_HEIGHT,
54
RD_PARAM_BLIT_X2, /* BLIT_X + BLIT_WIDTH */
55
RD_PARAM_BLIT_Y2, /* BLIT_Y + BLIT_WIDTH */
56
};
57
58
void rd_start(const char *name, const char *fmt, ...) __attribute__((weak));
59
void rd_end(void) __attribute__((weak));
60
void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
61
__attribute__((weak));
62
63
/* for code that should run with and without libwrap, use the following
64
* macros which check if the fxns are present before calling
65
*/
66
#define RD_START(n, f, ...) \
67
do { \
68
if (rd_start) \
69
rd_start(n, f, ##__VA_ARGS__); \
70
} while (0)
71
#define RD_END() \
72
do { \
73
if (rd_end) \
74
rd_end(); \
75
} while (0)
76
#define RD_WRITE_SECTION(t, b, s) \
77
do { \
78
if (rd_write_section) \
79
rd_write_section(t, b, s); \
80
} while (0)
81
82
#ifndef ARRAY_SIZE
83
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
84
#endif
85
#undef ALIGN
86
#define ALIGN(v, a) (((v) + (a)-1) & ~((a)-1))
87
88
#define min(a, b) (((a) < (b)) ? (a) : (b))
89
#define max(a, b) (((a) > (b)) ? (a) : (b))
90
91
#endif /* REDUMP_H_ */
92
93