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
;
522 struct thread1 thread1
;
523 struct thread2 thread2
;
524 struct thread3 thread3
;
529 GLuint gs_output_stats
:1; /* not always */
530 GLuint stats_enable
:1;
531 GLuint nr_urb_entries
:7;
533 GLuint urb_entry_allocation_size
:5;
535 GLuint max_threads
:6; /* may be less */
543 GLuint userclip_enable_flags
:8;
544 GLuint userclip_must_clip
:1;
546 GLuint guard_band_enable
:1;
547 GLuint viewport_z_clip_enable
:1;
548 GLuint viewport_xy_clip_enable
:1;
549 GLuint vertex_position_space
:1;
557 GLuint clipper_viewport_state_ptr
:27;
561 GLfloat viewport_xmin
;
562 GLfloat viewport_xmax
;
563 GLfloat viewport_ymin
;
564 GLfloat viewport_ymax
;
569 struct brw_cc_unit_state
574 GLuint bf_stencil_pass_depth_pass_op
:3;
575 GLuint bf_stencil_pass_depth_fail_op
:3;
576 GLuint bf_stencil_fail_op
:3;
577 GLuint bf_stencil_func
:3;
578 GLuint bf_stencil_enable
:1;
580 GLuint stencil_write_enable
:1;
581 GLuint stencil_pass_depth_pass_op
:3;
582 GLuint stencil_pass_depth_fail_op
:3;
583 GLuint stencil_fail_op
:3;
584 GLuint stencil_func
:3;
585 GLuint stencil_enable
:1;
591 GLuint bf_stencil_ref
:8;
592 GLuint stencil_write_mask
:8;
593 GLuint stencil_test_mask
:8;
594 GLuint stencil_ref
:8;
600 GLuint logicop_enable
:1;
602 GLuint depth_write_enable
:1;
603 GLuint depth_test_function
:3;
605 GLuint bf_stencil_write_mask
:8;
606 GLuint bf_stencil_test_mask
:8;
613 GLuint alpha_test_func
:3;
615 GLuint blend_enable
:1;
616 GLuint ia_blend_enable
:1;
618 GLuint alpha_test_format
:1;
625 GLuint cc_viewport_state_offset
:27;
631 GLuint ia_dest_blend_factor
:5;
632 GLuint ia_src_blend_factor
:5;
633 GLuint ia_blend_function
:3;
634 GLuint statistics_enable
:1;
635 GLuint logicop_func
:4;
637 GLuint dither_enable
:1;
642 GLuint clamp_post_alpha_blend
:1;
643 GLuint clamp_pre_alpha_blend
:1;
644 GLuint clamp_range
:2;
646 GLuint y_dither_offset
:2;
647 GLuint x_dither_offset
:2;
648 GLuint dest_blend_factor
:5;
649 GLuint src_blend_factor
:5;
650 GLuint blend_function
:3;
663 struct brw_sf_unit_state
665 struct thread0 thread0
;
666 struct thread1 thread1
;
667 struct thread2 thread2
;
668 struct thread3 thread3
;
673 GLuint stats_enable
:1;
674 GLuint nr_urb_entries
:7;
676 GLuint urb_entry_allocation_size
:5;
678 GLuint max_threads
:6;
684 GLuint front_winding
:1;
685 GLuint viewport_transform
:1;
687 GLuint sf_viewport_state_offset
:27;
693 GLuint dest_org_vbias
:4;
694 GLuint dest_org_hbias
:4;
696 GLuint disable_2x2_trifilter
:1;
697 GLuint disable_zero_pix_trifilter
:1;
698 GLuint point_rast_rule
:2;
699 GLuint line_endcap_aa_region_width
:2;
701 GLuint fast_scissor_disable
:1;
708 GLuint point_size
:11;
709 GLuint use_point_size_state
:1;
710 GLuint subpixel_precision
:1;
711 GLuint sprite_point
:1;
714 GLuint linestrip_pv
:2;
715 GLuint tristrip_pv
:2;
716 GLuint line_last_pixel_enable
:1;
722 struct brw_gs_unit_state
724 struct thread0 thread0
;
725 struct thread1 thread1
;
726 struct thread2 thread2
;
727 struct thread3 thread3
;
732 GLuint stats_enable
:1;
733 GLuint nr_urb_entries
:7;
735 GLuint urb_entry_allocation_size
:5;
737 GLuint max_threads
:1;
743 GLuint sampler_count
:3;
745 GLuint sampler_state_pointer
:27;
751 GLuint max_vp_index
:4;
753 GLuint reorder_enable
:1;
759 struct brw_vs_unit_state
761 struct thread0 thread0
;
762 struct thread1 thread1
;
763 struct thread2 thread2
;
764 struct thread3 thread3
;
769 GLuint stats_enable
:1;
770 GLuint nr_urb_entries
:7;
772 GLuint urb_entry_allocation_size
:5;
774 GLuint max_threads
:4;
780 GLuint sampler_count
:3;
782 GLuint sampler_state_pointer
:27;
788 GLuint vert_cache_disable
:1;
794 struct brw_wm_unit_state
796 struct thread0 thread0
;
797 struct thread1 thread1
;
798 struct thread2 thread2
;
799 struct thread3 thread3
;
802 GLuint stats_enable
:1;
804 GLuint sampler_count
:3;
805 GLuint sampler_state_pointer
:27;
810 GLuint enable_8_pix
:1;
811 GLuint enable_16_pix
:1;
812 GLuint enable_32_pix
:1;
814 GLuint legacy_global_depth_bias
:1;
815 GLuint line_stipple
:1;
816 GLuint depth_offset
:1;
817 GLuint polygon_stipple
:1;
818 GLuint line_aa_region_width
:2;
819 GLuint line_endcap_aa_region_width
:2;
820 GLuint early_depth_test
:1;
821 GLuint thread_dispatch_enable
:1;
822 GLuint program_uses_depth
:1;
823 GLuint program_computes_depth
:1;
824 GLuint program_uses_killpixel
:1;
825 GLuint legacy_line_rast
: 1;
827 GLuint max_threads
:6;
831 GLfloat global_depth_offset_constant
;
832 GLfloat global_depth_offset_scale
;
835 struct brw_sampler_default_color
{
839 struct brw_sampler_state
844 GLuint shadow_function
:3;
851 GLuint lod_preclamp
:1;
852 GLuint default_color_mode
:1;
859 GLuint r_wrap_mode
:3;
860 GLuint t_wrap_mode
:3;
861 GLuint s_wrap_mode
:3;
871 GLuint default_color_pointer
:27;
878 GLuint chroma_key_mode
:1;
879 GLuint chroma_key_index
:2;
880 GLuint chroma_key_enable
:1;
881 GLuint monochrome_filter_width
:3;
882 GLuint monochrome_filter_height
:3;
887 struct brw_clipper_viewport
895 struct brw_cc_viewport
901 struct brw_sf_viewport
920 /* Documented in the subsystem/shared-functions/sampler chapter...
922 struct brw_surface_state
932 GLuint mipmap_layout_mode
:1;
933 GLuint vert_line_stride_ofs
:1;
934 GLuint vert_line_stride
:1;
935 GLuint color_blend
:1;
936 GLuint writedisable_blue
:1;
937 GLuint writedisable_green
:1;
938 GLuint writedisable_red
:1;
939 GLuint writedisable_alpha
:1;
940 GLuint surface_format
:9;
941 GLuint data_return_format
:1;
943 GLuint surface_type
:3;
959 GLuint tiled_surface
:1;
967 GLuint min_array_elt
:9;
974 struct brw_vertex_buffer_state
979 GLuint access_type
:1;
986 GLuint instance_data_step_rate
; /* not included for sequential/random vertices? */
990 #define BRW_VBP_MAX 17
992 struct brw_vb_array_state
{
993 struct header header
;
994 struct brw_vertex_buffer_state vb
[BRW_VBP_MAX
];
998 struct brw_vertex_element_state
1002 GLuint src_offset
:11;
1004 GLuint src_format
:9;
1007 GLuint vertex_buffer_index
:5;
1012 GLuint dst_offset
:8;
1014 GLuint vfcomponent3
:4;
1015 GLuint vfcomponent2
:4;
1016 GLuint vfcomponent1
:4;
1017 GLuint vfcomponent0
:4;
1021 #define BRW_VEP_MAX 18
1023 struct brw_vertex_element_packet
{
1024 struct header header
;
1025 struct brw_vertex_element_state ve
[BRW_VEP_MAX
]; /* note: less than _TNL_ATTRIB_MAX */
1029 struct brw_urb_immediate
{
1032 GLuint swizzle_control
:2;
1037 GLuint response_length
:4;
1038 GLuint msg_length
:4;
1039 GLuint msg_target
:4;
1041 GLuint end_of_thread
:1;
1044 /* Instruction format for the execution units:
1047 struct brw_instruction
1053 GLuint access_mode
:1;
1054 GLuint mask_control
:1;
1055 GLuint dependency_control
:2;
1056 GLuint compression_control
:2;
1057 GLuint thread_control
:2;
1058 GLuint predicate_control
:4;
1059 GLuint predicate_inverse
:1;
1060 GLuint execution_size
:3;
1061 GLuint destreg__conditonalmod
:4; /* destreg - send, conditionalmod - others */
1063 GLuint debug_control
:1;
1070 GLuint dest_reg_file
:2;
1071 GLuint dest_reg_type
:3;
1072 GLuint src0_reg_file
:2;
1073 GLuint src0_reg_type
:3;
1074 GLuint src1_reg_file
:2;
1075 GLuint src1_reg_type
:3;
1077 GLuint dest_subreg_nr
:5;
1078 GLuint dest_reg_nr
:8;
1079 GLuint dest_horiz_stride
:2;
1080 GLuint dest_address_mode
: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;
1090 GLint dest_indirect_offset
:10; /* offset against the deref'd address reg */
1091 GLuint dest_subreg_nr
:3; /* subnr for the address reg a0.x */
1092 GLuint dest_horiz_stride
:2;
1093 GLuint dest_address_mode
:1;
1098 GLuint dest_reg_file
:2;
1099 GLuint dest_reg_type
:3;
1100 GLuint src0_reg_file
:2;
1101 GLuint src0_reg_type
:3;
1102 GLuint src1_reg_file
:2;
1103 GLuint src1_reg_type
:3;
1105 GLuint dest_writemask
:4;
1106 GLuint dest_subreg_nr
:1;
1107 GLuint dest_reg_nr
:8;
1109 GLuint dest_address_mode
:1;
1114 GLuint dest_reg_file
:2;
1115 GLuint dest_reg_type
:3;
1116 GLuint src0_reg_file
:2;
1117 GLuint src0_reg_type
:3;
1119 GLuint dest_writemask
:4;
1120 GLint dest_indirect_offset
:6;
1121 GLuint dest_subreg_nr
:3;
1123 GLuint dest_address_mode
:1;
1131 GLuint src0_subreg_nr
:5;
1132 GLuint src0_reg_nr
:8;
1134 GLuint src0_negate
:1;
1135 GLuint src0_address_mode
:1;
1136 GLuint src0_horiz_stride
:2;
1137 GLuint src0_width
:3;
1138 GLuint src0_vert_stride
:4;
1139 GLuint flag_reg_nr
:1;
1145 GLint src0_indirect_offset
:10;
1146 GLuint src0_subreg_nr
:3;
1148 GLuint src0_negate
:1;
1149 GLuint src0_address_mode
:1;
1150 GLuint src0_horiz_stride
:2;
1151 GLuint src0_width
:3;
1152 GLuint src0_vert_stride
:4;
1153 GLuint flag_reg_nr
:1;
1159 GLuint src0_swz_x
:2;
1160 GLuint src0_swz_y
:2;
1161 GLuint src0_subreg_nr
:1;
1162 GLuint src0_reg_nr
:8;
1164 GLuint src0_negate
:1;
1165 GLuint src0_address_mode
:1;
1166 GLuint src0_swz_z
:2;
1167 GLuint src0_swz_w
:2;
1169 GLuint src0_vert_stride
:4;
1170 GLuint flag_reg_nr
:1;
1176 GLuint src0_swz_x
:2;
1177 GLuint src0_swz_y
:2;
1178 GLint src0_indirect_offset
:6;
1179 GLuint src0_subreg_nr
:3;
1181 GLuint src0_negate
:1;
1182 GLuint src0_address_mode
:1;
1183 GLuint src0_swz_z
:2;
1184 GLuint src0_swz_w
:2;
1186 GLuint src0_vert_stride
:4;
1187 GLuint flag_reg_nr
:1;
1197 GLuint src1_subreg_nr
:5;
1198 GLuint src1_reg_nr
:8;
1200 GLuint src1_negate
:1;
1202 GLuint src1_horiz_stride
:2;
1203 GLuint src1_width
:3;
1204 GLuint src1_vert_stride
:4;
1210 GLuint src1_swz_x
:2;
1211 GLuint src1_swz_y
:2;
1212 GLuint src1_subreg_nr
:1;
1213 GLuint src1_reg_nr
:8;
1215 GLuint src1_negate
:1;
1217 GLuint src1_swz_z
:2;
1218 GLuint src1_swz_w
:2;
1220 GLuint src1_vert_stride
:4;
1226 GLint src1_indirect_offset
:10;
1227 GLuint src1_subreg_nr
:3;
1229 GLuint src1_negate
:1;
1231 GLuint src1_horiz_stride
:2;
1232 GLuint src1_width
:3;
1233 GLuint src1_vert_stride
:4;
1234 GLuint flag_reg_nr
:1;
1240 GLuint src1_swz_x
:2;
1241 GLuint src1_swz_y
:2;
1242 GLint src1_indirect_offset
:6;
1243 GLuint src1_subreg_nr
:3;
1245 GLuint src1_negate
:1;
1247 GLuint src1_swz_z
:2;
1248 GLuint src1_swz_w
:2;
1250 GLuint src1_vert_stride
:4;
1251 GLuint flag_reg_nr
:1;
1258 GLint jump_count
:16; /* note: signed */
1270 GLuint response_length
:4;
1271 GLuint msg_length
:4;
1272 GLuint msg_target
:4;
1274 GLuint end_of_thread
:1;
1278 GLuint binding_table_index
:8;
1280 GLuint return_format
:2;
1282 GLuint response_length
:4;
1283 GLuint msg_length
:4;
1284 GLuint msg_target
:4;
1286 GLuint end_of_thread
:1;
1289 struct brw_urb_immediate urb
;
1292 GLuint binding_table_index
:8;
1293 GLuint msg_control
:4;
1295 GLuint target_cache
:2;
1296 GLuint response_length
:4;
1297 GLuint msg_length
:4;
1298 GLuint msg_target
:4;
1300 GLuint end_of_thread
:1;
1304 GLuint binding_table_index
:8;
1305 GLuint msg_control
:3;
1306 GLuint pixel_scoreboard_clear
:1;
1308 GLuint send_commit_msg
:1;
1309 GLuint response_length
:4;
1310 GLuint msg_length
:4;
1311 GLuint msg_target
:4;
1313 GLuint end_of_thread
:1;
1318 GLuint response_length
:4;
1319 GLuint msg_length
:4;
1320 GLuint msg_target
:4;
1322 GLuint end_of_thread
:1;