diff options
author | Valentin Sitdikov <valentin.sitdikov@siemens.com> | 2009-12-15 19:46:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:01 -0500 |
commit | 2ec509b96cce5e6d19ee43fdd818eab78e76328d (patch) | |
tree | 7cc89e4ee2d10cc63327490905633c04a617ba18 /drivers/video/mb862xx | |
parent | d2a34c13e7ccec5d06eafd60e6f80ea531b34668 (diff) |
mb862xxfb: add acceleration support for Coral-P/Coral-PA. * imageblt * copyarea * fillrect
[akpm@linux-foundation.org: clean up comments, remove do-nothing tests, use min()]
[akpm@linux-foundation.org: fix Alexandr's email address]
[akpm@linux-foundation.org: export mb862xxfb_init_accel]
Signed-off-by: Valentin Sitdikov <valentin.sitdikov@siemens.com>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/mb862xx')
-rw-r--r-- | drivers/video/mb862xx/Makefile | 2 | ||||
-rw-r--r-- | drivers/video/mb862xx/mb862xxfb.c | 14 | ||||
-rw-r--r-- | drivers/video/mb862xx/mb862xxfb.h | 2 | ||||
-rw-r--r-- | drivers/video/mb862xx/mb862xxfb_accel.c | 331 | ||||
-rw-r--r-- | drivers/video/mb862xx/mb862xxfb_accel.h | 203 |
5 files changed, 551 insertions, 1 deletions
diff --git a/drivers/video/mb862xx/Makefile b/drivers/video/mb862xx/Makefile index 07664814bb1d..d7777714166b 100644 --- a/drivers/video/mb862xx/Makefile +++ b/drivers/video/mb862xx/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the MB862xx framebuffer driver | 2 | # Makefile for the MB862xx framebuffer driver |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_FB_MB862XX) := mb862xxfb.o | 5 | obj-$(CONFIG_FB_MB862XX) := mb862xxfb.o mb862xxfb_accel.o |
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c index a28e3cfbbf70..fabb0c59a211 100644 --- a/drivers/video/mb862xx/mb862xxfb.c +++ b/drivers/video/mb862xx/mb862xxfb.c | |||
@@ -214,6 +214,8 @@ static int mb862xxfb_set_par(struct fb_info *fbi) | |||
214 | unsigned long reg, sc; | 214 | unsigned long reg, sc; |
215 | 215 | ||
216 | dev_dbg(par->dev, "%s\n", __func__); | 216 | dev_dbg(par->dev, "%s\n", __func__); |
217 | if (par->type == BT_CORALP) | ||
218 | mb862xxfb_init_accel(fbi, fbi->var.xres); | ||
217 | 219 | ||
218 | if (par->pre_init) | 220 | if (par->pre_init) |
219 | return 0; | 221 | return 0; |
@@ -453,6 +455,18 @@ static ssize_t mb862xxfb_show_dispregs(struct device *dev, | |||
453 | ptr += sprintf(ptr, "%08x = %08x\n", | 455 | ptr += sprintf(ptr, "%08x = %08x\n", |
454 | reg, inreg(disp, reg)); | 456 | reg, inreg(disp, reg)); |
455 | 457 | ||
458 | for (reg = 0x400; reg <= 0x410; reg += 4) | ||
459 | ptr += sprintf(ptr, "geo %08x = %08x\n", | ||
460 | reg, inreg(geo, reg)); | ||
461 | |||
462 | for (reg = 0x400; reg <= 0x410; reg += 4) | ||
463 | ptr += sprintf(ptr, "draw %08x = %08x\n", | ||
464 | reg, inreg(draw, reg)); | ||
465 | |||
466 | for (reg = 0x440; reg <= 0x450; reg += 4) | ||
467 | ptr += sprintf(ptr, "draw %08x = %08x\n", | ||
468 | reg, inreg(draw, reg)); | ||
469 | |||
456 | return ptr - buf; | 470 | return ptr - buf; |
457 | } | 471 | } |
458 | 472 | ||
diff --git a/drivers/video/mb862xx/mb862xxfb.h b/drivers/video/mb862xx/mb862xxfb.h index c4c8f4dd2217..d7e7cb76bbf2 100644 --- a/drivers/video/mb862xx/mb862xxfb.h +++ b/drivers/video/mb862xx/mb862xxfb.h | |||
@@ -61,6 +61,8 @@ struct mb862xxfb_par { | |||
61 | u32 pseudo_palette[16]; | 61 | u32 pseudo_palette[16]; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | extern void mb862xxfb_init_accel(struct fb_info *info, int xres); | ||
65 | |||
64 | #if defined(CONFIG_FB_MB862XX_LIME) && defined(CONFIG_FB_MB862XX_PCI_GDC) | 66 | #if defined(CONFIG_FB_MB862XX_LIME) && defined(CONFIG_FB_MB862XX_PCI_GDC) |
65 | #error "Select Lime GDC or CoralP/Carmine support, but not both together" | 67 | #error "Select Lime GDC or CoralP/Carmine support, but not both together" |
66 | #endif | 68 | #endif |
diff --git a/drivers/video/mb862xx/mb862xxfb_accel.c b/drivers/video/mb862xx/mb862xxfb_accel.c new file mode 100644 index 000000000000..049256052b1a --- /dev/null +++ b/drivers/video/mb862xx/mb862xxfb_accel.c | |||
@@ -0,0 +1,331 @@ | |||
1 | /* | ||
2 | * drivers/mb862xx/mb862xxfb_accel.c | ||
3 | * | ||
4 | * Fujitsu Carmine/Coral-P(A)/Lime framebuffer driver acceleration support | ||
5 | * | ||
6 | * (C) 2007 Alexander Shishkin <virtuoso@slind.org> | ||
7 | * (C) 2009 Valentin Sitdikov <valentin.sitdikov@siemens.com> | ||
8 | * (C) 2009 Siemens AG | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | */ | ||
15 | #include <linux/fb.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/pci.h> | ||
20 | #if defined(CONFIG_OF) | ||
21 | #include <linux/of_platform.h> | ||
22 | #endif | ||
23 | #include "mb862xxfb.h" | ||
24 | #include "mb862xx_reg.h" | ||
25 | #include "mb862xxfb_accel.h" | ||
26 | |||
27 | static void mb862xxfb_write_fifo(u32 count, u32 *data, struct fb_info *info) | ||
28 | { | ||
29 | struct mb862xxfb_par *par = info->par; | ||
30 | static u32 free; | ||
31 | |||
32 | u32 total = 0; | ||
33 | while (total < count) { | ||
34 | if (free) { | ||
35 | outreg(geo, GDC_GEO_REG_INPUT_FIFO, data[total]); | ||
36 | total++; | ||
37 | free--; | ||
38 | } else { | ||
39 | free = (u32) inreg(draw, GDC_REG_FIFO_COUNT); | ||
40 | } | ||
41 | } | ||
42 | } | ||
43 | |||
44 | static void mb86290fb_copyarea(struct fb_info *info, | ||
45 | const struct fb_copyarea *area) | ||
46 | { | ||
47 | __u32 cmd[6]; | ||
48 | |||
49 | cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; | ||
50 | /* Set raster operation */ | ||
51 | cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); | ||
52 | cmd[2] = GDC_TYPE_BLTCOPYP << 24; | ||
53 | |||
54 | if (area->sx >= area->dx && area->sy >= area->dy) | ||
55 | cmd[2] |= GDC_CMD_BLTCOPY_TOP_LEFT << 16; | ||
56 | else if (area->sx >= area->dx && area->sy <= area->dy) | ||
57 | cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_LEFT << 16; | ||
58 | else if (area->sx <= area->dx && area->sy >= area->dy) | ||
59 | cmd[2] |= GDC_CMD_BLTCOPY_TOP_RIGHT << 16; | ||
60 | else | ||
61 | cmd[2] |= GDC_CMD_BLTCOPY_BOTTOM_RIGHT << 16; | ||
62 | |||
63 | cmd[3] = (area->sy << 16) | area->sx; | ||
64 | cmd[4] = (area->dy << 16) | area->dx; | ||
65 | cmd[5] = (area->height << 16) | area->width; | ||
66 | mb862xxfb_write_fifo(6, cmd, info); | ||
67 | } | ||
68 | |||
69 | /* | ||
70 | * Fill in the cmd array /GDC FIFO commands/ to draw a 1bit image. | ||
71 | * Make sure cmd has enough room! | ||
72 | */ | ||
73 | static void mb86290fb_imageblit1(u32 *cmd, u16 step, u16 dx, u16 dy, | ||
74 | u16 width, u16 height, u32 fgcolor, | ||
75 | u32 bgcolor, const struct fb_image *image, | ||
76 | struct fb_info *info) | ||
77 | { | ||
78 | int i; | ||
79 | unsigned const char *line; | ||
80 | u16 bytes; | ||
81 | |||
82 | /* set colors and raster operation regs */ | ||
83 | cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; | ||
84 | /* Set raster operation */ | ||
85 | cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); | ||
86 | cmd[2] = | ||
87 | (GDC_TYPE_SETCOLORREGISTER << 24) | (GDC_CMD_BODY_FORE_COLOR << 16); | ||
88 | cmd[3] = fgcolor; | ||
89 | cmd[4] = | ||
90 | (GDC_TYPE_SETCOLORREGISTER << 24) | (GDC_CMD_BODY_BACK_COLOR << 16); | ||
91 | cmd[5] = bgcolor; | ||
92 | |||
93 | i = 0; | ||
94 | line = image->data; | ||
95 | bytes = (image->width + 7) >> 3; | ||
96 | |||
97 | /* and the image */ | ||
98 | cmd[6] = (GDC_TYPE_DRAWBITMAPP << 24) | | ||
99 | (GDC_CMD_BITMAP << 16) | (2 + (step * height)); | ||
100 | cmd[7] = (dy << 16) | dx; | ||
101 | cmd[8] = (height << 16) | width; | ||
102 | |||
103 | while (i < height) { | ||
104 | memcpy(&cmd[9 + i * step], line, step << 2); | ||
105 | #ifdef __LITTLE_ENDIAN | ||
106 | { | ||
107 | int k = 0; | ||
108 | for (k = 0; k < step; k++) | ||
109 | cmd[9 + i * step + k] = | ||
110 | cpu_to_be32(cmd[9 + i * step + k]); | ||
111 | } | ||
112 | #endif | ||
113 | line += bytes; | ||
114 | i++; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * Fill in the cmd array /GDC FIFO commands/ to draw a 8bit image. | ||
120 | * Make sure cmd has enough room! | ||
121 | */ | ||
122 | static void mb86290fb_imageblit8(u32 *cmd, u16 step, u16 dx, u16 dy, | ||
123 | u16 width, u16 height, u32 fgcolor, | ||
124 | u32 bgcolor, const struct fb_image *image, | ||
125 | struct fb_info *info) | ||
126 | { | ||
127 | int i, j; | ||
128 | unsigned const char *line, *ptr; | ||
129 | u16 bytes; | ||
130 | |||
131 | cmd[0] = (GDC_TYPE_DRAWBITMAPP << 24) | | ||
132 | (GDC_CMD_BLT_DRAW << 16) | (2 + (height * step)); | ||
133 | cmd[1] = (dy << 16) | dx; | ||
134 | cmd[2] = (height << 16) | width; | ||
135 | |||
136 | i = 0; | ||
137 | line = ptr = image->data; | ||
138 | bytes = image->width; | ||
139 | |||
140 | while (i < height) { | ||
141 | ptr = line; | ||
142 | for (j = 0; j < step; j++) { | ||
143 | cmd[3 + i * step + j] = | ||
144 | (((u32 *) (info->pseudo_palette))[*ptr]) & 0xffff; | ||
145 | ptr++; | ||
146 | cmd[3 + i * step + j] |= | ||
147 | ((((u32 *) (info-> | ||
148 | pseudo_palette))[*ptr]) & 0xffff) << 16; | ||
149 | ptr++; | ||
150 | } | ||
151 | |||
152 | line += bytes; | ||
153 | i++; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * Fill in the cmd array /GDC FIFO commands/ to draw a 16bit image. | ||
159 | * Make sure cmd has enough room! | ||
160 | */ | ||
161 | static void mb86290fb_imageblit16(u32 *cmd, u16 step, u16 dx, u16 dy, | ||
162 | u16 width, u16 height, u32 fgcolor, | ||
163 | u32 bgcolor, const struct fb_image *image, | ||
164 | struct fb_info *info) | ||
165 | { | ||
166 | int i; | ||
167 | unsigned const char *line; | ||
168 | u16 bytes; | ||
169 | |||
170 | i = 0; | ||
171 | line = image->data; | ||
172 | bytes = image->width << 1; | ||
173 | |||
174 | cmd[0] = (GDC_TYPE_DRAWBITMAPP << 24) | | ||
175 | (GDC_CMD_BLT_DRAW << 16) | (2 + step * height); | ||
176 | cmd[1] = (dy << 16) | dx; | ||
177 | cmd[2] = (height << 16) | width; | ||
178 | |||
179 | while (i < height) { | ||
180 | memcpy(&cmd[3 + i * step], line, step); | ||
181 | line += bytes; | ||
182 | i++; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | static void mb86290fb_imageblit(struct fb_info *info, | ||
187 | const struct fb_image *image) | ||
188 | { | ||
189 | int mdr; | ||
190 | u32 *cmd = NULL; | ||
191 | void (*cmdfn) (u32 *, u16, u16, u16, u16, u16, u32, u32, | ||
192 | const struct fb_image *, struct fb_info *) = NULL; | ||
193 | u32 cmdlen; | ||
194 | u32 fgcolor = 0, bgcolor = 0; | ||
195 | u16 step; | ||
196 | |||
197 | u16 width = image->width, height = image->height; | ||
198 | u16 dx = image->dx, dy = image->dy; | ||
199 | int x2, y2, vxres, vyres; | ||
200 | |||
201 | mdr = (GDC_ROP_COPY << 9); | ||
202 | x2 = image->dx + image->width; | ||
203 | y2 = image->dy + image->height; | ||
204 | vxres = info->var.xres_virtual; | ||
205 | vyres = info->var.yres_virtual; | ||
206 | x2 = min(x2, vxres); | ||
207 | y2 = min(y2, vyres); | ||
208 | width = x2 - dx; | ||
209 | height = y2 - dy; | ||
210 | |||
211 | switch (image->depth) { | ||
212 | case 1: | ||
213 | step = (width + 31) >> 5; | ||
214 | cmdlen = 9 + height * step; | ||
215 | cmdfn = mb86290fb_imageblit1; | ||
216 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
217 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
218 | fgcolor = | ||
219 | ((u32 *) (info->pseudo_palette))[image->fg_color]; | ||
220 | bgcolor = | ||
221 | ((u32 *) (info->pseudo_palette))[image->bg_color]; | ||
222 | } else { | ||
223 | fgcolor = image->fg_color; | ||
224 | bgcolor = image->bg_color; | ||
225 | } | ||
226 | |||
227 | break; | ||
228 | |||
229 | case 8: | ||
230 | step = (width + 1) >> 1; | ||
231 | cmdlen = 3 + height * step; | ||
232 | cmdfn = mb86290fb_imageblit8; | ||
233 | break; | ||
234 | |||
235 | case 16: | ||
236 | step = (width + 1) >> 1; | ||
237 | cmdlen = 3 + height * step; | ||
238 | cmdfn = mb86290fb_imageblit16; | ||
239 | break; | ||
240 | |||
241 | default: | ||
242 | cfb_imageblit(info, image); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | cmd = kmalloc(cmdlen * 4, GFP_DMA); | ||
247 | if (!cmd) | ||
248 | return cfb_imageblit(info, image); | ||
249 | cmdfn(cmd, step, dx, dy, width, height, fgcolor, bgcolor, image, info); | ||
250 | mb862xxfb_write_fifo(cmdlen, cmd, info); | ||
251 | kfree(cmd); | ||
252 | } | ||
253 | |||
254 | static void mb86290fb_fillrect(struct fb_info *info, | ||
255 | const struct fb_fillrect *rect) | ||
256 | { | ||
257 | |||
258 | u32 x2, y2, vxres, vyres, height, width, fg; | ||
259 | u32 cmd[7]; | ||
260 | |||
261 | vxres = info->var.xres_virtual; | ||
262 | vyres = info->var.yres_virtual; | ||
263 | |||
264 | if (!rect->width || !rect->height || rect->dx > vxres | ||
265 | || rect->dy > vyres) | ||
266 | return; | ||
267 | |||
268 | /* We could use hardware clipping but on many cards you get around | ||
269 | * hardware clipping by writing to framebuffer directly. */ | ||
270 | x2 = rect->dx + rect->width; | ||
271 | y2 = rect->dy + rect->height; | ||
272 | x2 = min(x2, vxres); | ||
273 | y2 = min(y2, vyres); | ||
274 | width = x2 - rect->dx; | ||
275 | height = y2 - rect->dy; | ||
276 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
277 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) | ||
278 | fg = ((u32 *) (info->pseudo_palette))[rect->color]; | ||
279 | else | ||
280 | fg = rect->color; | ||
281 | |||
282 | switch (rect->rop) { | ||
283 | |||
284 | case ROP_XOR: | ||
285 | /* Set raster operation */ | ||
286 | cmd[1] = (2 << 7) | (GDC_ROP_XOR << 9); | ||
287 | break; | ||
288 | |||
289 | case ROP_COPY: | ||
290 | /* Set raster operation */ | ||
291 | cmd[1] = (2 << 7) | (GDC_ROP_COPY << 9); | ||
292 | break; | ||
293 | |||
294 | } | ||
295 | |||
296 | cmd[0] = (GDC_TYPE_SETREGISTER << 24) | (1 << 16) | GDC_REG_MODE_BITMAP; | ||
297 | /* cmd[1] set earlier */ | ||
298 | cmd[2] = | ||
299 | (GDC_TYPE_SETCOLORREGISTER << 24) | (GDC_CMD_BODY_FORE_COLOR << 16); | ||
300 | cmd[3] = fg; | ||
301 | cmd[4] = (GDC_TYPE_DRAWRECTP << 24) | (GDC_CMD_BLT_FILL << 16); | ||
302 | cmd[5] = (rect->dy << 16) | (rect->dx); | ||
303 | cmd[6] = (height << 16) | width; | ||
304 | |||
305 | mb862xxfb_write_fifo(7, cmd, info); | ||
306 | } | ||
307 | |||
308 | void mb862xxfb_init_accel(struct fb_info *info, int xres) | ||
309 | { | ||
310 | struct mb862xxfb_par *par = info->par; | ||
311 | |||
312 | if (info->var.bits_per_pixel == 32) { | ||
313 | info->fbops->fb_fillrect = cfb_fillrect; | ||
314 | info->fbops->fb_copyarea = cfb_copyarea; | ||
315 | info->fbops->fb_imageblit = cfb_imageblit; | ||
316 | } else { | ||
317 | outreg(disp, GC_L0EM, 3); | ||
318 | info->fbops->fb_fillrect = mb86290fb_fillrect; | ||
319 | info->fbops->fb_copyarea = mb86290fb_copyarea; | ||
320 | info->fbops->fb_imageblit = mb86290fb_imageblit; | ||
321 | } | ||
322 | outreg(draw, GDC_REG_DRAW_BASE, 0); | ||
323 | outreg(draw, GDC_REG_MODE_MISC, 0x8000); | ||
324 | outreg(draw, GDC_REG_X_RESOLUTION, xres); | ||
325 | |||
326 | info->flags |= | ||
327 | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | | ||
328 | FBINFO_HWACCEL_IMAGEBLIT; | ||
329 | info->fix.accel = 0xff; /*FIXME: add right define */ | ||
330 | } | ||
331 | EXPORT_SYMBOL(mb862xxfb_init_accel); | ||
diff --git a/drivers/video/mb862xx/mb862xxfb_accel.h b/drivers/video/mb862xx/mb862xxfb_accel.h new file mode 100644 index 000000000000..96a2dfef0f60 --- /dev/null +++ b/drivers/video/mb862xx/mb862xxfb_accel.h | |||
@@ -0,0 +1,203 @@ | |||
1 | #ifndef __MB826XXFB_ACCEL_H__ | ||
2 | #define __MB826XXFB_ACCEL_H__ | ||
3 | |||
4 | /* registers */ | ||
5 | #define GDC_GEO_REG_INPUT_FIFO 0x00000400L | ||
6 | |||
7 | /* Special Registers */ | ||
8 | #define GDC_REG_CTRL 0x00000400L | ||
9 | #define GDC_REG_FIFO_STATUS 0x00000404L | ||
10 | #define GDC_REG_FIFO_COUNT 0x00000408L | ||
11 | #define GDC_REG_SETUP_STATUS 0x0000040CL | ||
12 | #define GDC_REG_DDA_STATUS 0x00000410L | ||
13 | #define GDC_REG_ENGINE_STATUS 0x00000414L | ||
14 | #define GDC_REG_ERROR_STATUS 0x00000418L | ||
15 | #define GDC_REG_MODE_MISC 0x00000420L /* MDR0 */ | ||
16 | #define GDC_REG_MODE_LINE 0x00000424L /* MDR1 */ | ||
17 | #define GDC_REG_MODE_POLYGON 0x00000428L /* MDR2 */ | ||
18 | #define GDC_REG_MODE_TEXTURE 0x0000042CL /* MDR3 */ | ||
19 | #define GDC_REG_MODE_BITMAP 0x00000430L /* MDR4 */ | ||
20 | #define GDC_REG_MODE_EXTENSION 0x0000043CL /* MDR7 */ | ||
21 | |||
22 | /* Configuration Registers */ | ||
23 | #define GDC_REG_DRAW_BASE 0x00000440L | ||
24 | #define GDC_REG_X_RESOLUTION 0x00000444L | ||
25 | #define GDC_REG_Z_BASE 0x00000448L | ||
26 | #define GDC_REG_TEXTURE_BASE 0x0000044CL | ||
27 | #define GDC_REG_POLYGON_FLAG_BASE 0x00000450L | ||
28 | #define GDC_REG_CLIP_XMIN 0x00000454L | ||
29 | #define GDC_REG_CLIP_XMAX 0x00000458L | ||
30 | #define GDC_REG_CLIP_YMIN 0x0000045CL | ||
31 | #define GDC_REG_CLIP_YMAX 0x00000460L | ||
32 | #define GDC_REG_TEXURE_SIZE 0x00000464L | ||
33 | #define GDC_REG_TILE_SIZE 0x00000468L | ||
34 | #define GDC_REG_TEX_BUF_OFFSET 0x0000046CL | ||
35 | |||
36 | /* for MB86293 or later */ | ||
37 | #define GDC_REG_ALPHA_MAP_BASE 0x00000474L /* ABR */ | ||
38 | |||
39 | /* Constant Registers */ | ||
40 | #define GDC_REG_FOREGROUND_COLOR 0x00000480L | ||
41 | #define GDC_REG_BACKGROUND_COLOR 0x00000484L | ||
42 | #define GDC_REG_ALPHA 0x00000488L | ||
43 | #define GDC_REG_LINE_PATTERN 0x0000048CL | ||
44 | #define GDC_REG_TEX_BORDER_COLOR 0x00000494L | ||
45 | #define GDC_REG_LINE_PATTERN_OFFSET 0x000003E0L | ||
46 | |||
47 | /* Coomand Code */ | ||
48 | #define GDC_CMD_PIXEL 0x00000000L | ||
49 | #define GDC_CMD_PIXEL_Z 0x00000001L | ||
50 | |||
51 | #define GDC_CMD_X_VECTOR 0x00000020L | ||
52 | #define GDC_CMD_Y_VECTOR 0x00000021L | ||
53 | #define GDC_CMD_X_VECTOR_NOEND 0x00000022L | ||
54 | #define GDC_CMD_Y_VECTOR_NOEND 0x00000023L | ||
55 | #define GDC_CMD_X_VECTOR_BLPO 0x00000024L | ||
56 | #define GDC_CMD_Y_VECTOR_BLPO 0x00000025L | ||
57 | #define GDC_CMD_X_VECTOR_NOEND_BLPO 0x00000026L | ||
58 | #define GDC_CMD_Y_VECTOR_NOEND_BLPO 0x00000027L | ||
59 | #define GDC_CMD_AA_X_VECTOR 0x00000028L | ||
60 | #define GDC_CMD_AA_Y_VECTOR 0x00000029L | ||
61 | #define GDC_CMD_AA_X_VECTOR_NOEND 0x0000002AL | ||
62 | #define GDC_CMD_AA_Y_VECTOR_NOEND 0x0000002BL | ||
63 | #define GDC_CMD_AA_X_VECTOR_BLPO 0x0000002CL | ||
64 | #define GDC_CMD_AA_Y_VECTOR_BLPO 0x0000002DL | ||
65 | #define GDC_CMD_AA_X_VECTOR_NOEND_BLPO 0x0000002EL | ||
66 | #define GDC_CMD_AA_Y_VECTOR_NOEND_BLPO 0x0000002FL | ||
67 | |||
68 | #define GDC_CMD_0_VECTOR 0x00000030L | ||
69 | #define GDC_CMD_1_VECTOR 0x00000031L | ||
70 | #define GDC_CMD_0_VECTOR_NOEND 0x00000032L | ||
71 | #define GDC_CMD_1_VECTOR_NOEND 0x00000033L | ||
72 | #define GDC_CMD_0_VECTOR_BLPO 0x00000034L | ||
73 | #define GDC_CMD_1_VECTOR_BLPO 0x00000035L | ||
74 | #define GDC_CMD_0_VECTOR_NOEND_BLPO 0x00000036L | ||
75 | #define GDC_CMD_1_VECTOR_NOEND_BLPO 0x00000037L | ||
76 | #define GDC_CMD_AA_0_VECTOR 0x00000038L | ||
77 | #define GDC_CMD_AA_1_VECTOR 0x00000039L | ||
78 | #define GDC_CMD_AA_0_VECTOR_NOEND 0x0000003AL | ||
79 | #define GDC_CMD_AA_1_VECTOR_NOEND 0x0000003BL | ||
80 | #define GDC_CMD_AA_0_VECTOR_BLPO 0x0000003CL | ||
81 | #define GDC_CMD_AA_1_VECTOR_BLPO 0x0000003DL | ||
82 | #define GDC_CMD_AA_0_VECTOR_NOEND_BLPO 0x0000003EL | ||
83 | #define GDC_CMD_AA_1_VECTOR_NOEND_BLPO 0x0000003FL | ||
84 | |||
85 | #define GDC_CMD_BLT_FILL 0x00000041L | ||
86 | #define GDC_CMD_BLT_DRAW 0x00000042L | ||
87 | #define GDC_CMD_BITMAP 0x00000043L | ||
88 | #define GDC_CMD_BLTCOPY_TOP_LEFT 0x00000044L | ||
89 | #define GDC_CMD_BLTCOPY_TOP_RIGHT 0x00000045L | ||
90 | #define GDC_CMD_BLTCOPY_BOTTOM_LEFT 0x00000046L | ||
91 | #define GDC_CMD_BLTCOPY_BOTTOM_RIGHT 0x00000047L | ||
92 | #define GDC_CMD_LOAD_TEXTURE 0x00000048L | ||
93 | #define GDC_CMD_LOAD_TILE 0x00000049L | ||
94 | |||
95 | #define GDC_CMD_TRAP_RIGHT 0x00000060L | ||
96 | #define GDC_CMD_TRAP_LEFT 0x00000061L | ||
97 | #define GDC_CMD_TRIANGLE_FAN 0x00000062L | ||
98 | #define GDC_CMD_FLAG_TRIANGLE_FAN 0x00000063L | ||
99 | |||
100 | #define GDC_CMD_FLUSH_FB 0x000000C1L | ||
101 | #define GDC_CMD_FLUSH_Z 0x000000C2L | ||
102 | |||
103 | #define GDC_CMD_POLYGON_BEGIN 0x000000E0L | ||
104 | #define GDC_CMD_POLYGON_END 0x000000E1L | ||
105 | #define GDC_CMD_CLEAR_POLY_FLAG 0x000000E2L | ||
106 | #define GDC_CMD_NORMAL 0x000000FFL | ||
107 | |||
108 | #define GDC_CMD_VECTOR_BLPO_FLAG 0x00040000L | ||
109 | #define GDC_CMD_FAST_VECTOR_BLPO_FLAG 0x00000004L | ||
110 | |||
111 | /* for MB86293 or later */ | ||
112 | #define GDC_CMD_MDR1 0x00000000L | ||
113 | #define GDC_CMD_MDR1S 0x00000002L | ||
114 | #define GDC_CMD_MDR1B 0x00000004L | ||
115 | #define GDC_CMD_MDR2 0x00000001L | ||
116 | #define GDC_CMD_MDR2S 0x00000003L | ||
117 | #define GDC_CMD_MDR2TL 0x00000007L | ||
118 | #define GDC_CMD_GMDR1E 0x00000010L | ||
119 | #define GDC_CMD_GMDR2E 0x00000020L | ||
120 | #define GDC_CMD_OVERLAP_SHADOW_XY 0x00000000L | ||
121 | #define GDC_CMD_OVERLAP_SHADOW_XY_COMPOSITION 0x00000001L | ||
122 | #define GDC_CMD_OVERLAP_Z_PACKED_ONBS 0x00000007L | ||
123 | #define GDC_CMD_OVERLAP_Z_ORIGIN 0x00000000L | ||
124 | #define GDC_CMD_OVERLAP_Z_NON_TOPLEFT 0x00000001L | ||
125 | #define GDC_CMD_OVERLAP_Z_BORDER 0x00000002L | ||
126 | #define GDC_CMD_OVERLAP_Z_SHADOW 0x00000003L | ||
127 | #define GDC_CMD_BLTCOPY_ALT_ALPHA 0x00000000L /* Reserverd */ | ||
128 | #define GDC_CMD_DC_LOGOUT 0x00000000L /* Reserverd */ | ||
129 | #define GDC_CMD_BODY_FORE_COLOR 0x00000000L | ||
130 | #define GDC_CMD_BODY_BACK_COLOR 0x00000001L | ||
131 | #define GDC_CMD_SHADOW_FORE_COLOR 0x00000002L | ||
132 | #define GDC_CMD_SHADOW_BACK_COLOR 0x00000003L | ||
133 | #define GDC_CMD_BORDER_FORE_COLOR 0x00000004L | ||
134 | #define GDC_CMD_BORDER_BACK_COLOR 0x00000005L | ||
135 | |||
136 | /* Type Code Table */ | ||
137 | #define GDC_TYPE_G_NOP 0x00000020L | ||
138 | #define GDC_TYPE_G_BEGIN 0x00000021L | ||
139 | #define GDC_TYPE_G_BEGINCONT 0x00000022L | ||
140 | #define GDC_TYPE_G_END 0x00000023L | ||
141 | #define GDC_TYPE_G_VERTEX 0x00000030L | ||
142 | #define GDC_TYPE_G_VERTEXLOG 0x00000032L | ||
143 | #define GDC_TYPE_G_VERTEXNOPLOG 0x00000033L | ||
144 | #define GDC_TYPE_G_INIT 0x00000040L | ||
145 | #define GDC_TYPE_G_VIEWPORT 0x00000041L | ||
146 | #define GDC_TYPE_G_DEPTHRANGE 0x00000042L | ||
147 | #define GDC_TYPE_G_LOADMATRIX 0x00000043L | ||
148 | #define GDC_TYPE_G_VIEWVOLUMEXYCLIP 0x00000044L | ||
149 | #define GDC_TYPE_G_VIEWVOLUMEZCLIP 0x00000045L | ||
150 | #define GDC_TYPE_G_VIEWVOLUMEWCLIP 0x00000046L | ||
151 | #define GDC_TYPE_SETLVERTEX2I 0x00000072L | ||
152 | #define GDC_TYPE_SETLVERTEX2IP 0x00000073L | ||
153 | #define GDC_TYPE_SETMODEREGISTER 0x000000C0L | ||
154 | #define GDC_TYPE_SETGMODEREGISTER 0x000000C1L | ||
155 | #define GDC_TYPE_OVERLAPXYOFFT 0x000000C8L | ||
156 | #define GDC_TYPE_OVERLAPZOFFT 0x000000C9L | ||
157 | #define GDC_TYPE_DC_LOGOUTADDR 0x000000CCL | ||
158 | #define GDC_TYPE_SETCOLORREGISTER 0x000000CEL | ||
159 | #define GDC_TYPE_G_BEGINE 0x000000E1L | ||
160 | #define GDC_TYPE_G_BEGINCONTE 0x000000E2L | ||
161 | #define GDC_TYPE_G_ENDE 0x000000E3L | ||
162 | #define GDC_TYPE_DRAWPIXEL 0x00000000L | ||
163 | #define GDC_TYPE_DRAWPIXELZ 0x00000001L | ||
164 | #define GDC_TYPE_DRAWLINE 0x00000002L | ||
165 | #define GDC_TYPE_DRAWLINE2I 0x00000003L | ||
166 | #define GDC_TYPE_DRAWLINE2IP 0x00000004L | ||
167 | #define GDC_TYPE_DRAWTRAP 0x00000005L | ||
168 | #define GDC_TYPE_DRAWVERTEX2I 0x00000006L | ||
169 | #define GDC_TYPE_DRAWVERTEX2IP 0x00000007L | ||
170 | #define GDC_TYPE_DRAWRECTP 0x00000009L | ||
171 | #define GDC_TYPE_DRAWBITMAPP 0x0000000BL | ||
172 | #define GDC_TYPE_BLTCOPYP 0x0000000DL | ||
173 | #define GDC_TYPE_BLTCOPYALTERNATEP 0x0000000FL | ||
174 | #define GDC_TYPE_LOADTEXTUREP 0x00000011L | ||
175 | #define GDC_TYPE_BLTTEXTUREP 0x00000013L | ||
176 | #define GDC_TYPE_BLTCOPYALTALPHABLENDP 0x0000001FL | ||
177 | #define GDC_TYPE_SETVERTEX2I 0x00000070L | ||
178 | #define GDC_TYPE_SETVERTEX2IP 0x00000071L | ||
179 | #define GDC_TYPE_DRAW 0x000000F0L | ||
180 | #define GDC_TYPE_SETREGISTER 0x000000F1L | ||
181 | #define GDC_TYPE_SYNC 0x000000FCL | ||
182 | #define GDC_TYPE_INTERRUPT 0x000000FDL | ||
183 | #define GDC_TYPE_NOP 0x0 | ||
184 | |||
185 | /* Raster operation */ | ||
186 | #define GDC_ROP_CLEAR 0x0000 | ||
187 | #define GDC_ROP_AND 0x0001 | ||
188 | #define GDC_ROP_AND_REVERSE 0x0002 | ||
189 | #define GDC_ROP_COPY 0x0003 | ||
190 | #define GDC_ROP_AND_INVERTED 0x0004 | ||
191 | #define GDC_ROP_NOP 0x0005 | ||
192 | #define GDC_ROP_XOR 0x0006 | ||
193 | #define GDC_ROP_OR 0x0007 | ||
194 | #define GDC_ROP_NOR 0x0008 | ||
195 | #define GDC_ROP_EQUIV 0x0009 | ||
196 | #define GDC_ROP_INVERT 0x000A | ||
197 | #define GDC_ROP_OR_REVERSE 0x000B | ||
198 | #define GDC_ROP_COPY_INVERTED 0x000C | ||
199 | #define GDC_ROP_OR_INVERTED 0x000D | ||
200 | #define GDC_ROP_NAND 0x000E | ||
201 | #define GDC_ROP_SET 0x000F | ||
202 | |||
203 | #endif | ||