xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/r300/r300_screen.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright 2008 Corbin Simpson <[email protected]>
3  * Copyright 2010 Marek Olšák <[email protected]>
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef R300_SCREEN_H
8 #define R300_SCREEN_H
9 
10 #include "r300_chipset.h"
11 #include "winsys/radeon_winsys.h"
12 #include "pipe/p_screen.h"
13 #include "util/disk_cache.h"
14 #include "util/slab.h"
15 #include "util/u_thread.h"
16 #include <stdio.h>
17 
18 struct r300_screen {
19     /* Parent class */
20     struct pipe_screen screen;
21 
22     struct radeon_winsys *rws;
23 
24     /* Chipset info and capabilities. */
25     struct radeon_info info;
26     struct r300_capabilities caps;
27 
28     /** Combination of DBG_xxx flags */
29     unsigned debug;
30 
31     struct disk_cache *disk_shader_cache;
32 
33     struct slab_parent_pool pool_transfers;
34 
35     /* The MSAA texture with CMASK access; */
36     struct pipe_resource *cmask_resource;
37     mtx_t cmask_mutex;
38 
39     struct {
40 #define OPT_BOOL(name, dflt, description) bool name : 1;
41 #include "r300_debug_options.h"
42     } options;
43 };
44 
45 
46 /* Convenience cast wrappers. */
r300_screen(struct pipe_screen * screen)47 static inline struct r300_screen* r300_screen(struct pipe_screen* screen) {
48     return (struct r300_screen*)screen;
49 }
50 
51 static inline struct radeon_winsys *
radeon_winsys(struct pipe_screen * screen)52 radeon_winsys(struct pipe_screen *screen) {
53     return r300_screen(screen)->rws;
54 }
55 
56 /* Debug functionality. */
57 
58 /**
59  * Debug flags to disable/enable certain groups of debugging outputs.
60  *
61  * \note These may be rather coarse, and the grouping may be impractical.
62  * If you find, while debugging the driver, that a different grouping
63  * of these flags would be beneficial, just feel free to change them
64  * but make sure to update the documentation in r300_debug.c to reflect
65  * those changes.
66  */
67 /*@{*/
68 
69 /* Logging. */
70 #define DBG_PSC         (1 << 0)
71 #define DBG_FP          (1 << 1)
72 #define DBG_VP          (1 << 2)
73 #define DBG_SWTCL       (1 << 3)
74 #define DBG_DRAW        (1 << 4)
75 #define DBG_TEX         (1 << 5)
76 #define DBG_TEXALLOC    (1 << 6)
77 #define DBG_RS          (1 << 7)
78 #define DBG_FB          (1 << 8)
79 #define DBG_RS_BLOCK    (1 << 9)
80 #define DBG_CBZB        (1 << 10)
81 #define DBG_HYPERZ      (1 << 11)
82 #define DBG_SCISSOR     (1 << 12)
83 #define DBG_INFO        (1 << 13)
84 #define DBG_MSAA        (1 << 14)
85 /* Features. */
86 #define DBG_ANISOHQ     (1 << 16)
87 #define DBG_NO_TILING   (1 << 17)
88 #define DBG_NO_IMMD     (1 << 18)
89 #define DBG_NO_OPT      (1 << 19)
90 #define DBG_NO_CBZB     (1 << 20)
91 #define DBG_NO_ZMASK    (1 << 21)
92 #define DBG_NO_HIZ      (1 << 22)
93 #define DBG_NO_CMASK    (1 << 23)
94 #define DBG_NO_TCL      (1 << 25)
95 /*@}*/
SCREEN_DBG_ON(struct r300_screen * screen,unsigned flags)96 static inline bool SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
97 {
98     return (screen->debug & flags) ? true : false;
99 }
100 
SCREEN_DBG(struct r300_screen * screen,unsigned flags,const char * fmt,...)101 static inline void SCREEN_DBG(struct r300_screen * screen, unsigned flags,
102                               const char * fmt, ...)
103 {
104     if (SCREEN_DBG_ON(screen, flags)) {
105         va_list va;
106         va_start(va, fmt);
107         vfprintf(stderr, fmt, va);
108         va_end(va);
109     }
110 }
111 
112 void r300_init_debug(struct r300_screen* ctx);
113 
114 void r300_init_screen_resource_functions(struct r300_screen *r300screen);
115 
116 #endif /* R300_SCREEN_H */
117