84 #define curr_ydstorg(x) ((x)->curr.ydstorg.pixels)
86 #define mga_ydstlen(y,l) mga_outl(M_YDSTLEN | M_EXEC, ((y) << 16) | (l))
91 for (i = 0; i < 16; i++) {
92 pal[
i] = i * 0x11111111
U;
99 for (i = 0; i < 16; i++) {
100 pal[
i] = i * 0x01010101
U;
119 mpitch = minfo->
fbcon.var.xres_virtual;
128 switch (minfo->
fbcon.var.bits_per_pixel) {
129 case 4: maccess = 0x00000000;
130 mpitch = (mpitch >> 1) | 0x8000;
131 mopmode = M_OPMODE_4BPP;
132 matrox_cfb4_pal(minfo->
cmap);
133 if (accel && !(mpitch & 1)) {
134 minfo->
fbops.fb_copyarea = matroxfb_cfb4_copyarea;
135 minfo->
fbops.fb_fillrect = matroxfb_cfb4_fillrect;
138 case 8: maccess = 0x00000000;
139 mopmode = M_OPMODE_8BPP;
140 matrox_cfb8_pal(minfo->
cmap);
142 minfo->
fbops.fb_copyarea = matroxfb_copyarea;
143 minfo->
fbops.fb_fillrect = matroxfb_fillrect;
144 minfo->
fbops.fb_imageblit = matroxfb_imageblit;
147 case 16:
if (minfo->
fbcon.var.green.length == 5)
148 maccess = 0xC0000001;
150 maccess = 0x40000001;
151 mopmode = M_OPMODE_16BPP;
153 minfo->
fbops.fb_copyarea = matroxfb_copyarea;
154 minfo->
fbops.fb_fillrect = matroxfb_fillrect;
155 minfo->
fbops.fb_imageblit = matroxfb_imageblit;
158 case 24: maccess = 0x00000003;
159 mopmode = M_OPMODE_24BPP;
161 minfo->
fbops.fb_copyarea = matroxfb_copyarea;
162 minfo->
fbops.fb_fillrect = matroxfb_fillrect;
163 minfo->
fbops.fb_imageblit = matroxfb_imageblit;
166 case 32: maccess = 0x00000002;
167 mopmode = M_OPMODE_32BPP;
169 minfo->
fbops.fb_copyarea = matroxfb_copyarea;
170 minfo->
fbops.fb_fillrect = matroxfb_fillrect;
171 minfo->
fbops.fb_imageblit = matroxfb_imageblit;
174 default: maccess = 0x00000000;
175 mopmode = 0x00000000;
194 minfo->
accel.m_opmode = mopmode;
199 static void matrox_accel_bmove(
struct matrox_fb_info *minfo,
int vxres,
int sy,
209 if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
237 static void matrox_accel_bmove_lin(
struct matrox_fb_info *minfo,
int vxres,
238 int sy,
int sx,
int dy,
int dx,
int height,
248 if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
280 if ((area->
sx | area->
dx | area->
width) & 1)
283 matrox_accel_bmove_lin(minfo, minfo->
fbcon.var.xres_virtual >> 1, area->
sy, area->
sx >> 1, area->
dy, area->
dx >> 1, area->
height, area->
width >> 1);
289 matrox_accel_bmove(minfo, minfo->
fbcon.var.xres_virtual, area->
sy, area->
sx, area->
dy, area->
dx, area->
height, area->
width);
293 int sy,
int sx,
int height,
int width)
316 matroxfb_accel_clear(minfo, ((
u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width);
322 int sy,
int sx,
int height,
int width)
347 mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx);
356 unsigned int uaddr = sy * step + sx - 1;
359 for (loop = height; loop > 0; loop --) {
360 mga_writeb(vbase, uaddr, (mga_readb(vbase, uaddr) & 0x0F) | bgx2);
365 unsigned int uaddr = sy * step + sx +
width;
368 for (loop = height; loop > 0; loop --) {
369 mga_writeb(vbase, uaddr, (mga_readb(vbase, uaddr) & 0xF0) | bgx2);
378 static void matroxfb_cfb4_fillrect(
struct fb_info* info,
const struct fb_fillrect* rect) {
390 int width,
int height,
int yy,
int xx)
404 step = (width + 7) >> 3;
405 charcell = height *
step;
406 xlen = (charcell + 3) & ~3;
407 ydstlen = (yy << 16) | height;
408 if (width == step << 3) {
409 ar0 = height * width - 1;
425 fxbndry = ((xx + width - 1) << 16) |
xx;
426 mmio = minfo->
mmio.vbase;
429 mga_writel(mmio, M_FXBNDRY, fxbndry);
430 mga_writel(mmio,
M_AR0, ar0);
431 mga_writel(mmio,
M_AR3, 0);
434 mga_memcpy_toio(mmio, chardata, xlen);
436 mga_writel(mmio,
M_AR5, 0);
438 if ((step & 3) == 0) {
441 mga_memcpy_toio(mmio, chardata, charcell);
442 }
else if (step == 1) {
445 #if defined(__BIG_ENDIAN)
452 }
else if (step == 2) {
455 #if defined(__BIG_ENDIAN)
467 for (i = 0; i <
step; i += 4) {
485 if (image->
depth == 1) {
490 matroxfb_1bpp_imageblit(minfo, fgx, bgx, image->
data, image->
width, image->
height, image->
dy, image->
dx);