2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **********************************************************************/
29 * Keith Whitwell <keith@tungstengraphics.com>
37 /** Number of general purpose registers (VS, WM, etc) */
38 #define BRW_MAX_GRF 128
40 /** Number of message register file registers */
41 #define BRW_MAX_MRF 16
64 GLuint notify_enable
:1;
66 GLuint wc_flush_enable
:1;
67 GLuint depth_stall_enable
:1;
75 GLuint dest_addr_type
:1;
84 struct brw_3d_primitive
95 GLuint verts_per_instance
;
96 GLuint start_vert_location
;
97 GLuint instance_count
;
98 GLuint start_instance_location
;
99 GLuint base_vert_location
;
102 /* These seem to be passed around as function args, so it works out
103 * better to keep them as #defines:
105 #define BRW_FLUSH_READ_CACHE 0x1
106 #define BRW_FLUSH_STATE_CACHE 0x2
107 #define BRW_INHIBIT_FLUSH_RENDER_CACHE 0x4
108 #define BRW_FLUSH_SNAPSHOT_COUNTERS 0x8
117 struct brw_vf_statistics
119 GLuint statistics_enable
:1;
126 struct brw_binding_table_pointers
128 struct header header
;
137 struct brw_blend_constant_color
139 struct header header
;
140 GLfloat blend_constant_color
[4];
144 struct brw_depthbuffer
146 union header_union header
;
153 GLuint software_tiled_rendering_mode
:2;
154 GLuint depth_offset_disable
:1;
156 GLuint tiled_surface
:1;
158 GLuint surface_type
:3;
163 GLuint dword2_base_addr
;
168 GLuint mipmap_layout
:1;
179 GLuint min_array_element
:11;
186 struct brw_depthbuffer_g4x
188 union header_union header
;
195 GLuint software_tiled_rendering_mode
:2;
196 GLuint depth_offset_disable
:1;
198 GLuint tiled_surface
:1;
200 GLuint surface_type
:3;
205 GLuint dword2_base_addr
;
210 GLuint mipmap_layout
:1;
221 GLuint min_array_element
:11;
233 } dword5
; /* NEW in Integrated Graphics Device */
238 struct header header
;
250 struct brw_global_depth_offset_clamp
252 struct header header
;
253 GLfloat depth_offset_clamp
;
256 struct brw_indexbuffer
262 GLuint index_format
:2;
263 GLuint cut_index_enable
:1;
275 /* NEW in Integrated Graphics Device */
276 struct brw_aa_line_parameters
278 struct header header
;
281 GLuint aa_coverage_scope
:8;
283 GLuint aa_coverage_bias
:8;
288 GLuint aa_coverage_endcap_slope
:8;
290 GLuint aa_coverage_endcap_bias
:8;
295 struct brw_line_stipple
297 struct header header
;
307 GLuint repeat_count
:9;
309 GLuint inverse_repeat_count
:16;
314 struct brw_pipelined_state_pointers
316 struct header header
;
320 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
327 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
334 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
340 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
346 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
352 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE. KW: check me! */
357 struct brw_polygon_stipple_offset
359 struct header header
;
371 struct brw_polygon_stipple
373 struct header header
;
379 struct brw_pipeline_select
383 GLuint pipeline_select
:1;
390 struct brw_pipe_control
395 GLuint notify_enable
:1;
396 GLuint texture_cache_flush_enable
:1;
397 GLuint indirect_state_pointers_disable
:1;
398 GLuint instruction_state_cache_flush_enable
:1;
399 GLuint write_cache_flush_enable
:1;
400 GLuint depth_stall_enable
:1;
401 GLuint post_sync_operation
:2;
409 GLuint dest_addr_type
:1;
425 GLuint clp_realloc
:1;
427 GLuint vfe_realloc
:1;
450 struct brw_cs_urb_state
452 struct header header
;
456 GLuint nr_urb_entries
:3;
458 GLuint urb_entry_size
:5;
463 struct brw_constant_buffer
475 GLuint buffer_length
:6;
476 GLuint buffer_address
:26;
480 struct brw_state_base_address
482 struct header header
;
486 GLuint modify_enable
:1;
488 GLuint general_state_address
:27;
493 GLuint modify_enable
:1;
495 GLuint surface_state_address
:27;
500 GLuint modify_enable
:1;
502 GLuint indirect_object_state_address
:27;
507 GLuint modify_enable
:1;
509 GLuint general_state_upper_bound
:20;
514 GLuint modify_enable
:1;
516 GLuint indirect_object_state_upper_bound
:20;
520 struct brw_state_prefetch
522 struct header header
;
526 GLuint prefetch_count
:3;
528 GLuint prefetch_pointer
:26;
532 struct brw_system_instruction_pointer
534 struct header header
;
539 GLuint system_instruction_pointer
:28;
546 /* State structs for the various fixed function units:
553 GLuint grf_reg_count
:3;
555 GLuint kernel_start_pointer
:26; /* Offset from GENERAL_STATE_BASE */
560 GLuint ext_halt_exception_enable
:1;
561 GLuint sw_exception_enable
:1;
562 GLuint mask_stack_exception_enable
:1;
563 GLuint timeout_exception_enable
:1;
564 GLuint illegal_op_exception_enable
:1;
566 GLuint depth_coef_urb_read_offset
:6; /* WM only */
568 GLuint floating_point_mode
:1;
569 GLuint thread_priority
:1;
570 GLuint binding_table_entry_count
:8;
572 GLuint single_program_flow
:1;
577 GLuint per_thread_scratch_space
:4;
579 GLuint scratch_space_base_pointer
:22;
585 GLuint dispatch_grf_start_reg
:4;
586 GLuint urb_entry_read_offset
:6;
588 GLuint urb_entry_read_length
:6;
590 GLuint const_urb_entry_read_offset
:6;
592 GLuint const_urb_entry_read_length
:6;
598 struct brw_clip_unit_state
600 struct thread0 thread0
;
604 GLuint sw_exception_enable
:1;
606 GLuint mask_stack_exception_enable
:1;
608 GLuint illegal_op_exception_enable
:1;
610 GLuint floating_point_mode
:1;
611 GLuint thread_priority
:1;
612 GLuint binding_table_entry_count
:8;
614 GLuint single_program_flow
:1;
617 struct thread2 thread2
;
618 struct thread3 thread3
;
623 GLuint gs_output_stats
:1; /* not always */
624 GLuint stats_enable
:1;
625 GLuint nr_urb_entries
:7;
627 GLuint urb_entry_allocation_size
:5;
629 GLuint max_threads
:5; /* may be less */
637 GLuint userclip_enable_flags
:8;
638 GLuint userclip_must_clip
:1;
639 GLuint negative_w_clip_test
:1;
640 GLuint guard_band_enable
:1;
641 GLuint viewport_z_clip_enable
:1;
642 GLuint viewport_xy_clip_enable
:1;
643 GLuint vertex_position_space
:1;
651 GLuint clipper_viewport_state_ptr
:27;
655 GLfloat viewport_xmin
;
656 GLfloat viewport_xmax
;
657 GLfloat viewport_ymin
;
658 GLfloat viewport_ymax
;
663 struct brw_cc_unit_state
668 GLuint bf_stencil_pass_depth_pass_op
:3;
669 GLuint bf_stencil_pass_depth_fail_op
:3;
670 GLuint bf_stencil_fail_op
:3;
671 GLuint bf_stencil_func
:3;
672 GLuint bf_stencil_enable
:1;
674 GLuint stencil_write_enable
:1;
675 GLuint stencil_pass_depth_pass_op
:3;
676 GLuint stencil_pass_depth_fail_op
:3;
677 GLuint stencil_fail_op
:3;
678 GLuint stencil_func
:3;
679 GLuint stencil_enable
:1;
685 GLuint bf_stencil_ref
:8;
686 GLuint stencil_write_mask
:8;
687 GLuint stencil_test_mask
:8;
688 GLuint stencil_ref
:8;
694 GLuint logicop_enable
:1;
696 GLuint depth_write_enable
:1;
697 GLuint depth_test_function
:3;
699 GLuint bf_stencil_write_mask
:8;
700 GLuint bf_stencil_test_mask
:8;
707 GLuint alpha_test_func
:3;
709 GLuint blend_enable
:1;
710 GLuint ia_blend_enable
:1;
712 GLuint alpha_test_format
:1;
719 GLuint cc_viewport_state_offset
:27; /* Offset from GENERAL_STATE_BASE */
725 GLuint ia_dest_blend_factor
:5;
726 GLuint ia_src_blend_factor
:5;
727 GLuint ia_blend_function
:3;
728 GLuint statistics_enable
:1;
729 GLuint logicop_func
:4;
731 GLuint dither_enable
:1;
736 GLuint clamp_post_alpha_blend
:1;
737 GLuint clamp_pre_alpha_blend
:1;
738 GLuint clamp_range
:2;
740 GLuint y_dither_offset
:2;
741 GLuint x_dither_offset
:2;
742 GLuint dest_blend_factor
:5;
743 GLuint src_blend_factor
:5;
744 GLuint blend_function
:3;
757 struct brw_sf_unit_state
759 struct thread0 thread0
;
760 struct thread1 thread1
;
761 struct thread2 thread2
;
762 struct thread3 thread3
;
767 GLuint stats_enable
:1;
768 GLuint nr_urb_entries
:7;
770 GLuint urb_entry_allocation_size
:5;
772 GLuint max_threads
:6;
778 GLuint front_winding
:1;
779 GLuint viewport_transform
:1;
781 GLuint sf_viewport_state_offset
:27; /* Offset from GENERAL_STATE_BASE */
787 GLuint dest_org_vbias
:4;
788 GLuint dest_org_hbias
:4;
790 GLuint disable_2x2_trifilter
:1;
791 GLuint disable_zero_pix_trifilter
:1;
792 GLuint point_rast_rule
:2;
793 GLuint line_endcap_aa_region_width
:2;
795 GLuint fast_scissor_disable
:1;
802 GLuint point_size
:11;
803 GLuint use_point_size_state
:1;
804 GLuint subpixel_precision
:1;
805 GLuint sprite_point
:1;
807 GLuint aa_line_distance_mode
:1;
809 GLuint linestrip_pv
:2;
810 GLuint tristrip_pv
:2;
811 GLuint line_last_pixel_enable
:1;
817 struct brw_gs_unit_state
819 struct thread0 thread0
;
820 struct thread1 thread1
;
821 struct thread2 thread2
;
822 struct thread3 thread3
;
827 GLuint stats_enable
:1;
828 GLuint nr_urb_entries
:7;
830 GLuint urb_entry_allocation_size
:5;
832 GLuint max_threads
:5;
838 GLuint sampler_count
:3;
840 GLuint sampler_state_pointer
:27;
846 GLuint max_vp_index
:4;
848 GLuint svbi_post_inc_value
:10;
850 GLuint svbi_post_inc_enable
:1;
851 GLuint svbi_payload
:1;
852 GLuint discard_adjaceny
:1;
853 GLuint reorder_enable
:1;
859 struct brw_vs_unit_state
861 struct thread0 thread0
;
862 struct thread1 thread1
;
863 struct thread2 thread2
;
864 struct thread3 thread3
;
869 GLuint stats_enable
:1;
870 GLuint nr_urb_entries
:7;
872 GLuint urb_entry_allocation_size
:5;
874 GLuint max_threads
:6;
880 GLuint sampler_count
:3;
882 GLuint sampler_state_pointer
:27;
888 GLuint vert_cache_disable
:1;
894 struct brw_wm_unit_state
896 struct thread0 thread0
;
897 struct thread1 thread1
;
898 struct thread2 thread2
;
899 struct thread3 thread3
;
902 GLuint stats_enable
:1;
903 GLuint depth_buffer_clear
:1;
904 GLuint sampler_count
:3;
905 GLuint sampler_state_pointer
:27;
910 GLuint enable_8_pix
:1;
911 GLuint enable_16_pix
:1;
912 GLuint enable_32_pix
:1;
913 GLuint enable_con_32_pix
:1;
914 GLuint enable_con_64_pix
:1;
916 GLuint legacy_global_depth_bias
:1;
917 GLuint line_stipple
:1;
918 GLuint depth_offset
:1;
919 GLuint polygon_stipple
:1;
920 GLuint line_aa_region_width
:2;
921 GLuint line_endcap_aa_region_width
:2;
922 GLuint early_depth_test
:1;
923 GLuint thread_dispatch_enable
:1;
924 GLuint program_uses_depth
:1;
925 GLuint program_computes_depth
:1;
926 GLuint program_uses_killpixel
:1;
927 GLuint legacy_line_rast
: 1;
928 GLuint transposed_urb_read_enable
:1;
929 GLuint max_threads
:7;
932 GLfloat global_depth_offset_constant
;
933 GLfloat global_depth_offset_scale
;
936 struct brw_sampler_default_color
{
940 struct brw_sampler_state
945 GLuint shadow_function
:3;
952 GLuint lod_preclamp
:1;
953 GLuint default_color_mode
:1;
960 GLuint r_wrap_mode
:3;
961 GLuint t_wrap_mode
:3;
962 GLuint s_wrap_mode
:3;
972 GLuint default_color_pointer
:27;
979 GLuint chroma_key_mode
:1;
980 GLuint chroma_key_index
:2;
981 GLuint chroma_key_enable
:1;
982 GLuint monochrome_filter_width
:3;
983 GLuint monochrome_filter_height
:3;
988 struct brw_clipper_viewport
996 struct brw_cc_viewport
1002 struct brw_sf_viewport
1013 /* scissor coordinates are inclusive */
1022 /* Documented in the subsystem/shared-functions/sampler chapter...
1024 struct brw_surface_state
1027 GLuint cube_pos_z
:1;
1028 GLuint cube_neg_z
:1;
1029 GLuint cube_pos_y
:1;
1030 GLuint cube_neg_y
:1;
1031 GLuint cube_pos_x
:1;
1032 GLuint cube_neg_x
:1;
1034 GLuint mipmap_layout_mode
:1;
1035 GLuint vert_line_stride_ofs
:1;
1036 GLuint vert_line_stride
:1;
1037 GLuint color_blend
:1;
1038 GLuint writedisable_blue
:1;
1039 GLuint writedisable_green
:1;
1040 GLuint writedisable_red
:1;
1041 GLuint writedisable_alpha
:1;
1042 GLuint surface_format
:9; /**< BRW_SURFACEFORMAT_x */
1043 GLuint data_return_format
:1;
1045 GLuint surface_type
:3; /**< BRW_SURFACE_1D/2D/3D/CUBE */
1061 GLuint tiled_surface
:1;
1068 GLuint multisample_position_palette_index
:3;
1070 GLuint num_multisamples
:3;
1072 GLuint render_target_view_extent
:9;
1073 GLuint min_array_elt
:11;
1079 GLuint llc_mapping
:1;
1080 GLuint mlc_mapping
:1;
1086 } ss5
; /* New in G4X */
1092 struct brw_vertex_buffer_state
1097 GLuint access_type
:1;
1104 GLuint instance_data_step_rate
; /* not included for sequential/random vertices? */
1108 #define BRW_VBP_MAX 17
1110 struct brw_vb_array_state
{
1111 struct header header
;
1112 struct brw_vertex_buffer_state vb
[BRW_VBP_MAX
];
1116 struct brw_vertex_element_state
1120 GLuint src_offset
:11;
1122 GLuint src_format
:9;
1125 GLuint vertex_buffer_index
:5;
1130 GLuint dst_offset
:8;
1132 GLuint vfcomponent3
:4;
1133 GLuint vfcomponent2
:4;
1134 GLuint vfcomponent1
:4;
1135 GLuint vfcomponent0
:4;
1139 #define BRW_VEP_MAX 18
1141 struct brw_vertex_element_packet
{
1142 struct header header
;
1143 struct brw_vertex_element_state ve
[BRW_VEP_MAX
]; /* note: less than _TNL_ATTRIB_MAX */
1147 struct brw_urb_immediate
{
1150 GLuint swizzle_control
:2;
1155 GLuint response_length
:4;
1156 GLuint msg_length
:4;
1157 GLuint msg_target
:4;
1159 GLuint end_of_thread
:1;
1162 /* Instruction format for the execution units:
1165 struct brw_instruction
1171 GLuint access_mode
:1;
1172 GLuint mask_control
:1;
1173 GLuint dependency_control
:2;
1174 GLuint compression_control
:2;
1175 GLuint thread_control
:2;
1176 GLuint predicate_control
:4;
1177 GLuint predicate_inverse
:1;
1178 GLuint execution_size
:3;
1179 GLuint destreg__conditonalmod
:4; /* destreg - send, conditionalmod - others */
1181 GLuint debug_control
:1;
1188 GLuint dest_reg_file
:2;
1189 GLuint dest_reg_type
:3;
1190 GLuint src0_reg_file
:2;
1191 GLuint src0_reg_type
:3;
1192 GLuint src1_reg_file
:2;
1193 GLuint src1_reg_type
:3;
1195 GLuint dest_subreg_nr
:5;
1196 GLuint dest_reg_nr
:8;
1197 GLuint dest_horiz_stride
:2;
1198 GLuint dest_address_mode
:1;
1203 GLuint dest_reg_file
:2;
1204 GLuint dest_reg_type
:3;
1205 GLuint src0_reg_file
:2;
1206 GLuint src0_reg_type
:3;
1208 GLint dest_indirect_offset
:10; /* offset against the deref'd address reg */
1209 GLuint dest_subreg_nr
:3; /* subnr for the address reg a0.x */
1210 GLuint dest_horiz_stride
:2;
1211 GLuint dest_address_mode
:1;
1216 GLuint dest_reg_file
:2;
1217 GLuint dest_reg_type
:3;
1218 GLuint src0_reg_file
:2;
1219 GLuint src0_reg_type
:3;
1220 GLuint src1_reg_file
:2;
1221 GLuint src1_reg_type
:3;
1223 GLuint dest_writemask
:4;
1224 GLuint dest_subreg_nr
:1;
1225 GLuint dest_reg_nr
:8;
1227 GLuint dest_address_mode
:1;
1232 GLuint dest_reg_file
:2;
1233 GLuint dest_reg_type
:3;
1234 GLuint src0_reg_file
:2;
1235 GLuint src0_reg_type
:3;
1237 GLuint dest_writemask
:4;
1238 GLint dest_indirect_offset
:6;
1239 GLuint dest_subreg_nr
:3;
1241 GLuint dest_address_mode
:1;
1249 GLuint src0_subreg_nr
:5;
1250 GLuint src0_reg_nr
:8;
1252 GLuint src0_negate
:1;
1253 GLuint src0_address_mode
:1;
1254 GLuint src0_horiz_stride
:2;
1255 GLuint src0_width
:3;
1256 GLuint src0_vert_stride
:4;
1257 GLuint flag_reg_nr
:1;
1263 GLint src0_indirect_offset
:10;
1264 GLuint src0_subreg_nr
:3;
1266 GLuint src0_negate
:1;
1267 GLuint src0_address_mode
:1;
1268 GLuint src0_horiz_stride
:2;
1269 GLuint src0_width
:3;
1270 GLuint src0_vert_stride
:4;
1271 GLuint flag_reg_nr
:1;
1277 GLuint src0_swz_x
:2;
1278 GLuint src0_swz_y
:2;
1279 GLuint src0_subreg_nr
:1;
1280 GLuint src0_reg_nr
:8;
1282 GLuint src0_negate
:1;
1283 GLuint src0_address_mode
:1;
1284 GLuint src0_swz_z
:2;
1285 GLuint src0_swz_w
:2;
1287 GLuint src0_vert_stride
:4;
1288 GLuint flag_reg_nr
:1;
1294 GLuint src0_swz_x
:2;
1295 GLuint src0_swz_y
:2;
1296 GLint src0_indirect_offset
:6;
1297 GLuint src0_subreg_nr
:3;
1299 GLuint src0_negate
:1;
1300 GLuint src0_address_mode
:1;
1301 GLuint src0_swz_z
:2;
1302 GLuint src0_swz_w
:2;
1304 GLuint src0_vert_stride
:4;
1305 GLuint flag_reg_nr
:1;
1315 GLuint src1_subreg_nr
:5;
1316 GLuint src1_reg_nr
:8;
1318 GLuint src1_negate
:1;
1320 GLuint src1_horiz_stride
:2;
1321 GLuint src1_width
:3;
1322 GLuint src1_vert_stride
:4;
1328 GLuint src1_swz_x
:2;
1329 GLuint src1_swz_y
:2;
1330 GLuint src1_subreg_nr
:1;
1331 GLuint src1_reg_nr
:8;
1333 GLuint src1_negate
:1;
1335 GLuint src1_swz_z
:2;
1336 GLuint src1_swz_w
:2;
1338 GLuint src1_vert_stride
:4;
1344 GLint src1_indirect_offset
:10;
1345 GLuint src1_subreg_nr
:3;
1347 GLuint src1_negate
:1;
1349 GLuint src1_horiz_stride
:2;
1350 GLuint src1_width
:3;
1351 GLuint src1_vert_stride
:4;
1352 GLuint flag_reg_nr
:1;
1358 GLuint src1_swz_x
:2;
1359 GLuint src1_swz_y
:2;
1360 GLint src1_indirect_offset
:6;
1361 GLuint src1_subreg_nr
:3;
1363 GLuint src1_negate
:1;
1365 GLuint src1_swz_z
:2;
1366 GLuint src1_swz_w
:2;
1368 GLuint src1_vert_stride
:4;
1369 GLuint flag_reg_nr
:1;
1376 GLint jump_count
:16; /* note: signed */
1388 GLuint response_length
:4;
1389 GLuint msg_length
:4;
1390 GLuint msg_target
:4;
1392 GLuint end_of_thread
:1;
1396 GLuint binding_table_index
:8;
1398 GLuint return_format
:2;
1400 GLuint response_length
:4;
1401 GLuint msg_length
:4;
1402 GLuint msg_target
:4;
1404 GLuint end_of_thread
:1;
1408 GLuint binding_table_index
:8;
1411 GLuint response_length
:4;
1412 GLuint msg_length
:4;
1413 GLuint msg_target
:4;
1415 GLuint end_of_thread
:1;
1418 struct brw_urb_immediate urb
;
1421 GLuint binding_table_index
:8;
1422 GLuint msg_control
:4;
1424 GLuint target_cache
:2;
1425 GLuint response_length
:4;
1426 GLuint msg_length
:4;
1427 GLuint msg_target
:4;
1429 GLuint end_of_thread
:1;
1433 GLuint binding_table_index
:8;
1434 GLuint msg_control
:3;
1435 GLuint pixel_scoreboard_clear
:1;
1437 GLuint send_commit_msg
:1;
1438 GLuint response_length
:4;
1439 GLuint msg_length
:4;
1440 GLuint msg_target
:4;
1442 GLuint end_of_thread
:1;
1447 GLuint response_length
:4;
1448 GLuint msg_length
:4;
1449 GLuint msg_target
:4;
1451 GLuint end_of_thread
:1;