103b705cfSriastradh/*
203b705cfSriastradh * Copyright © 2006 Intel Corporation
303b705cfSriastradh *
403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a
503b705cfSriastradh * copy of this software and associated documentation files (the "Software"),
603b705cfSriastradh * to deal in the Software without restriction, including without limitation
703b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the
903b705cfSriastradh * Software is furnished to do so, subject to the following conditions:
1003b705cfSriastradh *
1103b705cfSriastradh * The above copyright notice and this permission notice (including the next
1203b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the
1303b705cfSriastradh * Software.
1403b705cfSriastradh *
1503b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1603b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1703b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1803b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1903b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2003b705cfSriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2103b705cfSriastradh * SOFTWARE.
2203b705cfSriastradh *
2303b705cfSriastradh * Authors:
2403b705cfSriastradh *    Xiang Haihao <haihao.xiang@intel.com>
2503b705cfSriastradh *
2603b705cfSriastradh */
2703b705cfSriastradh
2803b705cfSriastradh#ifndef _I915_STRUCTS_H
2903b705cfSriastradh#define _I915_STRUCTS_H
3003b705cfSriastradh
3103b705cfSriastradh#include <stdint.h>
3203b705cfSriastradh
3303b705cfSriastradh/* BLT */
3403b705cfSriastradh#define CMD_2D          0x02
3503b705cfSriastradh#define OPC_COLOR_BLT                           (0x40)
3603b705cfSriastradh
3703b705cfSriastradhstruct i915_color_blt {
3803b705cfSriastradh	struct {
3903b705cfSriastradh		unsigned length:5;
4003b705cfSriastradh		unsigned pad0:15;
4103b705cfSriastradh		unsigned bpp_mask:2;
4203b705cfSriastradh		unsigned opcode:7;
4303b705cfSriastradh		unsigned type:3;
4403b705cfSriastradh	} dw0;
4503b705cfSriastradh
4603b705cfSriastradh	struct {
4703b705cfSriastradh		unsigned pitch:16;
4803b705cfSriastradh		unsigned rop:8;
4903b705cfSriastradh		unsigned color_depth:2;
5003b705cfSriastradh		unsigned pad0:6;
5103b705cfSriastradh	} dw1;
5203b705cfSriastradh
5303b705cfSriastradh	struct {
5403b705cfSriastradh		unsigned width:16;
5503b705cfSriastradh		unsigned height:16;
5603b705cfSriastradh	} dw2;
5703b705cfSriastradh
5803b705cfSriastradh	struct {
5903b705cfSriastradh		unsigned address;
6003b705cfSriastradh	} dw3;
6103b705cfSriastradh
6203b705cfSriastradh	struct {
6303b705cfSriastradh		unsigned pattern;
6403b705cfSriastradh	} dw4;
6503b705cfSriastradh};
6603b705cfSriastradh
6703b705cfSriastradh/* 3D_INSTRUCTION */
6803b705cfSriastradh#define CMD_3D          0x03
6903b705cfSriastradh#define OPCODE_3D(x)	(CMD_3D << 29 | (x) << 16)
7003b705cfSriastradh
7103b705cfSriastradh#define OPC_3DMPEG_MACROBLOCK_IPICTURE          (0x01 + (0x1e << 5))
7203b705cfSriastradh#define OPC_3DMPEG_SET_ORIGIN                   (0x10 + (0x1e << 5))
7303b705cfSriastradh#define OPC_3DMPEG_MACROBLOCK                   (0x11 + (0x1e << 5))
7403b705cfSriastradh#define OPC_3DMPEG_SLICE                        (0x12 + (0x1e << 5))
7503b705cfSriastradh#define OPC_3DMPEG_QM_PALETTE_LOAD              (0x13 + (0x1e << 5))
7603b705cfSriastradh
7703b705cfSriastradh#define OPC_3DSTATE_SCISSOR_ENABLE              (0x10 + (0x1c << 5))
7803b705cfSriastradh
7903b705cfSriastradh#define OPC_3DSTATE_MAP_STATE                   (0x00 + (0x1d << 8))
8003b705cfSriastradh#define OPC_3DSTATE_SAMPLER_STATE               (0x01 + (0x1d << 8))
8103b705cfSriastradh#define OPC_3DSTATE_LOAD_STATE_IMMEDIATE_1      (0x04 + (0x1d << 8))
8203b705cfSriastradh#define OP_3D_LOAD_STATE_IMMEDIATE_1      	OPCODE_3D(OPC_3DSTATE_LOAD_STATE_IMMEDIATE_1)
8303b705cfSriastradh#define OPC_3DSTATE_PIXEL_SHADER_PROGRAM        (0x05 + (0x1d << 8))
8403b705cfSriastradh#define OPC_3DSTATE_PIXEL_SHADER_CONSTANTS      (0x06 + (0x1d << 8))
8503b705cfSriastradh#define OPC_3DSTATE_LOAD_INDIRECT               (0x07 + (0x1d << 8))
8603b705cfSriastradh#define OP_3D_LOAD_INDIRECT               	OPCODE_3D(OPC_3DSTATE_LOAD_INDIRECT)
8703b705cfSriastradh
8803b705cfSriastradh#define OPC_3DSTATE_MODES_5                     (0x0c)
8903b705cfSriastradh#define OPC_3DSTATE_COORD_SET_BINDINGS          (0x16)
9003b705cfSriastradh#define OPC_3DPRIMITIVE                         (0x1f)
9103b705cfSriastradh
9203b705cfSriastradh#define OPC_3DSTATE_DRAWING_RECTANGLE           (0x80 + (0x1d << 8))
9303b705cfSriastradh#define OPC_3DSTATE_SCISSOR_RECTANGLE           (0x81 + (0x1d << 8))
9403b705cfSriastradh#define OPC_3DSTATE_DEST_BUFFER_VARIABLES       (0x85 + (0x1d << 8))
9503b705cfSriastradh#define OPC_3DSTATE_DEST_BUFFER_VARIABLES_MPEG  (0x87 + (0x1d << 8))
9603b705cfSriastradh#define OPC_3DSTATE_BUFFER_INFO                 (0x8e + (0x1d << 8))
9703b705cfSriastradh
9803b705cfSriastradh/*
9903b705cfSriastradh * 3DMPEG instructions
10003b705cfSriastradh */
10103b705cfSriastradhstruct i915_3dmpeg_macroblock_header {
10203b705cfSriastradh	struct {
10303b705cfSriastradh		unsigned length:19;
10403b705cfSriastradh		unsigned opcode:10;
10503b705cfSriastradh		unsigned type:3;
10603b705cfSriastradh	} dw0;
10703b705cfSriastradh
10803b705cfSriastradh	struct {
10903b705cfSriastradh		unsigned mb_intra:1;
11003b705cfSriastradh		unsigned forward:1;
11103b705cfSriastradh		unsigned backward:1;
11203b705cfSriastradh		unsigned h263_4mv:1;
11303b705cfSriastradh		unsigned pad0:1;
11403b705cfSriastradh		unsigned dct_type:1;
11503b705cfSriastradh		unsigned pad1:2;
11603b705cfSriastradh		unsigned motion_type:2;
11703b705cfSriastradh		unsigned pad2:2;
11803b705cfSriastradh		unsigned vertical_field_select:4;
11903b705cfSriastradh		unsigned coded_block_pattern:6;
12003b705cfSriastradh		unsigned pad3:2;
12103b705cfSriastradh		unsigned skipped_macroblocks:7;
12203b705cfSriastradh		unsigned pad4:1;
12303b705cfSriastradh	} dw1;
12403b705cfSriastradh};
12503b705cfSriastradh
12603b705cfSriastradhstruct i915_3dmpeg_macroblock_0mv {
12703b705cfSriastradh	struct i915_3dmpeg_macroblock_header header;
12803b705cfSriastradh};
12903b705cfSriastradh
13003b705cfSriastradhstruct i915_3dmpeg_macroblock_1fbmv {
13103b705cfSriastradh	struct i915_3dmpeg_macroblock_header header;
13203b705cfSriastradh	unsigned dw2;
13303b705cfSriastradh	unsigned dw3;
13403b705cfSriastradh};
13503b705cfSriastradhstruct i915_3dmpeg_macroblock_2fbmv {
13603b705cfSriastradh	struct i915_3dmpeg_macroblock_header header;
13703b705cfSriastradh	unsigned dw2;
13803b705cfSriastradh	unsigned dw3;
13903b705cfSriastradh	unsigned dw4;
14003b705cfSriastradh	unsigned dw5;
14103b705cfSriastradh};
14203b705cfSriastradh
14303b705cfSriastradhstruct i915_3dmpeg_macroblock_5fmv {
14403b705cfSriastradh	struct i915_3dmpeg_macroblock_header header;
14503b705cfSriastradh	unsigned dw2;
14603b705cfSriastradh	unsigned dw3;
14703b705cfSriastradh	unsigned dw4;
14803b705cfSriastradh	unsigned dw5;
14903b705cfSriastradh	unsigned dw6;
15003b705cfSriastradh};
15103b705cfSriastradh
15203b705cfSriastradhstruct i915_3dmpeg_macroblock_ipicture {
15303b705cfSriastradh	struct {
15403b705cfSriastradh		unsigned pad0:5;
15503b705cfSriastradh		unsigned dct_type:1;
15603b705cfSriastradh		unsigned pad1:13;
15703b705cfSriastradh		unsigned opcode:10;
15803b705cfSriastradh		unsigned type:3;
15903b705cfSriastradh	} dw0;
16003b705cfSriastradh};
16103b705cfSriastradh
16203b705cfSriastradhstruct i915_3dmpeg_set_origin {
16303b705cfSriastradh	struct {
16403b705cfSriastradh		unsigned length:19;
16503b705cfSriastradh		unsigned opcode:10;
16603b705cfSriastradh		unsigned type:3;
16703b705cfSriastradh	} dw0;
16803b705cfSriastradh
16903b705cfSriastradh	struct {
17003b705cfSriastradh		unsigned v_origin:7;
17103b705cfSriastradh		unsigned pad0:1;
17203b705cfSriastradh		unsigned h_origin:7;
17303b705cfSriastradh		unsigned pad1:17;
17403b705cfSriastradh	} dw1;
17503b705cfSriastradh};
17603b705cfSriastradh
17703b705cfSriastradhstruct i915_3dmpeg_slice {
17803b705cfSriastradh	struct {
17903b705cfSriastradh		unsigned length:19;
18003b705cfSriastradh		unsigned opcode:10;
18103b705cfSriastradh		unsigned type:3;
18203b705cfSriastradh	} dw0;
18303b705cfSriastradh
18403b705cfSriastradh	struct {
18503b705cfSriastradh		unsigned fst_mb_bit_off:3;
18603b705cfSriastradh		unsigned pad0:5;
18703b705cfSriastradh		unsigned mb_count:7;
18803b705cfSriastradh		unsigned pad1:1;
18903b705cfSriastradh		unsigned v_position:7;
19003b705cfSriastradh		unsigned pad2:1;
19103b705cfSriastradh		unsigned h_position:7;
19203b705cfSriastradh		unsigned pad3:1;
19303b705cfSriastradh	} dw1;
19403b705cfSriastradh
19503b705cfSriastradh	struct {
19603b705cfSriastradh		unsigned length_minus_one:17;
19703b705cfSriastradh		unsigned pad0:7;
19803b705cfSriastradh		unsigned qt_scale_code:5;
19903b705cfSriastradh		unsigned pad1:3;
20003b705cfSriastradh	} dw2;
20103b705cfSriastradh};
20203b705cfSriastradh
20303b705cfSriastradhstruct i915_3dmpeg_qm_palette_load {
20403b705cfSriastradh	struct {
20503b705cfSriastradh		unsigned length:4;
20603b705cfSriastradh		unsigned pad0:15;
20703b705cfSriastradh		unsigned opcode:10;
20803b705cfSriastradh		unsigned type:3;
20903b705cfSriastradh	} dw0;
21003b705cfSriastradh
21103b705cfSriastradh	unsigned quantmatrix[16];
21203b705cfSriastradh};
21303b705cfSriastradh
21403b705cfSriastradh/*
21503b705cfSriastradh * 3DSTATE instruction
21603b705cfSriastradh */
21703b705cfSriastradh#define BUFFERID_COLOR_BACK     3
21803b705cfSriastradh#define BUFFERID_COLOR_AUX      4
21903b705cfSriastradh#define BUFFERID_MC_INTRA_CORR  5
22003b705cfSriastradh#define BUFFERID_DEPTH          7
22103b705cfSriastradh
22203b705cfSriastradh#define TILEWALK_XMAJOR         0
22303b705cfSriastradh#define TILEWALK_YMAJOR         1
22403b705cfSriastradh
22503b705cfSriastradhstruct i915_3dstate_buffer_info {
22603b705cfSriastradh	struct {
22703b705cfSriastradh		unsigned length:16;
22803b705cfSriastradh		unsigned opcode:13;
22903b705cfSriastradh		unsigned type:3;
23003b705cfSriastradh	} dw0;
23103b705cfSriastradh
23203b705cfSriastradh	struct {
23303b705cfSriastradh		unsigned pad0:2;
23403b705cfSriastradh		unsigned pitch:12;
23503b705cfSriastradh		unsigned pad1:7;
23603b705cfSriastradh		unsigned walk:1;
23703b705cfSriastradh		unsigned tiled_surface:1;
23803b705cfSriastradh		unsigned fence_regs:1;
23903b705cfSriastradh		unsigned buffer_id:4;
24003b705cfSriastradh		unsigned aux_id:1;
24103b705cfSriastradh		unsigned pad2:3;
24203b705cfSriastradh	} dw1;
24303b705cfSriastradh
24403b705cfSriastradh	struct {
24503b705cfSriastradh		unsigned pad0:2;
24603b705cfSriastradh		unsigned base_address:27;
24703b705cfSriastradh		unsigned pad1:3;
24803b705cfSriastradh	} dw2;
24903b705cfSriastradh};
25003b705cfSriastradh
25103b705cfSriastradh#define COLORBUFFER_8BIT         0x00
25203b705cfSriastradh#define COLORBUFFER_X1R5G5B5     0x01
25303b705cfSriastradh#define COLORBUFFER_R5G6B5       0x02
25403b705cfSriastradh#define COLORBUFFER_A8R8G8B8     0x03
25503b705cfSriastradh#define COLORBUFFER_YCRCB_SWAP   0x04
25603b705cfSriastradh#define COLORBUFFER_YCRCB_NORMAL 0x05
25703b705cfSriastradh#define COLORBUFFER_YCRCB_SWAPUV 0x06
25803b705cfSriastradh#define COLORBUFFER_YCRCB_SWAPUVY   0x07
25903b705cfSriastradh#define COLORBUFFER_A4R4G4B4     0x08
26003b705cfSriastradh#define COLORBUFFER_A1R5G5B5     0x09
26103b705cfSriastradh#define COLORBUFFER_A2R10G10B10  0x0a
26203b705cfSriastradh
26303b705cfSriastradhstruct i915_3dstate_dest_buffer_variables {
26403b705cfSriastradh	struct {
26503b705cfSriastradh		unsigned length:16;
26603b705cfSriastradh		unsigned opcode:13;
26703b705cfSriastradh		unsigned type:3;
26803b705cfSriastradh	} dw0;
26903b705cfSriastradh
27003b705cfSriastradh	struct {
27103b705cfSriastradh		unsigned v_ls_offset:1;
27203b705cfSriastradh		unsigned v_ls:1;
27303b705cfSriastradh		unsigned depth_fmt:2;
27403b705cfSriastradh		unsigned pad0:4;
27503b705cfSriastradh		unsigned color_fmt:4;
27603b705cfSriastradh		unsigned yuv422_select:3;
27703b705cfSriastradh		unsigned pad1:1;
27803b705cfSriastradh		unsigned dest_v_bias:4;
27903b705cfSriastradh		unsigned dest_h_bias:4;
28003b705cfSriastradh		unsigned dither_enhancement:1;
28103b705cfSriastradh		unsigned linear_gamma:1;
28203b705cfSriastradh		unsigned dither_pattern:2;
28303b705cfSriastradh		unsigned lod_preclamp:1;
28403b705cfSriastradh		unsigned edt_zone:1;	/* early depth test in zone rendering */
28503b705cfSriastradh		unsigned texture_default_color:1;
28603b705cfSriastradh		unsigned edt_classic:1;	/* early depth test in classic mode */
28703b705cfSriastradh	} dw1;
28803b705cfSriastradh};
28903b705cfSriastradh
29003b705cfSriastradh#define MPEG_DECODE_MC          0
29103b705cfSriastradh#define MPEG_DECODE_VLD_IDCT_MC 1
29203b705cfSriastradh
29303b705cfSriastradh#define MPEG_I_PICTURE          1
29403b705cfSriastradh#define MPEG_P_PICTURE          2
29503b705cfSriastradh#define MPEG_B_PICTURE          3
29603b705cfSriastradh
29703b705cfSriastradh#define MC_SUB_1H               0
29803b705cfSriastradh#define MC_SUB_2H               1
29903b705cfSriastradh#define MC_SUB_4H               2
30003b705cfSriastradh
30103b705cfSriastradh#define MC_SUB_1V               0
30203b705cfSriastradh#define MC_SUB_2V               1
30303b705cfSriastradh
30403b705cfSriastradhstruct i915_3dstate_dest_buffer_variables_mpeg {
30503b705cfSriastradh	struct {
30603b705cfSriastradh		unsigned length:16;
30703b705cfSriastradh		unsigned opcode:13;
30803b705cfSriastradh		unsigned type:3;
30903b705cfSriastradh	} dw0;
31003b705cfSriastradh
31103b705cfSriastradh	struct {
31203b705cfSriastradh		unsigned picture_width:7;
31303b705cfSriastradh		unsigned pad0:1;
31403b705cfSriastradh		unsigned v_subsample_factor:2;
31503b705cfSriastradh		unsigned h_subsample_factor:2;
31603b705cfSriastradh		unsigned tff:1;
31703b705cfSriastradh		unsigned mismatch:1;
31803b705cfSriastradh		unsigned pad1:1;
31903b705cfSriastradh		unsigned intra8:1;
32003b705cfSriastradh		unsigned abort_on_error:8;
32103b705cfSriastradh		unsigned pad2:4;
32203b705cfSriastradh		unsigned bidir_avrg_control:1;
32303b705cfSriastradh		unsigned rcontrol:1;
32403b705cfSriastradh		unsigned decode_mode:2;
32503b705cfSriastradh	} dw1;
32603b705cfSriastradh
32703b705cfSriastradh	struct {
32803b705cfSriastradh		unsigned pad0:1;
32903b705cfSriastradh		unsigned picture_coding_type:2;
33003b705cfSriastradh		unsigned pad1:2;
33103b705cfSriastradh		unsigned scan_order:1;
33203b705cfSriastradh		unsigned pad2:2;
33303b705cfSriastradh		unsigned q_scale_type:1;
33403b705cfSriastradh		unsigned concealment:1;
33503b705cfSriastradh		unsigned fpf_dct:1;
33603b705cfSriastradh		unsigned pad3:2;
33703b705cfSriastradh		unsigned intra_dc:2;
33803b705cfSriastradh		unsigned intra_vlc:1;
33903b705cfSriastradh		unsigned f_code00:4;
34003b705cfSriastradh		unsigned f_code01:4;
34103b705cfSriastradh		unsigned f_code10:4;
34203b705cfSriastradh		unsigned f_code11:4;
34303b705cfSriastradh	} dw2;
34403b705cfSriastradh};
34503b705cfSriastradh
34603b705cfSriastradhstruct i915_mc_static_indirect_state_buffer {
34703b705cfSriastradh	struct i915_3dstate_buffer_info dest_y;
34803b705cfSriastradh	struct i915_3dstate_buffer_info dest_u;
34903b705cfSriastradh	struct i915_3dstate_buffer_info dest_v;
35003b705cfSriastradh	struct i915_3dstate_dest_buffer_variables dest_buf;
35103b705cfSriastradh	struct i915_3dstate_dest_buffer_variables_mpeg dest_buf_mpeg;
35203b705cfSriastradh	struct i915_3dstate_buffer_info corr;
35303b705cfSriastradh};
35403b705cfSriastradh
35503b705cfSriastradh#define MAP_MAP0        0x0001
35603b705cfSriastradh#define MAP_MAP1        0x0002
35703b705cfSriastradh#define MAP_MAP2        0x0004
35803b705cfSriastradh#define MAP_MAP3        0x0008
35903b705cfSriastradh#define MAP_MAP4        0x0010
36003b705cfSriastradh#define MAP_MAP5        0x0020
36103b705cfSriastradh#define MAP_MAP6        0x0040
36203b705cfSriastradh#define MAP_MAP7        0x0080
36303b705cfSriastradh#define MAP_MAP8        0x0100
36403b705cfSriastradh#define MAP_MAP9        0x0200
36503b705cfSriastradh#define MAP_MAP10       0x0400
36603b705cfSriastradh#define MAP_MAP11       0x0800
36703b705cfSriastradh#define MAP_MAP12       0x1000
36803b705cfSriastradh#define MAP_MAP13       0x2000
36903b705cfSriastradh#define MAP_MAP14       0x4000
37003b705cfSriastradh#define MAP_MAP15       0x8000
37103b705cfSriastradh
37203b705cfSriastradhstruct texture_map {
37303b705cfSriastradh	struct {
37403b705cfSriastradh		unsigned v_ls_offset:1;
37503b705cfSriastradh		unsigned v_ls:1;
37603b705cfSriastradh		unsigned base_address:27;
37703b705cfSriastradh		unsigned pad0:2;
37803b705cfSriastradh		unsigned untrusted:1;
37903b705cfSriastradh	} tm0;
38003b705cfSriastradh
38103b705cfSriastradh	struct {
38203b705cfSriastradh		unsigned tile_walk:1;
38303b705cfSriastradh		unsigned tiled_surface:1;
38403b705cfSriastradh		unsigned utilize_fence_regs:1;
38503b705cfSriastradh		unsigned texel_fmt:4;
38603b705cfSriastradh		unsigned surface_fmt:3;
38703b705cfSriastradh		unsigned width:11;
38803b705cfSriastradh		unsigned height:11;
38903b705cfSriastradh	} tm1;
39003b705cfSriastradh
39103b705cfSriastradh	struct {
39203b705cfSriastradh		unsigned depth:8;
39303b705cfSriastradh		unsigned mipmap_layout:1;
39403b705cfSriastradh		unsigned max_lod:6;
39503b705cfSriastradh		unsigned cube_face:6;
39603b705cfSriastradh		unsigned pitch:11;
39703b705cfSriastradh	} tm2;
39803b705cfSriastradh};
39903b705cfSriastradh
40003b705cfSriastradhstruct i915_3dstate_map_state {
40103b705cfSriastradh	struct {
40203b705cfSriastradh		unsigned length:6;
40303b705cfSriastradh		unsigned pad0:9;
40403b705cfSriastradh		unsigned retain:1;
40503b705cfSriastradh		unsigned opcode:13;
40603b705cfSriastradh		unsigned type:3;
40703b705cfSriastradh	} dw0;
40803b705cfSriastradh
40903b705cfSriastradh	struct {
41003b705cfSriastradh		unsigned map_mask:16;
41103b705cfSriastradh		unsigned pad0:16;
41203b705cfSriastradh	} dw1;
41303b705cfSriastradh};
41403b705cfSriastradh
41503b705cfSriastradhstruct i915_mc_map_state {
41603b705cfSriastradh	struct i915_3dstate_map_state y_map;
41703b705cfSriastradh	struct texture_map y_forward;
41803b705cfSriastradh	struct texture_map y_backward;
41903b705cfSriastradh	struct i915_3dstate_map_state u_map;
42003b705cfSriastradh	struct texture_map u_forward;
42103b705cfSriastradh	struct texture_map u_backward;
42203b705cfSriastradh	struct i915_3dstate_map_state v_map;
42303b705cfSriastradh	struct texture_map v_forward;
42403b705cfSriastradh	struct texture_map v_backward;
42503b705cfSriastradh};
42603b705cfSriastradh
42703b705cfSriastradh#define SAMPLER_SAMPLER0        0x0001
42803b705cfSriastradh#define SAMPLER_SAMPLER1        0x0002
42903b705cfSriastradh#define SAMPLER_SAMPLER2        0x0004
43003b705cfSriastradh#define SAMPLER_SAMPLER3        0x0008
43103b705cfSriastradh#define SAMPLER_SAMPLER4        0x0010
43203b705cfSriastradh#define SAMPLER_SAMPLER5        0x0020
43303b705cfSriastradh#define SAMPLER_SAMPLER6        0x0040
43403b705cfSriastradh#define SAMPLER_SAMPLER7        0x0080
43503b705cfSriastradh#define SAMPLER_SAMPLER8        0x0100
43603b705cfSriastradh#define SAMPLER_SAMPLER9        0x0200
43703b705cfSriastradh#define SAMPLER_SAMPLER10       0x0400
43803b705cfSriastradh#define SAMPLER_SAMPLER11       0x0800
43903b705cfSriastradh#define SAMPLER_SAMPLER12       0x1000
44003b705cfSriastradh#define SAMPLER_SAMPLER13       0x2000
44103b705cfSriastradh#define SAMPLER_SAMPLER14       0x4000
44203b705cfSriastradh#define SAMPLER_SAMPLER15       0x8000
44303b705cfSriastradh
44403b705cfSriastradh#define MIPFILTER_NONE          0
44503b705cfSriastradh#define MIPFILTER_NEAREST       1
44603b705cfSriastradh#define MIPFILTER_LINEAR        3
44703b705cfSriastradh
44803b705cfSriastradh#define MAPFILTER_NEAREST       0
44903b705cfSriastradh#define MAPFILTER_LINEAR        1
45003b705cfSriastradh#define MAPFILTER_ANISOTROPIC   2
45103b705cfSriastradh#define MAPFILTER_4X4_1         3
45203b705cfSriastradh#define MAPFILTER_4X4_2         4
45303b705cfSriastradh#define MAPFILTER_4X4_FLAT      5
45403b705cfSriastradh#define MAPFILTER_MONO          6
45503b705cfSriastradh
45603b705cfSriastradh#define ANISORATIO_2            0
45703b705cfSriastradh#define ANISORATIO_4            1
45803b705cfSriastradh
45903b705cfSriastradh#define PREFILTEROP_ALWAYS      0
46003b705cfSriastradh#define PREFILTEROP_NEVER       1
46103b705cfSriastradh#define PREFILTEROP_LESS        2
46203b705cfSriastradh#define PREFILTEROP_EQUAL       3
46303b705cfSriastradh#define PREFILTEROP_LEQUAL      4
46403b705cfSriastradh#define PREFILTEROP_GREATER     5
46503b705cfSriastradh#define PREFILTEROP_NOTEQUAL    6
46603b705cfSriastradh#define PREFILTEROP_GEQUAL      7
46703b705cfSriastradh
46803b705cfSriastradh#define TEXCOORDMODE_WRAP       0
46903b705cfSriastradh#define TEXCOORDMODE_MIRROR     1
47003b705cfSriastradh#define TEXCOORDMODE_CLAMP      2
47103b705cfSriastradh#define TEXCOORDMODE_CUBE       3
47203b705cfSriastradh#define TEXCOORDMODE_CLAMP_BORDER       4
47303b705cfSriastradh#define TEXCOORDMODE_MIRROR_ONCE        5
47403b705cfSriastradh
47503b705cfSriastradhstruct texture_sampler {
47603b705cfSriastradh	struct {
47703b705cfSriastradh		unsigned shadow_function:3;
47803b705cfSriastradh		unsigned max_anisotropy:1;
47903b705cfSriastradh		unsigned shadow_enable:1;
48003b705cfSriastradh		unsigned lod_bias:9;
48103b705cfSriastradh		unsigned min_filter:3;
48203b705cfSriastradh		unsigned mag_filter:3;
48303b705cfSriastradh		unsigned mip_filter:2;
48403b705cfSriastradh		unsigned base_level:5;
48503b705cfSriastradh		unsigned chromakey_index:2;
48603b705cfSriastradh		unsigned color_conversion:1;
48703b705cfSriastradh		unsigned planar2packet:1;
48803b705cfSriastradh		unsigned reverse_gamma:1;
48903b705cfSriastradh	} ts0;
49003b705cfSriastradh
49103b705cfSriastradh	struct {
49203b705cfSriastradh		unsigned east_deinterlacer:1;
49303b705cfSriastradh		unsigned map_index:4;
49403b705cfSriastradh		unsigned normalized_coor:1;
49503b705cfSriastradh		unsigned tcz_control:3;
49603b705cfSriastradh		unsigned tcy_control:3;
49703b705cfSriastradh		unsigned tcx_control:3;
49803b705cfSriastradh		unsigned chromakey_enable:1;
49903b705cfSriastradh		unsigned keyed_texture_filter:1;
50003b705cfSriastradh		unsigned kill_pixel:1;
50103b705cfSriastradh		unsigned pad0:6;
50203b705cfSriastradh		unsigned min_lod:8;
50303b705cfSriastradh	} ts1;
50403b705cfSriastradh
50503b705cfSriastradh	struct {
50603b705cfSriastradh		unsigned default_color;
50703b705cfSriastradh	} ts2;
50803b705cfSriastradh};
50903b705cfSriastradh
51003b705cfSriastradhstruct i915_3dstate_sampler_state {
51103b705cfSriastradh	struct {
51203b705cfSriastradh		unsigned length:6;
51303b705cfSriastradh		unsigned pad0:10;
51403b705cfSriastradh		unsigned opcode:13;
51503b705cfSriastradh		unsigned type:3;
51603b705cfSriastradh	} dw0;
51703b705cfSriastradh
51803b705cfSriastradh	struct {
51903b705cfSriastradh		unsigned sampler_masker:16;
52003b705cfSriastradh		unsigned pad0:16;
52103b705cfSriastradh	} dw1;
52203b705cfSriastradh	/* we always use two samplers for mc */
52303b705cfSriastradh	struct texture_sampler sampler0;
52403b705cfSriastradh	struct texture_sampler sampler1;
52503b705cfSriastradh};
52603b705cfSriastradh
52703b705cfSriastradhstruct arithmetic_inst {
52803b705cfSriastradh	struct {
52903b705cfSriastradh		unsigned pad0:2;
53003b705cfSriastradh		unsigned src0_reg:5;
53103b705cfSriastradh		unsigned src0_reg_t:3;
53203b705cfSriastradh		unsigned dest_channel_mask:4;
53303b705cfSriastradh		unsigned dest_reg:4;
53403b705cfSriastradh		unsigned pad1:1;
53503b705cfSriastradh		unsigned dest_reg_t:3;
53603b705cfSriastradh		unsigned dest_saturate:1;
53703b705cfSriastradh		unsigned pad2:1;
53803b705cfSriastradh		unsigned opcode:5;
53903b705cfSriastradh		unsigned pad3:3;
54003b705cfSriastradh	} dw0;
54103b705cfSriastradh
54203b705cfSriastradh	struct {
54303b705cfSriastradh		unsigned src1_y_select:3;
54403b705cfSriastradh		unsigned src1_y_negate:1;
54503b705cfSriastradh		unsigned src1_x_select:3;
54603b705cfSriastradh		unsigned src1_x_negate:1;
54703b705cfSriastradh		unsigned src1_reg:5;
54803b705cfSriastradh		unsigned src1_reg_t:3;
54903b705cfSriastradh		unsigned src0_w_select:3;
55003b705cfSriastradh		unsigned src0_w_negate:1;
55103b705cfSriastradh		unsigned src0_z_select:3;
55203b705cfSriastradh		unsigned src0_z_negate:1;
55303b705cfSriastradh		unsigned src0_y_select:3;
55403b705cfSriastradh		unsigned src0_y_negate:1;
55503b705cfSriastradh		unsigned src0_x_select:3;
55603b705cfSriastradh		unsigned src0_x_negate:1;
55703b705cfSriastradh	} dw1;
55803b705cfSriastradh
55903b705cfSriastradh	struct {
56003b705cfSriastradh		unsigned src2_w_select:3;
56103b705cfSriastradh		unsigned src2_w_negate:1;
56203b705cfSriastradh		unsigned src2_z_select:3;
56303b705cfSriastradh		unsigned src2_z_negate:1;
56403b705cfSriastradh		unsigned src2_y_select:3;
56503b705cfSriastradh		unsigned src2_y_negate:1;
56603b705cfSriastradh		unsigned src2_x_select:3;
56703b705cfSriastradh		unsigned src2_x_negate:1;
56803b705cfSriastradh		unsigned src2_reg:5;
56903b705cfSriastradh		unsigned src2_reg_t:3;
57003b705cfSriastradh		unsigned src1_w_select:3;
57103b705cfSriastradh		unsigned src1_w_negate:1;
57203b705cfSriastradh		unsigned src1_z_select:3;
57303b705cfSriastradh		unsigned src1_z_negate:1;
57403b705cfSriastradh	} dw2;
57503b705cfSriastradh};
57603b705cfSriastradh
57703b705cfSriastradhstruct texture_inst {
57803b705cfSriastradh	struct {
57903b705cfSriastradh		unsigned sampler_reg:4;
58003b705cfSriastradh		unsigned pad0:10;
58103b705cfSriastradh		unsigned dest_reg:4;
58203b705cfSriastradh		unsigned pad1:1;
58303b705cfSriastradh		unsigned dest_reg_t:3;
58403b705cfSriastradh		unsigned pad2:2;
58503b705cfSriastradh		unsigned opcode:5;
58603b705cfSriastradh		unsigned pad3:3;
58703b705cfSriastradh	} dw0;
58803b705cfSriastradh
58903b705cfSriastradh	struct {
59003b705cfSriastradh		unsigned pad0:16;
59103b705cfSriastradh		unsigned address_reg:5;
59203b705cfSriastradh		unsigned pad1:3;
59303b705cfSriastradh		unsigned address_reg_t:3;
59403b705cfSriastradh		unsigned pad2:5;
59503b705cfSriastradh	} dw1;
59603b705cfSriastradh
59703b705cfSriastradh	struct {
59803b705cfSriastradh		unsigned pad0;
59903b705cfSriastradh	} dw2;
60003b705cfSriastradh};
60103b705cfSriastradh
60203b705cfSriastradhstruct declaration_inst {
60303b705cfSriastradh	struct {
60403b705cfSriastradh		unsigned pad0:10;
60503b705cfSriastradh		unsigned decl_channel_mask:4;
60603b705cfSriastradh		unsigned decl_reg:4;
60703b705cfSriastradh		unsigned pad1:1;
60803b705cfSriastradh		unsigned decl_reg_t:2;
60903b705cfSriastradh		unsigned pad2:1;
61003b705cfSriastradh		unsigned sampler_type:2;
61103b705cfSriastradh		unsigned opcode:5;
61203b705cfSriastradh		unsigned pad3:3;
61303b705cfSriastradh	} dw0;
61403b705cfSriastradh
61503b705cfSriastradh	struct {
61603b705cfSriastradh		unsigned pad0;
61703b705cfSriastradh	} dw1;
61803b705cfSriastradh
61903b705cfSriastradh	struct {
62003b705cfSriastradh		unsigned pad0;
62103b705cfSriastradh	} dw2;
62203b705cfSriastradh};
62303b705cfSriastradh
62403b705cfSriastradhunion shader_inst {
62503b705cfSriastradh	struct arithmetic_inst a;
62603b705cfSriastradh	struct texture_inst t;
62703b705cfSriastradh	struct declaration_inst d;
62803b705cfSriastradh};
62903b705cfSriastradh
63003b705cfSriastradhstruct i915_3dstate_pixel_shader_header {
63103b705cfSriastradh	unsigned length:9;
63203b705cfSriastradh	unsigned pad0:6;
63303b705cfSriastradh	unsigned retain:1;
63403b705cfSriastradh	unsigned opcode:13;
63503b705cfSriastradh	unsigned type:3;
63603b705cfSriastradh};
63703b705cfSriastradh
63803b705cfSriastradhstruct i915_3dstate_pixel_shader_program {
63903b705cfSriastradh	struct i915_3dstate_pixel_shader_header shader0;
64003b705cfSriastradh	/* mov oC, c0.0000 */
64103b705cfSriastradh	uint32_t inst0[3];
64203b705cfSriastradh
64303b705cfSriastradh	struct i915_3dstate_pixel_shader_header shader1;
64403b705cfSriastradh	/* dcl t0.xy */
64503b705cfSriastradh	/* dcl t1.xy */
64603b705cfSriastradh	/* dcl_2D s0 */
64703b705cfSriastradh	/* texld r0, t0, s0 */
64803b705cfSriastradh	/* mov oC, r0 */
64903b705cfSriastradh	uint32_t inst1[3 * 5];
65003b705cfSriastradh
65103b705cfSriastradh	struct i915_3dstate_pixel_shader_header shader2;
65203b705cfSriastradh	/* dcl t2.xy */
65303b705cfSriastradh	/* dcl t3.xy */
65403b705cfSriastradh	/* dcl_2D s1 */
65503b705cfSriastradh	/* texld r0, t2, s1 */
65603b705cfSriastradh	/* mov oC, r0 */
65703b705cfSriastradh	uint32_t inst2[3 * 5];
65803b705cfSriastradh
65903b705cfSriastradh	struct i915_3dstate_pixel_shader_header shader3;
66003b705cfSriastradh	/* dcl t0.xy */
66103b705cfSriastradh	/* dcl t1.xy */
66203b705cfSriastradh	/* dcl t2.xy */
66303b705cfSriastradh	/* dcl t3.xy */
66403b705cfSriastradh	/* dcl_2D s0 */
66503b705cfSriastradh	/* dcl_2D s1 */
66603b705cfSriastradh	/* texld r0, t0, s0 */
66703b705cfSriastradh	/* texld r0, t2, s1 */
66803b705cfSriastradh	/* add r0, r0, r1 */
66903b705cfSriastradh	/* mov oC, r0 */
67003b705cfSriastradh	uint32_t inst3[3 * 10];
67103b705cfSriastradh};
67203b705cfSriastradh
67303b705cfSriastradh#define REG_CR0         0x00000001
67403b705cfSriastradh#define REG_CR1         0x00000002
67503b705cfSriastradh#define REG_CR2         0x00000004
67603b705cfSriastradh#define REG_CR3         0x00000008
67703b705cfSriastradh#define REG_CR4         0x00000010
67803b705cfSriastradh#define REG_CR5         0x00000020
67903b705cfSriastradh#define REG_CR6         0x00000040
68003b705cfSriastradh#define REG_CR7         0x00000080
68103b705cfSriastradh#define REG_CR8         0x00000100
68203b705cfSriastradh#define REG_CR9         0x00000200
68303b705cfSriastradh#define REG_CR10        0x00000400
68403b705cfSriastradh#define REG_CR11        0x00000800
68503b705cfSriastradh#define REG_CR12        0x00001000
68603b705cfSriastradh#define REG_CR13        0x00002000
68703b705cfSriastradh#define REG_CR14        0x00004000
68803b705cfSriastradh#define REG_CR15        0x00008000
68903b705cfSriastradh#define REG_CR16        0x00010000
69003b705cfSriastradh#define REG_CR17        0x00020000
69103b705cfSriastradh#define REG_CR18        0x00040000
69203b705cfSriastradh#define REG_CR19        0x00080000
69303b705cfSriastradh#define REG_CR20        0x00100000
69403b705cfSriastradh#define REG_CR21        0x00200000
69503b705cfSriastradh#define REG_CR22        0x00400000
69603b705cfSriastradh#define REG_CR23        0x00800000
69703b705cfSriastradh#define REG_CR24        0x01000000
69803b705cfSriastradh#define REG_CR25        0x02000000
69903b705cfSriastradh#define REG_CR26        0x04000000
70003b705cfSriastradh#define REG_CR27        0x08000000
70103b705cfSriastradh#define REG_CR28        0x10000000
70203b705cfSriastradh#define REG_CR29        0x20000000
70303b705cfSriastradh#define REG_CR30        0x40000000
70403b705cfSriastradh#define REG_CR31        0x80000000
70503b705cfSriastradh
70603b705cfSriastradhstruct shader_constant {
70703b705cfSriastradh	float x;
70803b705cfSriastradh	float y;
70903b705cfSriastradh	float z;
71003b705cfSriastradh	float w;
71103b705cfSriastradh};
71203b705cfSriastradh
71303b705cfSriastradhstruct i915_3dstate_pixel_shader_constants {
71403b705cfSriastradh	struct {
71503b705cfSriastradh		unsigned length:8;
71603b705cfSriastradh		unsigned pad0:8;
71703b705cfSriastradh		unsigned opcode:13;
71803b705cfSriastradh		unsigned type:3;
71903b705cfSriastradh	} dw0;
72003b705cfSriastradh
72103b705cfSriastradh	struct {
72203b705cfSriastradh		unsigned reg_mask;
72303b705cfSriastradh	} dw1;
72403b705cfSriastradh	/* we only need one constant */
72503b705cfSriastradh	struct shader_constant value;
72603b705cfSriastradh};
72703b705cfSriastradh
72803b705cfSriastradh#define BLOCK_SIS       0x01
72903b705cfSriastradh#define BLOCK_DIS       0x02
73003b705cfSriastradh#define BLOCK_SSB       0x04
73103b705cfSriastradh#define BLOCK_MSB       0x08
73203b705cfSriastradh#define BLOCK_PSP       0x10
73303b705cfSriastradh#define BLOCK_PSC       0x20
73403b705cfSriastradh#define BLOCK_MASK_SHIFT 8
73503b705cfSriastradh
73603b705cfSriastradhtypedef struct _state_ddword {
73703b705cfSriastradh	struct {
73803b705cfSriastradh		unsigned valid:1;
73903b705cfSriastradh		unsigned force:1;
74003b705cfSriastradh		unsigned buffer_address:30;
74103b705cfSriastradh	} dw0;
74203b705cfSriastradh
74303b705cfSriastradh	struct {
74403b705cfSriastradh		unsigned length:9;
74503b705cfSriastradh		unsigned pad0:23;
74603b705cfSriastradh	} dw1;
74703b705cfSriastradh} sis_state, msb_state;
74803b705cfSriastradh#define STATE_VALID	0x1
74903b705cfSriastradh#define STATE_FORCE	0x2
75003b705cfSriastradh
75103b705cfSriastradhstruct i915_3dstate_load_indirect {
75203b705cfSriastradh	struct {
75303b705cfSriastradh		unsigned length:8;
75403b705cfSriastradh		unsigned block_mask:6;
75503b705cfSriastradh		unsigned mem_select:1;
75603b705cfSriastradh		unsigned pad0:1;
75703b705cfSriastradh		unsigned opcode:13;
75803b705cfSriastradh		unsigned type:3;
75903b705cfSriastradh	} dw0;
76003b705cfSriastradh};
76103b705cfSriastradh
76203b705cfSriastradh#define OP_3D_LOAD_INDIRECT_GFX_ADDR (1 << 14)
76303b705cfSriastradh
76403b705cfSriastradh#define TEXCOORDFMT_2FP       0x00
76503b705cfSriastradh#define TEXCOORDFMT_3FP       0x01
76603b705cfSriastradh#define TEXCOORDFMT_4FP       0x02
76703b705cfSriastradh#define TEXCOORDFMT_1FP       0x03
76803b705cfSriastradh#define TEXCOORDFMT_2FP_16    0x04
76903b705cfSriastradh#define TEXCOORDFMT_4FP_16    0x05
77003b705cfSriastradh#define TEXCOORDFMT_NOT_PRESENT  0x0f
77103b705cfSriastradhstruct s2_dword {
77203b705cfSriastradh	unsigned set0_texcoord_fmt:4;
77303b705cfSriastradh	unsigned set1_texcoord_fmt:4;
77403b705cfSriastradh	unsigned set2_texcoord_fmt:4;
77503b705cfSriastradh	unsigned set3_texcoord_fmt:4;
77603b705cfSriastradh	unsigned set4_texcoord_fmt:4;
77703b705cfSriastradh	unsigned set5_texcoord_fmt:4;
77803b705cfSriastradh	unsigned set6_texcoord_fmt:4;
77903b705cfSriastradh	unsigned set7_texcoord_fmt:4;
78003b705cfSriastradh};
78103b705cfSriastradh
78203b705cfSriastradh#define S3_SET0_PCD (1 << 0*4)
78303b705cfSriastradh#define S3_SET1_PCD (1 << 1*4)
78403b705cfSriastradh#define S3_SET2_PCD (1 << 2*4)
78503b705cfSriastradh#define S3_SET3_PCD (1 << 3*4)
78603b705cfSriastradh#define S3_SET4_PCD (1 << 4*4)
78703b705cfSriastradh#define S3_SET5_PCD (1 << 5*4)
78803b705cfSriastradh#define S3_SET6_PCD (1 << 6*4)
78903b705cfSriastradh#define S3_SET7_PCD (1 << 7*4)
79003b705cfSriastradh
79103b705cfSriastradh#define VERTEXHAS_XYZ      1
79203b705cfSriastradh#define VERTEXHAS_XYZW     2
79303b705cfSriastradh#define VERTEXHAS_XY       3
79403b705cfSriastradh#define VERTEXHAS_XYW      4
79503b705cfSriastradh
79603b705cfSriastradh#define CULLMODE_BOTH      0
79703b705cfSriastradh#define CULLMODE_NONE      1
79803b705cfSriastradh#define CULLMODE_CW        2
79903b705cfSriastradh#define CULLMODE_CCW       3
80003b705cfSriastradh
80103b705cfSriastradh#define SHADEMODE_LINEAR   0
80203b705cfSriastradh#define SHADEMODE_FLAT     1
80303b705cfSriastradhstruct s4_dword {
80403b705cfSriastradh	unsigned anti_aliasing_enable:1;
80503b705cfSriastradh	unsigned sprite_point_enable:1;
80603b705cfSriastradh	unsigned fog_parameter_present:1;
80703b705cfSriastradh	unsigned local_depth_offset_enable:1;
80803b705cfSriastradh	unsigned force_specular_diffuse_color:1;
80903b705cfSriastradh	unsigned force_default_diffuse_color:1;
81003b705cfSriastradh	unsigned position_mask:3;
81103b705cfSriastradh	unsigned local_depth_offset_present:1;
81203b705cfSriastradh	unsigned diffuse_color_presetn:1;
81303b705cfSriastradh	unsigned specular_color_fog_factor_present:1;
81403b705cfSriastradh	unsigned point_width_present:1;
81503b705cfSriastradh	unsigned cull_mode:2;
81603b705cfSriastradh	unsigned color_shade_mode:1;
81703b705cfSriastradh	unsigned specular_shade_mode:1;
81803b705cfSriastradh	unsigned fog_shade_mode:1;
81903b705cfSriastradh	unsigned alpha_shade_mode:1;
82003b705cfSriastradh	unsigned line_width:4;
82103b705cfSriastradh	unsigned point_width:9;
82203b705cfSriastradh};
82303b705cfSriastradh
82403b705cfSriastradhstruct s5_dword {
82503b705cfSriastradh	unsigned logic_op_enable:1;
82603b705cfSriastradh	unsigned color_dither_enable:1;
82703b705cfSriastradh	unsigned stencil_test_enable:1;
82803b705cfSriastradh	unsigned stencil_buffer_write_enable:1;
82903b705cfSriastradh	unsigned stencil_pass_depth_pass_op:3;
83003b705cfSriastradh	unsigned stencil_pass_depth_fail_op:3;
83103b705cfSriastradh	unsigned stencil_fail_op:3;
83203b705cfSriastradh	unsigned stencil_test_function:3;
83303b705cfSriastradh	unsigned stencil_reference_value:8;
83403b705cfSriastradh	unsigned fog_enable:1;
83503b705cfSriastradh	unsigned global_depth_offset_enable:1;
83603b705cfSriastradh	unsigned last_pixel_enable:1;
83703b705cfSriastradh	unsigned force_default_point_width:1;
83803b705cfSriastradh	unsigned color_buffer_component_write_disable:4;
83903b705cfSriastradh};
84003b705cfSriastradh
84103b705cfSriastradh#define S6_COLOR_BUFFER_WRITE		(1 << 2)
84203b705cfSriastradh#define S6_DST_BLEND_FACTOR_SHIFT	4
84303b705cfSriastradh#define S6_SRC_BLEND_FACTOR_SHIFT	8
84403b705cfSriastradh#define S6_DEPTH_TEST_ENABLE		(1 << 19)
84503b705cfSriastradh
84603b705cfSriastradhstruct s7_dword {
84703b705cfSriastradh	unsigned global_depth_offset_const;
84803b705cfSriastradh};
84903b705cfSriastradh
85003b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S0 (1 << 4)
85103b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S1 (1 << 5)
85203b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S2 (1 << 6)
85303b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S3 (1 << 7)
85403b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S4 (1 << 8)
85503b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S5 (1 << 9)
85603b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S6 (1 << 10)
85703b705cfSriastradh#define OP_3D_LOAD_STATE_IMM_LOAD_S7 (1 << 11)
85803b705cfSriastradh
85903b705cfSriastradhstruct i915_3dstate_scissor_rectangle {
86003b705cfSriastradh	struct {
86103b705cfSriastradh		unsigned length:16;
86203b705cfSriastradh		unsigned opcode:13;
86303b705cfSriastradh		unsigned type:3;
86403b705cfSriastradh	} dw0;
86503b705cfSriastradh
86603b705cfSriastradh	struct {
86703b705cfSriastradh		unsigned min_x:16;
86803b705cfSriastradh		unsigned min_y:16;
86903b705cfSriastradh	} dw1;
87003b705cfSriastradh
87103b705cfSriastradh	struct {
87203b705cfSriastradh		unsigned max_x:16;
87303b705cfSriastradh		unsigned max_y:16;
87403b705cfSriastradh	} dw2;
87503b705cfSriastradh};
87603b705cfSriastradh
87703b705cfSriastradh#define VERTEX_INLINE         0x00
87803b705cfSriastradh#define VERTEX_INDIRECT       0x01
87903b705cfSriastradh
88003b705cfSriastradh#define PRIM_TRILIST          0x00
88103b705cfSriastradh#define PRIM_TRISTRIP         0x01
88203b705cfSriastradh#define PRIM_TRISTRIP_REVERSE 0x02
88303b705cfSriastradh#define PRIM_TRIFAN           0x03
88403b705cfSriastradh#define PRIM_POLYGON          0x04
88503b705cfSriastradh#define PRIM_LINELIST         0x05
88603b705cfSriastradh#define PRIM_LINESTRIP        0x06
88703b705cfSriastradh#define PRIM_RECTLIST         0x07
88803b705cfSriastradh#define PRIM_POINTLIST        0x08
88903b705cfSriastradh#define PRIM_DIB              0x09
89003b705cfSriastradh#define PRIM_CLEAR_RECT       0x0a
89103b705cfSriastradh#define PRIM_ZONE_INIT        0x0d
89203b705cfSriastradh
89303b705cfSriastradhstruct texture_coordinate_set {
89403b705cfSriastradh	unsigned tcx;
89503b705cfSriastradh	unsigned tcy;
89603b705cfSriastradh};
89703b705cfSriastradh
89803b705cfSriastradhstruct vertex_data {
89903b705cfSriastradh	unsigned x;
90003b705cfSriastradh	unsigned y;
90103b705cfSriastradh	struct texture_coordinate_set tc0;
90203b705cfSriastradh	struct texture_coordinate_set tc1;
90303b705cfSriastradh};
90403b705cfSriastradh
90503b705cfSriastradhstruct i915_3dprimitive {
90603b705cfSriastradh	union {
90703b705cfSriastradh		struct {
90803b705cfSriastradh			unsigned length:18;
90903b705cfSriastradh			unsigned prim:5;
91003b705cfSriastradh			unsigned vertex_location:1;
91103b705cfSriastradh			unsigned opcode:5;
91203b705cfSriastradh			unsigned type:3;
91303b705cfSriastradh		} inline_prim;
91403b705cfSriastradh
91503b705cfSriastradh		struct {
91603b705cfSriastradh			unsigned vertex_count:16;
91703b705cfSriastradh			unsigned pad0:1;
91803b705cfSriastradh			unsigned vertex_access_mode:1;
91903b705cfSriastradh			unsigned prim:5;
92003b705cfSriastradh			unsigned vertex_location:1;
92103b705cfSriastradh			unsigned opcode:5;
92203b705cfSriastradh			unsigned type:3;
92303b705cfSriastradh		} indirect_prim;
92403b705cfSriastradh	} dw0;
92503b705cfSriastradh};
92603b705cfSriastradh#endif /*_I915_STRUCTS_H */
927