2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
3 * Copyright 2011 Marek Olšák <maraeo@gmail.com>
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:
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
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. */
24 #include "r300_chipset.h"
25 #include "radeon/radeon_winsys.h"
27 #include "util/u_debug.h"
28 #include "util/u_memory.h"
29 #include "os/os_process.h"
34 /* r300_chipset: A file all to itself for deducing the various properties of
37 static void r300_apply_hyperz_blacklist(struct r300_capabilities
* caps
)
39 static const char *list
[] = {
40 "X", /* the DDX or indirect rendering */
41 "Xorg", /* (alternative name) */
42 "check_gl_texture_size", /* compiz */
44 "gnome-session-check-accelerated-helper",
53 if (!os_get_process_name(proc_name
, sizeof(proc_name
)))
56 for (i
= 0; i
< ARRAY_SIZE(list
); i
++) {
57 if (strcmp(list
[i
], proc_name
) == 0) {
65 /* Parse a PCI ID and fill an r300_capabilities struct with information. */
66 void r300_parse_chipset(uint32_t pci_id
, struct r300_capabilities
* caps
)
69 #define CHIPSET(pci_id, name, chipfamily) \
71 caps->family = CHIP_##chipfamily; \
73 #include "pci_ids/r300_pci_ids.h"
77 fprintf(stderr
, "r300: Warning: Unknown chipset 0x%x\nAborting...",
83 caps
->high_second_pipe
= FALSE
;
84 caps
->num_vert_fpus
= 0;
87 caps
->has_cmask
= FALSE
;
90 switch (caps
->family
) {
93 caps
->high_second_pipe
= TRUE
;
94 caps
->num_vert_fpus
= 4;
95 caps
->has_cmask
= TRUE
; /* guessed because there is also HiZ */
96 caps
->hiz_ram
= R300_HIZ_LIMIT
;
97 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
102 caps
->high_second_pipe
= TRUE
;
103 caps
->num_vert_fpus
= 2;
104 caps
->zmask_ram
= RV3xx_ZMASK_SIZE
;
108 caps
->high_second_pipe
= TRUE
;
109 caps
->num_vert_fpus
= 2;
110 caps
->has_cmask
= TRUE
; /* guessed because there is also HiZ */
111 caps
->hiz_ram
= R300_HIZ_LIMIT
;
112 caps
->zmask_ram
= RV3xx_ZMASK_SIZE
;
123 caps
->zmask_ram
= RV3xx_ZMASK_SIZE
;
132 caps
->num_vert_fpus
= 6;
133 caps
->has_cmask
= TRUE
; /* guessed because there is also HiZ */
134 caps
->hiz_ram
= R300_HIZ_LIMIT
;
135 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
139 caps
->num_vert_fpus
= 8;
140 caps
->has_cmask
= TRUE
;
141 caps
->hiz_ram
= R300_HIZ_LIMIT
;
142 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
146 caps
->num_vert_fpus
= 2;
147 caps
->has_cmask
= TRUE
;
148 caps
->hiz_ram
= R300_HIZ_LIMIT
;
149 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
153 caps
->num_vert_fpus
= 5;
154 caps
->has_cmask
= TRUE
;
155 caps
->hiz_ram
= RV530_HIZ_LIMIT
;
156 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
162 caps
->num_vert_fpus
= 8;
163 caps
->has_cmask
= TRUE
;
164 caps
->hiz_ram
= RV530_HIZ_LIMIT
;
165 caps
->zmask_ram
= PIPE_ZMASK_SIZE
;
169 caps
->num_tex_units
= 16;
170 caps
->is_r400
= caps
->family
>= CHIP_R420
&& caps
->family
< CHIP_RV515
;
171 caps
->is_r500
= caps
->family
>= CHIP_RV515
;
172 caps
->is_rv350
= caps
->family
>= CHIP_RV350
;
173 caps
->z_compress
= caps
->is_rv350
? R300_ZCOMP_8X8
: R300_ZCOMP_4X4
;
174 caps
->dxtc_swizzle
= caps
->is_r400
|| caps
->is_r500
;
175 caps
->has_us_format
= caps
->family
== CHIP_R520
;
176 caps
->has_tcl
= caps
->num_vert_fpus
> 0;
179 caps
->has_tcl
= debug_get_bool_option("RADEON_NO_TCL", FALSE
) ? FALSE
: TRUE
;
182 r300_apply_hyperz_blacklist(caps
);