matroxfb_accel.c 14.5 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
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
/*
 *
 * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400
 *
 * (c) 1998-2002 Petr Vandrovec <vandrove@vc.cvut.cz>
 *
 * Version: 1.65 2002/08/14
 *
 * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org>
 *
 * Contributors: "menion?" <menion@mindless.com>
 *                     Betatesting, fixes, ideas
 *
 *               "Kurt Garloff" <garloff@suse.de>
 *                     Betatesting, fixes, ideas, videomodes, videomodes timmings
 *
 *               "Tom Rini" <trini@kernel.crashing.org>
 *                     MTRR stuff, PPC cleanups, betatesting, fixes, ideas
 *
 *               "Bibek Sahu" <scorpio@dodds.net>
 *                     Access device through readb|w|l and write b|w|l
 *                     Extensive debugging stuff
 *
 *               "Daniel Haun" <haund@usa.net>
 *                     Testing, hardware cursor fixes
 *
 *               "Scott Wood" <sawst46+@pitt.edu>
 *                     Fixes
 *
 *               "Gerd Knorr" <kraxel@goldbach.isdn.cs.tu-berlin.de>
 *                     Betatesting
 *
 *               "Kelly French" <targon@hazmat.com>
 *               "Fernando Herrera" <fherrera@eurielec.etsit.upm.es>
 *                     Betatesting, bug reporting
 *
 *               "Pablo Bianucci" <pbian@pccp.com.ar>
 *                     Fixes, ideas, betatesting
 *
 *               "Inaky Perez Gonzalez" <inaky@peloncho.fis.ucm.es>
 *                     Fixes, enhandcements, ideas, betatesting
 *
 *               "Ryuichi Oikawa" <roikawa@rr.iiij4u.or.jp>
 *                     PPC betatesting, PPC support, backward compatibility
 *
 *               "Paul Womar" <Paul@pwomar.demon.co.uk>
 *               "Owen Waller" <O.Waller@ee.qub.ac.uk>
 *                     PPC betatesting
 *
 *               "Thomas Pornin" <pornin@bolet.ens.fr>
 *                     Alpha betatesting
 *
 *               "Pieter van Leuven" <pvl@iae.nl>
 *               "Ulf Jaenicke-Roessler" <ujr@physik.phy.tu-dresden.de>
 *                     G100 testing
 *
 *               "H. Peter Arvin" <hpa@transmeta.com>
 *                     Ideas
 *
 *               "Cort Dougan" <cort@cs.nmt.edu>
 *                     CHRP fixes and PReP cleanup
 *
 *               "Mark Vojkovich" <mvojkovi@ucsd.edu>
 *                     G400 support
 *
 * (following author is not in any relation with this code, but his code
 *  is included in this driver)
 *
 * Based on framebuffer driver for VBE 2.0 compliant graphic boards
 *     (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
 *
 * (following author is not in any relation with this code, but his ideas
73
 *  were used when writing this driver)
Linus Torvalds's avatar
Linus Torvalds committed
74 75 76 77 78 79 80 81 82 83
 *
 *		 FreeVBE/AF (Matrox), "Shawn Hargreaves" <shawn@talula.demon.co.uk>
 *
 */

#include "matroxfb_accel.h"
#include "matroxfb_DAC1064.h"
#include "matroxfb_Ti3026.h"
#include "matroxfb_misc.h"

84
#define curr_ydstorg(x)	((x)->curr.ydstorg.pixels)
Linus Torvalds's avatar
Linus Torvalds committed
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

#define mga_ydstlen(y,l) mga_outl(M_YDSTLEN | M_EXEC, ((y) << 16) | (l))

static inline void matrox_cfb4_pal(u_int32_t* pal) {
	unsigned int i;
	
	for (i = 0; i < 16; i++) {
		pal[i] = i * 0x11111111U;
	}
}

static inline void matrox_cfb8_pal(u_int32_t* pal) {
	unsigned int i;
	
	for (i = 0; i < 16; i++) {
		pal[i] = i * 0x01010101U;
	}
}

static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area);
static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect);
static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image);
static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect);
static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area);

110 111
void matrox_cfbX_init(struct matrox_fb_info *minfo)
{
Linus Torvalds's avatar
Linus Torvalds committed
112 113 114 115 116
	u_int32_t maccess;
	u_int32_t mpitch;
	u_int32_t mopmode;
	int accel;

117
	DBG(__func__)
Linus Torvalds's avatar
Linus Torvalds committed
118

119
	mpitch = minfo->fbcon.var.xres_virtual;
Linus Torvalds's avatar
Linus Torvalds committed
120

121 122 123 124
	minfo->fbops.fb_copyarea = cfb_copyarea;
	minfo->fbops.fb_fillrect = cfb_fillrect;
	minfo->fbops.fb_imageblit = cfb_imageblit;
	minfo->fbops.fb_cursor = NULL;
Linus Torvalds's avatar
Linus Torvalds committed
125

126
	accel = (minfo->fbcon.var.accel_flags & FB_ACCELF_TEXT) == FB_ACCELF_TEXT;
Linus Torvalds's avatar
Linus Torvalds committed
127

128
	switch (minfo->fbcon.var.bits_per_pixel) {
Linus Torvalds's avatar
Linus Torvalds committed
129 130 131
		case 4:		maccess = 0x00000000;	/* accelerate as 8bpp video */
				mpitch = (mpitch >> 1) | 0x8000; /* disable linearization */
				mopmode = M_OPMODE_4BPP;
132
				matrox_cfb4_pal(minfo->cmap);
Linus Torvalds's avatar
Linus Torvalds committed
133
				if (accel && !(mpitch & 1)) {
134 135
					minfo->fbops.fb_copyarea = matroxfb_cfb4_copyarea;
					minfo->fbops.fb_fillrect = matroxfb_cfb4_fillrect;
Linus Torvalds's avatar
Linus Torvalds committed
136 137 138 139
				}
				break;
		case 8:		maccess = 0x00000000;
				mopmode = M_OPMODE_8BPP;
140
				matrox_cfb8_pal(minfo->cmap);
Linus Torvalds's avatar
Linus Torvalds committed
141
				if (accel) {
142 143 144
					minfo->fbops.fb_copyarea = matroxfb_copyarea;
					minfo->fbops.fb_fillrect = matroxfb_fillrect;
					minfo->fbops.fb_imageblit = matroxfb_imageblit;
Linus Torvalds's avatar
Linus Torvalds committed
145 146
				}
				break;
147
		case 16:	if (minfo->fbcon.var.green.length == 5)
Linus Torvalds's avatar
Linus Torvalds committed
148
					maccess = 0xC0000001;
149
				else
Linus Torvalds's avatar
Linus Torvalds committed
150 151 152
					maccess = 0x40000001;
				mopmode = M_OPMODE_16BPP;
				if (accel) {
153 154 155
					minfo->fbops.fb_copyarea = matroxfb_copyarea;
					minfo->fbops.fb_fillrect = matroxfb_fillrect;
					minfo->fbops.fb_imageblit = matroxfb_imageblit;
Linus Torvalds's avatar
Linus Torvalds committed
156 157 158 159 160
				}
				break;
		case 24:	maccess = 0x00000003;
				mopmode = M_OPMODE_24BPP;
				if (accel) {
161 162 163
					minfo->fbops.fb_copyarea = matroxfb_copyarea;
					minfo->fbops.fb_fillrect = matroxfb_fillrect;
					minfo->fbops.fb_imageblit = matroxfb_imageblit;
Linus Torvalds's avatar
Linus Torvalds committed
164 165 166 167 168
				}
				break;
		case 32:	maccess = 0x00000002;
				mopmode = M_OPMODE_32BPP;
				if (accel) {
169 170 171
					minfo->fbops.fb_copyarea = matroxfb_copyarea;
					minfo->fbops.fb_fillrect = matroxfb_fillrect;
					minfo->fbops.fb_imageblit = matroxfb_imageblit;
Linus Torvalds's avatar
Linus Torvalds committed
172 173 174 175 176 177 178 179
				}
				break;
		default:	maccess = 0x00000000;
				mopmode = 0x00000000;
				break;	/* turn off acceleration!!! */
	}
	mga_fifo(8);
	mga_outl(M_PITCH, mpitch);
180 181
	mga_outl(M_YDSTORG, curr_ydstorg(minfo));
	if (minfo->capable.plnwt)
Linus Torvalds's avatar
Linus Torvalds committed
182
		mga_outl(M_PLNWT, -1);
183
	if (minfo->capable.srcorg) {
Linus Torvalds's avatar
Linus Torvalds committed
184 185 186 187 188 189 190 191
		mga_outl(M_SRCORG, 0);
		mga_outl(M_DSTORG, 0);
	}
	mga_outl(M_OPMODE, mopmode);
	mga_outl(M_CXBNDRY, 0xFFFF0000);
	mga_outl(M_YTOP, 0);
	mga_outl(M_YBOT, 0x01FFFFFF);
	mga_outl(M_MACCESS, maccess);
192 193 194
	minfo->accel.m_dwg_rect = M_DWG_TRAP | M_DWG_SOLID | M_DWG_ARZERO | M_DWG_SGNZERO | M_DWG_SHIFTZERO;
	if (isMilleniumII(minfo)) minfo->accel.m_dwg_rect |= M_DWG_TRANSC;
	minfo->accel.m_opmode = mopmode;
195 196
	minfo->accel.m_access = maccess;
	minfo->accel.m_pitch = mpitch;
Linus Torvalds's avatar
Linus Torvalds committed
197 198 199 200
}

EXPORT_SYMBOL(matrox_cfbX_init);

201 202 203 204 205 206
static void matrox_accel_restore_maccess(struct matrox_fb_info *minfo)
{
	mga_outl(M_MACCESS, minfo->accel.m_access);
	mga_outl(M_PITCH, minfo->accel.m_pitch);
}

207 208 209
static void matrox_accel_bmove(struct matrox_fb_info *minfo, int vxres, int sy,
			       int sx, int dy, int dx, int height, int width)
{
Linus Torvalds's avatar
Linus Torvalds committed
210 211 212
	int start, end;
	CRITFLAGS

213
	DBG(__func__)
Linus Torvalds's avatar
Linus Torvalds committed
214 215 216 217

	CRITBEGIN

	if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
218 219
		mga_fifo(4);
		matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
220 221 222 223
		mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO |
			 M_DWG_BFCOL | M_DWG_REPLACE);
		mga_outl(M_AR5, vxres);
		width--;
224
		start = sy*vxres+sx+curr_ydstorg(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
225 226
		end = start+width;
	} else {
227 228
		mga_fifo(5);
		matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
229 230 231 232
		mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE);
		mga_outl(M_SGN, 5);
		mga_outl(M_AR5, -vxres);
		width--;
233
		end = (sy+height-1)*vxres+sx+curr_ydstorg(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
234 235 236
		start = end+width;
		dy += height-1;
	}
237 238
	mga_fifo(6);
	matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
239 240 241 242 243 244 245 246 247
	mga_outl(M_AR0, end);
	mga_outl(M_AR3, start);
	mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx);
	mga_ydstlen(dy, height);
	WaitTillIdle();

	CRITEND
}

248 249 250 251
static void matrox_accel_bmove_lin(struct matrox_fb_info *minfo, int vxres,
				   int sy, int sx, int dy, int dx, int height,
				   int width)
{
Linus Torvalds's avatar
Linus Torvalds committed
252 253 254
	int start, end;
	CRITFLAGS

255
	DBG(__func__)
Linus Torvalds's avatar
Linus Torvalds committed
256 257 258 259

	CRITBEGIN

	if ((dy < sy) || ((dy == sy) && (dx <= sx))) {
260 261
		mga_fifo(4);
		matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
262 263 264 265
		mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO |
			M_DWG_BFCOL | M_DWG_REPLACE);
		mga_outl(M_AR5, vxres);
		width--;
266
		start = sy*vxres+sx+curr_ydstorg(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
267 268
		end = start+width;
	} else {
269 270
		mga_fifo(5);
		matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
271 272 273 274
		mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_BFCOL | M_DWG_REPLACE);
		mga_outl(M_SGN, 5);
		mga_outl(M_AR5, -vxres);
		width--;
275
		end = (sy+height-1)*vxres+sx+curr_ydstorg(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
276 277 278
		start = end+width;
		dy += height-1;
	}
279 280
	mga_fifo(7);
	matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
281 282 283 284 285 286 287 288 289 290 291
	mga_outl(M_AR0, end);
	mga_outl(M_AR3, start);
	mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx);
	mga_outl(M_YDST, dy*vxres >> 5);
	mga_outl(M_LEN | M_EXEC, height);
	WaitTillIdle();

	CRITEND
}

static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
292
	struct matrox_fb_info *minfo = info2minfo(info);
Linus Torvalds's avatar
Linus Torvalds committed
293 294 295 296

	if ((area->sx | area->dx | area->width) & 1)
		cfb_copyarea(info, area);
	else
297
		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);
Linus Torvalds's avatar
Linus Torvalds committed
298 299 300
}

static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) {
301
	struct matrox_fb_info *minfo = info2minfo(info);
Linus Torvalds's avatar
Linus Torvalds committed
302

303
	matrox_accel_bmove(minfo, minfo->fbcon.var.xres_virtual, area->sy, area->sx, area->dy, area->dx, area->height, area->width);
Linus Torvalds's avatar
Linus Torvalds committed
304 305
}

306 307 308
static void matroxfb_accel_clear(struct matrox_fb_info *minfo, u_int32_t color,
				 int sy, int sx, int height, int width)
{
Linus Torvalds's avatar
Linus Torvalds committed
309 310
	CRITFLAGS

311
	DBG(__func__)
Linus Torvalds's avatar
Linus Torvalds committed
312 313 314

	CRITBEGIN

315 316
	mga_fifo(7);
	matrox_accel_restore_maccess(minfo);
317
	mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE);
Linus Torvalds's avatar
Linus Torvalds committed
318 319 320 321 322 323 324 325 326
	mga_outl(M_FCOL, color);
	mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx);
	mga_ydstlen(sy, height);
	WaitTillIdle();

	CRITEND
}

static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
327
	struct matrox_fb_info *minfo = info2minfo(info);
Linus Torvalds's avatar
Linus Torvalds committed
328 329 330

	switch (rect->rop) {
		case ROP_COPY:
331
			matroxfb_accel_clear(minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width);
Linus Torvalds's avatar
Linus Torvalds committed
332 333 334 335
			break;
	}
}

336 337 338
static void matroxfb_cfb4_clear(struct matrox_fb_info *minfo, u_int32_t bgx,
				int sy, int sx, int height, int width)
{
Linus Torvalds's avatar
Linus Torvalds committed
339 340 341
	int whattodo;
	CRITFLAGS

342
	DBG(__func__)
Linus Torvalds's avatar
Linus Torvalds committed
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358

	CRITBEGIN

	whattodo = 0;
	if (sx & 1) {
		sx ++;
		if (!width) return;
		width --;
		whattodo = 1;
	}
	if (width & 1) {
		whattodo |= 2;
	}
	width >>= 1;
	sx >>= 1;
	if (width) {
359 360
		mga_fifo(7);
		matrox_accel_restore_maccess(minfo);
361
		mga_outl(M_DWGCTL, minfo->accel.m_dwg_rect | M_DWG_REPLACE2);
Linus Torvalds's avatar
Linus Torvalds committed
362 363
		mga_outl(M_FCOL, bgx);
		mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx);
364
		mga_outl(M_YDST, sy * minfo->fbcon.var.xres_virtual >> 6);
Linus Torvalds's avatar
Linus Torvalds committed
365 366 367 368
		mga_outl(M_LEN | M_EXEC, height);
		WaitTillIdle();
	}
	if (whattodo) {
369 370
		u_int32_t step = minfo->fbcon.var.xres_virtual >> 1;
		vaddr_t vbase = minfo->video.vbase;
Linus Torvalds's avatar
Linus Torvalds committed
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
		if (whattodo & 1) {
			unsigned int uaddr = sy * step + sx - 1;
			u_int32_t loop;
			u_int8_t bgx2 = bgx & 0xF0;
			for (loop = height; loop > 0; loop --) {
				mga_writeb(vbase, uaddr, (mga_readb(vbase, uaddr) & 0x0F) | bgx2);
				uaddr += step;
			}
		}
		if (whattodo & 2) {
			unsigned int uaddr = sy * step + sx + width;
			u_int32_t loop;
			u_int8_t bgx2 = bgx & 0x0F;
			for (loop = height; loop > 0; loop --) {
				mga_writeb(vbase, uaddr, (mga_readb(vbase, uaddr) & 0xF0) | bgx2);
				uaddr += step;
			}
		}
	}

	CRITEND
}

static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) {
395
	struct matrox_fb_info *minfo = info2minfo(info);
Linus Torvalds's avatar
Linus Torvalds committed
396 397 398

	switch (rect->rop) {
		case ROP_COPY:
399
			matroxfb_cfb4_clear(minfo, ((u_int32_t *)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width);
Linus Torvalds's avatar
Linus Torvalds committed
400 401 402 403
			break;
	}
}

404 405 406 407
static void matroxfb_1bpp_imageblit(struct matrox_fb_info *minfo, u_int32_t fgx,
				    u_int32_t bgx, const u_int8_t *chardata,
				    int width, int height, int yy, int xx)
{
Linus Torvalds's avatar
Linus Torvalds committed
408 409 410 411 412 413 414 415 416 417
	u_int32_t step;
	u_int32_t ydstlen;
	u_int32_t xlen;
	u_int32_t ar0;
	u_int32_t charcell;
	u_int32_t fxbndry;
	vaddr_t mmio;
	int easy;
	CRITFLAGS

418
	DBG_HEAVY(__func__);
Linus Torvalds's avatar
Linus Torvalds committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433

	step = (width + 7) >> 3;
	charcell = height * step;
	xlen = (charcell + 3) & ~3;
	ydstlen = (yy << 16) | height;
	if (width == step << 3) {
		ar0 = height * width - 1;
		easy = 1;
	} else {
		ar0 = width - 1;
		easy = 0;
	}

	CRITBEGIN

434 435
	mga_fifo(5);
	matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
436 437 438 439 440 441 442
	if (easy)
		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE);
	else
		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_REPLACE);
	mga_outl(M_FCOL, fgx);
	mga_outl(M_BCOL, bgx);
	fxbndry = ((xx + width - 1) << 16) | xx;
443
	mmio = minfo->mmio.vbase;
Linus Torvalds's avatar
Linus Torvalds committed
444

445 446
	mga_fifo(8);
	matrox_accel_restore_maccess(minfo);
Linus Torvalds's avatar
Linus Torvalds committed
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
	mga_writel(mmio, M_FXBNDRY, fxbndry);
	mga_writel(mmio, M_AR0, ar0);
	mga_writel(mmio, M_AR3, 0);
	if (easy) {
		mga_writel(mmio, M_YDSTLEN | M_EXEC, ydstlen);
		mga_memcpy_toio(mmio, chardata, xlen);
	} else {
		mga_writel(mmio, M_AR5, 0);
		mga_writel(mmio, M_YDSTLEN | M_EXEC, ydstlen);
		if ((step & 3) == 0) {
			/* Great. Source has 32bit aligned lines, so we can feed them
			   directly to the accelerator. */
			mga_memcpy_toio(mmio, chardata, charcell);
		} else if (step == 1) {
			/* Special case for 1..8bit widths */
			while (height--) {
#if defined(__BIG_ENDIAN)
				fb_writel((*chardata) << 24, mmio.vaddr);
#else
				fb_writel(*chardata, mmio.vaddr);
#endif
				chardata++;
			}
		} else if (step == 2) {
			/* Special case for 9..15bit widths */
			while (height--) {
#if defined(__BIG_ENDIAN)
				fb_writel((*(u_int16_t*)chardata) << 16, mmio.vaddr);
#else
				fb_writel(*(u_int16_t*)chardata, mmio.vaddr);
#endif
				chardata += 2;
			}
		} else {
			/* Tell... well, why bother... */
			while (height--) {
				size_t i;
				
				for (i = 0; i < step; i += 4) {
					/* Hope that there are at least three readable bytes beyond the end of bitmap */
					fb_writel(get_unaligned((u_int32_t*)(chardata + i)),mmio.vaddr);
				}
				chardata += step;
			}
		}
	}
	WaitTillIdle();
	CRITEND
}


static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) {
499
	struct matrox_fb_info *minfo = info2minfo(info);
Linus Torvalds's avatar
Linus Torvalds committed
500

501
	DBG_HEAVY(__func__);
Linus Torvalds's avatar
Linus Torvalds committed
502 503 504 505 506 507

	if (image->depth == 1) {
		u_int32_t fgx, bgx;

		fgx = ((u_int32_t*)info->pseudo_palette)[image->fg_color];
		bgx = ((u_int32_t*)info->pseudo_palette)[image->bg_color];
508
		matroxfb_1bpp_imageblit(minfo, fgx, bgx, image->data, image->width, image->height, image->dy, image->dx);
Linus Torvalds's avatar
Linus Torvalds committed
509 510 511 512 513 514 515 516 517 518 519
	} else {
		/* Danger! image->depth is useless: logo painting code always
		   passes framebuffer color depth here, although logo data are
		   always 8bpp and info->pseudo_palette is changed to contain
		   logo palette to be used (but only for true/direct-color... sic...).
		   So do it completely in software... */
		cfb_imageblit(info, image);
	}
}

MODULE_LICENSE("GPL");