decoder: h264: fix frame store logic for MVC.
[platform/upstream/libva-intel-driver.git] / src / i965_structs.h
1 #ifndef _I965_STRUCTS_H_
2 #define _I965_STRUCTS_H_
3
4 struct i965_vfe_state 
5 {
6     struct {
7         unsigned int per_thread_scratch_space:4;
8         unsigned int pad3:3;
9         unsigned int extend_vfe_state_present:1;
10         unsigned int pad2:2;
11         unsigned int scratch_base:22;
12     } vfe0;
13
14     struct {
15         unsigned int debug_counter_control:2;
16         unsigned int children_present:1;
17         unsigned int vfe_mode:4;
18         unsigned int pad2:2;
19         unsigned int num_urb_entries:7;
20         unsigned int urb_entry_alloc_size:9;
21         unsigned int max_threads:7;
22     } vfe1;
23
24     struct {
25         unsigned int pad4:4;
26         unsigned int interface_descriptor_base:28;
27     } vfe2;
28 };
29
30 struct i965_vfe_state_ex 
31 {
32     struct {
33         unsigned int pad:8;
34         unsigned int obj_id:24;
35     } vfex0;
36
37     union {
38         struct {
39             unsigned int residual_grf_offset:5;
40             unsigned int pad0:3;
41             unsigned int weight_grf_offset:5;
42             unsigned int pad1:3;
43             unsigned int residual_data_offset:8;
44             unsigned int sub_field_present_flag:2;
45             unsigned int residual_data_fix_offset_flag:1;
46             unsigned int pad2:5;
47         } avc;
48         
49         unsigned int vc1;
50     } vfex1;
51
52     struct {
53         unsigned int remap_index_0:4;
54         unsigned int remap_index_1:4;
55         unsigned int remap_index_2:4;
56         unsigned int remap_index_3:4;
57         unsigned int remap_index_4:4;
58         unsigned int remap_index_5:4;
59         unsigned int remap_index_6:4;
60         unsigned int remap_index_7:4;
61     }remap_table0;
62
63     struct {
64         unsigned int remap_index_8:4;
65         unsigned int remap_index_9:4;
66         unsigned int remap_index_10:4;
67         unsigned int remap_index_11:4;
68         unsigned int remap_index_12:4;
69         unsigned int remap_index_13:4;
70         unsigned int remap_index_14:4;
71         unsigned int remap_index_15:4;
72     } remap_table1;
73
74     struct {
75         unsigned int mask:8;
76         unsigned int pad:22;
77         unsigned int type:1;
78         unsigned int enable:1;
79     } scoreboard0;
80
81     struct {
82         int delta_x0:4;
83         int delta_y0:4;
84         int delta_x1:4;
85         int delta_y1:4;
86         int delta_x2:4;
87         int delta_y2:4;
88         int delta_x3:4;
89         int delta_y3:4;
90     } scoreboard1;
91
92     struct {
93         int delta_x4:4;
94         int delta_y4:4;
95         int delta_x5:4;
96         int delta_y5:4;
97         int delta_x6:4;
98         int delta_y6:4;
99         int delta_x7:4;
100         int delta_y7:4;
101     } scoreboard2;
102
103     unsigned int pad;
104 };
105
106 struct i965_vld_state 
107 {
108     struct {
109         unsigned int pad6:6;
110         unsigned int scan_order:1;
111         unsigned int intra_vlc_format:1;
112         unsigned int quantizer_scale_type:1;
113         unsigned int concealment_motion_vector:1;
114         unsigned int frame_predict_frame_dct:1;
115         unsigned int top_field_first:1;
116         unsigned int picture_structure:2;
117         unsigned int intra_dc_precision:2;
118         unsigned int f_code_0_0:4;
119         unsigned int f_code_0_1:4;
120         unsigned int f_code_1_0:4;
121         unsigned int f_code_1_1:4;
122     } vld0;
123
124     struct {
125         unsigned int pad2:9;
126         unsigned int picture_coding_type:2;
127         unsigned int pad:21;
128     } vld1;
129
130     struct {
131         unsigned int index_0:4;
132         unsigned int index_1:4;
133         unsigned int index_2:4;
134         unsigned int index_3:4;
135         unsigned int index_4:4;
136         unsigned int index_5:4;
137         unsigned int index_6:4;
138         unsigned int index_7:4;
139     } desc_remap_table0;
140
141     struct {
142         unsigned int index_8:4;
143         unsigned int index_9:4;
144         unsigned int index_10:4;
145         unsigned int index_11:4;
146         unsigned int index_12:4;
147         unsigned int index_13:4;
148         unsigned int index_14:4;
149         unsigned int index_15:4;
150     } desc_remap_table1;
151 };
152
153 struct i965_interface_descriptor 
154 {
155     struct {
156         unsigned int grf_reg_blocks:4;
157         unsigned int pad:2;
158         unsigned int kernel_start_pointer:26;
159     } desc0;
160
161     struct {
162         unsigned int pad:7;
163         unsigned int software_exception:1;
164         unsigned int pad2:3;
165         unsigned int maskstack_exception:1;
166         unsigned int pad3:1;
167         unsigned int illegal_opcode_exception:1;
168         unsigned int pad4:2;
169         unsigned int floating_point_mode:1;
170         unsigned int thread_priority:1;
171         unsigned int single_program_flow:1;
172         unsigned int pad5:1;
173         unsigned int const_urb_entry_read_offset:6;
174         unsigned int const_urb_entry_read_len:6;
175     } desc1;
176
177     struct {
178         unsigned int pad:2;
179         unsigned int sampler_count:3;
180         unsigned int sampler_state_pointer:27;
181     } desc2;
182
183     struct {
184         unsigned int binding_table_entry_count:5;
185         unsigned int binding_table_pointer:27;
186     } desc3;
187 };
188
189 struct i965_surface_state 
190 {
191     struct {
192         unsigned int cube_pos_z:1;
193         unsigned int cube_neg_z:1;
194         unsigned int cube_pos_y:1;
195         unsigned int cube_neg_y:1;
196         unsigned int cube_pos_x:1;
197         unsigned int cube_neg_x:1;
198         unsigned int pad:2;
199         unsigned int render_cache_read_mode:1;
200         unsigned int cube_map_corner_mode:1;
201         unsigned int mipmap_layout_mode:1;
202         unsigned int vert_line_stride_ofs:1;
203         unsigned int vert_line_stride:1;
204         unsigned int color_blend:1;
205         unsigned int writedisable_blue:1;
206         unsigned int writedisable_green:1;
207         unsigned int writedisable_red:1;
208         unsigned int writedisable_alpha:1;
209         unsigned int surface_format:9;
210         unsigned int data_return_format:1;
211         unsigned int pad0:1;
212         unsigned int surface_type:3;
213     } ss0;
214
215     struct {
216         unsigned int base_addr;
217     } ss1;
218
219     struct {
220         unsigned int render_target_rotation:2;
221         unsigned int mip_count:4;
222         unsigned int width:13;
223         unsigned int height:13;
224     } ss2;
225
226     struct {
227         unsigned int tile_walk:1;
228         unsigned int tiled_surface:1;
229         unsigned int pad:1;
230         unsigned int pitch:18;
231         unsigned int depth:11;
232     } ss3;
233
234     struct {
235         unsigned int pad:19;
236         unsigned int min_array_elt:9;
237         unsigned int min_lod:4;
238     } ss4;
239
240     struct {
241         unsigned int pad:20;
242         unsigned int y_offset:4;
243         unsigned int pad2:1;
244         unsigned int x_offset:7;
245     } ss5;
246 };
247
248 struct thread0
249 {
250     unsigned int pad0:1;
251     unsigned int grf_reg_count:3; 
252     unsigned int pad1:2;
253     unsigned int kernel_start_pointer:26; 
254 };
255
256 struct thread1
257 {
258     unsigned int ext_halt_exception_enable:1; 
259     unsigned int sw_exception_enable:1; 
260     unsigned int mask_stack_exception_enable:1; 
261     unsigned int timeout_exception_enable:1; 
262     unsigned int illegal_op_exception_enable:1; 
263     unsigned int pad0:3;
264     unsigned int depth_coef_urb_read_offset:6;  /* WM only */
265     unsigned int pad1:2;
266     unsigned int floating_point_mode:1; 
267     unsigned int thread_priority:1; 
268     unsigned int binding_table_entry_count:8; 
269     unsigned int pad3:5;
270     unsigned int single_program_flow:1; 
271 };
272
273 struct thread2
274 {
275     unsigned int per_thread_scratch_space:4; 
276     unsigned int pad0:6;
277     unsigned int scratch_space_base_pointer:22; 
278 };
279
280    
281 struct thread3
282 {
283     unsigned int dispatch_grf_start_reg:4; 
284     unsigned int urb_entry_read_offset:6; 
285     unsigned int pad0:1;
286     unsigned int urb_entry_read_length:6; 
287     unsigned int pad1:1;
288     unsigned int const_urb_entry_read_offset:6; 
289     unsigned int pad2:1;
290     unsigned int const_urb_entry_read_length:6; 
291     unsigned int pad3:1;
292 };
293
294 struct i965_vs_unit_state
295 {
296     struct thread0 thread0;
297     struct thread1 thread1;
298     struct thread2 thread2;
299     struct thread3 thread3;
300    
301     struct {
302         unsigned int pad0:10;
303         unsigned int stats_enable:1; 
304         unsigned int nr_urb_entries:7; 
305         unsigned int pad1:1;
306         unsigned int urb_entry_allocation_size:5; 
307         unsigned int pad2:1;
308         unsigned int max_threads:4; 
309         unsigned int pad3:3;
310     } thread4;   
311
312     struct {
313         unsigned int sampler_count:3; 
314         unsigned int pad0:2;
315         unsigned int sampler_state_pointer:27; 
316     } vs5;
317
318     struct {
319         unsigned int vs_enable:1; 
320         unsigned int vert_cache_disable:1; 
321         unsigned int pad0:30;
322     } vs6;
323 };
324
325 struct i965_gs_unit_state
326 {
327    struct thread0 thread0;
328    struct thread1 thread1;
329    struct thread2 thread2;
330    struct thread3 thread3;
331
332    struct {
333       unsigned int pad0:10;
334       unsigned int stats_enable:1; 
335       unsigned int nr_urb_entries:7; 
336       unsigned int pad1:1;
337       unsigned int urb_entry_allocation_size:5; 
338       unsigned int pad2:1;
339       unsigned int max_threads:1; 
340       unsigned int pad3:6;
341    } thread4;   
342       
343    struct {
344       unsigned int sampler_count:3; 
345       unsigned int pad0:2;
346       unsigned int sampler_state_pointer:27; 
347    } gs5;
348
349    
350    struct {
351       unsigned int max_vp_index:4; 
352       unsigned int pad0:26;
353       unsigned int reorder_enable:1; 
354       unsigned int pad1:1;
355    } gs6;
356 };
357
358 struct i965_clip_unit_state
359 {
360    struct thread0 thread0;
361    struct thread1 thread1;
362    struct thread2 thread2;
363    struct thread3 thread3;
364
365    struct {
366       unsigned int pad0:9;
367       unsigned int gs_output_stats:1; /* not always */
368       unsigned int stats_enable:1; 
369       unsigned int nr_urb_entries:7; 
370       unsigned int pad1:1;
371       unsigned int urb_entry_allocation_size:5; 
372       unsigned int pad2:1;
373       unsigned int max_threads:6;       /* may be less */
374       unsigned int pad3:1;
375    } thread4;   
376       
377    struct {
378       unsigned int pad0:13;
379       unsigned int clip_mode:3; 
380       unsigned int userclip_enable_flags:8; 
381       unsigned int userclip_must_clip:1; 
382       unsigned int pad1:1;
383       unsigned int guard_band_enable:1; 
384       unsigned int viewport_z_clip_enable:1; 
385       unsigned int viewport_xy_clip_enable:1; 
386       unsigned int vertex_position_space:1; 
387       unsigned int api_mode:1; 
388       unsigned int pad2:1;
389    } clip5;
390    
391    struct {
392       unsigned int pad0:5;
393       unsigned int clipper_viewport_state_ptr:27; 
394    } clip6;
395
396    
397    float viewport_xmin;  
398    float viewport_xmax;  
399    float viewport_ymin;  
400    float viewport_ymax;  
401 };
402
403 struct i965_sf_unit_state
404 {
405    struct thread0 thread0;
406    struct {
407       unsigned int pad0:7;
408       unsigned int sw_exception_enable:1; 
409       unsigned int pad1:3;
410       unsigned int mask_stack_exception_enable:1; 
411       unsigned int pad2:1;
412       unsigned int illegal_op_exception_enable:1; 
413       unsigned int pad3:2;
414       unsigned int floating_point_mode:1; 
415       unsigned int thread_priority:1; 
416       unsigned int binding_table_entry_count:8; 
417       unsigned int pad4:5;
418       unsigned int single_program_flow:1; 
419    } sf1;
420    
421    struct thread2 thread2;
422    struct thread3 thread3;
423
424    struct {
425       unsigned int pad0:10;
426       unsigned int stats_enable:1; 
427       unsigned int nr_urb_entries:7; 
428       unsigned int pad1:1;
429       unsigned int urb_entry_allocation_size:5; 
430       unsigned int pad2:1;
431       unsigned int max_threads:6; 
432       unsigned int pad3:1;
433    } thread4;   
434
435    struct {
436       unsigned int front_winding:1; 
437       unsigned int viewport_transform:1; 
438       unsigned int pad0:3;
439       unsigned int sf_viewport_state_offset:27; 
440    } sf5;
441    
442    struct {
443       unsigned int pad0:9;
444       unsigned int dest_org_vbias:4; 
445       unsigned int dest_org_hbias:4; 
446       unsigned int scissor:1; 
447       unsigned int disable_2x2_trifilter:1; 
448       unsigned int disable_zero_pix_trifilter:1; 
449       unsigned int point_rast_rule:2; 
450       unsigned int line_endcap_aa_region_width:2; 
451       unsigned int line_width:4; 
452       unsigned int fast_scissor_disable:1; 
453       unsigned int cull_mode:2; 
454       unsigned int aa_enable:1; 
455    } sf6;
456
457    struct {
458       unsigned int point_size:11; 
459       unsigned int use_point_size_state:1; 
460       unsigned int subpixel_precision:1; 
461       unsigned int sprite_point:1; 
462       unsigned int pad0:11;
463       unsigned int trifan_pv:2; 
464       unsigned int linestrip_pv:2; 
465       unsigned int tristrip_pv:2; 
466       unsigned int line_last_pixel_enable:1; 
467    } sf7;
468 };
469
470 struct i965_sampler_state
471 {
472    struct {
473       unsigned int shadow_function:3; 
474       unsigned int lod_bias:11; 
475       unsigned int min_filter:3; 
476       unsigned int mag_filter:3; 
477       unsigned int mip_filter:2; 
478       unsigned int base_level:5; 
479       unsigned int pad:1;
480       unsigned int lod_preclamp:1; 
481       unsigned int border_color_mode:1; 
482       unsigned int pad0:1;
483       unsigned int disable:1; 
484    } ss0;
485
486    struct {
487       unsigned int r_wrap_mode:3; 
488       unsigned int t_wrap_mode:3; 
489       unsigned int s_wrap_mode:3; 
490       unsigned int pad:3;
491       unsigned int max_lod:10; 
492       unsigned int min_lod:10; 
493    } ss1;
494
495    
496    struct {
497       unsigned int pad:5;
498       unsigned int border_color_pointer:27; 
499    } ss2;
500    
501    struct {
502       unsigned int pad:19;
503       unsigned int max_aniso:3; 
504       unsigned int chroma_key_mode:1; 
505       unsigned int chroma_key_index:2; 
506       unsigned int chroma_key_enable:1; 
507       unsigned int monochrome_filter_width:3; 
508       unsigned int monochrome_filter_height:3; 
509    } ss3;
510 };
511
512 struct i965_wm_unit_state
513 {
514    struct thread0 thread0;
515    struct thread1 thread1;
516    struct thread2 thread2;
517    struct thread3 thread3;
518    
519    struct {
520       unsigned int stats_enable:1; 
521       unsigned int pad0:1;
522       unsigned int sampler_count:3; 
523       unsigned int sampler_state_pointer:27; 
524    } wm4;
525    
526    struct {
527       unsigned int enable_8_pix:1; 
528       unsigned int enable_16_pix:1; 
529       unsigned int enable_32_pix:1; 
530       unsigned int pad0:7;
531       unsigned int legacy_global_depth_bias:1; 
532       unsigned int line_stipple:1; 
533       unsigned int depth_offset:1; 
534       unsigned int polygon_stipple:1; 
535       unsigned int line_aa_region_width:2; 
536       unsigned int line_endcap_aa_region_width:2; 
537       unsigned int early_depth_test:1; 
538       unsigned int thread_dispatch_enable:1; 
539       unsigned int program_uses_depth:1; 
540       unsigned int program_computes_depth:1; 
541       unsigned int program_uses_killpixel:1; 
542       unsigned int legacy_line_rast: 1; 
543       unsigned int transposed_urb_read:1; 
544       unsigned int max_threads:7; 
545    } wm5;
546    
547    float global_depth_offset_constant;  
548    float global_depth_offset_scale;   
549 };
550
551 struct i965_cc_viewport
552 {
553    float min_depth;  
554    float max_depth;  
555 };
556
557 struct i965_cc_unit_state
558 {
559    struct {
560       unsigned int pad0:3;
561       unsigned int bf_stencil_pass_depth_pass_op:3; 
562       unsigned int bf_stencil_pass_depth_fail_op:3; 
563       unsigned int bf_stencil_fail_op:3; 
564       unsigned int bf_stencil_func:3; 
565       unsigned int bf_stencil_enable:1; 
566       unsigned int pad1:2;
567       unsigned int stencil_write_enable:1; 
568       unsigned int stencil_pass_depth_pass_op:3; 
569       unsigned int stencil_pass_depth_fail_op:3; 
570       unsigned int stencil_fail_op:3; 
571       unsigned int stencil_func:3; 
572       unsigned int stencil_enable:1; 
573    } cc0;
574
575    
576    struct {
577       unsigned int bf_stencil_ref:8; 
578       unsigned int stencil_write_mask:8; 
579       unsigned int stencil_test_mask:8; 
580       unsigned int stencil_ref:8; 
581    } cc1;
582
583    
584    struct {
585       unsigned int logicop_enable:1; 
586       unsigned int pad0:10;
587       unsigned int depth_write_enable:1; 
588       unsigned int depth_test_function:3; 
589       unsigned int depth_test:1; 
590       unsigned int bf_stencil_write_mask:8; 
591       unsigned int bf_stencil_test_mask:8; 
592    } cc2;
593
594    
595    struct {
596       unsigned int pad0:8;
597       unsigned int alpha_test_func:3; 
598       unsigned int alpha_test:1; 
599       unsigned int blend_enable:1; 
600       unsigned int ia_blend_enable:1; 
601       unsigned int pad1:1;
602       unsigned int alpha_test_format:1;
603       unsigned int pad2:16;
604    } cc3;
605    
606    struct {
607       unsigned int pad0:5; 
608       unsigned int cc_viewport_state_offset:27; 
609    } cc4;
610    
611    struct {
612       unsigned int pad0:2;
613       unsigned int ia_dest_blend_factor:5; 
614       unsigned int ia_src_blend_factor:5; 
615       unsigned int ia_blend_function:3; 
616       unsigned int statistics_enable:1; 
617       unsigned int logicop_func:4; 
618       unsigned int pad1:11;
619       unsigned int dither_enable:1; 
620    } cc5;
621
622    struct {
623       unsigned int clamp_post_alpha_blend:1; 
624       unsigned int clamp_pre_alpha_blend:1; 
625       unsigned int clamp_range:2; 
626       unsigned int pad0:11;
627       unsigned int y_dither_offset:2; 
628       unsigned int x_dither_offset:2; 
629       unsigned int dest_blend_factor:5; 
630       unsigned int src_blend_factor:5; 
631       unsigned int blend_function:3; 
632    } cc6;
633
634    struct {
635       union {
636          float f;  
637          unsigned char ub[4];
638       } alpha_ref;
639    } cc7;
640 };
641
642 struct i965_sampler_8x8
643 {
644     struct {
645         unsigned int pad0:16;
646         unsigned int chroma_key_index:2;
647         unsigned int chroma_key_enable:1;
648         unsigned int pad1:8;
649         unsigned int ief_filter_size:1;
650         unsigned int ief_filter_type:1;
651         unsigned int ief_bypass:1;
652         unsigned int pad2:1;
653         unsigned int avs_filter_type:1;
654     } dw0;
655
656     struct {
657         unsigned int pad0:5;
658         unsigned int sampler_8x8_state_pointer:27;
659     } dw1;
660     
661     struct {
662         unsigned int weak_edge_threshold:4;
663         unsigned int strong_edge_threshold:4;
664         unsigned int global_noise_estimation:8;
665         unsigned int pad0:16;
666     } dw2;
667
668     struct {
669         unsigned int r3x_coefficient:5;
670         unsigned int pad0:1;
671         unsigned int r3c_coefficient:5;
672         unsigned int pad1:3;
673         unsigned int gain_factor:6;
674         unsigned int non_edge_weight:3;
675         unsigned int pad2:1;
676         unsigned int regular_weight:3;
677         unsigned int pad3:1;
678         unsigned int strong_edge_weight:3;
679         unsigned int pad4:1;
680     } dw3;
681
682     struct {
683         unsigned int pad0:2;
684         unsigned int mr_boost:1;
685         unsigned int mr_threshold:4;
686         unsigned int steepness_boost:1;
687         unsigned int steepness_threshold:4;
688         unsigned int pad1:2;
689         unsigned int r5x_coefficient:5;
690         unsigned int pad2:1;
691         unsigned int r5cx_coefficient:5;
692         unsigned int pad3:1;
693         unsigned int r5c_coefficient:5;
694         unsigned int pad4:1;
695     } dw4;
696
697     struct {
698         unsigned int pwl1_point_1:8;
699         unsigned int pwl1_point_2:8;
700         unsigned int pwl1_point_3:8;
701         unsigned int pwl1_point_4:8;
702     } dw5;
703
704     struct {
705         unsigned int pwl1_point_5:8;
706         unsigned int pwl1_point_6:8;
707         unsigned int pwl1_r3_bias_0:8;
708         unsigned int pwl1_r3_bias_1:8;
709     } dw6;
710
711     struct {
712         unsigned int pwl1_r3_bias_2:8;
713         unsigned int pwl1_r3_bias_3:8;
714         unsigned int pwl1_r3_bias_4:8;
715         unsigned int pwl1_r3_bias_5:8;
716     } dw7;
717
718     struct {
719         unsigned int pwl1_r3_bias_6:8;
720         unsigned int pwl1_r5_bias_0:8;
721         unsigned int pwl1_r5_bias_1:8;
722         unsigned int pwl1_r5_bias_2:8;
723     } dw8;
724
725     struct {
726         unsigned int pwl1_r5_bias_3:8;
727         unsigned int pwl1_r5_bias_4:8;
728         unsigned int pwl1_r5_bias_5:8;
729         unsigned int pwl1_r5_bias_6:8;
730     } dw9;
731
732     struct {
733         int pwl1_r3_slope_0:8;
734         int pwl1_r3_slope_1:8;
735         int pwl1_r3_slope_2:8;
736         int pwl1_r3_slope_3:8;
737     } dw10;
738
739     struct {
740         int pwl1_r3_slope_4:8;
741         int pwl1_r3_slope_5:8;
742         int pwl1_r3_slope_6:8;
743         int pwl1_r5_slope_0:8;
744     } dw11;
745
746     struct {
747         int pwl1_r5_slope_1:8;
748         int pwl1_r5_slope_2:8;
749         int pwl1_r5_slope_3:8;
750         int pwl1_r5_slope_4:8;
751     } dw12;
752
753     struct {
754         int pwl1_r5_slope_5:8;
755         int pwl1_r5_slope_6:8;
756         unsigned int limiter_boost:4;
757         unsigned int pad0:4;
758         unsigned int minimum_limiter:4;
759         unsigned int maximum_limiter:4;
760     } dw13;
761
762     struct {
763         unsigned int pad0:8;
764         unsigned int clip_limiter:10;
765         unsigned int pad1:14;
766     } dw14;
767
768     unsigned int dw15; /* Just a pad */
769 };
770
771 struct i965_sampler_8x8_coefficient
772 {
773     struct {
774         int table_0x_filter_c0:8;
775         int table_0x_filter_c1:8;
776         int table_0x_filter_c2:8;
777         int table_0x_filter_c3:8;
778     } dw0;
779
780     struct {
781         int table_0x_filter_c4:8;
782         int table_0x_filter_c5:8;
783         int table_0x_filter_c6:8;
784         int table_0x_filter_c7:8;
785     } dw1;
786
787     struct {
788         int table_0y_filter_c0:8;
789         int table_0y_filter_c1:8;
790         int table_0y_filter_c2:8;
791         int table_0y_filter_c3:8;
792     } dw2;
793
794     struct {
795         int table_0y_filter_c4:8;
796         int table_0y_filter_c5:8;
797         int table_0y_filter_c6:8;
798         int table_0y_filter_c7:8;
799     } dw3;
800
801     struct {
802         int table_1x_filter_c0:8;
803         int table_1x_filter_c1:8;
804         int table_1x_filter_c2:8;
805         int table_1x_filter_c3:8;
806     } dw4;
807
808     struct {
809         int table_1x_filter_c4:8;
810         int table_1x_filter_c5:8;
811         int table_1x_filter_c6:8;
812         int table_1x_filter_c7:8;
813     } dw5;
814
815     struct {
816         int table_1y_filter_c0:8;
817         int table_1y_filter_c1:8;
818         int table_1y_filter_c2:8;
819         int table_1y_filter_c3:8;
820     } dw6;
821
822     struct {
823         int table_1y_filter_c4:8;
824         int table_1y_filter_c5:8;
825         int table_1y_filter_c6:8;
826         int table_1y_filter_c7:8;
827     } dw7;
828 };
829
830 struct i965_sampler_8x8_state
831 {
832     struct i965_sampler_8x8_coefficient coefficients[17];
833
834     struct {
835         unsigned int transition_area_with_8_pixels:3;
836         unsigned int pad0:1;
837         unsigned int transition_area_with_4_pixels:3;
838         unsigned int pad1:1;
839         unsigned int max_derivative_8_pixels:8;
840         unsigned int max_derivative_4_pixels:8;
841         unsigned int default_sharpness_level:8;
842     } dw136;
843
844     struct {
845         unsigned int bit_field_name:1;
846         unsigned int adaptive_filter_for_all_channel:1;
847         unsigned int pad0:19;
848         unsigned int bypass_y_adaptive_filtering:1;
849         unsigned int bypass_x_adaptive_filtering:1;
850         unsigned int pad1:9;
851     } dw137;
852 };
853
854 struct i965_surface_state2
855 {
856     struct {
857         unsigned int surface_base_address;
858     } ss0;
859
860     struct {
861         unsigned int cbcr_pixel_offset_v_direction:2;
862         unsigned int pad0:4;
863         unsigned int width:13;
864         unsigned int height:13;
865     } ss1;
866
867     struct {
868         unsigned int tile_walk:1;
869         unsigned int tiled_surface:1;
870         unsigned int half_pitch_for_chroma:1;
871         unsigned int pitch:17;
872         unsigned int pad0:2;
873         unsigned int surface_object_control_data:4;
874         unsigned int pad1:1;
875         unsigned int interleave_chroma:1;
876         unsigned int surface_format:4;
877     } ss2;
878
879     struct {
880         unsigned int y_offset_for_cb:13;
881         unsigned int pad0:3;
882         unsigned int x_offset_for_cb:13;
883         unsigned int pad1:3;
884     } ss3;
885
886     struct {
887         unsigned int y_offset_for_cr:13;
888         unsigned int pad0:3;
889         unsigned int x_offset_for_cr:13;
890         unsigned int pad1:3;
891     } ss4;
892 };
893
894 struct i965_sampler_dndi
895 {
896     struct {
897         unsigned int denoise_asd_threshold:8;
898         unsigned int denoise_history_delta:8;
899         unsigned int denoise_maximum_history:8;
900         unsigned int denoise_stad_threshold:8;
901     } dw0;
902
903     struct {
904         unsigned int denoise_threshold_for_sum_of_complexity_measure:8;
905         unsigned int denoise_moving_pixel_threshold:5;
906         unsigned int stmm_c2:3;
907         unsigned int low_temporal_difference_threshold:6;
908         unsigned int pad0:2;
909         unsigned int temporal_difference_threshold:6;
910         unsigned int pad1:2;
911     } dw1;
912
913     struct {
914         unsigned int block_noise_estimate_noise_threshold:8;
915         unsigned int block_noise_estimate_edge_threshold:8; 
916         unsigned int denoise_edge_threshold:8;
917         unsigned int good_neighbor_threshold:8;
918    } dw2;
919
920     struct {
921         unsigned int maximum_stmm:8;
922         unsigned int multipler_for_vecm:6;
923         unsigned int pad0:2;
924         unsigned int blending_constant_across_time_for_small_values_of_stmm:8;
925         unsigned int blending_constant_across_time_for_large_values_of_stmm:7;
926         unsigned int stmm_blending_constant_select:1;
927     } dw3;
928
929     struct {
930         unsigned int sdi_delta:8;
931         unsigned int sdi_threshold:8;
932         unsigned int stmm_output_shift:4;
933         unsigned int stmm_shift_up:2;
934         unsigned int stmm_shift_down:2;
935         unsigned int minimum_stmm:8;
936     } dw4;
937
938     struct {
939         unsigned int fmd_temporal_difference_threshold:8;
940         unsigned int sdi_fallback_mode_2_constant:8;
941         unsigned int sdi_fallback_mode_1_t2_constant:8;
942         unsigned int sdi_fallback_mode_1_t1_constant:8;
943     } dw5;
944
945     struct {
946         unsigned int dn_enable:1;
947         unsigned int di_enable:1;
948         unsigned int di_partial:1;
949         unsigned int dndi_top_first:1;
950         unsigned int dndi_stream_id:1;
951         unsigned int dndi_first_frame:1;
952         unsigned int progressive_dn:1;
953         unsigned int pad0:1;
954         unsigned int fmd_tear_threshold:6;
955         unsigned int pad1:2;
956         unsigned int fmd2_vertical_difference_threshold:8;
957         unsigned int fmd1_vertical_difference_threshold:8;
958     } dw6;
959
960     struct {
961         unsigned int pad0:8;
962         unsigned int fmd_for_1st_field_of_current_frame:2;
963         unsigned int pad1:6;
964         unsigned int fmd_for_2nd_field_of_previous_frame:2;
965         unsigned int vdi_walker_enable:1;
966         unsigned int pad2:4;
967         unsigned int column_width_minus1:9;
968     } dw7;
969 };
970
971 struct gen8_interface_descriptor_data
972 {
973     struct {
974         unsigned int pad0:6;
975         unsigned int kernel_start_pointer:26;
976     } desc0;
977     
978     struct {
979         unsigned int kernel_start_pointer_high:16;
980         unsigned int pad0:16;
981     } desc1;
982
983     struct {
984         unsigned int pad0:7;
985         unsigned int software_exception_enable:1;
986         unsigned int pad1:3;
987         unsigned int maskstack_exception_enable:1;
988         unsigned int pad2:1;
989         unsigned int illegal_opcode_exception_enable:1;
990         unsigned int pad3:2;
991         unsigned int floating_point_mode:1;
992         unsigned int thread_priority:1;
993         unsigned int single_program_flow:1;
994         unsigned int denorm_mode:1;
995         unsigned int pad4:12;
996     } desc2;
997
998     struct {
999         unsigned int pad0:2;
1000         unsigned int sampler_count:3;
1001         unsigned int sampler_state_pointer:27;
1002     } desc3;
1003
1004     struct {
1005         unsigned int binding_table_entry_count:5;
1006         unsigned int binding_table_pointer:11;
1007         unsigned int pad0: 16;
1008     } desc4;
1009
1010     struct {
1011         unsigned int constant_urb_entry_read_offset:16;
1012         unsigned int constant_urb_entry_read_length:16;
1013     } desc5;
1014
1015     struct {
1016         unsigned int num_threads_in_tg:10;
1017         unsigned int pad0:5;
1018         unsigned int global_barrier_enable:1;
1019         unsigned int shared_local_memory_size:5;
1020         unsigned int barrier_enable:1;
1021         unsigned int rounding_mode:2;
1022         unsigned int pad1:8;
1023     } desc6;
1024
1025     struct {
1026         unsigned int cross_thread_constant_data_read_length:8;
1027         unsigned int pad0:24;
1028     } desc7;
1029 };
1030  
1031 struct gen8_surface_state
1032 {
1033     struct {
1034         unsigned int cube_pos_z:1;
1035         unsigned int cube_neg_z:1;
1036         unsigned int cube_pos_y:1;
1037         unsigned int cube_neg_y:1;
1038         unsigned int cube_pos_x:1;
1039         unsigned int cube_neg_x:1;
1040         unsigned int media_boundary_pixel_mode:2;
1041         unsigned int render_cache_read_write:1;
1042         unsigned int sampler_l2bypass_disable:1;
1043         unsigned int vert_line_stride_ofs:1;
1044         unsigned int vert_line_stride:1;
1045         unsigned int tile_walk:1;
1046         unsigned int tiled_surface:1;
1047         unsigned int horizontal_alignment:2;
1048         /* Field 16 */
1049         unsigned int vertical_alignment:2;
1050         unsigned int surface_format:9;     /**< BRW_SURFACEFORMAT_x */
1051         unsigned int pad0:1;
1052         unsigned int is_array:1;
1053         unsigned int surface_type:3;       /**< BRW_SURFACE_1D/2D/3D/CUBE */
1054     } ss0;
1055
1056     struct {
1057         unsigned int surface_qpitch:15;
1058         unsigned int pad0:4;
1059         unsigned int base_mip_level:5;
1060         unsigned int surface_mocs:7;
1061         unsigned int pad1:1;
1062     } ss1;
1063
1064     struct {
1065         unsigned int width:14;
1066         unsigned int pad0:2;
1067         unsigned int height:14;
1068         unsigned int pad1:2;
1069     } ss2;
1070
1071     struct {
1072         unsigned int pitch:18;
1073         unsigned int pad:3;
1074         unsigned int depth:11;
1075     } ss3;
1076
1077     struct {
1078         unsigned int multisample_position_palette_index:3;
1079         unsigned int num_multisamples:3;
1080         unsigned int multisampled_surface_storage_format:1;
1081         unsigned int render_target_view_extent:11;
1082         unsigned int min_array_elt:11;
1083         unsigned int rotation:2;
1084         unsigned int force_ncmp_reduce_type:1;
1085     } ss4;
1086
1087     struct {
1088         unsigned int mip_count:4;
1089         unsigned int min_lod:4;
1090         unsigned int pad0:4;
1091         unsigned int pad1:2;
1092         unsigned int coherence_type:1;
1093         unsigned int pad2:3;
1094         unsigned int pad3:2;
1095         unsigned int ewa_disable_cube:1;
1096         unsigned int y_offset:3;
1097         unsigned int pad4:1;
1098         unsigned int x_offset:7;
1099     } ss5;
1100
1101     struct {
1102         unsigned int y_offset_uv_plane:14;
1103         unsigned int pad0:2;
1104         unsigned int x_offset_uv_plane:14;
1105         unsigned int pad1:1;
1106         unsigned int separate_uv_plane:1;
1107     } ss6;
1108
1109     struct {
1110         unsigned int resource_min_lod:12;
1111         unsigned int pad0:4;
1112         unsigned int shader_chanel_select_a:3;
1113         unsigned int shader_chanel_select_b:3;
1114         unsigned int shader_chanel_select_g:3;
1115         unsigned int shader_chanel_select_r:3;
1116         unsigned int alpha_clear_color:1;
1117         unsigned int blue_clear_color:1;
1118         unsigned int green_clear_color:1;
1119         unsigned int red_clear_color:1;
1120     } ss7;
1121     struct {
1122         unsigned int base_addr;
1123     } ss8;
1124
1125     struct {
1126         unsigned int base_addr_high:16;
1127         unsigned int pad0:16;
1128     } ss9;
1129
1130     struct {
1131         unsigned int pad0:12;
1132         unsigned int aux_base_addr:20;
1133     } ss10;
1134  
1135     union {
1136         struct {
1137                 unsigned int y_offset_v_plane:14;
1138                 unsigned int pad0:2;
1139                 unsigned int x_offset_v_plane:14;
1140                 unsigned int pad1:2;
1141         } planar;
1142         struct {
1143                 unsigned int aux_base_addr_high:16;
1144                 unsigned int pad2:16;
1145         } aux_buffer;
1146     } ss11; 
1147
1148     struct {
1149         unsigned int hier_depth_clear;
1150     } ss12;
1151
1152     struct {
1153         unsigned int pad0;
1154     } ss13;
1155
1156     struct {
1157         unsigned int pad0;
1158     } ss14;
1159
1160     struct {
1161         unsigned int pad0;
1162     } ss15;  
1163 };
1164
1165 struct gen8_surface_state2
1166 {
1167     struct {
1168         unsigned int pad0;
1169     } ss0;
1170
1171     struct {
1172         unsigned int cbcr_pixel_offset_v_direction:2;
1173         unsigned int picture_structure:2;
1174         unsigned int width:14;
1175         unsigned int height:14;
1176     } ss1;
1177
1178     struct {
1179         unsigned int tile_walk:1;
1180         unsigned int tiled_surface:1;
1181         unsigned int half_pitch_for_chroma:1;
1182         unsigned int pitch:18;
1183         unsigned int address_ctrl:1; /* clamp or mirror mode */
1184         unsigned int pad0:4;
1185         unsigned int interleave_chroma:1;
1186         unsigned int surface_format:5;
1187     } ss2;
1188
1189     struct {
1190         unsigned int y_offset_for_cb:14;
1191         unsigned int pad0:2;
1192         unsigned int x_offset_for_cb:14;
1193         unsigned int pad1:2;
1194     } ss3;
1195
1196     struct {
1197         unsigned int y_offset_for_cr:15;
1198         unsigned int pad0:1;
1199         unsigned int x_offset_for_cr:14;
1200         unsigned int pad1:2;
1201     } ss4;
1202
1203     struct {
1204         unsigned int surface_object_mocs:7;
1205         unsigned int pad0:11;
1206         unsigned int pad1:2;
1207         unsigned int pad2:10;
1208         unsigned int vert_line_stride_offset:1;
1209         unsigned int vert_line_stride:1;
1210     } ss5;
1211
1212     struct {
1213         unsigned int base_addr;
1214     } ss6;
1215
1216     struct {
1217         unsigned int base_addr_high:16;
1218         unsigned int pad0:16;
1219     } ss7;
1220 };
1221
1222 struct gen8_sampler_state
1223 {
1224    struct
1225    {
1226       unsigned int aniso_algorithm:1;
1227       unsigned int lod_bias:13;
1228       unsigned int min_filter:3;
1229       unsigned int mag_filter:3;
1230       unsigned int mip_filter:2;
1231       unsigned int base_level:5;
1232       unsigned int lod_preclamp:2;
1233       unsigned int default_color_mode:1;
1234       unsigned int pad0:1;
1235       unsigned int disable:1;
1236    } ss0;
1237
1238    struct
1239    {
1240       unsigned int cube_control_mode:1;
1241       unsigned int shadow_function:3;
1242       unsigned int chroma_key_mode:1;
1243       unsigned int chroma_key_index:2;
1244       unsigned int chroma_key_enable:1;
1245       unsigned int max_lod:12;
1246       unsigned int min_lod:12;
1247    } ss1;
1248
1249    struct
1250    {
1251         unsigned int lod_clamp_mag_mode:1; /* MIPNONE or MIPFILTER */
1252         unsigned int flex_filter_vert_align:1;
1253         unsigned int flex_filter_hort_align:1;
1254         unsigned int flex_filter_coff_size:1; /* coff8 or coff 16 */
1255         unsigned int flex_filter_mode:1;
1256         unsigned int pad0:1;
1257         unsigned int indirect_state_pointer:18; /* point to the SAMPLE_INDIRECT_STATE */
1258         union {
1259                 unsigned char nonsep_filter_footer_highmask;
1260                 struct {
1261                         unsigned char pad1:2;
1262                         unsigned char sep_filter_height:2;
1263                         unsigned char sep_filter_width:2;
1264                         unsigned char sep_filter_coff_size:2;
1265                 } sep_filter;           
1266         } ss2_byte3;
1267    } ss2;
1268
1269    struct
1270    {
1271       unsigned int r_wrap_mode:3;
1272       unsigned int t_wrap_mode:3;
1273       unsigned int s_wrap_mode:3;
1274       unsigned int pad0:1;
1275       unsigned int non_normalized_coord:1;
1276       unsigned int trilinear_quality:2;
1277       unsigned int address_round:6;
1278       unsigned int max_aniso:3;
1279         unsigned int pad1:2;
1280         unsigned int nonsep_filter_foot_lowmask:8; 
1281    } ss3;
1282 };
1283
1284 struct gen8_global_blend_state
1285 {
1286     unsigned int pad0:19;
1287     unsigned int ydither_offset:2;
1288     unsigned int xdither_offset:2;
1289     unsigned int color_dither_enable:1;
1290     unsigned int alpha_test_func:3;
1291     unsigned int alpha_test_enable:1;
1292     unsigned int alpha_to_coverage_dither:1;
1293     unsigned int alpha_to_one:1;
1294     unsigned int ia_blend_enable:1;
1295     unsigned int alpha_to_coverage:1;
1296 };
1297
1298 struct gen8_blend_state_rt {
1299     struct {
1300         unsigned int blue_write_dis:1;
1301         unsigned int green_write_dis:1;
1302         unsigned int red_write_dis:1;
1303         unsigned int alpha_write_dis:1;
1304         unsigned int pad0:1;
1305         unsigned int alpha_blend_func:3;
1306         unsigned int ia_dest_blend_factor:5;
1307         unsigned int ia_src_blend_factor:5;
1308         unsigned int color_blend_func:3;
1309         unsigned int dest_blend_factor:5;
1310         unsigned int src_blend_factor:5;
1311         unsigned int colorbuf_blend:1;
1312     } blend0;
1313
1314     struct {
1315         unsigned int post_blend_clamp_enable:1;
1316         unsigned int pre_blend_clamp_enable:1;
1317         unsigned int clamp_range:2;
1318         unsigned int pre_blend_src_clamp:1;
1319         unsigned int pad0:22;
1320         unsigned int logic_op_func:4;
1321         unsigned int logic_op_enable:1;
1322     } blend1;
1323 };
1324
1325 /* TODO: Add the sampler_8x8 for Gen8+. 
1326  * AVS/Convolve is 256DWs.
1327  * MinMaxfilter/Erode/Dilate: 8DWs*/
1328
1329
1330 struct gen6_blend_state
1331 {
1332     struct {
1333         unsigned int dest_blend_factor:5;
1334         unsigned int source_blend_factor:5;
1335         unsigned int pad3:1;
1336         unsigned int blend_func:3;
1337         unsigned int pad2:1;
1338         unsigned int ia_dest_blend_factor:5;
1339         unsigned int ia_source_blend_factor:5;
1340         unsigned int pad1:1;
1341         unsigned int ia_blend_func:3;
1342         unsigned int pad0:1;
1343         unsigned int ia_blend_enable:1;
1344         unsigned int blend_enable:1;
1345     } blend0;
1346
1347     struct {
1348         unsigned int post_blend_clamp_enable:1;
1349         unsigned int pre_blend_clamp_enable:1;
1350         unsigned int clamp_range:2;
1351         unsigned int pad0:4;
1352         unsigned int x_dither_offset:2;
1353         unsigned int y_dither_offset:2;
1354         unsigned int dither_enable:1;
1355         unsigned int alpha_test_func:3;
1356         unsigned int alpha_test_enable:1;
1357         unsigned int pad1:1;
1358         unsigned int logic_op_func:4;
1359         unsigned int logic_op_enable:1;
1360         unsigned int pad2:1;
1361         unsigned int write_disable_b:1;
1362         unsigned int write_disable_g:1;
1363         unsigned int write_disable_r:1;
1364         unsigned int write_disable_a:1;
1365         unsigned int pad3:1;
1366         unsigned int alpha_to_coverage_dither:1;
1367         unsigned int alpha_to_one:1;
1368         unsigned int alpha_to_coverage:1;
1369     } blend1;
1370 };
1371
1372 struct gen6_color_calc_state
1373 {
1374     struct {
1375         unsigned int alpha_test_format:1;
1376         unsigned int pad0:14;
1377         unsigned int round_disable:1;
1378         unsigned int bf_stencil_ref:8;
1379         unsigned int stencil_ref:8;
1380     } cc0;
1381
1382     union {
1383         float alpha_ref_f;
1384         struct {
1385             unsigned int ui:8;
1386             unsigned int pad0:24;
1387         } alpha_ref_fi;
1388     } cc1;
1389
1390     float constant_r;
1391     float constant_g;
1392     float constant_b;
1393     float constant_a;
1394 };
1395
1396 struct gen6_depth_stencil_state
1397 {
1398     struct {
1399         unsigned int pad0:3;
1400         unsigned int bf_stencil_pass_depth_pass_op:3;
1401         unsigned int bf_stencil_pass_depth_fail_op:3;
1402         unsigned int bf_stencil_fail_op:3;
1403         unsigned int bf_stencil_func:3;
1404         unsigned int bf_stencil_enable:1;
1405         unsigned int pad1:2;
1406         unsigned int stencil_write_enable:1;
1407         unsigned int stencil_pass_depth_pass_op:3;
1408         unsigned int stencil_pass_depth_fail_op:3;
1409         unsigned int stencil_fail_op:3;
1410         unsigned int stencil_func:3;
1411         unsigned int stencil_enable:1;
1412     } ds0;
1413
1414     struct {
1415         unsigned int bf_stencil_write_mask:8;
1416         unsigned int bf_stencil_test_mask:8;
1417         unsigned int stencil_write_mask:8;
1418         unsigned int stencil_test_mask:8;
1419     } ds1;
1420
1421     struct {
1422         unsigned int pad0:26;
1423         unsigned int depth_write_enable:1;
1424         unsigned int depth_test_func:3;
1425         unsigned int pad1:1;
1426         unsigned int depth_test_enable:1;
1427     } ds2;
1428 };
1429
1430 struct gen6_interface_descriptor_data
1431 {
1432     struct {
1433         unsigned int pad0:6;
1434         unsigned int kernel_start_pointer:26;
1435     } desc0;
1436     
1437     struct {
1438         unsigned int pad0:7;
1439         unsigned int software_exception_enable:1;
1440         unsigned int pad1:3;
1441         unsigned int maskstack_exception_enable:1;
1442         unsigned int pad2:1;
1443         unsigned int illegal_opcode_exception_enable:1;
1444         unsigned int pad3:2;
1445         unsigned int floating_point_mode:1;
1446         unsigned int thread_priority:1;
1447         unsigned int single_program_flow:1;
1448         unsigned int pad4:13;
1449     } desc1;
1450
1451     struct {
1452         unsigned int pad0:2;
1453         unsigned int sampler_count:3;
1454         unsigned int sampler_state_pointer:27;
1455     } desc2;
1456
1457     struct {
1458         unsigned int binding_table_entry_count:5;
1459         unsigned int binding_table_pointer:27;
1460     } desc3;
1461
1462     struct {
1463         unsigned int constant_urb_entry_read_offset:16;
1464         unsigned int constant_urb_entry_read_length:16;
1465     } desc4;
1466     
1467     union {
1468         struct {
1469             unsigned int num_threads:8;
1470             unsigned int barrier_return_byte:8;
1471             unsigned int shared_local_memory_size:5;
1472             unsigned int barrier_enable:1;
1473             unsigned int rounding_mode:2;
1474             unsigned int barrier_return_grf_offset:8;
1475         } gen7;
1476
1477         struct {
1478             unsigned int barrier_id:4;
1479             unsigned int pad0:28;
1480         } gen6;
1481     } desc5;
1482
1483     struct {
1484         unsigned int cross_thread_constant_data_read_length:8;
1485         unsigned int pad0:24;
1486     } desc6;
1487
1488     struct {
1489         unsigned int pad0;
1490     } desc7;
1491 };
1492
1493 struct gen7_surface_state
1494 {
1495     struct {
1496         unsigned int cube_pos_z:1;
1497         unsigned int cube_neg_z:1;
1498         unsigned int cube_pos_y:1;
1499         unsigned int cube_neg_y:1;
1500         unsigned int cube_pos_x:1;
1501         unsigned int cube_neg_x:1;
1502         unsigned int pad2:2;
1503         unsigned int render_cache_read_write:1;
1504         unsigned int pad1:1;
1505         unsigned int surface_array_spacing:1;
1506         unsigned int vert_line_stride_ofs:1;
1507         unsigned int vert_line_stride:1;
1508         unsigned int tile_walk:1;
1509         unsigned int tiled_surface:1;
1510         unsigned int horizontal_alignment:1;
1511         unsigned int vertical_alignment:2;
1512         unsigned int surface_format:9;     /**< BRW_SURFACEFORMAT_x */
1513         unsigned int pad0:1;
1514         unsigned int is_array:1;
1515         unsigned int surface_type:3;       /**< BRW_SURFACE_1D/2D/3D/CUBE */
1516     } ss0;
1517
1518     struct {
1519         unsigned int base_addr;
1520     } ss1;
1521
1522     struct {
1523         unsigned int width:14;
1524         unsigned int pad1:2;
1525         unsigned int height:14;
1526         unsigned int pad0:2;
1527     } ss2;
1528
1529     struct {
1530         unsigned int pitch:18;
1531         unsigned int pad:3;
1532         unsigned int depth:11;
1533     } ss3;
1534
1535     struct {
1536         unsigned int multisample_position_palette_index:3;
1537         unsigned int num_multisamples:3;
1538         unsigned int multisampled_surface_storage_format:1;
1539         unsigned int render_target_view_extent:11;
1540         unsigned int min_array_elt:11;
1541         unsigned int rotation:2;
1542         unsigned int pad0:1;
1543     } ss4;
1544
1545     struct {
1546         unsigned int mip_count:4;
1547         unsigned int min_lod:4;
1548         unsigned int pad1:12;
1549         unsigned int y_offset:4;
1550         unsigned int pad0:1;
1551         unsigned int x_offset:7;
1552     } ss5;
1553
1554     struct {
1555         unsigned int pad; /* Multisample Control Surface stuff */
1556     } ss6;
1557
1558     struct {
1559         unsigned int resource_min_lod:12;
1560         unsigned int pad0:4;
1561         unsigned int shader_chanel_select_a:3;
1562         unsigned int shader_chanel_select_b:3;
1563         unsigned int shader_chanel_select_g:3;
1564         unsigned int shader_chanel_select_r:3;
1565         unsigned int alpha_clear_color:1;
1566         unsigned int blue_clear_color:1;
1567         unsigned int green_clear_color:1;
1568         unsigned int red_clear_color:1;
1569     } ss7;
1570 };
1571
1572 struct gen7_sampler_state
1573 {
1574    struct
1575    {
1576       unsigned int aniso_algorithm:1;
1577       unsigned int lod_bias:13;
1578       unsigned int min_filter:3;
1579       unsigned int mag_filter:3;
1580       unsigned int mip_filter:2;
1581       unsigned int base_level:5;
1582       unsigned int pad1:1;
1583       unsigned int lod_preclamp:1;
1584       unsigned int default_color_mode:1;
1585       unsigned int pad0:1;
1586       unsigned int disable:1;
1587    } ss0;
1588
1589    struct
1590    {
1591       unsigned int cube_control_mode:1;
1592       unsigned int shadow_function:3;
1593       unsigned int pad:4;
1594       unsigned int max_lod:12;
1595       unsigned int min_lod:12;
1596    } ss1;
1597
1598    struct
1599    {
1600       unsigned int pad:5;
1601       unsigned int default_color_pointer:27;
1602    } ss2;
1603
1604    struct
1605    {
1606       unsigned int r_wrap_mode:3;
1607       unsigned int t_wrap_mode:3;
1608       unsigned int s_wrap_mode:3;
1609       unsigned int pad:1;
1610       unsigned int non_normalized_coord:1;
1611       unsigned int trilinear_quality:2;
1612       unsigned int address_round:6;
1613       unsigned int max_aniso:3;
1614       unsigned int chroma_key_mode:1;
1615       unsigned int chroma_key_index:2;
1616       unsigned int chroma_key_enable:1;
1617       unsigned int pad0:6;
1618    } ss3;
1619 };
1620
1621 struct gen7_surface_state2
1622 {
1623     struct {
1624         unsigned int surface_base_address;
1625     } ss0;
1626
1627     struct {
1628         unsigned int cbcr_pixel_offset_v_direction:2;
1629         unsigned int picture_structure:2;
1630         unsigned int width:14;
1631         unsigned int height:14;
1632     } ss1;
1633
1634     struct {
1635         unsigned int tile_walk:1;
1636         unsigned int tiled_surface:1;
1637         unsigned int half_pitch_for_chroma:1;
1638         unsigned int pitch:18;
1639         unsigned int pad0:1;
1640         unsigned int surface_object_control_data:4;
1641         unsigned int pad1:1;
1642         unsigned int interleave_chroma:1;
1643         unsigned int surface_format:4;
1644     } ss2;
1645
1646     struct {
1647         unsigned int y_offset_for_cb:15;
1648         unsigned int pad0:1;
1649         unsigned int x_offset_for_cb:14;
1650         unsigned int pad1:2;
1651     } ss3;
1652
1653     struct {
1654         unsigned int y_offset_for_cr:15;
1655         unsigned int pad0:1;
1656         unsigned int x_offset_for_cr:14;
1657         unsigned int pad1:2;
1658     } ss4;
1659
1660     struct {
1661         unsigned int pad0;
1662     } ss5;
1663
1664     struct {
1665         unsigned int pad0;
1666     } ss6;
1667
1668     struct {
1669         unsigned int pad0;
1670     } ss7;
1671 };
1672
1673 struct gen7_sampler_8x8
1674 {
1675     struct {
1676         unsigned int global_noise_estimation:8;
1677         unsigned int pad0:8;
1678         unsigned int chroma_key_index:2;
1679         unsigned int chroma_key_enable:1;
1680         unsigned int pad1:10;
1681         unsigned int ief_bypass:1;
1682         unsigned int pad2:1;
1683         unsigned int disable_8x8_filter:1;
1684     } dw0;
1685
1686     struct {
1687         unsigned int pad0:5;
1688         unsigned int sampler_8x8_state_pointer:27;
1689     } dw1;
1690     
1691     struct {
1692         unsigned int weak_edge_threshold:6;
1693         unsigned int pad0:2;
1694         unsigned int strong_edge_threshold:6;
1695         unsigned int pad1:2;
1696         unsigned int r5x_coefficient:5;
1697         unsigned int r5cx_coefficient:5;
1698         unsigned int r5c_coefficient:5;
1699         unsigned int pad2:1;
1700     } dw2;
1701
1702     struct {
1703         unsigned int r3x_coefficient:5;
1704         unsigned int pad0:1;
1705         unsigned int r3c_coefficient:5;
1706         unsigned int pad1:3;
1707         unsigned int gain_factor:6;
1708         unsigned int non_edge_weight:3;
1709         unsigned int pad2:1;
1710         unsigned int regular_weight:3;
1711         unsigned int pad3:1;
1712         unsigned int strong_edge_weight:3;
1713         unsigned int ief4_smooth_enable:1;
1714     } dw3;
1715 };
1716
1717 /* This can also be used for BDW+ */
1718 struct gen7_sampler_dndi
1719 {
1720     struct {
1721         unsigned int denoise_asd_threshold:8;
1722         unsigned int dnmh_delt:4;
1723         unsigned int vdi_walker_y_stride:2;
1724         unsigned int vdi_walker_frame_sharing_enable:1;
1725         unsigned int pad0:1;
1726         unsigned int denoise_maximum_history:8;
1727         unsigned int denoise_stad_threshold:8;
1728     } dw0;
1729
1730     struct {
1731         unsigned int denoise_threshold_for_sum_of_complexity_measure:8;
1732         unsigned int denoise_moving_pixel_threshold:5;
1733         unsigned int stmm_c2:3;
1734         unsigned int low_temporal_difference_threshold:6;
1735         unsigned int pad0:2;
1736         unsigned int temporal_difference_threshold:6;
1737         unsigned int pad1:2;
1738     } dw1;
1739
1740     struct {
1741         unsigned int block_noise_estimate_noise_threshold:8;
1742         unsigned int bne_edge_th:4;
1743         unsigned int pad0:2;
1744         unsigned int smooth_mv_th:2;
1745         unsigned int sad_tight_th:4;
1746         unsigned int cat_slope_minus1:4;
1747         unsigned int good_neighbor_th:6;
1748         unsigned int pad1:2;
1749    } dw2;
1750
1751     struct {
1752         unsigned int maximum_stmm:8;
1753         unsigned int multipler_for_vecm:6;
1754         unsigned int pad0:2;
1755         unsigned int blending_constant_across_time_for_small_values_of_stmm:8;
1756         unsigned int blending_constant_across_time_for_large_values_of_stmm:7;
1757         unsigned int stmm_blending_constant_select:1;
1758     } dw3;
1759
1760     struct {
1761         unsigned int sdi_delta:8;
1762         unsigned int sdi_threshold:8;
1763         unsigned int stmm_output_shift:4;
1764         unsigned int stmm_shift_up:2;
1765         unsigned int stmm_shift_down:2;
1766         unsigned int minimum_stmm:8;
1767     } dw4;
1768
1769     struct {
1770         unsigned int fmd_temporal_difference_threshold:8;
1771         unsigned int sdi_fallback_mode_2_constant:8;
1772         unsigned int sdi_fallback_mode_1_t2_constant:8;
1773         unsigned int sdi_fallback_mode_1_t1_constant:8;
1774     } dw5;
1775
1776     struct {
1777         unsigned int dn_enable:1;
1778         unsigned int di_enable:1;
1779         unsigned int di_partial:1;
1780         unsigned int dndi_top_first:1;
1781         unsigned int dndi_stream_id:1;
1782         unsigned int dndi_first_frame:1;
1783         unsigned int progressive_dn:1;
1784         unsigned int mcdi_enable:1;
1785         unsigned int fmd_tear_threshold:6;
1786         unsigned int cat_th1:2;
1787         unsigned int fmd2_vertical_difference_threshold:8;
1788         unsigned int fmd1_vertical_difference_threshold:8;
1789     } dw6;
1790
1791     struct {
1792         unsigned int sad_tha:4;
1793         unsigned int sad_thb:4;
1794         unsigned int fmd_for_1st_field_of_current_frame:2;
1795         unsigned int mc_pixel_consistency_th:6;
1796         unsigned int fmd_for_2nd_field_of_previous_frame:2;
1797         unsigned int vdi_walker_enable:1;
1798         unsigned int neighborpixel_th:4;
1799         unsigned int column_width_minus1:9;
1800     } dw7;
1801 };
1802
1803 struct gen8_sampler_8x8_avs {
1804     struct {
1805         unsigned int gain_factor:6;
1806         unsigned int weak_edge_threshold:6;
1807         unsigned int strong_edge_threshold:6;
1808         unsigned int r3x_coefficient:5;
1809         unsigned int r3c_coefficient:5;
1810         unsigned int chroma_key_index:2;
1811         unsigned int chroma_key_enable:1;
1812         unsigned int pad1:1;
1813     } dw0;
1814
1815     struct {
1816         unsigned int pad0;
1817     } dw1;
1818     
1819     struct {
1820         unsigned int global_noise_estimation:8;
1821         unsigned int non_edge_weight:3;
1822         unsigned int regular_weight:3;
1823         unsigned int strong_edge_weight:3;
1824         unsigned int r5x_coefficient:5;
1825         unsigned int r5cx_coefficient:5;
1826         unsigned int r5c_coefficient:5;
1827     } dw2;
1828     
1829     struct {
1830         unsigned int sin_alpha:8; /* S0.7 */
1831         unsigned int cos_alpha:8; /* S0.7 */
1832         unsigned int sat_max:6;
1833         unsigned int hue_max:6;
1834         unsigned int enable_8tap_filter:2;
1835         unsigned int ief4_smooth_enable:1;
1836         unsigned int skin_ief_enable:1;
1837     } dw3;
1838     
1839     struct {
1840         unsigned int s3u:11; /* S2.8 */
1841         unsigned int pad0:1;
1842         unsigned int diamond_margin:3;
1843         unsigned int vy_std_enable:1;
1844         unsigned int umid:8;
1845         unsigned int vmid:8;
1846     } dw4;
1847
1848     struct {
1849         unsigned int diamond_dv:7;
1850         unsigned int diamond_th:6;
1851         unsigned int diamond_alpha:8;
1852         unsigned int hs_margin:3;
1853         unsigned int diamond_du:7;
1854         unsigned int skin_detailfilter:1;
1855     } dw5;
1856
1857     struct {
1858         unsigned int y_point1:8;
1859         unsigned int y_point2:8;
1860         unsigned int y_point3:8;
1861         unsigned int y_point4:8;
1862     } dw6;
1863
1864     struct {
1865         unsigned int inv_margin_vyl:16;
1866         unsigned int pad0:16;
1867     } dw7;
1868
1869     struct {
1870         unsigned int inv_margin_vyu:16;
1871         unsigned int p0l:8;
1872         unsigned int p1l:8;
1873     } dw8;
1874
1875     struct {
1876         unsigned int p2l:8;
1877         unsigned int p3l:8;
1878         unsigned int b0l:8;
1879         unsigned int b1l:8;
1880     } dw9;
1881
1882     struct {
1883         unsigned int b2l:8;
1884         unsigned int b3l:8;
1885         unsigned int s0l:11;
1886         unsigned int y_slope2:5;
1887     } dw10;
1888
1889     struct {
1890         unsigned int s1l:11;
1891         unsigned int s2l:11;
1892         unsigned int pad0:10;
1893     } dw11;
1894
1895     struct {
1896         unsigned int s3l:11;
1897         unsigned int p0u:8;
1898         unsigned int p1u:8;
1899         unsigned int y_slope1:5;
1900     } dw12;
1901
1902     struct {
1903         unsigned int p2u:8;
1904         unsigned int p3u:8;
1905         unsigned int b0u:8;
1906         unsigned int b1u:8;
1907     } dw13;
1908
1909     struct {
1910         unsigned int b2u:8;
1911         unsigned int b3u:8;
1912         unsigned int s0u:11;
1913         unsigned int pad0:5;
1914     } dw14;
1915
1916     struct {
1917         unsigned int s1u:11;
1918         unsigned int s2u:11;
1919         unsigned int pad0:10;
1920     } dw15;
1921
1922     /* DW16-DW151 */
1923     struct i965_sampler_8x8_coefficient coefficients[17];
1924     
1925     struct {
1926         unsigned int transition_area_with_8_pixels:3;
1927         unsigned int pad0:1;
1928         unsigned int transition_area_with_4_pixels:3;
1929         unsigned int pad1:1;
1930         unsigned int max_derivative_8_pixels:8;
1931         unsigned int max_derivative_4_pixels:8;
1932         unsigned int default_sharpness_level:8;
1933     } dw152;
1934   
1935     struct {
1936         unsigned int rgb_adaptive:1;
1937         unsigned int adaptive_filter_for_all_channel:1;
1938         unsigned int pad0:19;
1939         unsigned int bypass_y_adaptive_filtering:1;
1940         unsigned int bypass_x_adaptive_filtering:1;
1941         unsigned int pad1:9;
1942     } dw153;
1943
1944     /* Reserved to 256DW */
1945     unsigned int reserved[102];
1946 };
1947
1948 #define SURFACE_STATE_PADDED_SIZE_0_GEN7        ALIGN(sizeof(struct gen7_surface_state), 32)
1949 #define SURFACE_STATE_PADDED_SIZE_1_GEN7        ALIGN(sizeof(struct gen7_surface_state2), 32)
1950 #define SURFACE_STATE_PADDED_SIZE_GEN7          MAX(SURFACE_STATE_PADDED_SIZE_0_GEN7, SURFACE_STATE_PADDED_SIZE_1_GEN7)
1951
1952 #define SURFACE_STATE_PADDED_SIZE_0_GEN6        ALIGN(sizeof(struct i965_surface_state), 32)
1953 #define SURFACE_STATE_PADDED_SIZE_1_GEN6        ALIGN(sizeof(struct i965_surface_state2), 32)
1954 #define SURFACE_STATE_PADDED_SIZE_GEN6          MAX(SURFACE_STATE_PADDED_SIZE_0_GEN6, SURFACE_STATE_PADDED_SIZE_1_GEN6)
1955
1956 #define SURFACE_STATE_PADDED_SIZE_0_GEN8        ALIGN(sizeof(struct gen8_surface_state), 32)
1957 #define SURFACE_STATE_PADDED_SIZE_1_GEN8        ALIGN(sizeof(struct gen8_surface_state2), 32)
1958 #define SURFACE_STATE_PADDED_SIZE_GEN8          MAX(SURFACE_STATE_PADDED_SIZE_0_GEN8, SURFACE_STATE_PADDED_SIZE_1_GEN8)
1959
1960 #endif /* _I965_STRUCTS_H_ */