r300g: rebuild winsys and command submission to support multiple contexts
[mesa.git] / src / gallium / drivers / r300 / r300_screen.h
1 /*
2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
3 * Copyright 2010 Marek Olšák <maraeo@gmail.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23
24 #ifndef R300_SCREEN_H
25 #define R300_SCREEN_H
26
27 #include "pipe/p_screen.h"
28
29 #include "r300_chipset.h"
30
31 #include <stdio.h>
32
33 struct r300_winsys_screen;
34
35 struct r300_screen {
36 /* Parent class */
37 struct pipe_screen screen;
38
39 struct r300_winsys_screen *rws;
40
41 /* Chipset capabilities */
42 struct r300_capabilities caps;
43
44 /** Combination of DBG_xxx flags */
45 unsigned debug;
46 };
47
48
49 /* Convenience cast wrappers. */
50 static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
51 return (struct r300_screen*)screen;
52 }
53
54 static INLINE struct r300_winsys_screen *
55 r300_winsys_screen(struct pipe_screen *screen) {
56 return r300_screen(screen)->rws;
57 }
58
59 /* Debug functionality. */
60
61 /**
62 * Debug flags to disable/enable certain groups of debugging outputs.
63 *
64 * \note These may be rather coarse, and the grouping may be impractical.
65 * If you find, while debugging the driver, that a different grouping
66 * of these flags would be beneficial, just feel free to change them
67 * but make sure to update the documentation in r300_debug.c to reflect
68 * those changes.
69 */
70 /*@{*/
71
72 /* Logging. */
73 #define DBG_PSC (1 << 0)
74 #define DBG_FP (1 << 1)
75 #define DBG_VP (1 << 2)
76 #define DBG_SWTCL (1 << 3)
77 #define DBG_DRAW (1 << 4)
78 #define DBG_TEX (1 << 5)
79 #define DBG_TEXALLOC (1 << 6)
80 #define DBG_RS (1 << 7)
81 #define DBG_FALL (1 << 8)
82 #define DBG_FB (1 << 9)
83 #define DBG_RS_BLOCK (1 << 10)
84 /* Features. */
85 #define DBG_ANISOHQ (1 << 16)
86 #define DBG_NO_TILING (1 << 17)
87 #define DBG_NO_IMMD (1 << 18)
88 #define DBG_FAKE_OCC (1 << 19)
89 /* Statistics. */
90 #define DBG_STATS (1 << 24)
91 /*@}*/
92
93 static INLINE boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
94 {
95 return (screen->debug & flags) ? TRUE : FALSE;
96 }
97
98 static INLINE void SCREEN_DBG(struct r300_screen * screen, unsigned flags,
99 const char * fmt, ...)
100 {
101 if (SCREEN_DBG_ON(screen, flags)) {
102 va_list va;
103 va_start(va, fmt);
104 vfprintf(stderr, fmt, va);
105 va_end(va);
106 }
107 }
108
109 void r300_init_debug(struct r300_screen* ctx);
110
111 void r300_init_screen_resource_functions(struct r300_screen *r300screen);
112
113 #endif /* R300_SCREEN_H */