4 #include "gen6_render.h"
6 #define GEN7_3DSTATE_URB_VS (0x7830 << 16)
7 #define GEN7_3DSTATE_URB_HS (0x7831 << 16)
8 #define GEN7_3DSTATE_URB_DS (0x7832 << 16)
9 #define GEN7_3DSTATE_URB_GS (0x7833 << 16)
11 #define GEN6_3DSTATE_SCISSOR_STATE_POINTERS GEN6_3D(3, 0, 0xf)
12 #define GEN7_3DSTATE_CLEAR_PARAMS GEN6_3D(3, 0, 0x04)
13 #define GEN7_3DSTATE_DEPTH_BUFFER GEN6_3D(3, 0, 0x05)
14 #define GEN7_3DSTATE_STENCIL_BUFFER GEN6_3D(3, 0, 0x06)
15 #define GEN7_3DSTATE_HIER_DEPTH_BUFFER GEN6_3D(3, 0, 0x07)
17 #define GEN7_3DSTATE_GS GEN6_3D(3, 0, 0x11)
18 #define GEN7_3DSTATE_CONSTANT_GS GEN6_3D(3, 0, 0x16)
19 #define GEN7_3DSTATE_CONSTANT_HS GEN6_3D(3, 0, 0x19)
20 #define GEN7_3DSTATE_CONSTANT_DS GEN6_3D(3, 0, 0x1a)
21 #define GEN7_3DSTATE_HS GEN6_3D(3, 0, 0x1b)
22 #define GEN7_3DSTATE_TE GEN6_3D(3, 0, 0x1c)
23 #define GEN7_3DSTATE_DS GEN6_3D(3, 0, 0x1d)
24 #define GEN7_3DSTATE_STREAMOUT GEN6_3D(3, 0, 0x1e)
25 #define GEN7_3DSTATE_SBE GEN6_3D(3, 0, 0x1f)
26 #define GEN7_3DSTATE_PS GEN6_3D(3, 0, 0x20)
27 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP \
29 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC GEN6_3D(3, 0, 0x23)
30 #define GEN7_3DSTATE_BLEND_STATE_POINTERS GEN6_3D(3, 0, 0x24)
31 #define GEN7_3DSTATE_DS_STATE_POINTERS GEN6_3D(3, 0, 0x25)
32 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS GEN6_3D(3, 0, 0x26)
33 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS GEN6_3D(3, 0, 0x27)
34 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS GEN6_3D(3, 0, 0x28)
35 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS GEN6_3D(3, 0, 0x29)
36 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS GEN6_3D(3, 0, 0x2a)
38 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS GEN6_3D(3, 0, 0x2b)
39 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS GEN6_3D(3, 0, 0x2c)
40 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS GEN6_3D(3, 0, 0x2d)
41 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS GEN6_3D(3, 0, 0x2e)
42 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS GEN6_3D(3, 0, 0x2f)
44 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS GEN6_3D(3, 1, 0x12)
45 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS GEN6_3D(3, 1, 0x13)
46 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS GEN6_3D(3, 1, 0x14)
47 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS GEN6_3D(3, 1, 0x15)
48 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS GEN6_3D(3, 1, 0x16)
50 /* Some random bits that we care about */
51 #define GEN7_VB0_BUFFER_ADDR_MOD_EN (1 << 14)
52 #define GEN7_WM_DISPATCH_ENABLE (1 << 29)
53 #define GEN7_3DSTATE_PS_PERSPECTIVE_PIXEL_BARYCENTRIC (1 << 11)
54 #define GEN7_3DSTATE_PS_ATTRIBUTE_ENABLED (1 << 10)
57 #define GEN7_3DSTATE_WM_MAX_THREADS_SHIFT 24
58 #define HSW_3DSTATE_WM_MAX_THREADS_SHIFT 23
60 /* Shamelessly ripped from mesa */
61 struct gen8_surface_state
64 uint32_t cube_pos_z:1;
65 uint32_t cube_neg_z:1;
66 uint32_t cube_pos_y:1;
67 uint32_t cube_neg_y:1;
68 uint32_t cube_pos_x:1;
69 uint32_t cube_neg_x:1;
70 uint32_t media_boundary_pixel_mode:2;
71 uint32_t render_cache_read_write:1;
72 uint32_t smapler_l2_bypass:1;
73 uint32_t vert_line_stride_ofs:1;
74 uint32_t vert_line_stride:1;
75 uint32_t tiled_mode:2;
76 uint32_t horizontal_alignment:2;
77 uint32_t vertical_alignment:2;
78 uint32_t surface_format:9; /**< BRW_SURFACEFORMAT_x */
81 uint32_t surface_type:3; /**< BRW_SURFACE_1D/2D/3D/CUBE */
87 uint32_t base_mip_level:5;
88 uint32_t memory_object_control:7;
106 uint32_t minimum_array_element:27;
111 uint32_t mip_count:4;
114 uint32_t coherency_type:1;
116 uint32_t ewa_disable_for_cube:1;
123 uint32_t pad; /* Multisample Control Surface stuff */
127 uint32_t resource_min_lod:12;
129 /* Only on Haswell */
131 uint32_t shader_chanel_select_a:3;
132 uint32_t shader_chanel_select_b:3;
133 uint32_t shader_chanel_select_g:3;
134 uint32_t shader_chanel_select_r:3;
136 uint32_t alpha_clear_color:1;
137 uint32_t blue_clear_color:1;
138 uint32_t green_clear_color:1;
139 uint32_t red_clear_color:1;
147 uint32_t base_addr_hi:16;
153 uint32_t aux_base_addr:20;
157 uint32_t aux_base_addr_hi:16;
162 uint32_t hiz_depth_clear_value;
178 struct gen8_sampler_state
182 uint32_t aniso_algorithm:1;
183 uint32_t lod_bias:13;
184 uint32_t min_filter:3;
185 uint32_t mag_filter:3;
186 uint32_t mip_filter:2;
187 uint32_t base_level:5;
188 uint32_t lod_preclamp:2;
189 uint32_t default_color_mode:1;
196 uint32_t cube_control_mode:1;
197 uint32_t shadow_function:3;
198 uint32_t chromakey_mode:1;
199 uint32_t chromakey_index:2;
200 uint32_t chromakey_enable:1;
207 uint32_t lod_clamp_mag_mode:1;
208 uint32_t flexible_filter_valign:1;
209 uint32_t flexible_filter_halign:1;
210 uint32_t flexible_filter_coeff_size:1;
211 uint32_t flexible_filter_mode:1;
213 uint32_t indirect_state_ptr:18;
215 uint32_t sep_filter_height:2;
216 uint32_t sep_filter_width:2;
217 uint32_t sep_filter_coeff_table_size:2;
222 uint32_t r_wrap_mode:3;
223 uint32_t t_wrap_mode:3;
224 uint32_t s_wrap_mode:3;
226 uint32_t non_normalized_coord:1;
227 uint32_t trilinear_quality:2;
228 uint32_t address_round:6;
229 uint32_t max_aniso:3;
231 uint32_t non_sep_filter_footprint_mask:8;
235 struct gen8_blend_state {
238 uint32_t y_dither_offset:2;
239 uint32_t x_dither_offset:2;
240 uint32_t dither_enable:1;
241 uint32_t alpha_test_func:3;
242 uint32_t alpha_test:1;
243 uint32_t alpha_to_coverage_dither:1;
244 uint32_t alpha_to_one:1;
246 uint32_t alpha_to_coverage:1;
250 uint64_t write_disable_blue:1;
251 uint64_t write_disable_green:1;
252 uint64_t write_disable_red:1;
253 uint64_t write_disable_alpha:1;
255 uint64_t alpha_blend_func:3;
256 uint64_t dest_alpha_blend_factor:5;
257 uint64_t source_alpha_blend_factor:5;
258 uint64_t color_blend_func:3;
259 uint64_t dest_blend_factor:5;
260 uint64_t source_blend_factor:5;
261 uint64_t color_buffer_blend:1;
262 uint64_t post_blend_color_clamp:1;
263 uint64_t pre_blend_color_clamp:1;
264 uint64_t color_clamp_range:2;
265 uint64_t pre_blend_source_only_clamp:1;
267 uint64_t logic_op_func:4;
268 uint64_t logic_op_enable:1;
272 struct gen7_sf_clip_viewport {
294 struct gen6_scissor_rect