2 *-----------------------------------------------------------------------------
5 *-----------------------------------------------------------------------------
6 * Copyright (c) 2002-2010, Intel Corporation.
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 *-----------------------------------------------------------------------------
29 *-----------------------------------------------------------------------------
33 * Add or modify the struct and other definitions for Poulsbo
38 #include <instr_common.h>
40 typedef struct _igd_vertex {
42 unsigned long x_ieee_fp;
44 unsigned long y_ieee_fp;
46 unsigned long z_ieee_fp;
48 } igd_vertex_t, *pigd_vertex_t;
50 /* Common FP numbers */
51 #define IEEE_FP_0 0x00000000
52 #define IEEE_FP_1 0x3f800000
54 /* For EMGD_WRITE32 */
58 /* All instruction sizes must be Double DWORD aligned for the current
59 * platform. The exception to this is the NOOP, which may be useful
60 * not being Double DWORD aligned. */
63 #define PLB_PF_1BIT_PALETTE 0x0
64 #define PLB_PF_2BIT_PALETTE 0x1
65 #define PLB_PF_4BIT_PALETTE 0x2
66 #define PLB_PF_8BIT_PALETTE 0x3
67 #define PLB_PF_8BIT_ALPHA 0x4
68 #define PLB_PF_4BIT_ALPHA 0x5
69 #define PLB_PF_8BPP 0x6
70 #define PLB_PF_16BPP4444 0x7
71 #define PLB_PF_16BPP555 0x8
72 #define PLB_PF_16BPP1555 0x9
73 #define PLB_PF_16BPP565 0xA
74 #define PLB_PF_24BPP 0xB
75 #define PLB_PF_32BPP 0xC
76 #define PLB_PF_32BPP_UYVY 0xD
77 #define PLB_PF_32BPP_AYUV 0xE
82 /* Size of 2D Instructions */
83 #define PLB_2D_PAT_CONTROL_SIZE 1
84 #define PLB_2D_CONTROL_SIZE 3
85 #define PLB_2D_SRC_SURF_SIZE 2
86 #define PLB_2D_DEST_SURF_SIZE 2
87 #define PLB_2D_PAT_SURF_SIZE 2
88 #define PLB_2D_MASK_SURF_SIZE 2
89 #define PLB_2D_SRC_OFFSET_SIZE 1
90 #define PLB_2D_MASK_OFFSET_SIZE 1
91 #define PLB_2D_SRC_PAL_SIZE 1
92 #define PLB_2D_PAT_PAL_SIZE 1
93 /* The 2D_BLT_SIZE is different when doing a Fill */
94 #define PLB_2D_BLT_SIZE 3
95 #define PLB_2D_BLT_FILL_SIZE 4
96 #define PLB_2D_CLIP_SIZE 2
97 #define PLB_2D_FENCE_SIZE 1
98 #define PLB_2D_FLUSH_SIZE 1
99 #define PLB_2D_BLT_SRC_COPY_SIZE 3
101 /* 2D instruction (BR0) */
102 #define _PLB_2D_CLIP (0x0 << 28)
103 #define _PLB_2D_PAT_CONTROL (0x1 << 28)
104 #define _PLB_2D_CONTROL (0x2 << 28)
105 #define _PLB_2D_SRC_OFFSET (0x3 << 28)
106 #define _PLB_2D_MASK_OFFSET (0x4 << 28)
107 #define _PLB_2D_FENCE (0x7 << 28)
108 #define _PLB_2D_BLT (0x8 << 28)
109 #define _PLB_2D_SRC_SURF (0x9 << 28)
110 #define _PLB_2D_DEST_SURF (0xa << 28)
111 #define _PLB_2D_PAT_SURF (0xb << 28)
112 #define _PLB_2D_SRC_PAL (0xc << 28)
113 #define _PLB_2D_PAT_PAL (0xd << 28)
114 #define _PLB_2D_MASK_SURF (0xe << 28)
115 #define _PLB_2D_FLUSH (0xf << 28)
118 #define PSB_2D_SRCCK_CTRL 1
119 #define PSB_2D_DSTCK_CTRL 2
120 #define PSB_2D_ALPHA_CTRL 4
122 #define PLB_2D_BLT_CTRL_ROT_0 0
123 #define PLB_2D_BLT_CTRL_ROT_90 (1<<25)
124 #define PLB_2D_BLT_CTRL_ROT_180 (2<<25)
125 #define PLB_2D_BLT_CTRL_ROT_270 (3<<25)
127 /* Top Left or Bottom Right */
128 #define PLB_2D_BLT_CTRL_ORDER_TL2BR 0
129 #define PLB_2D_BLT_CTRL_ORDER_BR2TL (1<<23)
130 #define PLB_2D_BLT_CTRL_ORDER_TR2BL (2<<23)
131 #define PLB_2D_BLT_CTRL_ORDER_BL2TR (3<<23)
133 #define PLB_2D_BLT_CTRL_DEST_CK_DISABLE 0
134 #define PLB_2D_BLT_CTRL_DEST_CK_PASS_MATCH (1<<21)
135 #define PLB_2D_BLT_CTRL_DEST_CK_KILL_MATCH (2<<21)
137 #define PLB_2D_BLT_CTRL_SRC_CK_DISABLE 0
138 #define PLB_2D_BLT_CTRL_SRC_CK_PASS_MATCH (1<<19)
139 #define PLB_2D_BLT_CTRL_SRC_CK_KILL_MATCH (2<<19)
141 #define PLB_2D_BLT_CTRL_CLIP_DISABLE 0
142 #define PLB_2D_BLT_CTRL_CLIP_ENABLE (1<<18)
144 #define PLB_2D_BLT_CTRL_ALPHA_BLEND_DISABLE 0
145 #define PLB_2D_BLT_CTRL_ALPHA_BLEND_ENABLE (1<<17)
147 #define PLB_2D_BLT_CTRL_FILL 0
148 #define PLB_2D_BLT_CTRL_PATTERN (1<<16)
153 #define PLB_2D_CLIP(queue, xmin, xmax, ymin, ymax) \
154 CMD_2D_WRITE_PLB(queue, _PLB_2D_CLIP | (xmax << 12) | xmin); \
155 CMD_2D_WRITE_PLB(queue, (ymax << 12) | ymin);
157 #define PLB_2D_PAT_CONTROL(queue, pt, width, height) \
158 CMD_2D_WRITE_PLB(queue, _PLB_2D_PAT_CONTROL | (pt.x << 15) | \
159 (pt.y << 10) | (width << 5) | height);
161 #define PLB_2D_CONTROL(queue, ctrl_flag, ck_color, ck_mask) \
162 CMD_2D_WRITE_PLB(queue, _PLB_2D_CONTROL | ctrl_flag); \
163 CMD_2D_WRITE_PLB(queue, ck_color); \
164 CMD_2D_WRITE_PLB(queue, ck_mask);
166 #define PLB_2D_FENCE(queue) \
167 CMD_2D_WRITE_PLB(queue, _PLB_2D_FENCE);
169 #define PLB_2D_FLUSH(queue) \
170 CMD_2D_WRITE_PLB(queue, _PLB_2D_FLUSH);
172 #define PLB_2D_DEST_SURF(queue, pf, pitch, offset) \
173 CMD_2D_WRITE_PLB(queue, _PLB_2D_DEST_SURF | (pf<<15) | pitch); \
174 CMD_2D_WRITE_PLB(queue, offset);
176 #define PLB_2D_SRC_SURF(queue, pf, pitch, offset) \
177 CMD_2D_WRITE_PLB(queue, _PLB_2D_SRC_SURF | (pf<<15) | pitch); \
178 CMD_2D_WRITE_PLB(queue, offset);
180 #define PLB_2D_PAT_SURF(queue, pf, pitch, offset) \
181 CMD_2D_WRITE_PLB(queue, _PLB_2D_PAT_SURF | (pf<<15) | pitch); \
182 CMD_2D_WRITE_PLB(queue, offset);
184 #define PLB_2D_MASK_SURF(queue, pitch, offset) \
185 CMD_2D_WRITE_PLB(queue, _PLB_2D_MASK_SURF | pitch); \
186 CMD_2D_WRITE_PLB(queue, offset);
188 #define PLB_2D_SRC_OFFSET(queue, pt) \
189 CMD_2D_WRITE_PLB(queue, _PLB_2D_SRC_OFFSET | (pt.x<<12) | pt.y);
191 #define PLB_2D_MASK_OFFSET(queue, pt) \
192 CMD_2D_WRITE_PLB(queue, _PLB_2D_MASK_OFFSET | (pt.x<<12) | pt.y);
194 #define PLB_2D_SRC_PAL(queue, offset) \
195 CMD_2D_WRITE_PLB(queue, _PLB_2D_SRC_PAL | offset);
197 #define PLB_2D_PAT_PAL(queue, offset) \
198 CMD_2D_WRITE_PLB(queue, _PLB_2D_PAT_PAL | offset);
200 /* Color fill from Top Left to Bottom Right */
201 #define PLB_2D_BLT_FILL_TL2BR(queue, control, rop, fill, rect) \
202 CMD_2D_WRITE_PLB(queue, _PLB_2D_BLT | control | (rop<<8) | rop); \
203 CMD_2D_WRITE_PLB(queue, fill); \
204 CMD_2D_WRITE_PLB(queue, (rect->x1<<12) | rect->y1); \
205 CMD_2D_WRITE_PLB(queue, ((rect->x2-rect->x1)<<12) | \
206 (rect->y2-rect->y1));
208 /* Color fill from Bottom Right to Top Left */
209 #define PLB_2D_BLT_FILL_BR2TL(queue, control, rop, fill, rect) \
210 CMD_2D_WRITE_PLB(queue, _PLB_2D_BLT | control | (rop<<8) | rop); \
211 CMD_2D_WRITE_PLB(queue, fill); \
212 CMD_2D_WRITE_PLB(queue, ((rect->x2-1)<<12) | (rect->y2-1)); \
213 CMD_2D_WRITE_PLB(queue, ((rect->x2-rect->x1)<<12) | \
214 (rect->y2-rect->y1));
216 #define PLB_2D_BLT_SRC_COPY(queue, control, rop, pt, w, h) \
217 CMD_2D_WRITE_PLB(queue, _PLB_2D_BLT | control | (rop<<8) | rop); \
218 CMD_2D_WRITE_PLB(queue, (pt.x<<12) | pt.y); \
219 CMD_2D_WRITE_PLB(queue, (w<<12) | h);
221 #define PLB_2D_BLT_CHROMA(queue, chroma_color) \
222 CMD_2D_WRITE_PLB(queue, chroma_color);