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>
56 GLuint notify_enable
:1;
58 GLuint wc_flush_enable
:1;
59 GLuint depth_stall_enable
:1;
67 GLuint dest_addr_type
:1;
76 struct brw_3d_primitive
87 GLuint verts_per_instance
;
88 GLuint start_vert_location
;
89 GLuint instance_count
;
90 GLuint start_instance_location
;
91 GLuint base_vert_location
;
94 /* These seem to be passed around as function args, so it works out
95 * better to keep them as #defines:
97 #define BRW_FLUSH_READ_CACHE 0x1
98 #define BRW_FLUSH_STATE_CACHE 0x2
99 #define BRW_INHIBIT_FLUSH_RENDER_CACHE 0x4
100 #define BRW_FLUSH_SNAPSHOT_COUNTERS 0x8
109 struct brw_vf_statistics
111 GLuint statistics_enable
:1;
118 struct brw_binding_table_pointers
120 struct header header
;
129 struct brw_blend_constant_color
131 struct header header
;
132 GLfloat blend_constant_color
[4];
136 struct brw_depthbuffer
138 union header_union header
;
145 GLuint software_tiled_rendering_mode
:2;
146 GLuint depth_offset_disable
:1;
148 GLuint tiled_surface
:1;
150 GLuint surface_type
:3;
155 GLuint dword2_base_addr
;
160 GLuint mipmap_layout
:1;
171 GLuint min_array_element
:11;
178 struct brw_depthbuffer_gm45_g4x
180 union header_union header
;
187 GLuint software_tiled_rendering_mode
:2;
188 GLuint depth_offset_disable
:1;
190 GLuint tiled_surface
:1;
192 GLuint surface_type
:3;
197 GLuint dword2_base_addr
;
202 GLuint mipmap_layout
:1;
213 GLuint min_array_element
:11;
225 } dword5
; /* NEW in Integrated Graphics Device */
230 struct header header
;
242 struct brw_global_depth_offset_clamp
244 struct header header
;
245 GLfloat depth_offset_clamp
;
248 struct brw_indexbuffer
254 GLuint index_format
:2;
255 GLuint cut_index_enable
:1;
267 /* NEW in Integrated Graphics Device */
268 struct brw_aa_line_parameters
270 struct header header
;
273 GLuint aa_coverage_scope
:8;
275 GLuint aa_coverage_bias
:8;
280 GLuint aa_coverage_endcap_slope
:8;
282 GLuint aa_coverage_endcap_bias
:8;
287 struct brw_line_stipple
289 struct header header
;
299 GLuint repeat_count
:9;
301 GLuint inverse_repeat_count
:16;
306 struct brw_pipelined_state_pointers
308 struct header header
;
312 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
319 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
326 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
332 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
338 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE */
344 GLuint offset
:27; /* Offset from GENERAL_STATE_BASE. KW: check me! */
349 struct brw_polygon_stipple_offset
351 struct header header
;
363 struct brw_polygon_stipple
365 struct header header
;
371 struct brw_pipeline_select
375 GLuint pipeline_select
:1;
382 struct brw_pipe_control
387 GLuint notify_enable
:1;
388 GLuint texture_cache_flush_enable
:1;
389 GLuint indirect_state_pointers_disable
:1;
390 GLuint instruction_state_cache_flush_enable
:1;
391 GLuint write_cache_flush_enable
:1;
392 GLuint depth_stall_enable
:1;
393 GLuint post_sync_operation
:2;
401 GLuint dest_addr_type
:1;
417 GLuint clp_realloc
:1;
419 GLuint vfe_realloc
:1;
442 struct brw_constant_buffer_state
/* previously brw_command_streamer */
444 struct header header
;
448 GLuint nr_urb_entries
:3;
450 GLuint urb_entry_size
:5;
455 struct brw_constant_buffer
467 GLuint buffer_length
:6;
468 GLuint buffer_address
:26;
472 struct brw_state_base_address
474 struct header header
;
478 GLuint modify_enable
:1;
480 GLuint general_state_address
:27;
485 GLuint modify_enable
:1;
487 GLuint surface_state_address
:27;
492 GLuint modify_enable
:1;
494 GLuint indirect_object_state_address
:27;
499 GLuint modify_enable
:1;
501 GLuint general_state_upper_bound
:20;
506 GLuint modify_enable
:1;
508 GLuint indirect_object_state_upper_bound
:20;
512 struct brw_state_prefetch
514 struct header header
;
518 GLuint prefetch_count
:3;
520 GLuint prefetch_pointer
:26;
524 struct brw_system_instruction_pointer
526 struct header header
;
531 GLuint system_instruction_pointer
:28;
538 /* State structs for the various fixed function units:
545 GLuint grf_reg_count
:3;
547 GLuint kernel_start_pointer
:26; /* Offset from GENERAL_STATE_BASE */
552 GLuint ext_halt_exception_enable
:1;
553 GLuint sw_exception_enable
:1;
554 GLuint mask_stack_exception_enable
:1;
555 GLuint timeout_exception_enable
:1;
556 GLuint illegal_op_exception_enable
:1;
558 GLuint depth_coef_urb_read_offset
:6; /* WM only */
560 GLuint floating_point_mode
:1;
561 GLuint thread_priority
:1;
562 GLuint binding_table_entry_count
:8;
564 GLuint single_program_flow
:1;
569 GLuint per_thread_scratch_space
:4;
571 GLuint scratch_space_base_pointer
:22;
577 GLuint dispatch_grf_start_reg
:4;
578 GLuint urb_entry_read_offset
:6;
580 GLuint urb_entry_read_length
:6;
582 GLuint const_urb_entry_read_offset
:6;
584 GLuint const_urb_entry_read_length
:6;
590 struct brw_clip_unit_state
592 struct thread0 thread0
;
596 GLuint sw_exception_enable
:1;
598 GLuint mask_stack_exception_enable
:1;
600 GLuint illegal_op_exception_enable
:1;
602 GLuint floating_point_mode
:1;
603 GLuint thread_priority
:1;
604 GLuint binding_table_entry_count
:8;
606 GLuint single_program_flow
:1;
609 struct thread2 thread2
;
610 struct thread3 thread3
;
615 GLuint gs_output_stats
:1; /* not always */
616 GLuint stats_enable
:1;
617 GLuint nr_urb_entries
:7;
619 GLuint urb_entry_allocation_size
:5;
621 GLuint max_threads
:5; /* may be less */
629 GLuint userclip_enable_flags
:8;
630 GLuint userclip_must_clip
:1;
631 GLuint negative_w_clip_test
:1;
632 GLuint guard_band_enable
:1;
633 GLuint viewport_z_clip_enable
:1;
634 GLuint viewport_xy_clip_enable
:1;
635 GLuint vertex_position_space
:1;
643 GLuint clipper_viewport_state_ptr
:27;
647 GLfloat viewport_xmin
;
648 GLfloat viewport_xmax
;
649 GLfloat viewport_ymin
;
650 GLfloat viewport_ymax
;
655 struct brw_cc_unit_state
660 GLuint bf_stencil_pass_depth_pass_op
:3;
661 GLuint bf_stencil_pass_depth_fail_op
:3;
662 GLuint bf_stencil_fail_op
:3;
663 GLuint bf_stencil_func
:3;
664 GLuint bf_stencil_enable
:1;
666 GLuint stencil_write_enable
:1;
667 GLuint stencil_pass_depth_pass_op
:3;
668 GLuint stencil_pass_depth_fail_op
:3;
669 GLuint stencil_fail_op
:3;
670 GLuint stencil_func
:3;
671 GLuint stencil_enable
:1;
677 GLuint bf_stencil_ref
:8;
678 GLuint stencil_write_mask
:8;
679 GLuint stencil_test_mask
:8;
680 GLuint stencil_ref
:8;
686 GLuint logicop_enable
:1;
688 GLuint depth_write_enable
:1;
689 GLuint depth_test_function
:3;
691 GLuint bf_stencil_write_mask
:8;
692 GLuint bf_stencil_test_mask
:8;
699 GLuint alpha_test_func
:3;
701 GLuint blend_enable
:1;
702 GLuint ia_blend_enable
:1;
704 GLuint alpha_test_format
:1;
711 GLuint cc_viewport_state_offset
:27; /* Offset from GENERAL_STATE_BASE */
717 GLuint ia_dest_blend_factor
:5;
718 GLuint ia_src_blend_factor
:5;
719 GLuint ia_blend_function
:3;
720 GLuint statistics_enable
:1;
721 GLuint logicop_func
:4;
723 GLuint dither_enable
:1;
728 GLuint clamp_post_alpha_blend
:1;
729 GLuint clamp_pre_alpha_blend
:1;
730 GLuint clamp_range
:2;
732 GLuint y_dither_offset
:2;
733 GLuint x_dither_offset
:2;
734 GLuint dest_blend_factor
:5;
735 GLuint src_blend_factor
:5;
736 GLuint blend_function
:3;
749 struct brw_sf_unit_state
751 struct thread0 thread0
;
752 struct thread1 thread1
;
753 struct thread2 thread2
;
754 struct thread3 thread3
;
759 GLuint stats_enable
:1;
760 GLuint nr_urb_entries
:7;
762 GLuint urb_entry_allocation_size
:5;
764 GLuint max_threads
:6;
770 GLuint front_winding
:1;
771 GLuint viewport_transform
:1;
773 GLuint sf_viewport_state_offset
:27; /* Offset from GENERAL_STATE_BASE */
779 GLuint dest_org_vbias
:4;
780 GLuint dest_org_hbias
:4;
782 GLuint disable_2x2_trifilter
:1;
783 GLuint disable_zero_pix_trifilter
:1;
784 GLuint point_rast_rule
:2;
785 GLuint line_endcap_aa_region_width
:2;
787 GLuint fast_scissor_disable
:1;
794 GLuint point_size
:11;
795 GLuint use_point_size_state
:1;
796 GLuint subpixel_precision
:1;
797 GLuint sprite_point
:1;
799 GLuint aa_line_distance_mode
:1;
801 GLuint linestrip_pv
:2;
802 GLuint tristrip_pv
:2;
803 GLuint line_last_pixel_enable
:1;
809 struct brw_gs_unit_state
811 struct thread0 thread0
;
812 struct thread1 thread1
;
813 struct thread2 thread2
;
814 struct thread3 thread3
;
819 GLuint stats_enable
:1;
820 GLuint nr_urb_entries
:7;
822 GLuint urb_entry_allocation_size
:5;
824 GLuint max_threads
:5;
830 GLuint sampler_count
:3;
832 GLuint sampler_state_pointer
:27;
838 GLuint max_vp_index
:4;
840 GLuint svbi_post_inc_value
:10;
842 GLuint svbi_post_inc_enable
:1;
843 GLuint svbi_payload
:1;
844 GLuint discard_adjaceny
:1;
845 GLuint reorder_enable
:1;
851 struct brw_vs_unit_state
853 struct thread0 thread0
;
854 struct thread1 thread1
;
855 struct thread2 thread2
;
856 struct thread3 thread3
;
861 GLuint stats_enable
:1;
862 GLuint nr_urb_entries
:7;
864 GLuint urb_entry_allocation_size
:5;
866 GLuint max_threads
:6;
872 GLuint sampler_count
:3;
874 GLuint sampler_state_pointer
:27;
880 GLuint vert_cache_disable
:1;
886 struct brw_wm_unit_state
888 struct thread0 thread0
;
889 struct thread1 thread1
;
890 struct thread2 thread2
;
891 struct thread3 thread3
;
894 GLuint stats_enable
:1;
895 GLuint depth_buffer_clear
:1;
896 GLuint sampler_count
:3;
897 GLuint sampler_state_pointer
:27;
902 GLuint enable_8_pix
:1;
903 GLuint enable_16_pix
:1;
904 GLuint enable_32_pix
:1;
905 GLuint enable_con_32_pix
:1;
906 GLuint enable_con_64_pix
:1;
908 GLuint legacy_global_depth_bias
:1;
909 GLuint line_stipple
:1;
910 GLuint depth_offset
:1;
911 GLuint polygon_stipple
:1;
912 GLuint line_aa_region_width
:2;
913 GLuint line_endcap_aa_region_width
:2;
914 GLuint early_depth_test
:1;
915 GLuint thread_dispatch_enable
:1;
916 GLuint program_uses_depth
:1;
917 GLuint program_computes_depth
:1;
918 GLuint program_uses_killpixel
:1;
919 GLuint legacy_line_rast
: 1;
920 GLuint transposed_urb_read_enable
:1;
921 GLuint max_threads
:7;
924 GLfloat global_depth_offset_constant
;
925 GLfloat global_depth_offset_scale
;
928 struct brw_sampler_default_color
{
932 struct brw_sampler_state
937 GLuint shadow_function
:3;
944 GLuint lod_preclamp
:1;
945 GLuint default_color_mode
:1;
952 GLuint r_wrap_mode
:3;
953 GLuint t_wrap_mode
:3;
954 GLuint s_wrap_mode
:3;
964 GLuint default_color_pointer
:27;
971 GLuint chroma_key_mode
:1;
972 GLuint chroma_key_index
:2;
973 GLuint chroma_key_enable
:1;
974 GLuint monochrome_filter_width
:3;
975 GLuint monochrome_filter_height
:3;
980 struct brw_clipper_viewport
988 struct brw_cc_viewport
994 struct brw_sf_viewport
1005 /* scissor coordinates are inclusive */
1014 /* Documented in the subsystem/shared-functions/sampler chapter...
1016 struct brw_surface_state
1019 GLuint cube_pos_z
:1;
1020 GLuint cube_neg_z
:1;
1021 GLuint cube_pos_y
:1;
1022 GLuint cube_neg_y
:1;
1023 GLuint cube_pos_x
:1;
1024 GLuint cube_neg_x
:1;
1026 GLuint mipmap_layout_mode
:1;
1027 GLuint vert_line_stride_ofs
:1;
1028 GLuint vert_line_stride
:1;
1029 GLuint color_blend
:1;
1030 GLuint writedisable_blue
:1;
1031 GLuint writedisable_green
:1;
1032 GLuint writedisable_red
:1;
1033 GLuint writedisable_alpha
:1;
1034 GLuint surface_format
:9;
1035 GLuint data_return_format
:1;
1037 GLuint surface_type
:3;
1053 GLuint tiled_surface
:1;
1060 GLuint multisample_position_palette_index
:3;
1062 GLuint num_multisamples
:3;
1064 GLuint render_target_view_extent
:9;
1065 GLuint min_array_elt
:11;
1071 GLuint llc_mapping
:1;
1072 GLuint mlc_mapping
:1;
1078 } ss5
; /* NEW in Integrated Graphics Device */
1084 struct brw_vertex_buffer_state
1089 GLuint access_type
:1;
1096 GLuint instance_data_step_rate
; /* not included for sequential/random vertices? */
1100 #define BRW_VBP_MAX 17
1102 struct brw_vb_array_state
{
1103 struct header header
;
1104 struct brw_vertex_buffer_state vb
[BRW_VBP_MAX
];
1108 struct brw_vertex_element_state
1112 GLuint src_offset
:11;
1114 GLuint src_format
:9;
1117 GLuint vertex_buffer_index
:5;
1122 GLuint dst_offset
:8;
1124 GLuint vfcomponent3
:4;
1125 GLuint vfcomponent2
:4;
1126 GLuint vfcomponent1
:4;
1127 GLuint vfcomponent0
:4;
1131 #define BRW_VEP_MAX 18
1133 struct brw_vertex_element_packet
{
1134 struct header header
;
1135 struct brw_vertex_element_state ve
[BRW_VEP_MAX
]; /* note: less than _TNL_ATTRIB_MAX */
1139 struct brw_urb_immediate
{
1142 GLuint swizzle_control
:2;
1147 GLuint response_length
:4;
1148 GLuint msg_length
:4;
1149 GLuint msg_target
:4;
1151 GLuint end_of_thread
:1;
1154 /* Instruction format for the execution units:
1157 struct brw_instruction
1163 GLuint access_mode
:1;
1164 GLuint mask_control
:1;
1165 GLuint dependency_control
:2;
1166 GLuint compression_control
:2;
1167 GLuint thread_control
:2;
1168 GLuint predicate_control
:4;
1169 GLuint predicate_inverse
:1;
1170 GLuint execution_size
:3;
1171 GLuint destreg__conditonalmod
:4; /* destreg - send, conditionalmod - others */
1173 GLuint debug_control
:1;
1180 GLuint dest_reg_file
:2;
1181 GLuint dest_reg_type
:3;
1182 GLuint src0_reg_file
:2;
1183 GLuint src0_reg_type
:3;
1184 GLuint src1_reg_file
:2;
1185 GLuint src1_reg_type
:3;
1187 GLuint dest_subreg_nr
:5;
1188 GLuint dest_reg_nr
:8;
1189 GLuint dest_horiz_stride
:2;
1190 GLuint dest_address_mode
:1;
1195 GLuint dest_reg_file
:2;
1196 GLuint dest_reg_type
:3;
1197 GLuint src0_reg_file
:2;
1198 GLuint src0_reg_type
:3;
1200 GLint dest_indirect_offset
:10; /* offset against the deref'd address reg */
1201 GLuint dest_subreg_nr
:3; /* subnr for the address reg a0.x */
1202 GLuint dest_horiz_stride
:2;
1203 GLuint dest_address_mode
:1;
1208 GLuint dest_reg_file
:2;
1209 GLuint dest_reg_type
:3;
1210 GLuint src0_reg_file
:2;
1211 GLuint src0_reg_type
:3;
1212 GLuint src1_reg_file
:2;
1213 GLuint src1_reg_type
:3;
1215 GLuint dest_writemask
:4;
1216 GLuint dest_subreg_nr
:1;
1217 GLuint dest_reg_nr
:8;
1219 GLuint dest_address_mode
:1;
1224 GLuint dest_reg_file
:2;
1225 GLuint dest_reg_type
:3;
1226 GLuint src0_reg_file
:2;
1227 GLuint src0_reg_type
:3;
1229 GLuint dest_writemask
:4;
1230 GLint dest_indirect_offset
:6;
1231 GLuint dest_subreg_nr
:3;
1233 GLuint dest_address_mode
:1;
1241 GLuint src0_subreg_nr
:5;
1242 GLuint src0_reg_nr
:8;
1244 GLuint src0_negate
:1;
1245 GLuint src0_address_mode
:1;
1246 GLuint src0_horiz_stride
:2;
1247 GLuint src0_width
:3;
1248 GLuint src0_vert_stride
:4;
1249 GLuint flag_reg_nr
:1;
1255 GLint src0_indirect_offset
:10;
1256 GLuint src0_subreg_nr
:3;
1258 GLuint src0_negate
:1;
1259 GLuint src0_address_mode
:1;
1260 GLuint src0_horiz_stride
:2;
1261 GLuint src0_width
:3;
1262 GLuint src0_vert_stride
:4;
1263 GLuint flag_reg_nr
:1;
1269 GLuint src0_swz_x
:2;
1270 GLuint src0_swz_y
:2;
1271 GLuint src0_subreg_nr
:1;
1272 GLuint src0_reg_nr
:8;
1274 GLuint src0_negate
:1;
1275 GLuint src0_address_mode
:1;
1276 GLuint src0_swz_z
:2;
1277 GLuint src0_swz_w
:2;
1279 GLuint src0_vert_stride
:4;
1280 GLuint flag_reg_nr
:1;
1286 GLuint src0_swz_x
:2;
1287 GLuint src0_swz_y
:2;
1288 GLint src0_indirect_offset
:6;
1289 GLuint src0_subreg_nr
:3;
1291 GLuint src0_negate
:1;
1292 GLuint src0_address_mode
:1;
1293 GLuint src0_swz_z
:2;
1294 GLuint src0_swz_w
:2;
1296 GLuint src0_vert_stride
:4;
1297 GLuint flag_reg_nr
:1;
1307 GLuint src1_subreg_nr
:5;
1308 GLuint src1_reg_nr
:8;
1310 GLuint src1_negate
:1;
1312 GLuint src1_horiz_stride
:2;
1313 GLuint src1_width
:3;
1314 GLuint src1_vert_stride
:4;
1320 GLuint src1_swz_x
:2;
1321 GLuint src1_swz_y
:2;
1322 GLuint src1_subreg_nr
:1;
1323 GLuint src1_reg_nr
:8;
1325 GLuint src1_negate
:1;
1327 GLuint src1_swz_z
:2;
1328 GLuint src1_swz_w
:2;
1330 GLuint src1_vert_stride
:4;
1336 GLint src1_indirect_offset
:10;
1337 GLuint src1_subreg_nr
:3;
1339 GLuint src1_negate
:1;
1341 GLuint src1_horiz_stride
:2;
1342 GLuint src1_width
:3;
1343 GLuint src1_vert_stride
:4;
1344 GLuint flag_reg_nr
:1;
1350 GLuint src1_swz_x
:2;
1351 GLuint src1_swz_y
:2;
1352 GLint src1_indirect_offset
:6;
1353 GLuint src1_subreg_nr
:3;
1355 GLuint src1_negate
:1;
1357 GLuint src1_swz_z
:2;
1358 GLuint src1_swz_w
:2;
1360 GLuint src1_vert_stride
:4;
1361 GLuint flag_reg_nr
:1;
1368 GLint jump_count
:16; /* note: signed */
1380 GLuint response_length
:4;
1381 GLuint msg_length
:4;
1382 GLuint msg_target
:4;
1384 GLuint end_of_thread
:1;
1388 GLuint binding_table_index
:8;
1390 GLuint return_format
:2;
1392 GLuint response_length
:4;
1393 GLuint msg_length
:4;
1394 GLuint msg_target
:4;
1396 GLuint end_of_thread
:1;
1400 GLuint binding_table_index
:8;
1403 GLuint response_length
:4;
1404 GLuint msg_length
:4;
1405 GLuint msg_target
:4;
1407 GLuint end_of_thread
:1;
1410 struct brw_urb_immediate urb
;
1413 GLuint binding_table_index
:8;
1414 GLuint msg_control
:4;
1416 GLuint target_cache
:2;
1417 GLuint response_length
:4;
1418 GLuint msg_length
:4;
1419 GLuint msg_target
:4;
1421 GLuint end_of_thread
:1;
1425 GLuint binding_table_index
:8;
1426 GLuint msg_control
:3;
1427 GLuint pixel_scoreboard_clear
:1;
1429 GLuint send_commit_msg
:1;
1430 GLuint response_length
:4;
1431 GLuint msg_length
:4;
1432 GLuint msg_target
:4;
1434 GLuint end_of_thread
:1;
1439 GLuint response_length
:4;
1440 GLuint msg_length
:4;
1441 GLuint msg_target
:4;
1443 GLuint end_of_thread
:1;