aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/emgd/emgd/include/plb/state3d_plb.h
blob: 145a92d23d083793a48a5fbda379e18ff68e1fae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
/* -*- pse-c -*-
 *-----------------------------------------------------------------------------
 * Filename: state3d_plb.h
 * $Revision: 1.3 $
 *-----------------------------------------------------------------------------
 * Copyright © 2002-2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *-----------------------------------------------------------------------------
 * Description:
 *  This file is an inter-module header file for manipulating the 3D
 *  State variables.
 *-----------------------------------------------------------------------------
 */

#ifndef _STATE3D_PLB_H
#define _STATE3D_PLB_H

#include <plb/appcontext.h>

typedef struct _state3d_anti_aliasing_plb {
	union {
		struct {
			unsigned int :6;
			unsigned int line_aa_region_width :2;
			unsigned int line_aa_region_width_mod_en :1;
			unsigned int :5;
			unsigned int line_end_cap_aa_region_width :2;
			unsigned int line_end_cap_aa_region_width_mod_en :1;
			unsigned int :15;
		};
		unsigned int dw0;
	};
	unsigned int updated;

} state3d_anti_aliasing_plb_t;

#define STATE3D_ANTI_ALIASING_UPDATED_PLB	1
#define STATE3D_ANTI_ALIASING_DWORD_COUNT_PLB 	1

typedef struct _state3d_backface_stencil_ops_plb {
	union {
		struct {
			unsigned int double_sided_en :1;
			unsigned int double_sided_en_mod_en :1;
			unsigned int pass_depth_pass_op :3;
			unsigned int pass_depth_fail_op :3;
			unsigned int fail_op :3;
			unsigned int test_function :3;
			unsigned int multiple_mod_en :1;
			unsigned int ref_val :8;
			unsigned int ref_val_mod_en :1;
			unsigned int :8;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_backface_stencil_ops_plb_t;
#define STATE3D_BACKFACE_STENCIL_OPS_UPDATED_PLB	1
#define STATE3D_BACKFACE_STENCIL_OPS_DWORD_COUNT_PLB	1

typedef struct _state3d_backface_stencil_masks_plb {
	union {
		struct {
			unsigned int write_mask :8;
			unsigned int test_mask :8;
			unsigned int write_mask_mod_en :1;
			unsigned int test_mask_mod_en :1;
			unsigned int :14;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_backface_stencil_masks_plb_t;
#define STATE3D_BACKFACE_STENCIL_MASK_UPDATED_PLB	1
#define STATE3D_BACKFACE_STENCIL_MASK_DWORD_COUNT_PLB	1

/* FIXME: Details are ignored in this struct */
typedef struct _state3d_bin_control_plb {
	unsigned int dw0;
	unsigned int dw1;
	unsigned int dw2;
	unsigned int dw3;
	unsigned int dw4;
	unsigned int dw5;
	unsigned int updated;
} state3d_bin_control_plb_t;
#define STATE3D_BIN_CONTROL_UPDATED_PLB		1
#define STATE3D_BIN_CONTROL_DWORD_COUNT_PLB	6

typedef struct _state3d_buffer_info_plb {
	unsigned int dw0;
	union {
		struct {
			unsigned int :2;
			unsigned int buffer_pitch :12;
			unsigned int :7;
			unsigned int tile_walk :1;
			unsigned int tiled_surface :1;
			unsigned int util_fence_regs :1;
			unsigned int buffer_id :4;
			unsigned int aux_buffer_id :1;
			unsigned int :3;
		};
		unsigned int dw1;
	};
	union {
		struct {
			unsigned int :2;
			unsigned int buffer_base_addr :26;
		};
		unsigned int dw2;
	};
	unsigned int updated;
} state3d_buffer_info_plb_t;
#define STATE3D_BUFFER_INFO_UPDATED_PLB		1
#define STATE3D_BUFFER_INFO_DWORD_COUNT_PLB	3
#define STATE3D_BUFFER_INFO_BUFFERID_COLOR_BACK			0x03
#define STATE3D_BUFFER_INFO_BUFFERID_COLOR_AUX			0x04
#define STATE3D_BUFFER_INFO_BUFFERID_COLOR_MC_INTRA_CORR	0x05
#define STATE3D_BUFFER_INFO_BUFFERID_DEPTH			0x07

typedef struct _state3d_chroma_key_plb {
	union {
		struct {
			unsigned int :30;
			unsigned int table_index :2;
		};
		unsigned int dw1;
	};
	union {
		unsigned int lo_val;
		unsigned int dw2;
	};
	union {
		unsigned int hi_val;
		unsigned int dw3;
	};
	unsigned int updated;
} state3d_chroma_key_plb_t;
#define STATE3D_CHROMA_KEY_UPDATED_PLB		1
#define STATE3D_CHROMA_KEY_DWORD_COUNT_PLB	4

typedef struct _state3d_clear_parameters_plb {
	union {
		struct {
        		unsigned int stencil_write_en :1;
        		unsigned int depth_buffer_write_en :1;
        		unsigned int color_buffer_write_en :1;
			unsigned int :13;
			unsigned int clear_primitive_type :1;
			unsigned int :15;
		};
		unsigned int dw1;
        };
	union {
		unsigned int	clear_color_buffer_val;
		unsigned int dw2;
	};
	union {
        	unsigned int	clear_depth_buffer_val;
		unsigned int dw3;
	};
	union {
        	unsigned int	clear_color;
		unsigned int dw4;
	};
	union {
        	unsigned int	clear_depth;
		unsigned int dw5;
	};
	union {
		struct {
        		unsigned int clear_stencil :8;
			unsigned int :24;
		};
		unsigned int dw6;
	};
	unsigned int updated;
} state3d_clear_parameters_plb_t;
#define STATE3D_CLEAR_PARAMETERS_UPDATED_PLB		1
#define STATE3D_CLEAR_PARAMETERS_DWORD_COUNT_PLB	7

typedef struct _state3d_constant_blend_color_plb {
	union {
		unsigned int color;
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_constant_blend_color_plb_t; 
#define STATE3D_CONSTANT_BLEND_COLOR_UPDATED_PLB	1
#define STATE3D_CONSTANT_BLEND_COLOR_DWORD_COUNT_PLB	2

typedef struct _state3d_coord_set_bindings_plb {
	union {
		struct {
			unsigned int internal_tc_set_0_src :3;
			unsigned int internal_tc_set_1_src :3;
			unsigned int internal_tc_set_2_src :3;
			unsigned int internal_tc_set_3_src :3;
			unsigned int internal_tc_set_4_src :3;
			unsigned int internal_tc_set_5_src :3;
			unsigned int internal_tc_set_6_src :3;
			unsigned int internal_tc_set_7_src :3;
			unsigned int :8;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_coord_set_bindings_plb_t;
#define STATE3D_COORD_SET_BINDINGS_UPDATED_PLB		1
#define STATE3D_COORD_SET_BINDINGS_DWORD_COUNT_PLB	1

typedef struct _state3d_default_diffuse_plb {
	union {
		unsigned int color;
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_default_diffuse_plb_t;
#define STATE3D_DEFAULT_DIFFUSE_UPDATED_PLB		1
#define STATE3D_DEFAULT_DIFFUSE_DWORD_COUNT_PLB		2

typedef struct _state3d_default_specular_plb {
	union {
		unsigned int color;
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_default_specular_plb_t;
#define STATE3D_DEFAULT_SPECULAR_UPDATED_PLB		1
#define STATE3D_DEFAULT_SPECULAR_DWORD_COUNT_PLB	2

typedef struct _state3d_default_z_plb {
	union {
		unsigned int depth;
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_default_z_plb_t;
#define STATE3D_DEFAULT_Z_UPDATED_PLB			1
#define STATE3D_DEFAULT_Z_DWORD_COUNT_PLB		2

typedef struct _state3d_depth_offset_scale_plb {
	union {
		unsigned int global_val;
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_depth_offset_scale_plb_t;
#define STATE3D_DEPTH_OFFSET_SCALE_UPDATED_PLB		1
#define STATE3D_DEPTH_OFFSET_SCALE_DWORD_COUNT_PLB	2

typedef struct _state3d_depth_subrectangle_enable_plb {
	union {
		struct {
			unsigned int enable :1;	/* B-spec says this is difeatured, MUST BE DISABLE */
			unsigned int mod_en :1;
			unsigned int :30;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_depth_subrectangle_enable_plb_t;
#define STATE3D_DEPTH_SUBRECTANGLE_ENABLE_UPDATED_PLB		1
#define STATE3D_DEPTH_SUBRECTANGLE_ENABLE_DWORD_COUNT_PLB	1

typedef struct _state3d_dest_buffer_variables_plb {
	union {
		struct {
			unsigned int vert_line_stride_offset :1;
			unsigned int vert_line_stride :1;
			unsigned int depth_buffer_format :2;
			unsigned int :4;
			unsigned int color_buffer_format :4;
			unsigned int write_select_422_channel :3;
			unsigned int :1;
			unsigned int dest_origin_vert_bias :4;
			unsigned int dest_origin_horiz_bias :4;
			unsigned int dither_enhance_dis :1;
			unsigned int linear_gamma_blend_en :1;
			unsigned int dither_pattern_select :2;
			unsigned int lod_preclamp_en :1;
			unsigned int early_depth_test_en :1;
			unsigned int texture_default_color_mode :1;
			unsigned int :1;
		};
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_dest_buffer_variables_plb_t;
#define STATE3D_DEST_BUFFER_VARIABLES_UPDATED_PLB	      1
#define STATE3D_DEST_BUFFER_VARIABLES_DWORD_COUNT_PLB	  2

#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_8BIT          0
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_X1R5G6B5      1
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_R5G6B5        2
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_A8R8G8B8      3
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_YCRCB_SWAPY   4
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_YCRCB_NORMAL  5
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_YCRCB_SWAPUV  6
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_YCRCB_SWAPUVY 7
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_A4R4G4B4      8
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_A1R5G5B5      9
#define STATE3D_DEST_BUFF_COLOR_BUFF_FORMAT_A2R10G10B10   0xA

typedef struct _state3d_drawing_rectangle_plb {
	union {
		struct {
			unsigned int :24;
        		unsigned int y_dither_offset :2;
        		unsigned int x_dither_offset :2;
			unsigned int :2;
        		unsigned int depth_buffer_coord_offset_dis :1;
        		unsigned int fast_scissor_clip_dis :1;
		};
		unsigned int dw1;
	};
	union {
		struct {
        		unsigned int clip_draw_rect_x_min :16;
        		unsigned int clip_draw_rect_y_min :16;
		};
		unsigned int dw2;
	};
	union {
		struct {
        		unsigned int clip_draw_rect_x_max :16;
        		unsigned int clip_draw_rect_y_max :16;
		};
		unsigned int dw3;
	};
	union {
		struct {
        		unsigned int draw_rect_origin_x :16;
        		unsigned int draw_rect_origin_y :16;
		};
		unsigned int dw4;
	};
	unsigned int updated;
} state3d_drawing_rectangle_plb_t;
#define STATE3D_DRAWING_RECTANGLE_UPDATED_PLB		1
#define STATE3D_DRAWING_RECTANGLE_DWORD_COUNT_PLB	5

typedef struct _state3d_filter_coefficients_4x4_plb {
	/* FIXME: This might be an over simplified abstraction
	 * and may subject to change to meet its semantic later */
	unsigned int filter1[32];
	unsigned int filter2[32];
	unsigned int updated;
} state3d_filter_coefficients_4x4_plb_t;
#define STATE3D_FILTER_COEFFICIENT_4X4_UPDATED_PLB	1
#define STATE3D_FILTER_COEFFICIENT_4X4_DWORD_COUNT_PLB	65

typedef struct _state3d_filter_coefficients_6x5_plb {
	union {
		struct {
			unsigned int k1 :16;
			unsigned int k2 :16;
		};
		unsigned int dw1;
	};
	union {
		struct {
			unsigned int k3 :16;
			unsigned int k4 :16;
		};
		unsigned int dw2;
	};
	union {
		struct {
			unsigned int k5 :16;
			unsigned int k6 :16;
		};
		unsigned int dw3;
	};
	unsigned int updated;
} state3d_filter_coefficients_6x5_plb_t;
#define STATE3D_FILTER_COEFFICIENT_6X5_UPDATED_PLB	1
#define STATE3D_FILTER_COEFFICIENT_6X5_DWORD_COUNT_PLB	4

typedef struct _state3d_fog_color_plb {
	union {
		struct {
			unsigned int blue :8;
			unsigned int green :8;
			unsigned int red :8;
			unsigned int :8;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_fog_color_plb_t;
#define STATE3D_FOG_COLOR_UPDATED_PLB		1
#define STATE3D_FOG_COLOR_DWORD_COUNT_PLB	1

typedef struct _state3d_fog_mode_plb {
	union {
		struct {
			unsigned int :4;
			unsigned int linear_fog_c1_const:16;
			unsigned int :3;
			unsigned int fog_density_mod_en: 1;
			unsigned int linear_fog_c1c2_const_mod_en :1;
			unsigned int fog_source :1;
			unsigned int :1;
			unsigned int fog_source_mod_en :1;
			unsigned int fog_func :2;
			unsigned int :1;
			unsigned int fog_func_mod_en :1;
		};
		unsigned int dw1;
	};
	union {
		unsigned int linear_fog_c2_const;
		unsigned int dw2;
	};
	union {
		unsigned int fog_density;
		unsigned int dw3;
	};
	unsigned int updated;
} state3d_fog_mode_plb_t;

#define STATE3D_FOG_MODE_UPDATED_PLB		1
#define STATE3D_FOG_MODE_DWORD_COUNT_PLB	4

typedef struct _state3d_independent_alpha_blend_plb {
	union {
		struct {
			unsigned int dest_factor :4;
			unsigned int :1;
			unsigned int dest_factor_mod_en :1;
			unsigned int src_factor :4;
			unsigned int :1;
			unsigned int src_factor_mod_en :1;
			unsigned int :4;
			unsigned int function :3;
			unsigned int :2;
			unsigned int function_mod_en :1;
			unsigned int enable :1;
			unsigned int enable_mod_en :1;
			unsigned int :8;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_independent_alpha_blend_plb_t;
#define STATE3D_INDEPENDENT_ALPHA_BLEND_UPDATED_PLB	1
#define STATE3D_INDEPENDENT_ALPHA_BLEND_DWORD_COUNT_PLB	1

typedef struct _state3d_load_indirect_plb {
	union {
		struct {
			unsigned int block_num :8;
			unsigned int block_mask :6;
			unsigned int mem_space_select :1;
			unsigned int :17;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int static_buffer_valid :1;
			unsigned int force_static_load :1;
			unsigned int static_buffer_addr :30;
		};
		unsigned int dw_sis0;
	};
	union {
		struct {
			unsigned int static_buffer_length :9;
			unsigned int :23;
		};
		unsigned int dw_sis1;
	};
	union {
		struct {
			unsigned int dynamic_buffer_valid :1;
			unsigned int dynamic_buffer_reset :1;
			unsigned int dynamic_buffer_addr :30;
		};
		unsigned int dw_dis0;
	};
	union {
		struct {
			unsigned int sampler_buffer_valid :1;
			unsigned int force_sampler_load :1;
			unsigned int sampler_buffer_addr :30;
		};
		unsigned int dw_ssb0;
	};
	union {
		struct {
			unsigned int sampler_buffer_length :9;
			unsigned int :23;
		};
		unsigned int dw_ssb1;
	};
	union {
		struct {
			unsigned int map_buffer_valid :1;
			unsigned int force_map_load :1;
			unsigned int map_buffer_addr :30;
		};
		unsigned int dw_msb0;
	};
	union {
		struct {
			unsigned int map_buffer_length :9;
			unsigned int :23;
		};
		unsigned int dw_msb1;
	};
	union {
		struct {
			unsigned int psp_buffer_valid :1;
			unsigned int force_psp_load :1;
			unsigned int psp_buffer_addr :30;
		};
		unsigned int dw_psp0;
	};
	union {
		struct {
			unsigned int psp_buffer_length :9;
			unsigned int :23;
		};
		unsigned int dw_psp1;
	};
	union {
		struct {
			unsigned int psc_buffer_valid :1;
			unsigned int force_psc_load :1;
			unsigned int psc_buffer_addr :30;
		};
		unsigned int dw_psc0;
	};
	union {
		struct {
			unsigned int psc_buffer_length :9;
			unsigned int :23;
		};
		unsigned int dw_psc1;
	};
	unsigned int updated;
} state3d_load_indirect_plb_t;
#define STATE3D_LOAD_INDIRECT_UPDATED_PLB		1
#define STATE3D_LOAD_INDIRECT_DWORD_COUNT_PLB		12
#define STATE3D_LOAD_INDIRECT_HEADER_DWORD_COUNT_PLB	1
#define STATE3D_LOAD_INDIRECT_PSP_DWORD_COUNT_PLB	2

typedef struct _state3d_load_state_immediate_1_plb {
	union {
		struct {
			unsigned int state_num :4;
			unsigned int load_dw_s0 :1;
			unsigned int load_dw_s1 :1;
			unsigned int load_dw_s2 :1;
			unsigned int load_dw_s3 :1;
			unsigned int load_dw_s4 :1;
			unsigned int load_dw_s5 :1;
			unsigned int load_dw_s6 :1;
			unsigned int load_dw_s7 :1;
			unsigned int :20;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int vtx_cache_invalid_dis :1;
			unsigned int :1;
			unsigned int vtx_buf_addr :26;
			unsigned int :4;
		};
		unsigned int dw_s0;
	};
	union {
		struct {
			unsigned int :16;
			unsigned int vtx_buf_pitch :6;
			unsigned int :2;
			unsigned int vtx_buf_width :6;
			unsigned int :2;
		};
		unsigned int dw_s1;
	};
	union {
		/*
		struct {
			unsigned int :4;
		} tex_coord_set_fmt[8];
		*/
		struct {
			unsigned int tex_coord_set_0_fmt :4;
			unsigned int tex_coord_set_1_fmt :4;
			unsigned int tex_coord_set_2_fmt :4;
			unsigned int tex_coord_set_3_fmt :4;
			unsigned int tex_coord_set_4_fmt :4;
			unsigned int tex_coord_set_5_fmt :4;
			unsigned int tex_coord_set_6_fmt :4;
			unsigned int tex_coord_set_7_fmt :4;
		}; 
		unsigned int dw_s2;
	};
	union {
		/*
		struct {
			unsigned int pspec_crtn_dis :1;
			unsigned int wrap_short_tcz :1;
			unsigned int wrap_short_tcy :1;
			unsigned int wrap_short_tcx :1;
		} tex_coor_set[8];
		*/
		struct {
			unsigned int tex_coord_set_0_pspec_crtn_dis :1;
			unsigned int tex_coord_set_0_wrap_short_tcz :1;
			unsigned int tex_coord_set_0_wrap_short_tcy :1;
			unsigned int tex_coord_set_0_wrap_short_tcx :1;

			unsigned int tex_coord_set_1_pspec_crtn_dis :1;
			unsigned int tex_coord_set_1_wrap_short_tcz :1;
			unsigned int tex_coord_set_1_wrap_short_tcy :1;
			unsigned int tex_coord_set_1_wrap_short_tcx :1;

			unsigned int tex_coord_set_2_pspec_crtn_dis :1;
			unsigned int tex_coord_set_2_wrap_short_tcz :1;
			unsigned int tex_coord_set_2_wrap_short_tcy :1;
			unsigned int tex_coord_set_2_wrap_short_tcx :1;

			unsigned int tex_coord_set_3_pspec_crtn_dis :1;
			unsigned int tex_coord_set_3_wrap_short_tcz :1;
			unsigned int tex_coord_set_3_wrap_short_tcy :1;
			unsigned int tex_coord_set_3_wrap_short_tcx :1;

			unsigned int tex_coord_set_4_pspec_crtn_dis :1;
			unsigned int tex_coord_set_4_wrap_short_tcz :1;
			unsigned int tex_coord_set_4_wrap_short_tcy :1;
			unsigned int tex_coord_set_4_wrap_short_tcx :1;

			unsigned int tex_coord_set_5_pspec_crtn_dis :1;
			unsigned int tex_coord_set_5_wrap_short_tcz :1;
			unsigned int tex_coord_set_5_wrap_short_tcy :1;
			unsigned int tex_coord_set_5_wrap_short_tcx :1;

			unsigned int tex_coord_set_6_pspec_crtn_dis :1;
			unsigned int tex_coord_set_6_wrap_short_tcz :1;
			unsigned int tex_coord_set_6_wrap_short_tcy :1;
			unsigned int tex_coord_set_6_wrap_short_tcx :1;

			unsigned int tex_coord_set_7_pspec_crtn_dis :1;
			unsigned int tex_coord_set_7_wrap_short_tcz :1;
			unsigned int tex_coord_set_7_wrap_short_tcy :1;
			unsigned int tex_coord_set_7_wrap_short_tcx :1;

		};
		unsigned int dw_s3;
	};
	union {
		struct {
			unsigned int anti_alias_en :1;
			unsigned int sprite_point_en :1;
			unsigned int fog_param_present :1;
			unsigned int local_depth_offset_en :1;
			unsigned int force_specular_diffuse_color :1;
			unsigned int force_default_diffuse_color :1;
			unsigned int position_mask :3;
			unsigned int local_depth_offset_present: 1;
			unsigned int diffuse_color_present :1;
			unsigned int specular_color_fog_factor_present :1;
			unsigned int point_width_present :1;
			unsigned int cull_mode :2;
			unsigned int color_shade_mode :1;
			unsigned int specular_shade_mode :1;
			unsigned int fog_shade_mode :1;
			unsigned int alpha_shade_mode :1;
			unsigned int line_width :4;
			unsigned int point_width :9;
		};
		unsigned int dw_s4;
	};
	union {
		struct {
			unsigned int logic_op_en :1;
			unsigned int color_dither_en :1;
			unsigned int stencil_test_en :1;
			unsigned int stencil_buffer_write_en :1;
			unsigned int stencil_pass_depth_pass_op :3;
			unsigned int stencil_pass_depth_fail_op :3;
			unsigned int stencil_fail_op :3;
			unsigned int stencil_test_func :3;
			unsigned int stencil_ref_val :8;
			unsigned int fog_enable :1;
			unsigned int global_depth_offset_en :1;
			unsigned int last_pixel_en :1;
			unsigned int force_default_point_width :1;
			unsigned int color_buffer_component_write_dis :4;
		};
		unsigned int dw_s5;
	};
	union {
		struct {
			unsigned int triang_list_provoke_vtx_sel :2;
			unsigned int color_buffer_write_en :1;
			unsigned int depth_buffer_write_en :1;
			unsigned int dest_blend_factor :4;
			unsigned int src_blend_factor :4;
			unsigned int color_blend_func :3;
			unsigned int color_buffer_blend_en :1;
			unsigned int depth_test_func :3;
			unsigned int depth_test_en :1;
			unsigned int alpha_ref_val :8;
			unsigned int alpha_test_func :3;
			unsigned int alpha_test_en :1;
		};
		unsigned int dw_s6;
	};
	union {
		unsigned int global_depth_offset_const;
		unsigned int dw_s7;
	};
	unsigned int updated;
} state3d_load_state_immediate_1_plb_t;
/* FIXME: Need to refine to smaller enable flags */
#define STATE3D_LOAD_STATE_IMMEDIATE_1_UPDATED_PLB			1
#define STATE3D_LOAD_STATE_IMMEDIATE_1_HEADER_DWORD_COUNT_PLB		1
#define STATE3D_LOAD_STATE_IMMEDIATE_1_STATES_ALL_DWORD_COUNT_PLB	8
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_ZERO			1
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_ONE			2
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_SRC_ALPHA		5
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_INV_SRC_ALPHA	6
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_DST_ALPHA		7
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_INV_DST_ALPHA	8
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_CONST_ALPHA		0xe
#define STATE3D_LOAD_STATE_IMMEDIATE_1_BLENDFACTOR_INV_CONST_ALPHA	0xf

typedef struct _state3d_map_deinterlacer_parameters_plb {
	union {
		struct {
			unsigned int da_en_y :1;
			unsigned int da_en_uv :1;
			unsigned int :30;
		};
		unsigned int dw1;
	};
	union {
		struct {
			unsigned int edge_threshold_low_y :8;
			unsigned int edge_threshold_high_y :8;
			unsigned int edge_threshold_low_uv :8;
			unsigned int edge_threshold_high_uv :8;
		};
		unsigned int dw2;
	};
	unsigned int updated;
} state3d_map_deinterlacer_parameters_plb_t;
#define STATE3D_MAP_DEINTERLACER_PARAMETERS_UPDATED_PLB		1
#define STATE3D_MAP_DEINTERLACER_PARAMETERS_DWORD_COUNT_PLB	3

typedef struct _state3d_map_palette_load_32_plb {
	union {
		struct {
			unsigned int color_num :4;
			unsigned int :12;
			unsigned int :16;
		};
		unsigned int dw0;
	};
	unsigned int color[16];
	unsigned int updated;
} state3d_map_palette_load_32_plb_t;
#define STATE3D_MAP_PALETTE_LOAD_32_UPDATED_PLB		1
#define STATE3D_MAP_PALETTE_LOAD_32_DWORD_COUNT_PLB	17

typedef	struct _state3d_map_state_texmap_plb {
		union {
			struct {
				unsigned int vert_stride_offset :1;
				unsigned int vert_stride :1;
				unsigned int base_addr :26;
				unsigned int :3;
			};
			unsigned int tm_dw0;
		};
		union {
			struct {
				unsigned int tile_walk :1;
				unsigned int tiled_surface :1;
				unsigned int util_fence_regs :1;
				unsigned int texel_format :4;
				unsigned int surface_format :3;
				unsigned int width :11;
				unsigned int height :11;
			};
			unsigned int tm_dw1;
		};
		union {
			struct {
				unsigned int depth :8;
				unsigned int :1;
				unsigned int max_lod :6;
				unsigned int cube_face_en :6;
				unsigned int dword_pitch :11;
			};
			unsigned int tm_dw2;
		};
} state3d_map_state_texmap_plb_t; 
#define STATE3D_MAP_STATE_MAPSURF_8BIT_PLB		1
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_I8_PLB		0
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_L8_PLB		1
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_A4P4_PLB		2
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_P4A4_PLB		3
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_A8_PLB		4
  #define STATE3D_MAP_STATE_MAPSURF_8BIT_MAPTEXEL_MONO8_PLB		5
#define STATE3D_MAP_STATE_MAPSURF_16BIT_PLB		2
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_R5G6B5_PLB		0
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_A1R5G5B5_PLB		1
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_A4R4G4B4_PLB		2
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_A8L8_PLB		3
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_V8U8_PLB		5
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_L6V5U5_PLB		6
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_I16_PLB		7
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_L16_PLB		8
  #define STATE3D_MAP_STATE_MAPSURF_16BIT_MAPTEXEL_A16_PLB		9
#define STATE3D_MAP_STATE_MAPSURF_32BIT_PLB		3
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A8R8G8B8_PLB		0
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A8B8G8R8_PLB		1
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8R8G8B8_PLB		2
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8B8G8R8_PLB		3
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_Q8W8V8U8_PLB		4
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A8X8V8U8_PLB		5
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_L8X8V8U8_PLB		6
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8L8V8U8_PLB		7
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A2R10G10B10_PLB	8
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A2B10G10R10_PLB	9
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_A2W10V10U10_PLB	0xA
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_G16R16_PLB		0xB
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_V16U16_PLB		0xC
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8I24_PLB		0xD
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8L24_PLB		0xE
  #define STATE3D_MAP_STATE_MAPSURF_32BIT_MAPTEXEL_X8A24_PLB		0xF
  #define STATE3D_MAP_STATE_MAPSURF_422_PLB		5
  #define STATE3D_MAP_STATE_MAPSURF_422_MAPTEXEL_YCRCB_SWAPY_PLB	0
  #define STATE3D_MAP_STATE_MAPSURF_422_MAPTEXEL_YCRCB_NORMAL_PLB	1
  #define STATE3D_MAP_STATE_MAPSURF_422_MAPTEXEL_YCRCB_SWAPUV_PLB	2
  #define STATE3D_MAP_STATE_MAPSURF_422_MAPTEXEL_YCRCB_SWAPUVY_PLB	3
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_PLB	6
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_MAPTEXEL_DX1_PLB		0
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_MAPTEXEL_DX2_3_PLB	1
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_MAPTEXEL_DX4_5_PLB	2
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_MAPTEXEL_FX1_PLB		3
  #define STATE3D_MAP_STATE_MAPSURF_COMPRESSED_MAPTEXEL_DX1_RGB_PLB	4
#define STATE3D_MAP_STATE_MAPSURF_4BIT_INDEXED_PLB	7
  #define STATE3D_MAP_STATE_MAPSURF_4BIT_INDEXED_MAPTEXEL_A8R8G8B8_PLB	7
typedef struct _state3d_map_state_plb {
	union {
		struct {
			unsigned int map_num :6;
			unsigned int :9;
			unsigned int retain :1;
			unsigned int :16;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int map_mask :16;
			unsigned int :16;
		};
		unsigned int dw1;
	};
	state3d_map_state_texmap_plb_t texmap[16]; /* Napa support 16 texture maps, B-spec-1a pg198 */
	unsigned int updated;
} state3d_map_state_plb_t;
/* FIXME: Need to refine to smaller enable flags */
#define STATE3D_MAP_STATE_UPDATED_PLB			1
#define STATE3D_MAP_STATE_MAX_DWORD_COUNT_PLB		50 
#define STATE3D_MAP_STATE_HEADER_DWORD_COUNT_PLB	2
#define STATE3D_MAP_STATE_SINGLE_TM_DWORD_COUNT_PLB	3

typedef struct _state3d_modes_4_plb {
	union {
		struct {
			unsigned int stencil_write_mask :8;
			unsigned int stencil_test_mask :8;
			unsigned int stencil_write_mask_mod_en :1;
			unsigned int stencil_test_mask_mod_en :1;
			unsigned int logic_op_func :4;
			unsigned int :1;
			unsigned int logic_op_func_mod_en :1;
			unsigned int :8;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_modes_4_plb_t;
#define STATE3D_MODES_4_UPDATED_PLB		1
#define STATE3D_MODES_4_DWORD_COUNT_PLB		1

typedef struct _state3d_modes_5_plb {
	union {
		struct {
			unsigned int :16;
			unsigned int pipelined_tex_cache_op :1;
			unsigned int tex_cache_dis :1;
			unsigned int pipelined_render_cache_op :1;
			unsigned int :13;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_modes_5_plb_t;

#define STATE3D_MODES_5_UPDATED_PLB		1
#define STATE3D_MODES_5_DWORD_COUNT_PLB		1

typedef struct _state3d_pixel_shader_const_elem_plb {
	unsigned int const_x;
	unsigned int const_y;
	unsigned int const_z;
	unsigned int const_w;
} state3d_pixel_shader_const_elem_plb_t;

typedef struct _state3d_pixel_shader_constants_plb {
	union {
		struct {
			unsigned int const_num :8;
			unsigned int :24;
		};
		unsigned int dw0;
	};
	union {
		unsigned int reg_mask;
		unsigned int dw1;
	};
	state3d_pixel_shader_const_elem_plb_t elem[32]; 
	unsigned int updated;
} state3d_pixel_shader_constants_plb_t;
#define STATE3D_PIXEL_SHADER_CONSTANTS_UPDATED_PLB		1
#define STATE3D_PIXEL_SHADER_CONSTANTS_HEADER_DWORD_COUNT_PLB	2
#define STATE3D_PIXEL_SHADER_CONSTANTS_SINGLE_ELEM_DWORD_COUNT_PLB	4

typedef struct _state3d_pixel_shader_program_ari_instr_plb {
	union {
		struct {
			unsigned int :2;
			unsigned int src0_reg_num :5;
			unsigned int src0_reg_type :3;
			unsigned int dest_channel_mask :4;
			unsigned int dest_reg_num :4;
			unsigned int :1;
			unsigned int dest_reg_type :3;
			unsigned int dest_saturate :1;
			unsigned int :1;
			unsigned int opcode :5;
			unsigned int :3;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int src1_y_channel_select :3;
			unsigned int src1_y_channel_negate :1;
			unsigned int src1_x_channel_select :3;
			unsigned int src1_x_channel_negate :1;
			unsigned int src1_reg_num :5;
			unsigned int src1_reg_type :3;
			unsigned int src0_w_channel_select :3;
			unsigned int src0_w_channel_negate :1;
			unsigned int src0_z_channel_select :3;
			unsigned int src0_z_channel_negate :1;
			unsigned int src0_y_channel_select :3;
			unsigned int src0_y_channel_negate :1;
			unsigned int src0_x_channel_select :3;
			unsigned int src0_x_channel_negate :1;
		};
		unsigned int dw1;
	};
	union {
		struct {
			unsigned int src2_w_channel_select :3;
			unsigned int src2_w_channel_negate :1;
			unsigned int src2_z_channel_select :3;
			unsigned int src2_z_channel_negate :1;
			unsigned int src2_y_channel_select :3;
			unsigned int src2_y_channel_negate :1;
			unsigned int src2_x_channel_select :3;
			unsigned int src2_x_channel_negate :1;
			unsigned int src2_reg_num :5;
			unsigned int src2_reg_type :3;
			unsigned int src1_w_channel_select :3;
			unsigned int src1_w_channel_negate :1;
			unsigned int src1_z_channel_select :3;
			unsigned int src1_z_channel_negate :1;
		};
		unsigned int dw2;
	};

	void * next_instr;
	unsigned char ps_id;
} state3d_pixel_shader_program_ari_instr_plb_t;

typedef struct _state3d_pixel_shader_program_tex_instr_plb {
	union {
		struct {
			unsigned int samp_reg_num :4;
			unsigned int :10;
			unsigned int dest_reg_num :4;
			unsigned int :1;
			unsigned int dest_reg_type :3;
			unsigned int :2;
			unsigned int opcode :5;
			unsigned int :3;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int :17;
			unsigned int addr_reg_num :4;
			unsigned int :3;
			unsigned int addr_reg_type :3;
			unsigned int :5;
		};
		unsigned int dw1;
	};
	unsigned int dw2;

	void * next_instr;
	unsigned char ps_id;
} state3d_pixel_shader_program_tex_instr_plb_t;

typedef struct _state3d_pixel_shader_program_dcl_instr_plb {
	union {
		struct {
			unsigned int :10;
			unsigned int dcl_channel_mask :4;
			unsigned int dcl_reg_num :4;
			unsigned int :1;
			unsigned int dcl_reg_type :2;
			unsigned int :1;
			unsigned int samp_type :2;
			unsigned int opcode :5;
			unsigned int :3;
		};
		unsigned int dw0;
	};
	unsigned int dw1;
	unsigned int dw2;

	void * next_instr;
	unsigned char ps_id;
} state3d_pixel_shader_program_dcl_instr_plb_t;

typedef struct _state3d_pixel_shader_program_instr_plb {
	unsigned int idw0;	//instruction's first dword
	unsigned int idw1;	//instruction's second dword
	unsigned int idw2;	//instruction's third dword
} state3d_pixel_shader_program_instr_plb_t;

typedef struct _state3d_pixel_shader_program_plb {
	union {
		struct {
			unsigned int instr_num :9;
			unsigned int :6;
			unsigned int retain :1;
			unsigned int :16;
		};
		unsigned int dw0;
	};
	state3d_pixel_shader_program_instr_plb_t instr[123];
	unsigned int updated;
} state3d_pixel_shader_program_plb_t;

/*
#define STATE3D_PIXEL_SHADER_PROGRAM_ARI_INSTR_UPDATED_PLB	1
#define STATE3D_PIXEL_SHADER_PROGRAM_TEX_INSTR_UPDATED_PLB	1
#define STATE3D_PIXEL_SHADER_PROGRAM_DCL_INSTR_UPDATED_PLB	1
*/
#define STATE3D_PIXEL_SHADER_PROGRAM_HEADER_DWORD_COUNT_PLB	1

typedef struct _state3d_rasterization_rules_plb {
	union {
		struct {
			unsigned int :3;
			unsigned int tri_fan_provok_vtx_sel :2;
			unsigned int tri_fan_provok_vtx_sel_mod_en :1;
			unsigned int line_list_provok_vtx_sel :2;
			unsigned int line_list_provok_vtx_sel_mod_en :1;
			unsigned int texkill_3d4d :1;
			unsigned int texkill_3d4d_mod_en :1;
			unsigned int :1;
			unsigned int snake_walk_dis :1;
			unsigned int point_raster_rule :2;
			unsigned int point_raster_rule_mod_en :1;
			unsigned int zero_pixel_tri_filter_dis :1;
			unsigned int zero_pixel_tri_filter_dis_mod_en :1;
			unsigned int tri_2x2_filter_dis :1;
			unsigned int tri_2x2_filter_dis_mod_en :1;
			unsigned int :12;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_rasterization_rules_plb_t;
#define STATE3D_RASTERIZATION_RULES_UPDATED_PLB		1
#define STATE3D_RASTERIZATION_RULES_DWORD_COUNT_PLB	1

typedef struct _state3d_sampler_state_samp_plb {
	union {
		struct {
			unsigned int shadow_func :3;
			unsigned int max_anisotropy :1;
			unsigned int shadow_en :1;
			unsigned int tex_lod_bias :9;
			unsigned int min_mode_filter :3;
			unsigned int mag_mode_filter :3;
			unsigned int mip_mode_filter :2;
			unsigned int base_mip_level :5;
			unsigned int chroma_index :2;
			unsigned int color_space_conv_en :1;
			unsigned int planar_to_packed_en :1;
			unsigned int reverse_gamma_en :1;
		};
		unsigned int ts_dw0;
	};
	union {
		struct {
			unsigned int east_deinterlace_en:1;
			unsigned int map_index:4;
			unsigned int normalized_coord:1;
			unsigned int tcz_addr_ctrl_mode:3;
			unsigned int tcy_addr_ctrl_mode:3;
			unsigned int tcx_addr_ctrl_mode:3;
			unsigned int chroma_en:1;
			unsigned int keyed_tex_filter_mode:1;
			unsigned int kill_pixel_en:1;
			unsigned int :6;
			unsigned int min_lod:8;
		};
		unsigned int ts_dw1;
	};
	union {
		unsigned int default_color;
		unsigned int ts_dw2;
	};
} state3d_sampler_state_samp_plb_t; 

typedef struct _state3d_sampler_state_plb {
	union {
		struct {
			unsigned int samp_num :6;
			unsigned int :26;
		};
		unsigned int dw0;
	};
	union {
		struct {
			unsigned int samp_mask :16;
			unsigned int :16;
		};
		unsigned int dw1;
	};
	state3d_sampler_state_samp_plb_t samp[16]; /* Napa support up to 16 sampler */
	unsigned int updated;
} state3d_sampler_state_plb_t;
/* FIXME: Need to refine smaller enable flags */
#define STATE3D_SAMPLER_STATE_UPDATED_PLB			1
#define STATE3D_SAMPLER_STATE_MAX_DWORD_COUNT_PLB		50
#define STATE3D_SAMPLER_STATE_HEADER_DWORD_COUNT_PLB		2
#define STATE3D_SAMPLER_STATE_SINGLE_TS_DWORD_COUNT_PLB		3

typedef struct _state3d_scissor_enable_plb {
	union {
		struct {
			unsigned int enable :1;
			unsigned int enable_mod_en :1;
			unsigned int :30;
		};
		unsigned int dw0;
	};
	unsigned int updated;
} state3d_scissor_enable_plb_t;
#define STATE3D_SCISSOR_ENABLE_UPDATED_PLB	1
#define STATE3D_SCISSOR_ENABLE_DWORD_COUNT_PLB	1

typedef struct _state3d_scissor_rectangle_plb {
	union {
		struct {
			unsigned int x_min :16;
			unsigned int y_min :16;
		};
		unsigned int dw1;
	};
	union {
		struct {
			unsigned int x_max :16;
			unsigned int y_max :16;
		};
		unsigned int dw2;
	};
	unsigned int updated;

} state3d_scissor_rectangle_plb_t;
#define STATE3D_SCISSOR_RECTANGLE_UPDATED_PLB		1
#define STATE3D_SCISSOR_RECTANGLE_DWORD_COUNT_PLB	3

typedef struct _state3d_span_stipple_plb {
	union {
		struct {
			unsigned int pattern :16;
			unsigned int enable :1;
			unsigned int :15;
		};
		unsigned int dw1;
	};
	unsigned int updated;
} state3d_span_stipple_plb_t;
#define STATE3D_SPAN_STIPPLE_UPDATED_PLB	1
#define STATE3D_SPAN_STIPPLE_DWORD_COUNT_PLB	2

#define COLOR_BUFFER_INDEX	0
#define DEPTH_BUFFER_INDEX	1
#define AUX0_BUFFER_INDEX	2
#define AUX1_BUFFER_INDEX	3
#define INTRA_BUFFER_INDEX	4

#define ZONE_INIT_CLEARPARAM_INDEX  0
#define CLEAR_RECT_CLEARPARAM_INDEX 1

typedef struct _state3d_plb {
	igd_surface_t					color_buffer;
	igd_surface_t					depth_buffer;
	state3d_anti_aliasing_plb_t 			anti_alias;
	state3d_backface_stencil_ops_plb_t 		bface_stencil_ops;
	state3d_backface_stencil_masks_plb_t 		bface_stencil_masks;
	state3d_bin_control_plb_t 			bin_control;
/*
	state3d_buffer_info_plb_t 			dest_buffer_info;	
	state3d_buffer_info_plb_t 			depth_buffer_info;	
*/
	state3d_buffer_info_plb_t			buffer_info[5];
	state3d_chroma_key_plb_t 			chroma_key[4];
	state3d_clear_parameters_plb_t 			clear_param[2]; 
	state3d_constant_blend_color_plb_t 		const_blend_color;
	state3d_coord_set_bindings_plb_t 		coord_set_bind; 
	state3d_default_diffuse_plb_t 			default_diffuse;
	state3d_default_specular_plb_t 			default_specular;
	state3d_default_z_plb_t 			default_z;
	state3d_depth_offset_scale_plb_t 		depth_offset_scale;
	state3d_depth_subrectangle_enable_plb_t 	depth_subrect_en;
	state3d_dest_buffer_variables_plb_t		dest_buf_vars;
	state3d_drawing_rectangle_plb_t			draw_rect;
	state3d_filter_coefficients_4x4_plb_t		filter_coef_4x4;
	state3d_filter_coefficients_6x5_plb_t		filter_coef_6x5;
	state3d_fog_color_plb_t				fog_color;
	state3d_fog_mode_plb_t				fog_mode;
	state3d_independent_alpha_blend_plb_t		indep_alpha_blend;
	state3d_load_indirect_plb_t			load_indirect;
	state3d_load_state_immediate_1_plb_t		lsi1;
	state3d_map_deinterlacer_parameters_plb_t	map_deinterlace_param;
	state3d_map_palette_load_32_plb_t		map_pal_load_32;
	state3d_map_state_plb_t				map_state; 
	state3d_modes_4_plb_t				modes_4;
	state3d_modes_5_plb_t				modes_5;
	state3d_pixel_shader_constants_plb_t		pixel_shader_const;
	state3d_pixel_shader_program_plb_t		pixel_shader_program; 
/*	state3d_pixel_shader_program_dcl_instr_plb_t	pixel_shader_dcl;
	state3d_pixel_shader_program_ari_instr_plb_t	pixel_shader_ari;
	state3d_pixel_shader_program_tex_instr_plb_t	pixel_shader_tex;*/
	state3d_rasterization_rules_plb_t		raster_rules;
	state3d_sampler_state_plb_t			sampler_state;
	state3d_scissor_enable_plb_t			scissor_en;	
	state3d_scissor_rectangle_plb_t			scissor_rect;
	state3d_span_stipple_plb_t			span_stipple;
} state3d_plb_t;

int state3d_update_plb(igd_command_t ** in, state3d_plb_t *state, int load_all);
int state3d_update_size_plb(state3d_plb_t *state);

#define STATE3D_PLB(ac) ((state3d_plb_t*)((appcontext_plb_t*)ac)->state3d)

#endif