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 depth_offset_disable
:1;
147 GLuint tiled_surface
:1;
149 GLuint surface_type
:3;
154 GLuint dword2_base_addr
;
159 GLuint mipmap_layout
:1;
170 GLuint min_array_element
:9;
179 struct header header
;
191 struct brw_global_depth_offset_clamp
193 struct header header
;
194 GLfloat depth_offset_clamp
;
197 struct brw_indexbuffer
203 GLuint index_format
:2;
204 GLuint cut_index_enable
:1;
217 struct brw_line_stipple
219 struct header header
;
229 GLuint repeat_count
:9;
231 GLuint inverse_repeat_count
:16;
236 struct brw_pipelined_state_pointers
238 struct header header
;
274 GLuint offset
:27; /* KW: check me! */
279 struct brw_polygon_stipple_offset
281 struct header header
;
293 struct brw_polygon_stipple
295 struct header header
;
301 struct brw_pipeline_select
305 GLuint pipeline_select
:1;
312 struct brw_pipe_control
317 GLuint notify_enable
:1;
319 GLuint instruction_state_cache_flush_enable
:1;
320 GLuint write_cache_flush_enable
:1;
321 GLuint depth_stall_enable
:1;
322 GLuint post_sync_operation
:2;
330 GLuint dest_addr_type
:1;
346 GLuint clp_realloc
:1;
348 GLuint vfe_realloc
:1;
371 struct brw_constant_buffer_state
/* previously brw_command_streamer */
373 struct header header
;
377 GLuint nr_urb_entries
:3;
379 GLuint urb_entry_size
:5;
384 struct brw_constant_buffer
396 GLuint buffer_length
:6;
397 GLuint buffer_address
:26;
401 struct brw_state_base_address
403 struct header header
;
407 GLuint modify_enable
:1;
409 GLuint general_state_address
:27;
414 GLuint modify_enable
:1;
416 GLuint surface_state_address
:27;
421 GLuint modify_enable
:1;
423 GLuint indirect_object_state_address
:27;
428 GLuint modify_enable
:1;
430 GLuint general_state_upper_bound
:20;
435 GLuint modify_enable
:1;
437 GLuint indirect_object_state_upper_bound
:20;
441 struct brw_state_prefetch
443 struct header header
;
447 GLuint prefetch_count
:3;
449 GLuint prefetch_pointer
:26;
453 struct brw_system_instruction_pointer
455 struct header header
;
460 GLuint system_instruction_pointer
:28;
467 /* State structs for the various fixed function units:
474 GLuint grf_reg_count
:3;
476 GLuint kernel_start_pointer
:26;
481 GLuint ext_halt_exception_enable
:1;
482 GLuint sw_exception_enable
:1;
483 GLuint mask_stack_exception_enable
:1;
484 GLuint timeout_exception_enable
:1;
485 GLuint illegal_op_exception_enable
:1;
487 GLuint depth_coef_urb_read_offset
:6; /* WM only */
489 GLuint floating_point_mode
:1;
490 GLuint thread_priority
:1;
491 GLuint binding_table_entry_count
:8;
493 GLuint single_program_flow
:1;
498 GLuint per_thread_scratch_space
:4;
500 GLuint scratch_space_base_pointer
:22;
506 GLuint dispatch_grf_start_reg
:4;
507 GLuint urb_entry_read_offset
:6;
509 GLuint urb_entry_read_length
:6;
511 GLuint const_urb_entry_read_offset
:6;
513 GLuint const_urb_entry_read_length
:6;
519 struct brw_clip_unit_state
521 struct thread0 thread0
;
525 GLuint sw_exception_enable
:1;
527 GLuint mask_stack_exception_enable
:1;
529 GLuint illegal_op_exception_enable
:1;
531 GLuint floating_point_mode
:1;
532 GLuint thread_priority
:1;
533 GLuint binding_table_entry_count
:8;
535 GLuint single_program_flow
:1;
538 struct thread2 thread2
;
539 struct thread3 thread3
;
544 GLuint gs_output_stats
:1; /* not always */
545 GLuint stats_enable
:1;
546 GLuint nr_urb_entries
:7;
548 GLuint urb_entry_allocation_size
:5;
550 GLuint max_threads
:1; /* may be less */
558 GLuint userclip_enable_flags
:8;
559 GLuint userclip_must_clip
:1;
561 GLuint guard_band_enable
:1;
562 GLuint viewport_z_clip_enable
:1;
563 GLuint viewport_xy_clip_enable
:1;
564 GLuint vertex_position_space
:1;
572 GLuint clipper_viewport_state_ptr
:27;
576 GLfloat viewport_xmin
;
577 GLfloat viewport_xmax
;
578 GLfloat viewport_ymin
;
579 GLfloat viewport_ymax
;
584 struct brw_cc_unit_state
589 GLuint bf_stencil_pass_depth_pass_op
:3;
590 GLuint bf_stencil_pass_depth_fail_op
:3;
591 GLuint bf_stencil_fail_op
:3;
592 GLuint bf_stencil_func
:3;
593 GLuint bf_stencil_enable
:1;
595 GLuint stencil_write_enable
:1;
596 GLuint stencil_pass_depth_pass_op
:3;
597 GLuint stencil_pass_depth_fail_op
:3;
598 GLuint stencil_fail_op
:3;
599 GLuint stencil_func
:3;
600 GLuint stencil_enable
:1;
606 GLuint bf_stencil_ref
:8;
607 GLuint stencil_write_mask
:8;
608 GLuint stencil_test_mask
:8;
609 GLuint stencil_ref
:8;
615 GLuint logicop_enable
:1;
617 GLuint depth_write_enable
:1;
618 GLuint depth_test_function
:3;
620 GLuint bf_stencil_write_mask
:8;
621 GLuint bf_stencil_test_mask
:8;
628 GLuint alpha_test_func
:3;
630 GLuint blend_enable
:1;
631 GLuint ia_blend_enable
:1;
633 GLuint alpha_test_format
:1;
640 GLuint cc_viewport_state_offset
:27;
646 GLuint ia_dest_blend_factor
:5;
647 GLuint ia_src_blend_factor
:5;
648 GLuint ia_blend_function
:3;
649 GLuint statistics_enable
:1;
650 GLuint logicop_func
:4;
652 GLuint dither_enable
:1;
657 GLuint clamp_post_alpha_blend
:1;
658 GLuint clamp_pre_alpha_blend
:1;
659 GLuint clamp_range
:2;
661 GLuint y_dither_offset
:2;
662 GLuint x_dither_offset
:2;
663 GLuint dest_blend_factor
:5;
664 GLuint src_blend_factor
:5;
665 GLuint blend_function
:3;
678 struct brw_sf_unit_state
680 struct thread0 thread0
;
681 struct thread1 thread1
;
682 struct thread2 thread2
;
683 struct thread3 thread3
;
688 GLuint stats_enable
:1;
689 GLuint nr_urb_entries
:7;
691 GLuint urb_entry_allocation_size
:5;
693 GLuint max_threads
:6;
699 GLuint front_winding
:1;
700 GLuint viewport_transform
:1;
702 GLuint sf_viewport_state_offset
:27;
708 GLuint dest_org_vbias
:4;
709 GLuint dest_org_hbias
:4;
711 GLuint disable_2x2_trifilter
:1;
712 GLuint disable_zero_pix_trifilter
:1;
713 GLuint point_rast_rule
:2;
714 GLuint line_endcap_aa_region_width
:2;
716 GLuint fast_scissor_disable
:1;
723 GLuint point_size
:11;
724 GLuint use_point_size_state
:1;
725 GLuint subpixel_precision
:1;
726 GLuint sprite_point
:1;
729 GLuint linestrip_pv
:2;
730 GLuint tristrip_pv
:2;
731 GLuint line_last_pixel_enable
:1;
737 struct brw_gs_unit_state
739 struct thread0 thread0
;
740 struct thread1 thread1
;
741 struct thread2 thread2
;
742 struct thread3 thread3
;
747 GLuint stats_enable
:1;
748 GLuint nr_urb_entries
:7;
750 GLuint urb_entry_allocation_size
:5;
752 GLuint max_threads
:1;
758 GLuint sampler_count
:3;
760 GLuint sampler_state_pointer
:27;
766 GLuint max_vp_index
:4;
768 GLuint reorder_enable
:1;
774 struct brw_vs_unit_state
776 struct thread0 thread0
;
777 struct thread1 thread1
;
778 struct thread2 thread2
;
779 struct thread3 thread3
;
784 GLuint stats_enable
:1;
785 GLuint nr_urb_entries
:7;
787 GLuint urb_entry_allocation_size
:5;
789 GLuint max_threads
:4;
795 GLuint sampler_count
:3;
797 GLuint sampler_state_pointer
:27;
803 GLuint vert_cache_disable
:1;
809 struct brw_wm_unit_state
811 struct thread0 thread0
;
812 struct thread1 thread1
;
813 struct thread2 thread2
;
814 struct thread3 thread3
;
817 GLuint stats_enable
:1;
819 GLuint sampler_count
:3;
820 GLuint sampler_state_pointer
:27;
825 GLuint enable_8_pix
:1;
826 GLuint enable_16_pix
:1;
827 GLuint enable_32_pix
:1;
829 GLuint legacy_global_depth_bias
:1;
830 GLuint line_stipple
:1;
831 GLuint depth_offset
:1;
832 GLuint polygon_stipple
:1;
833 GLuint line_aa_region_width
:2;
834 GLuint line_endcap_aa_region_width
:2;
835 GLuint early_depth_test
:1;
836 GLuint thread_dispatch_enable
:1;
837 GLuint program_uses_depth
:1;
838 GLuint program_computes_depth
:1;
839 GLuint program_uses_killpixel
:1;
840 GLuint legacy_line_rast
: 1;
842 GLuint max_threads
:6;
846 GLfloat global_depth_offset_constant
;
847 GLfloat global_depth_offset_scale
;
850 struct brw_sampler_default_color
{
854 struct brw_sampler_state
859 GLuint shadow_function
:3;
866 GLuint lod_preclamp
:1;
867 GLuint default_color_mode
:1;
874 GLuint r_wrap_mode
:3;
875 GLuint t_wrap_mode
:3;
876 GLuint s_wrap_mode
:3;
886 GLuint default_color_pointer
:27;
893 GLuint chroma_key_mode
:1;
894 GLuint chroma_key_index
:2;
895 GLuint chroma_key_enable
:1;
896 GLuint monochrome_filter_width
:3;
897 GLuint monochrome_filter_height
:3;
902 struct brw_clipper_viewport
910 struct brw_cc_viewport
916 struct brw_sf_viewport
935 /* Documented in the subsystem/shared-functions/sampler chapter...
937 struct brw_surface_state
947 GLuint mipmap_layout_mode
:1;
948 GLuint vert_line_stride_ofs
:1;
949 GLuint vert_line_stride
:1;
950 GLuint color_blend
:1;
951 GLuint writedisable_blue
:1;
952 GLuint writedisable_green
:1;
953 GLuint writedisable_red
:1;
954 GLuint writedisable_alpha
:1;
955 GLuint surface_format
:9;
956 GLuint data_return_format
:1;
958 GLuint surface_type
:3;
974 GLuint tiled_surface
:1;
982 GLuint min_array_elt
:9;
989 struct brw_vertex_buffer_state
994 GLuint access_type
:1;
1001 GLuint instance_data_step_rate
; /* not included for sequential/random vertices? */
1005 #define BRW_VBP_MAX 17
1007 struct brw_vb_array_state
{
1008 struct header header
;
1009 struct brw_vertex_buffer_state vb
[BRW_VBP_MAX
];
1013 struct brw_vertex_element_state
1017 GLuint src_offset
:11;
1019 GLuint src_format
:9;
1022 GLuint vertex_buffer_index
:5;
1027 GLuint dst_offset
:8;
1029 GLuint vfcomponent3
:4;
1030 GLuint vfcomponent2
:4;
1031 GLuint vfcomponent1
:4;
1032 GLuint vfcomponent0
:4;
1036 #define BRW_VEP_MAX 18
1038 struct brw_vertex_element_packet
{
1039 struct header header
;
1040 struct brw_vertex_element_state ve
[BRW_VEP_MAX
]; /* note: less than _TNL_ATTRIB_MAX */
1044 struct brw_urb_immediate
{
1047 GLuint swizzle_control
:2;
1052 GLuint response_length
:4;
1053 GLuint msg_length
:4;
1054 GLuint msg_target
:4;
1056 GLuint end_of_thread
:1;
1059 /* Instruction format for the execution units:
1062 struct brw_instruction
1068 GLuint access_mode
:1;
1069 GLuint mask_control
:1;
1070 GLuint dependency_control
:2;
1071 GLuint compression_control
:2;
1072 GLuint thread_control
:2;
1073 GLuint predicate_control
:4;
1074 GLuint predicate_inverse
:1;
1075 GLuint execution_size
:3;
1076 GLuint destreg__conditonalmod
:4; /* destreg - send, conditionalmod - others */
1078 GLuint debug_control
:1;
1085 GLuint dest_reg_file
:2;
1086 GLuint dest_reg_type
:3;
1087 GLuint src0_reg_file
:2;
1088 GLuint src0_reg_type
:3;
1089 GLuint src1_reg_file
:2;
1090 GLuint src1_reg_type
:3;
1092 GLuint dest_subreg_nr
:5;
1093 GLuint dest_reg_nr
:8;
1094 GLuint dest_horiz_stride
:2;
1095 GLuint dest_address_mode
:1;
1100 GLuint dest_reg_file
:2;
1101 GLuint dest_reg_type
:3;
1102 GLuint src0_reg_file
:2;
1103 GLuint src0_reg_type
:3;
1105 GLint dest_indirect_offset
:10; /* offset against the deref'd address reg */
1106 GLuint dest_subreg_nr
:3; /* subnr for the address reg a0.x */
1107 GLuint dest_horiz_stride
:2;
1108 GLuint dest_address_mode
:1;
1113 GLuint dest_reg_file
:2;
1114 GLuint dest_reg_type
:3;
1115 GLuint src0_reg_file
:2;
1116 GLuint src0_reg_type
:3;
1117 GLuint src1_reg_file
:2;
1118 GLuint src1_reg_type
:3;
1120 GLuint dest_writemask
:4;
1121 GLuint dest_subreg_nr
:1;
1122 GLuint dest_reg_nr
:8;
1124 GLuint dest_address_mode
:1;
1129 GLuint dest_reg_file
:2;
1130 GLuint dest_reg_type
:3;
1131 GLuint src0_reg_file
:2;
1132 GLuint src0_reg_type
:3;
1134 GLuint dest_writemask
:4;
1135 GLint dest_indirect_offset
:6;
1136 GLuint dest_subreg_nr
:3;
1138 GLuint dest_address_mode
:1;
1146 GLuint src0_subreg_nr
:5;
1147 GLuint src0_reg_nr
:8;
1149 GLuint src0_negate
:1;
1150 GLuint src0_address_mode
:1;
1151 GLuint src0_horiz_stride
:2;
1152 GLuint src0_width
:3;
1153 GLuint src0_vert_stride
:4;
1154 GLuint flag_reg_nr
:1;
1160 GLint src0_indirect_offset
:10;
1161 GLuint src0_subreg_nr
:3;
1163 GLuint src0_negate
:1;
1164 GLuint src0_address_mode
:1;
1165 GLuint src0_horiz_stride
:2;
1166 GLuint src0_width
:3;
1167 GLuint src0_vert_stride
:4;
1168 GLuint flag_reg_nr
:1;
1174 GLuint src0_swz_x
:2;
1175 GLuint src0_swz_y
:2;
1176 GLuint src0_subreg_nr
:1;
1177 GLuint src0_reg_nr
:8;
1179 GLuint src0_negate
:1;
1180 GLuint src0_address_mode
:1;
1181 GLuint src0_swz_z
:2;
1182 GLuint src0_swz_w
:2;
1184 GLuint src0_vert_stride
:4;
1185 GLuint flag_reg_nr
:1;
1191 GLuint src0_swz_x
:2;
1192 GLuint src0_swz_y
:2;
1193 GLint src0_indirect_offset
:6;
1194 GLuint src0_subreg_nr
:3;
1196 GLuint src0_negate
:1;
1197 GLuint src0_address_mode
:1;
1198 GLuint src0_swz_z
:2;
1199 GLuint src0_swz_w
:2;
1201 GLuint src0_vert_stride
:4;
1202 GLuint flag_reg_nr
:1;
1212 GLuint src1_subreg_nr
:5;
1213 GLuint src1_reg_nr
:8;
1215 GLuint src1_negate
:1;
1217 GLuint src1_horiz_stride
:2;
1218 GLuint src1_width
:3;
1219 GLuint src1_vert_stride
:4;
1225 GLuint src1_swz_x
:2;
1226 GLuint src1_swz_y
:2;
1227 GLuint src1_subreg_nr
:1;
1228 GLuint src1_reg_nr
:8;
1230 GLuint src1_negate
:1;
1232 GLuint src1_swz_z
:2;
1233 GLuint src1_swz_w
:2;
1235 GLuint src1_vert_stride
:4;
1241 GLint src1_indirect_offset
:10;
1242 GLuint src1_subreg_nr
:3;
1244 GLuint src1_negate
:1;
1246 GLuint src1_horiz_stride
:2;
1247 GLuint src1_width
:3;
1248 GLuint src1_vert_stride
:4;
1249 GLuint flag_reg_nr
:1;
1255 GLuint src1_swz_x
:2;
1256 GLuint src1_swz_y
:2;
1257 GLint src1_indirect_offset
:6;
1258 GLuint src1_subreg_nr
:3;
1260 GLuint src1_negate
:1;
1262 GLuint src1_swz_z
:2;
1263 GLuint src1_swz_w
:2;
1265 GLuint src1_vert_stride
:4;
1266 GLuint flag_reg_nr
:1;
1273 GLint jump_count
:16; /* note: signed */
1285 GLuint response_length
:4;
1286 GLuint msg_length
:4;
1287 GLuint msg_target
:4;
1289 GLuint end_of_thread
:1;
1293 GLuint binding_table_index
:8;
1295 GLuint return_format
:2;
1297 GLuint response_length
:4;
1298 GLuint msg_length
:4;
1299 GLuint msg_target
:4;
1301 GLuint end_of_thread
:1;
1304 struct brw_urb_immediate urb
;
1307 GLuint binding_table_index
:8;
1308 GLuint msg_control
:4;
1310 GLuint target_cache
:2;
1311 GLuint response_length
:4;
1312 GLuint msg_length
:4;
1313 GLuint msg_target
:4;
1315 GLuint end_of_thread
:1;
1319 GLuint binding_table_index
:8;
1320 GLuint msg_control
:3;
1321 GLuint pixel_scoreboard_clear
:1;
1323 GLuint send_commit_msg
:1;
1324 GLuint response_length
:4;
1325 GLuint msg_length
:4;
1326 GLuint msg_target
:4;
1328 GLuint end_of_thread
:1;
1333 GLuint response_length
:4;
1334 GLuint msg_length
:4;
1335 GLuint msg_target
:4;
1337 GLuint end_of_thread
:1;