## Automatically generated incremental diff ## From: linux-2.5.70-bk5 ## To: linux-2.5.70-bk6 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.5.70-bk5/Makefile linux-2.5.70-bk6/Makefile --- linux-2.5.70-bk5/Makefile 2003-06-01 04:39:39.000000000 -0700 +++ linux-2.5.70-bk6/Makefile 2003-06-01 04:39:44.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 70 -EXTRAVERSION = -bk5 +EXTRAVERSION = -bk6 # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -urN linux-2.5.70-bk5/arch/i386/kernel/entry.S linux-2.5.70-bk6/arch/i386/kernel/entry.S --- linux-2.5.70-bk5/arch/i386/kernel/entry.S 2003-05-26 18:00:26.000000000 -0700 +++ linux-2.5.70-bk6/arch/i386/kernel/entry.S 2003-06-01 04:39:44.000000000 -0700 @@ -508,6 +508,15 @@ ENTRY(nmi) cmpl $sysenter_entry,(%esp) je nmi_stack_fixup + pushl %eax + movl %esp,%eax + /* Do not access memory above the end of our stack page, + * it might not exist. + */ + andl $0x1fff,%eax + cmpl $0x1fec,%eax + popl %eax + jae nmi_stack_correct cmpl $sysenter_entry,12(%esp) je nmi_debug_stack_check nmi_stack_correct: diff -urN linux-2.5.70-bk5/arch/ppc/boot/lib/zlib.c linux-2.5.70-bk6/arch/ppc/boot/lib/zlib.c --- linux-2.5.70-bk5/arch/ppc/boot/lib/zlib.c 2003-06-01 04:39:39.000000000 -0700 +++ linux-2.5.70-bk6/arch/ppc/boot/lib/zlib.c 2003-06-01 04:39:44.000000000 -0700 @@ -316,8 +316,9 @@ } -int inflateEnd(z) -z_stream *z; +int inflateEnd( + z_stream *z +) { uLong c; @@ -332,9 +333,10 @@ } -int inflateInit2(z, w) -z_stream *z; -int w; +int inflateInit2( + z_stream *z, + int w +) { /* initialize state */ if (z == Z_NULL) @@ -378,8 +380,9 @@ } -int inflateInit(z) -z_stream *z; +int inflateInit( + z_stream *z +) { return inflateInit2(z, DEF_WBITS); } @@ -1128,8 +1131,9 @@ * At the end of a Deflate-compressed PPP packet, we expect to have seen * a `stored' block type value but not the (zero) length bytes. */ -local int inflate_packet_flush(s) - inflate_blocks_statef *s; +local int inflate_packet_flush( + inflate_blocks_statef *s +) { if (s->mode != LENS) return Z_DATA_ERROR; @@ -1592,9 +1596,10 @@ } -local int inflate_trees_free(t, z) -inflate_huft *t; /* table to free */ -z_stream *z; /* for zfree function */ +local int inflate_trees_free( + inflate_huft *t, /* table to free */ + z_stream *z /* for zfree function */ +) /* Free the malloc'ed tables built by huft_build(), which makes a linked list of the tables it made, with the links in a dummy first entry of each table. */ diff -urN linux-2.5.70-bk5/arch/ppc64/boot/zlib.c linux-2.5.70-bk6/arch/ppc64/boot/zlib.c --- linux-2.5.70-bk5/arch/ppc64/boot/zlib.c 2003-06-01 04:39:40.000000000 -0700 +++ linux-2.5.70-bk6/arch/ppc64/boot/zlib.c 2003-06-01 04:39:44.000000000 -0700 @@ -339,8 +339,9 @@ } -int inflateEnd(z) -z_stream *z; +int inflateEnd( + z_stream *z +) { uLong c; @@ -355,9 +356,10 @@ } -int inflateInit2(z, w) -z_stream *z; -int w; +int inflateInit2( + z_stream *z, + int w +) { /* initialize state */ if (z == Z_NULL) @@ -401,8 +403,9 @@ } -int inflateInit(z) -z_stream *z; +int inflateInit( + z_stream *z +) { return inflateInit2(z, DEF_WBITS); } @@ -1151,8 +1154,9 @@ * At the end of a Deflate-compressed PPP packet, we expect to have seen * a `stored' block type value but not the (zero) length bytes. */ -local int inflate_packet_flush(s) - inflate_blocks_statef *s; +local int inflate_packet_flush( + inflate_blocks_statef *s +) { if (s->mode != LENS) return Z_DATA_ERROR; @@ -1615,9 +1619,10 @@ } -local int inflate_trees_free(t, z) -inflate_huft *t; /* table to free */ -z_stream *z; /* for zfree function */ +local int inflate_trees_free( + inflate_huft *t, /* table to free */ + z_stream *z /* for zfree function */ +) /* Free the malloc'ed tables built by huft_build(), which makes a linked list of the tables it made, with the links in a dummy first entry of each table. */ diff -urN linux-2.5.70-bk5/arch/sparc64/kernel/sys_sparc.c linux-2.5.70-bk6/arch/sparc64/kernel/sys_sparc.c --- linux-2.5.70-bk5/arch/sparc64/kernel/sys_sparc.c 2003-06-01 04:39:40.000000000 -0700 +++ linux-2.5.70-bk6/arch/sparc64/kernel/sys_sparc.c 2003-06-01 04:39:44.000000000 -0700 @@ -223,9 +223,15 @@ } if (call <= SHMCTL) switch (call) { - case SHMAT: - err = sys_shmat (first, (char *) ptr, second, (ulong *) third); + case SHMAT: { + ulong raddr; + err = sys_shmat (first, (char *) ptr, second, &raddr); + if (!err) { + if (put_user(raddr, (ulong __user *) third)) + err = -EFAULT; + } goto out; + } case SHMDT: err = sys_shmdt ((char *)ptr); goto out; diff -urN linux-2.5.70-bk5/drivers/video/Makefile linux-2.5.70-bk6/drivers/video/Makefile --- linux-2.5.70-bk5/drivers/video/Makefile 2003-05-26 18:00:23.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/Makefile 2003-06-01 04:39:46.000000000 -0700 @@ -55,7 +55,7 @@ obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_MATROX) += matrox/ +obj-$(CONFIG_FB_MATROX) += matrox/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_RIVA) += riva/ cfbimgblt.o vgastate.o obj-$(CONFIG_FB_SIS) += sis/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o obj-$(CONFIG_FB_ATY) += aty/ cfbcopyarea.o cfbfillrect.o cfbimgblt.o diff -urN linux-2.5.70-bk5/drivers/video/matrox/i2c-matroxfb.c linux-2.5.70-bk6/drivers/video/matrox/i2c-matroxfb.c --- linux-2.5.70-bk5/drivers/video/matrox/i2c-matroxfb.c 2003-05-26 18:00:39.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/i2c-matroxfb.c 2003-06-01 04:39:46.000000000 -0700 @@ -113,7 +113,7 @@ b->adapter = matrox_i2c_adapter_template; snprintf(b->adapter.dev.name, DEVICE_NAME_SIZE, name, minfo->fbcon.node); - b->adapter.data = b; + i2c_set_adapdata(&b->adapter, b); b->adapter.algo_data = &b->bac; b->bac = matrox_i2c_algo_template; b->bac.data = b; diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_DAC1064.c linux-2.5.70-bk6/drivers/video/matrox/matroxfb_DAC1064.c --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_DAC1064.c 2003-05-26 18:00:39.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_DAC1064.c 2003-06-01 04:39:46.000000000 -0700 @@ -35,132 +35,11 @@ #define DAC1064_OPT_MDIV2 0x00 #define DAC1064_OPT_RESERVED 0x10 -static void matroxfb_DAC1064_flashcursor(unsigned long ptr) { - unsigned long flags; - -#define minfo ((struct matrox_fb_info*)ptr) - matroxfb_DAC_lock_irqsave(flags); - outDAC1064(PMINFO M1064_XCURCTRL, inDAC1064(PMINFO M1064_XCURCTRL) ^ M1064_XCURCTRL_DIS ^ M1064_XCURCTRL_XGA); - ACCESS_FBINFO(cursor.timer.expires) = jiffies + HZ/2; - add_timer(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_unlock_irqrestore(flags); -#undef minfo -} - -static void matroxfb_DAC1064_createcursor(WPMINFO struct display* p) { - vaddr_t cursorbase; - u_int32_t xline; - unsigned int i; - unsigned int h, to; - CRITFLAGS - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - matroxfb_createcursorshape(PMINFO p, p->var.vmode); - - xline = (~0) << (32 - ACCESS_FBINFO(cursor.w)); - cursorbase = ACCESS_FBINFO(video.vbase); - h = ACCESS_FBINFO(features.DAC1064.cursorimage); - - CRITBEGIN - -#ifdef __BIG_ENDIAN - WaitTillIdle(); - mga_outl(M_OPMODE, M_OPMODE_32BPP); -#endif - to = ACCESS_FBINFO(cursor.u); - for (i = 0; i < to; i++) { - mga_writel(cursorbase, h, 0); - mga_writel(cursorbase, h+4, 0); - mga_writel(cursorbase, h+8, ~0); - mga_writel(cursorbase, h+12, ~0); - h += 16; - } - to = ACCESS_FBINFO(cursor.d); - for (; i < to; i++) { - mga_writel(cursorbase, h, 0); - mga_writel(cursorbase, h+4, xline); - mga_writel(cursorbase, h+8, ~0); - mga_writel(cursorbase, h+12, ~0); - h += 16; - } - for (; i < 64; i++) { - mga_writel(cursorbase, h, 0); - mga_writel(cursorbase, h+4, 0); - mga_writel(cursorbase, h+8, ~0); - mga_writel(cursorbase, h+12, ~0); - h += 16; - } -#ifdef __BIG_ENDIAN - mga_outl(M_OPMODE, ACCESS_FBINFO(accel.m_opmode)); -#endif - - CRITEND -} - -static void matroxfb_DAC1064_cursor(struct display* p, int mode, int x, int y) { - unsigned long flags; - MINFO_FROM_DISP(p); - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - if (mode == CM_ERASE) { - if (ACCESS_FBINFO(cursor.state) != CM_ERASE) { - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_lock_irqsave(flags); - ACCESS_FBINFO(cursor.state) = CM_ERASE; - outDAC1064(PMINFO M1064_XCURCTRL, M1064_XCURCTRL_DIS); - matroxfb_DAC_unlock_irqrestore(flags); - } - return; - } - if ((p->conp->vc_cursor_type & CUR_HWMASK) != ACCESS_FBINFO(cursor.type)) - matroxfb_DAC1064_createcursor(PMINFO p); - x *= fontwidth(p); - y *= fontheight(p); - y -= p->var.yoffset; - if (p->var.vmode & FB_VMODE_DOUBLE) - y *= 2; - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_lock_irqsave(flags); - if ((x != ACCESS_FBINFO(cursor.x)) || (y != ACCESS_FBINFO(cursor.y)) || ACCESS_FBINFO(cursor.redraw)) { - ACCESS_FBINFO(cursor.redraw) = 0; - ACCESS_FBINFO(cursor.x) = x; - ACCESS_FBINFO(cursor.y) = y; - x += 64; - y += 64; - outDAC1064(PMINFO M1064_XCURCTRL, M1064_XCURCTRL_DIS); - mga_outb(M_RAMDAC_BASE+M1064_CURPOSXL, x); - mga_outb(M_RAMDAC_BASE+M1064_CURPOSXH, x >> 8); - mga_outb(M_RAMDAC_BASE+M1064_CURPOSYL, y); - mga_outb(M_RAMDAC_BASE+M1064_CURPOSYH, y >> 8); - } - ACCESS_FBINFO(cursor.state) = CM_DRAW; - if (ACCESS_FBINFO(devflags.blink)) - mod_timer(&ACCESS_FBINFO(cursor.timer), jiffies + HZ/2); - outDAC1064(PMINFO M1064_XCURCTRL, M1064_XCURCTRL_XGA); - matroxfb_DAC_unlock_irqrestore(flags); -} - -static int matroxfb_DAC1064_setfont(struct display* p, int width, int height) { - if (p && p->conp) - matroxfb_DAC1064_createcursor(PMXINFO(p) p); - return 0; -} - -static int DAC1064_selhwcursor(WPMINFO2) { - ACCESS_FBINFO(dispsw.cursor) = matroxfb_DAC1064_cursor; - ACCESS_FBINFO(dispsw.set_font) = matroxfb_DAC1064_setfont; - return 0; -} - static void DAC1064_calcclock(CPMINFO unsigned int freq, unsigned int fmax, unsigned int* in, unsigned int* feed, unsigned int* post) { unsigned int fvco; unsigned int p; - DBG("DAC1064_calcclock") + DBG(__FUNCTION__) /* only for devices older than G450 */ @@ -206,7 +85,7 @@ static void DAC1064_setpclk(WPMINFO unsigned long fout) { unsigned int m, n, p; - DBG("DAC1064_setpclk") + DBG(__FUNCTION__) DAC1064_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); ACCESS_FBINFO(hw).DACclk[0] = m; @@ -218,7 +97,7 @@ u_int32_t mx; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("DAC1064_setmclk") + DBG(__FUNCTION__) if (ACCESS_FBINFO(devflags.noinit)) { /* read MCLK and give up... */ @@ -461,15 +340,10 @@ static int DAC1064_init_1(WPMINFO struct my_timming* m) { struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("DAC1064_init_1") + DBG(__FUNCTION__) memcpy(hw->DACreg, MGA1064_DAC, sizeof(MGA1064_DAC_regs)); - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - hw->DACreg[POS1064_XMISCCTRL] = M1064_XMISCCTRL_DAC_6BIT; - hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_8BPP - | M1064_XMULCTRL_GRAPHICS_PALETIZED; - } else { - switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { + switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { /* case 4: not supported by MGA1064 DAC */ case 8: hw->DACreg[POS1064_XMULCTRL] = M1064_XMULCTRL_DEPTH_8BPP | M1064_XMULCTRL_GRAPHICS_PALETIZED; @@ -488,13 +362,12 @@ break; default: return 1; /* unsupported depth */ - } } hw->DACreg[POS1064_XVREFCTRL] = ACCESS_FBINFO(features.DAC1064.xvrefctrl); hw->DACreg[POS1064_XGENCTRL] &= ~M1064_XGENCTRL_SYNC_ON_GREEN_MASK; hw->DACreg[POS1064_XGENCTRL] |= (m->sync & FB_SYNC_ON_GREEN)?M1064_XGENCTRL_SYNC_ON_GREEN:M1064_XGENCTRL_NO_SYNC_ON_GREEN; - hw->DACreg[POS1064_XCURADDL] = ACCESS_FBINFO(features.DAC1064.cursorimage) >> 10; - hw->DACreg[POS1064_XCURADDH] = ACCESS_FBINFO(features.DAC1064.cursorimage) >> 18; + hw->DACreg[POS1064_XCURADDL] = 0; + hw->DACreg[POS1064_XCURADDH] = 0; DAC1064_global_init(PMINFO2); return 0; @@ -503,7 +376,7 @@ static int DAC1064_init_2(WPMINFO struct my_timming* m) { struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("DAC1064_init_2") + DBG(__FUNCTION__) if (ACCESS_FBINFO(fbcon).var.bits_per_pixel > 16) { /* 256 entries */ int i; @@ -547,7 +420,7 @@ CRITFLAGS - DBG("DAC1064_restore_1") + DBG(__FUNCTION__) CRITBEGIN @@ -572,14 +445,13 @@ CRITEND }; -static void DAC1064_restore_2(WPMINFO struct display* p) { +static void DAC1064_restore_2(WPMINFO2) { #ifdef DEBUG unsigned int i; #endif - DBG("DAC1064_restore_2") + DBG(__FUNCTION__) - matrox_init_putc(PMINFO p, matroxfb_DAC1064_createcursor); #ifdef DEBUG dprintk(KERN_DEBUG "DAC1064regs "); for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { @@ -648,13 +520,13 @@ #endif /* NEED_DAC1064 */ #ifdef CONFIG_FB_MATROX_MYSTIQUE -static int MGA1064_init(WPMINFO struct my_timming* m, struct display* p) { +static int MGA1064_init(WPMINFO struct my_timming* m) { struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("MGA1064_init") + DBG(__FUNCTION__) if (DAC1064_init_1(PMINFO m)) return 1; - if (matroxfb_vgaHWinit(PMINFO m, p)) return 1; + if (matroxfb_vgaHWinit(PMINFO m)) return 1; hw->MiscOutReg = 0xCB; if (m->sync & FB_SYNC_HOR_HIGH_ACT) @@ -670,14 +542,14 @@ #endif #ifdef CONFIG_FB_MATROX_G100 -static int MGAG100_init(WPMINFO struct my_timming* m, struct display* p) { +static int MGAG100_init(WPMINFO struct my_timming* m) { struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("MGAG100_init") + DBG(__FUNCTION__) if (DAC1064_init_1(PMINFO m)) return 1; hw->MXoptionReg &= ~0x2000; - if (matroxfb_vgaHWinit(PMINFO m, p)) return 1; + if (matroxfb_vgaHWinit(PMINFO m)) return 1; hw->MiscOutReg = 0xEF; if (m->sync & FB_SYNC_HOR_HIGH_ACT) @@ -695,7 +567,7 @@ #ifdef CONFIG_FB_MATROX_MYSTIQUE static void MGA1064_ramdac_init(WPMINFO2) { - DBG("MGA1064_ramdac_init"); + DBG(__FUNCTION__) /* ACCESS_FBINFO(features.DAC1064.vco_freq_min) = 120000; */ ACCESS_FBINFO(features.pll.vco_freq_min) = 62000; @@ -724,7 +596,7 @@ int selClk; int clk; - DBG("MGAG100_progPixClock") + DBG(__FUNCTION__) outDAC1064(PMINFO M1064_XPIXCLKCTRL, inDAC1064(PMINFO M1064_XPIXCLKCTRL) | M1064_XPIXCLKCTRL_DIS | M1064_XPIXCLKCTRL_PLL_UP); @@ -766,7 +638,7 @@ static void MGAG100_setPixClock(CPMINFO int flags, int freq) { unsigned int m, n, p; - DBG("MGAG100_setPixClock") + DBG(__FUNCTION__) DAC1064_calcclock(PMINFO freq, ACCESS_FBINFO(max_pixel_clock), &m, &n, &p); MGAG100_progPixClock(PMINFO flags, m, n, p); @@ -780,13 +652,12 @@ 2048, 0}; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("MGA1064_preinit") + DBG(__FUNCTION__) /* ACCESS_FBINFO(capable.cfb4) = 0; ... preinitialized by 0 */ ACCESS_FBINFO(capable.text) = 1; ACCESS_FBINFO(capable.vxres) = vxres_mystique; ACCESS_FBINFO(features.accel.has_cacheflush) = 1; - ACCESS_FBINFO(cursor.timer.function) = matroxfb_DAC1064_flashcursor; ACCESS_FBINFO(outputs[0]).output = &m1064; ACCESS_FBINFO(outputs[0]).src = MATROXFB_SRC_CRTC1; @@ -815,12 +686,8 @@ static void MGA1064_reset(WPMINFO2) { - DBG("MGA1064_reset"); + DBG(__FUNCTION__); - ACCESS_FBINFO(features.DAC1064.cursorimage) = ACCESS_FBINFO(video.len_usable) - 1024; - if (ACCESS_FBINFO(devflags.hwcursor)) - ACCESS_FBINFO(video.len_usable) -= 1024; - matroxfb_fastfont_init(MINFO); MGA1064_ramdac_init(PMINFO2); } #endif @@ -960,7 +827,7 @@ u_int32_t q; #endif - DBG("MGAG100_preinit") + DBG(__FUNCTION__) /* there are some instabilities if in_div > 19 && vco < 61000 */ if (ACCESS_FBINFO(devflags.g450dac)) { @@ -981,7 +848,6 @@ ACCESS_FBINFO(capable.text) = 1; ACCESS_FBINFO(capable.vxres) = vxres_g100; ACCESS_FBINFO(features.accel.has_cacheflush) = 1; - ACCESS_FBINFO(cursor.timer.function) = matroxfb_DAC1064_flashcursor; ACCESS_FBINFO(capable.plnwt) = ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG100 ? ACCESS_FBINFO(devflags.sgram) : 1; @@ -1099,12 +965,7 @@ u_int8_t b; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("MGAG100_reset") - - ACCESS_FBINFO(features.DAC1064.cursorimage) = ACCESS_FBINFO(video.len_usable) - 1024; - if (ACCESS_FBINFO(devflags.hwcursor)) - ACCESS_FBINFO(video.len_usable) -= 1024; - matroxfb_fastfont_init(MINFO); + DBG(__FUNCTION__) { #ifdef G100_BROKEN_IBM_82351 @@ -1157,13 +1018,13 @@ #endif #ifdef CONFIG_FB_MATROX_MYSTIQUE -static void MGA1064_restore(WPMINFO struct display* p) { +static void MGA1064_restore(WPMINFO2) { int i; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); CRITFLAGS - DBG("MGA1064_restore") + DBG(__FUNCTION__) CRITBEGIN @@ -1177,18 +1038,18 @@ matroxfb_vgaHWrestore(PMINFO2); for (i = 0; i < 6; i++) mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); - DAC1064_restore_2(PMINFO p); + DAC1064_restore_2(PMINFO2); } #endif #ifdef CONFIG_FB_MATROX_G100 -static void MGAG100_restore(WPMINFO struct display* p) { +static void MGAG100_restore(WPMINFO2) { int i; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); CRITFLAGS - DBG("MGAG100_restore") + DBG(__FUNCTION__) CRITBEGIN @@ -1203,20 +1064,20 @@ #endif for (i = 0; i < 6; i++) mga_setr(M_EXTVGA_INDEX, i, hw->CRTCEXT[i]); - DAC1064_restore_2(PMINFO p); + DAC1064_restore_2(PMINFO2); } #endif #ifdef CONFIG_FB_MATROX_MYSTIQUE struct matrox_switch matrox_mystique = { - MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, DAC1064_selhwcursor + MGA1064_preinit, MGA1064_reset, MGA1064_init, MGA1064_restore, }; EXPORT_SYMBOL(matrox_mystique); #endif #ifdef CONFIG_FB_MATROX_G100 struct matrox_switch matrox_G100 = { - MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, DAC1064_selhwcursor + MGAG100_preinit, MGAG100_reset, MGAG100_init, MGAG100_restore, }; EXPORT_SYMBOL(matrox_G100); #endif diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_Ti3026.c linux-2.5.70-bk6/drivers/video/matrox/matroxfb_Ti3026.c --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_Ti3026.c 2003-05-26 18:00:20.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_Ti3026.c 2003-06-01 04:39:46.000000000 -0700 @@ -281,138 +281,11 @@ TVP3026_XCOLKEYCTRL_ZOOM1, 0x00, 0x00, TVP3026_XCURCTRL_DIS }; -static void matroxfb_ti3026_flashcursor(unsigned long ptr) { - unsigned long flags; - -#define minfo ((struct matrox_fb_info*)ptr) - matroxfb_DAC_lock_irqsave(flags); - outTi3026(PMINFO TVP3026_XCURCTRL, inTi3026(PMINFO TVP3026_XCURCTRL) ^ TVP3026_XCURCTRL_DIS ^ TVP3026_XCURCTRL_XGA); - ACCESS_FBINFO(cursor.timer.expires) = jiffies + HZ/2; - add_timer(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_unlock_irqrestore(flags); -#undef minfo -} - -static void matroxfb_ti3026_createcursor(WPMINFO struct display* p) { - unsigned long flags; - u_int32_t xline; - unsigned int i; - unsigned int to; - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - DBG("matroxfb_ti3026_createcursor"); - - matroxfb_createcursorshape(PMINFO p, p->var.vmode); - - xline = (~0) << (32 - ACCESS_FBINFO(cursor.w)); - matroxfb_DAC_lock_irqsave(flags); - mga_outb(M_RAMDAC_BASE+TVP3026_INDEX, 0); - to = ACCESS_FBINFO(cursor.u); - for (i = 0; i < to; i++) { - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - } - to = ACCESS_FBINFO(cursor.d); - for (; i < to; i++) { - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, xline >> 24); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, xline >> 16); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, xline >> 8); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, xline); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - } - for (; i < 64; i++) { - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0); - } - for (i = 0; i < 512; i++) - mga_outb(M_RAMDAC_BASE+TVP3026_CURRAMDATA, 0xFF); - matroxfb_DAC_unlock_irqrestore(flags); -} - -static void matroxfb_ti3026_cursor(struct display* p, int mode, int x, int y) { - unsigned long flags; - MINFO_FROM_DISP(p); - - DBG("matroxfb_ti3026_cursor") - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - if (mode == CM_ERASE) { - if (ACCESS_FBINFO(cursor.state) != CM_ERASE) { - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_lock_irqsave(flags); - ACCESS_FBINFO(cursor.state) = CM_ERASE; - outTi3026(PMINFO TVP3026_XCURCTRL, ACCESS_FBINFO(hw.DACreg[POS3026_XCURCTRL])); - matroxfb_DAC_unlock_irqrestore(flags); - } - return; - } - if ((p->conp->vc_cursor_type & CUR_HWMASK) != ACCESS_FBINFO(cursor.type)) - matroxfb_ti3026_createcursor(PMINFO p); - x *= fontwidth(p); - y *= fontheight(p); - y -= p->var.yoffset; - if (p->var.vmode & FB_VMODE_DOUBLE) - y *= 2; - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); - matroxfb_DAC_lock_irqsave(flags); - if ((x != ACCESS_FBINFO(cursor.x)) || (y != ACCESS_FBINFO(cursor.y)) || ACCESS_FBINFO(cursor.redraw)) { - ACCESS_FBINFO(cursor.redraw) = 0; - ACCESS_FBINFO(cursor.x) = x; - ACCESS_FBINFO(cursor.y) = y; - x += 64; - y += 64; - outTi3026(PMINFO TVP3026_XCURCTRL, ACCESS_FBINFO(hw.DACreg[POS3026_XCURCTRL])); - mga_outb(M_RAMDAC_BASE+TVP3026_CURPOSXL, x); - mga_outb(M_RAMDAC_BASE+TVP3026_CURPOSXH, x >> 8); - mga_outb(M_RAMDAC_BASE+TVP3026_CURPOSYL, y); - mga_outb(M_RAMDAC_BASE+TVP3026_CURPOSYH, y >> 8); - } - ACCESS_FBINFO(cursor.state) = CM_DRAW; - if (ACCESS_FBINFO(devflags.blink)) - mod_timer(&ACCESS_FBINFO(cursor.timer), jiffies + HZ/2); - outTi3026(PMINFO TVP3026_XCURCTRL, ACCESS_FBINFO(hw.DACreg[POS3026_XCURCTRL]) | TVP3026_XCURCTRL_XGA); - matroxfb_DAC_unlock_irqrestore(flags); -} - -static int matroxfb_ti3026_setfont(struct display* p, int width, int height) { - - DBG("matrox_ti3026_setfont"); - - if (p && p->conp) - matroxfb_ti3026_createcursor(PMXINFO(p) p); - return 0; -} - -static int matroxfb_ti3026_selhwcursor(WPMINFO2) { - ACCESS_FBINFO(dispsw.cursor) = matroxfb_ti3026_cursor; - ACCESS_FBINFO(dispsw.set_font) = matroxfb_ti3026_setfont; - return 0; -} - static int Ti3026_calcclock(CPMINFO unsigned int freq, unsigned int fmax, int* in, int* feed, int* post) { unsigned int fvco; unsigned int lin, lfeed, lpost; - DBG("Ti3026_calcclock") + DBG(__FUNCTION__) fvco = PLL_calcclock(PMINFO freq, fmax, &lin, &lfeed, &lpost); fvco >>= (*post = lpost); @@ -421,12 +294,12 @@ return fvco; } -static int Ti3026_setpclk(WPMINFO int clk, struct display* p) { +static int Ti3026_setpclk(WPMINFO int clk) { unsigned int f_pll; unsigned int pixfeed, pixin, pixpost; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("Ti3026_setpclk") + DBG(__FUNCTION__) f_pll = Ti3026_calcclock(PMINFO clk, ACCESS_FBINFO(max_pixel_clock), &pixin, &pixfeed, &pixpost); @@ -434,18 +307,13 @@ hw->DACclk[1] = pixfeed; hw->DACclk[2] = pixpost | 0xB0; - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - hw->DACreg[POS3026_XMEMPLLCTRL] = TVP3026_XMEMPLLCTRL_MCLK_MCLKPLL | TVP3026_XMEMPLLCTRL_RCLK_PIXPLL; - hw->DACclk[3] = 0xFD; - hw->DACclk[4] = 0x3D; - hw->DACclk[5] = 0x70; - } else { + { unsigned int loopfeed, loopin, looppost, loopdiv, z; unsigned int Bpp; Bpp = ACCESS_FBINFO(curr.final_bppShift); - if (p->var.bits_per_pixel == 24) { + if (ACCESS_FBINFO(fbcon).var.bits_per_pixel == 24) { loopfeed = 3; /* set lm to any possible value */ loopin = 3 * 32 / Bpp; } else { @@ -464,7 +332,7 @@ looppost = 3; loopdiv = z/16; } - if (p->var.bits_per_pixel == 24) { + if (ACCESS_FBINFO(fbcon).var.bits_per_pixel == 24) { hw->DACclk[3] = ((65 - loopin) & 0x3F) | 0xC0; hw->DACclk[4] = (65 - loopfeed) | 0x80; if (ACCESS_FBINFO(accel.ramdac_rev) > 0x20) { @@ -495,22 +363,14 @@ return 0; } -static int Ti3026_init(WPMINFO struct my_timming* m, struct display* p) { +static int Ti3026_init(WPMINFO struct my_timming* m) { u_int8_t muxctrl = isInterleave(MINFO) ? TVP3026_XMUXCTRL_MEMORY_64BIT : TVP3026_XMUXCTRL_MEMORY_32BIT; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("Ti3026_init") + DBG(__FUNCTION__) memcpy(hw->DACreg, MGADACbpp32, sizeof(hw->DACreg)); - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_8_1; - hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR; - hw->DACreg[POS3026_XMUXCTRL] = TVP3026_XMUXCTRL_VGA; - hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | - TVP3026_XCLKCTRL_DIV4; - hw->DACreg[POS3026_XMISCCTRL] = TVP3026_XMISCCTRL_DAC_PUP | TVP3026_XMISCCTRL_DAC_6BIT | TVP3026_XMISCCTRL_PSEL_DIS | TVP3026_XMISCCTRL_PSEL_LOW; - } else { - switch (p->var.bits_per_pixel) { + switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { case 4: hw->DACreg[POS3026_XLATCHCTRL] = TVP3026_XLATCHCTRL_16_1; /* or _8_1, they are same */ hw->DACreg[POS3026_XTRUECOLORCTRL] = TVP3026_XTRUECOLORCTRL_PSEUDOCOLOR; hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_4BIT; @@ -525,7 +385,7 @@ break; case 16: /* XLATCHCTRL should be _4_1 / _2_1... Why is not? (_2_1 is used everytime) */ - hw->DACreg[POS3026_XTRUECOLORCTRL] = (p->var.green.length == 5)? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555 ) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565); + hw->DACreg[POS3026_XTRUECOLORCTRL] = (ACCESS_FBINFO(fbcon).var.green.length == 5)? (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_ORGB_1555 ) : (TVP3026_XTRUECOLORCTRL_DIRECTCOLOR | TVP3026_XTRUECOLORCTRL_RGB_565); hw->DACreg[POS3026_XMUXCTRL] = muxctrl | TVP3026_XMUXCTRL_PIXEL_16BIT; hw->DACreg[POS3026_XCLKCTRL] = TVP3026_XCLKCTRL_SRC_PLL | TVP3026_XCLKCTRL_DIV2; break; @@ -541,9 +401,8 @@ break; default: return 1; /* TODO: failed */ - } } - if (matroxfb_vgaHWinit(PMINFO m, p)) return 1; + if (matroxfb_vgaHWinit(PMINFO m)) return 1; /* set SYNC */ hw->MiscOutReg = 0xCB; @@ -569,10 +428,10 @@ /* set interleaving */ hw->MXoptionReg &= ~0x00001000; - if ((ACCESS_FBINFO(fbcon).fix.type != FB_TYPE_TEXT) && isInterleave(MINFO)) hw->MXoptionReg |= 0x00001000; + if (isInterleave(MINFO)) hw->MXoptionReg |= 0x00001000; /* set DAC */ - Ti3026_setpclk(PMINFO m->pixclock, p); + Ti3026_setpclk(PMINFO m->pixclock); return 0; } @@ -583,7 +442,7 @@ unsigned int rfhcnt, mclk_ctl; int tmout; - DBG("ti3026_setMCLK") + DBG(__FUNCTION__) f_pll = Ti3026_calcclock(PMINFO fout, ACCESS_FBINFO(max_pixel_clock), &mclk_n, &mclk_m, &mclk_p); @@ -677,7 +536,7 @@ static void ti3026_ramdac_init(WPMINFO2) { - DBG("ti3026_ramdac_init") + DBG(__FUNCTION__) ACCESS_FBINFO(features.pll.vco_freq_min) = 110000; ACCESS_FBINFO(features.pll.ref_freq) = 114545; @@ -691,13 +550,13 @@ ti3026_setMCLK(PMINFO 60000); } -static void Ti3026_restore(WPMINFO struct display* p) { +static void Ti3026_restore(WPMINFO2) { int i; unsigned char progdac[6]; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); CRITFLAGS - DBG("Ti3026_restore") + DBG(__FUNCTION__) #ifdef DEBUG dprintk(KERN_INFO "EXTVGA regs: "); @@ -788,7 +647,6 @@ dprintk(KERN_INFO "LoopPLL: %d\n", 500000-tmout); } } - matrox_init_putc(PMINFO p, matroxfb_ti3026_createcursor); #ifdef DEBUG dprintk(KERN_DEBUG "3026DACregs "); @@ -805,9 +663,7 @@ static void Ti3026_reset(WPMINFO2) { - DBG("Ti3026_reset") - - matroxfb_fastfont_init(MINFO); + DBG(__FUNCTION__) ti3026_ramdac_init(PMINFO2); } @@ -825,14 +681,13 @@ 2048, 0}; struct matrox_hw_state* hw = &ACCESS_FBINFO(hw); - DBG("Ti3026_preinit") + DBG(__FUNCTION__) ACCESS_FBINFO(millenium) = 1; ACCESS_FBINFO(milleniumII) = (ACCESS_FBINFO(pcidev)->device != PCI_DEVICE_ID_MATROX_MIL); ACCESS_FBINFO(capable.cfb4) = 1; ACCESS_FBINFO(capable.text) = 1; /* isMilleniumII(MINFO); */ ACCESS_FBINFO(capable.vxres) = isMilleniumII(MINFO)?vxres_mill2:vxres_mill1; - ACCESS_FBINFO(cursor.timer.function) = matroxfb_ti3026_flashcursor; ACCESS_FBINFO(outputs[0]).data = MINFO; ACCESS_FBINFO(outputs[0]).output = &ti3026_output; @@ -876,7 +731,7 @@ } struct matrox_switch matrox_millennium = { - Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore, matroxfb_ti3026_selhwcursor + Ti3026_preinit, Ti3026_reset, Ti3026_init, Ti3026_restore }; EXPORT_SYMBOL(matrox_millennium); #endif diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_accel.c linux-2.5.70-bk6/drivers/video/matrox/matroxfb_accel.c --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_accel.c 2003-05-26 18:00:41.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_accel.c 2003-06-01 04:39:46.000000000 -0700 @@ -85,44 +85,101 @@ #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; + } + pal[i] = 0xFFFFFFFF; +} + +static inline void matrox_cfb8_pal(u_int32_t* pal) { + unsigned int i; + + for (i = 0; i < 16; i++) { + pal[i] = i * 0x01010101U; + } + pal[i] = 0x0F0F0F0F; +} + +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); + void matrox_cfbX_init(WPMINFO2) { u_int32_t maccess; u_int32_t mpitch; u_int32_t mopmode; + int accel; - DBG("matrox_cfbX_init") + DBG(__FUNCTION__) mpitch = ACCESS_FBINFO(fbcon).var.xres_virtual; - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - maccess = 0x00000000; - mpitch = (mpitch >> 4) | 0x8000; /* set something */ - mopmode = M_OPMODE_8BPP; - } else { - switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { + ACCESS_FBINFO(fbops).fb_copyarea = cfb_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = cfb_fillrect; + ACCESS_FBINFO(fbops).fb_imageblit = cfb_imageblit; + ACCESS_FBINFO(fbops).fb_cursor = soft_cursor; + + accel = (ACCESS_FBINFO(fbcon).var.accel_flags & FB_ACCELF_TEXT) == FB_ACCELF_TEXT; + + switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { case 4: maccess = 0x00000000; /* accelerate as 8bpp video */ mpitch = (mpitch >> 1) | 0x8000; /* disable linearization */ mopmode = M_OPMODE_4BPP; + matrox_cfb4_pal(ACCESS_FBINFO(cmap)); + if (accel && !(mpitch & 1)) { + ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_cfb4_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_cfb4_fillrect; + } break; case 8: maccess = 0x00000000; mopmode = M_OPMODE_8BPP; + matrox_cfb8_pal(ACCESS_FBINFO(cmap)); + if (accel) { + ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; + ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; + } break; - case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) + case 16: if (ACCESS_FBINFO(fbcon).var.green.length == 5) { maccess = 0xC0000001; - else + ACCESS_FBINFO(cmap[16]) = 0x7FFF7FFF; + } else { maccess = 0x40000001; + ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; + } mopmode = M_OPMODE_16BPP; + if (accel) { + ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; + ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; + } break; case 24: maccess = 0x00000003; mopmode = M_OPMODE_24BPP; + ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; + if (accel) { + ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; + ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; + } break; case 32: maccess = 0x00000002; mopmode = M_OPMODE_32BPP; + ACCESS_FBINFO(cmap[16]) = 0xFFFFFFFF; + if (accel) { + ACCESS_FBINFO(fbops).fb_copyarea = matroxfb_copyarea; + ACCESS_FBINFO(fbops).fb_fillrect = matroxfb_fillrect; + ACCESS_FBINFO(fbops).fb_imageblit = matroxfb_imageblit; + } break; default: maccess = 0x00000000; mopmode = 0x00000000; break; /* turn off acceleration!!! */ - } } mga_fifo(8); mga_outl(M_PITCH, mpitch); @@ -145,36 +202,29 @@ EXPORT_SYMBOL(matrox_cfbX_init); -static void matrox_cfbX_bmove(struct display* p, int sy, int sx, int dy, int dx, int height, int width) { - int pixx = p->var.xres_virtual, start, end; +static void matrox_accel_bmove(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { + int start, end; CRITFLAGS - MINFO_FROM_DISP(p); - DBG("matrox_cfbX_bmove") + DBG(__FUNCTION__) CRITBEGIN - sx *= fontwidth(p); - dx *= fontwidth(p); - width *= fontwidth(p); - height *= fontheight(p); - sy *= fontheight(p); - dy *= fontheight(p); if ((dy < sy) || ((dy == sy) && (dx <= sx))) { mga_fifo(2); mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SHIFTZERO | M_DWG_SGNZERO | M_DWG_BFCOL | M_DWG_REPLACE); - mga_outl(M_AR5, pixx); + mga_outl(M_AR5, vxres); width--; - start = sy*pixx+sx+curr_ydstorg(MINFO); + start = sy*vxres+sx+curr_ydstorg(MINFO); end = start+width; } else { mga_fifo(3); 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, -pixx); + mga_outl(M_AR5, -vxres); width--; - end = (sy+height-1)*pixx+sx+curr_ydstorg(MINFO); + end = (sy+height-1)*vxres+sx+curr_ydstorg(MINFO); start = end+width; dy += height-1; } @@ -188,47 +238,29 @@ CRITEND } -#ifdef FBCON_HAS_CFB4 -static void matrox_cfb4_bmove(struct display* p, int sy, int sx, int dy, int dx, int height, int width) { - int pixx, start, end; +static void matrox_accel_bmove_lin(WPMINFO int vxres, int sy, int sx, int dy, int dx, int height, int width) { + int start, end; CRITFLAGS - MINFO_FROM_DISP(p); - /* both (sx or dx or width) and fontwidth() are odd, so their multiply is - also odd, that means that we cannot use acceleration */ - DBG("matrox_cfb4_bmove") + DBG(__FUNCTION__) CRITBEGIN - if ((sx | dx | width) & fontwidth(p) & 1) { - fbcon_cfb4_bmove(p, sy, sx, dy, dx, height, width); - return; - } - sx *= fontwidth(p); - dx *= fontwidth(p); - width *= fontwidth(p); - height *= fontheight(p); - sy *= fontheight(p); - dy *= fontheight(p); - pixx = p->var.xres_virtual >> 1; - sx >>= 1; - dx >>= 1; - width >>= 1; if ((dy < sy) || ((dy == sy) && (dx <= sx))) { mga_fifo(2); - mga_outl(M_AR5, pixx); 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--; - start = sy*pixx+sx+curr_ydstorg(MINFO); + start = sy*vxres+sx+curr_ydstorg(MINFO); end = start+width; } else { mga_fifo(3); - mga_outl(M_SGN, 5); - mga_outl(M_AR5, -pixx); 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--; - end = (sy+height-1)*pixx+sx+curr_ydstorg(MINFO); + end = (sy+height-1)*vxres+sx+curr_ydstorg(MINFO); start = end+width; dy += height-1; } @@ -236,19 +268,33 @@ mga_outl(M_AR0, end); mga_outl(M_AR3, start); mga_outl(M_FXBNDRY, ((dx+width)<<16) | dx); - mga_outl(M_YDST, dy*pixx >> 5); + mga_outl(M_YDST, dy*vxres >> 5); mga_outl(M_LEN | M_EXEC, height); WaitTillIdle(); CRITEND } -#endif + +static void matroxfb_cfb4_copyarea(struct fb_info* info, const struct fb_copyarea* area) { + MINFO_FROM_INFO(info); + + if ((area->sx | area->dx | area->width) & 1) + cfb_copyarea(info, area); + else + matrox_accel_bmove_lin(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual) >> 1, area->sy, area->sx >> 1, area->dy, area->dx >> 1, area->height, area->width >> 1); +} + +static void matroxfb_copyarea(struct fb_info* info, const struct fb_copyarea* area) { + MINFO_FROM_INFO(info); + + matrox_accel_bmove(PMINFO ACCESS_FBINFO(fbcon.var.xres_virtual), area->sy, area->sx, area->dy, area->dx, area->height, area->width); +} static void matroxfb_accel_clear(WPMINFO u_int32_t color, int sy, int sx, int height, int width) { CRITFLAGS - DBG("matroxfb_accel_clear") + DBG(__FUNCTION__) CRITBEGIN @@ -262,34 +308,25 @@ CRITEND } -static void matrox_cfbX_clear(u_int32_t color, struct display* p, int sy, int sx, int height, int width) { - - DBG("matrox_cfbX_clear") +static void matroxfb_fillrect(struct fb_info* info, const struct fb_fillrect* rect) { + MINFO_FROM_INFO(info); - matroxfb_accel_clear(PMXINFO(p) color, sy * fontheight(p), sx * fontwidth(p), - height * fontheight(p), width * fontwidth(p)); + switch (rect->rop) { + case ROP_COPY: + matroxfb_accel_clear(PMINFO ((u_int32_t*)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); + break; + } } -#ifdef FBCON_HAS_CFB4 -static void matrox_cfb4_clear(struct vc_data* conp, struct display* p, int sy, int sx, int height, int width) { - u_int32_t bgx; +static void matroxfb_cfb4_clear(WPMINFO u_int32_t bgx, int sy, int sx, int height, int width) { int whattodo; CRITFLAGS - MINFO_FROM_DISP(p); - DBG("matrox_cfb4_clear") + DBG(__FUNCTION__) CRITBEGIN whattodo = 0; - bgx = attr_bgcol_ec(p, conp); - bgx |= bgx << 4; - bgx |= bgx << 8; - bgx |= bgx << 16; - sy *= fontheight(p); - sx *= fontwidth(p); - height *= fontheight(p); - width *= fontwidth(p); if (sx & 1) { sx ++; if (!width) return; @@ -306,12 +343,12 @@ mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_REPLACE2); mga_outl(M_FCOL, bgx); mga_outl(M_FXBNDRY, ((sx + width) << 16) | sx); - mga_outl(M_YDST, sy * p->var.xres_virtual >> 6); + mga_outl(M_YDST, sy * ACCESS_FBINFO(fbcon).var.xres_virtual >> 6); mga_outl(M_LEN | M_EXEC, height); WaitTillIdle(); } if (whattodo) { - u_int32_t step = p->var.xres_virtual >> 1; + u_int32_t step = ACCESS_FBINFO(fbcon).var.xres_virtual >> 1; vaddr_t vbase = ACCESS_FBINFO(video.vbase); if (whattodo & 1) { unsigned int uaddr = sy * step + sx - 1; @@ -335,227 +372,19 @@ CRITEND } -#endif -#ifdef FBCON_HAS_CFB8 -static void matrox_cfb8_clear(struct vc_data* conp, struct display* p, int sy, int sx, int height, int width) { - u_int32_t bgx; - - DBG("matrox_cfb8_clear") - - bgx = attr_bgcol_ec(p, conp); - bgx |= bgx << 8; - bgx |= bgx << 16; - matrox_cfbX_clear(bgx, p, sy, sx, height, width); -} -#endif +static void matroxfb_cfb4_fillrect(struct fb_info* info, const struct fb_fillrect* rect) { + MINFO_FROM_INFO(info); -#ifdef FBCON_HAS_CFB16 -static void matrox_cfb16_clear(struct vc_data* conp, struct display* p, int sy, int sx, int height, int width) { - u_int32_t bgx; - - DBG("matrox_cfb16_clear") - - bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - matrox_cfbX_clear((bgx << 16) | bgx, p, sy, sx, height, width); -} -#endif - -#if defined(FBCON_HAS_CFB32) || defined(FBCON_HAS_CFB24) -static void matrox_cfb32_clear(struct vc_data* conp, struct display* p, int sy, int sx, int height, int width) { - u_int32_t bgx; - - DBG("matrox_cfb32_clear") - - bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; - matrox_cfbX_clear(bgx, p, sy, sx, height, width); -} -#endif - -static void matrox_cfbX_fastputc(u_int32_t fgx, u_int32_t bgx, struct display* p, int c, int yy, int xx) { - unsigned int charcell; - unsigned int ar3; - CRITFLAGS - MINFO_FROM_DISP(p); - - charcell = fontwidth(p) * fontheight(p); - yy *= fontheight(p); - xx *= fontwidth(p); - - CRITBEGIN - - mga_fifo(8); - mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); - - mga_outl(M_FCOL, fgx); - mga_outl(M_BCOL, bgx); - mga_outl(M_FXBNDRY, ((xx + fontwidth(p) - 1) << 16) | xx); - ar3 = ACCESS_FBINFO(fastfont.mgabase) + (c & p->charmask) * charcell; - mga_outl(M_AR3, ar3); - mga_outl(M_AR0, (ar3 + charcell - 1) & 0x0003FFFF); - mga_ydstlen(yy, fontheight(p)); - WaitTillIdle(); - - CRITEND -} - -static void matrox_cfbX_putc(u_int32_t fgx, u_int32_t bgx, struct display* p, int c, int yy, int xx) { - u_int32_t ar0; - u_int32_t step; - CRITFLAGS - MINFO_FROM_DISP(p); - - DBG_HEAVY("matrox_cfbX_putc"); - - yy *= fontheight(p); - xx *= fontwidth(p); - - CRITBEGIN - -#ifdef __BIG_ENDIAN - WaitTillIdle(); - mga_outl(M_OPMODE, M_OPMODE_8BPP); -#else - mga_fifo(7); -#endif - ar0 = fontwidth(p) - 1; - mga_outl(M_FXBNDRY, ((xx+ar0)<<16) | xx); - if (fontwidth(p) <= 8) - step = 1; - else if (fontwidth(p) <= 16) - step = 2; - else - step = 4; - if (fontwidth(p) == step << 3) { - size_t charcell = fontheight(p)*step; - /* TODO: Align charcell to 4B for BE */ - mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); - mga_outl(M_FCOL, fgx); - mga_outl(M_BCOL, bgx); - mga_outl(M_AR3, 0); - mga_outl(M_AR0, fontheight(p)*fontwidth(p)-1); - mga_ydstlen(yy, fontheight(p)); - mga_memcpy_toio(ACCESS_FBINFO(mmio.vbase), 0, p->fontdata+(c&p->charmask)*charcell, charcell); - } else { - u8* chardata = p->fontdata+(c&p->charmask)*fontheight(p)*step; - int i; - - 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); - mga_outl(M_AR5, 0); - mga_outl(M_AR3, 0); - mga_outl(M_AR0, ar0); - mga_ydstlen(yy, fontheight(p)); - - switch (step) { - case 1: - for (i = fontheight(p); i > 0; i--) { -#ifdef __LITTLE_ENDIAN - mga_outl(0, *chardata++); -#else - mga_outl(0, (*chardata++) << 24); -#endif - } - break; - case 2: - for (i = fontheight(p); i > 0; i--) { -#ifdef __LITTLE_ENDIAN - mga_outl(0, *(u_int16_t*)chardata); -#else - mga_outl(0, (*(u_int16_t*)chardata) << 16); -#endif - chardata += 2; - } + switch (rect->rop) { + case ROP_COPY: + matroxfb_cfb4_clear(PMINFO ((u_int32_t*)info->pseudo_palette)[rect->color], rect->dy, rect->dx, rect->height, rect->width); break; - case 4: - mga_memcpy_toio(ACCESS_FBINFO(mmio.vbase), 0, chardata, fontheight(p) * 4); - break; - } } - WaitTillIdle(); -#ifdef __BIG_ENDIAN - mga_outl(M_OPMODE, ACCESS_FBINFO(accel.m_opmode)); -#endif - CRITEND -} - -#ifdef FBCON_HAS_CFB8 -static void matrox_cfb8_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) { - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb8_putc"); - - fgx = attr_fgcol(p, c); - bgx = attr_bgcol(p, c); - fgx |= (fgx << 8); - fgx |= (fgx << 16); - bgx |= (bgx << 8); - bgx |= (bgx << 16); - ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx); -} -#endif - -#ifdef FBCON_HAS_CFB16 -static void matrox_cfb16_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) { - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb16_putc"); - - fgx = ((u_int16_t*)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol(p, c)]; - fgx |= (fgx << 16); - bgx |= (bgx << 16); - ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx); } -#endif -#if defined(FBCON_HAS_CFB32) || defined(FBCON_HAS_CFB24) -static void matrox_cfb32_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) { - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb32_putc"); - - fgx = ((u_int32_t*)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol(p, c)]; - ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx); -} -#endif - -static void matrox_cfbX_fastputcs(u_int32_t fgx, u_int32_t bgx, struct display* p, const unsigned short* s, int count, int yy, int xx) { - unsigned int charcell; - CRITFLAGS - MINFO_FROM_DISP(p); - - yy *= fontheight(p); - xx *= fontwidth(p); - charcell = fontwidth(p) * fontheight(p); - - CRITBEGIN - - mga_fifo(3); - mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE); - mga_outl(M_FCOL, fgx); - mga_outl(M_BCOL, bgx); - while (count--) { - u_int32_t ar3 = ACCESS_FBINFO(fastfont.mgabase) + (scr_readw(s++) & p->charmask)*charcell; - - mga_fifo(4); - mga_outl(M_FXBNDRY, ((xx + fontwidth(p) - 1) << 16) | xx); - mga_outl(M_AR3, ar3); - mga_outl(M_AR0, (ar3 + charcell - 1) & 0x0003FFFF); - mga_ydstlen(yy, fontheight(p)); - xx += fontwidth(p); - } - WaitTillIdle(); - - CRITEND -} - -static void matrox_cfbX_putcs(u_int32_t fgx, u_int32_t bgx, struct display* p, const unsigned short* s, int count, int yy, int xx) { +static void matroxfb_1bpp_imageblit(WPMINFO u_int32_t fgx, u_int32_t bgx, + const u_int8_t* chardata, int width, int height, int yy, int xx) { u_int32_t step; u_int32_t ydstlen; u_int32_t xlen; @@ -565,26 +394,18 @@ vaddr_t mmio; int easy; CRITFLAGS - MINFO_FROM_DISP(p); - DBG_HEAVY("matroxfb_cfbX_putcs"); + DBG_HEAVY(__FUNCTION__); - yy *= fontheight(p); - xx *= fontwidth(p); - if (fontwidth(p) <= 8) - step = 1; - else if (fontwidth(p) <= 16) - step = 2; - else - step = 4; - charcell = fontheight(p)*step; + step = (width + 7) >> 3; + charcell = height * step; xlen = (charcell + 3) & ~3; - ydstlen = (yy << 16) | fontheight(p); - if (fontwidth(p) == step << 3) { - ar0 = fontheight(p)*fontwidth(p) - 1; + ydstlen = (yy << 16) | height; + if (width == step << 3) { + ar0 = height * width - 1; easy = 1; } else { - ar0 = fontwidth(p) - 1; + ar0 = width - 1; easy = 0; } @@ -602,50 +423,55 @@ 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 + fontwidth(p) - 1) << 16) | xx; + fxbndry = ((xx + width - 1) << 16) | xx; mmio = ACCESS_FBINFO(mmio.vbase); - while (count--) { - u_int8_t* chardata = p->fontdata + (scr_readw(s++) & p->charmask)*charcell; - mga_fifo(6); - 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, 0, chardata, xlen); - } else { - mga_writel(mmio, M_AR5, 0); - mga_writel(mmio, M_YDSTLEN | M_EXEC, ydstlen); - switch (step) { - case 1: { - u_int8_t* charend = chardata + charcell; - for (; chardata != charend; chardata++) { + mga_fifo(6); + 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, 0, 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, 0, chardata, charcell); + } else if (step == 1) { + /* Special case for 1..8bit widths */ + while (height--) { #ifdef __LITTLE_ENDIAN - mga_writel(mmio, 0, *chardata); + mga_writel(mmio, 0, *chardata); #else - mga_writel(mmio, 0, (*chardata) << 24); + mga_writel(mmio, 0, (*chardata) << 24); #endif - } - } - break; - case 2: { - u_int8_t* charend = chardata + charcell; - for (; chardata != charend; chardata += 2) { + chardata++; + } + } else if (step == 2) { + /* Special case for 9..15bit widths */ + while (height--) { #ifdef __LITTLE_ENDIAN - mga_writel(mmio, 0, *(u_int16_t*)chardata); + mga_writel(mmio, 0, *(u_int16_t*)chardata); #else - mga_writel(mmio, 0, (*(u_int16_t*)chardata) << 16); + mga_writel(mmio, 0, (*(u_int16_t*)chardata) << 16); #endif - } - } - break; - default: - mga_memcpy_toio(mmio, 0, chardata, charcell); - break; + 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 */ + mga_writel(mmio, 0, get_unaligned((u_int32_t*)(chardata + i))); + } + chardata += step; } } - fxbndry += fontwidth(p) + (fontwidth(p) << 16); } WaitTillIdle(); #ifdef __BIG_ENDIAN @@ -654,606 +480,26 @@ CRITEND } -#ifdef FBCON_HAS_CFB8 -static void matrox_cfb8_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) { - u_int16_t c; - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb8_putcs"); - - c = scr_readw(s); - fgx = attr_fgcol(p, c); - bgx = attr_bgcol(p, c); - fgx |= (fgx << 8); - fgx |= (fgx << 16); - bgx |= (bgx << 8); - bgx |= (bgx << 16); - ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx); -} -#endif - -#ifdef FBCON_HAS_CFB16 -static void matrox_cfb16_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) { - u_int16_t c; - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb16_putcs"); - - c = scr_readw(s); - fgx = ((u_int16_t*)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol(p, c)]; - fgx |= (fgx << 16); - bgx |= (bgx << 16); - ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx); -} -#endif - -#if defined(FBCON_HAS_CFB32) || defined(FBCON_HAS_CFB24) -static void matrox_cfb32_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) { - u_int16_t c; - u_int32_t fgx, bgx; - MINFO_FROM_DISP(p); - - DBG_HEAVY("matroxfb_cfb32_putcs"); - - c = scr_readw(s); - fgx = ((u_int32_t*)p->dispsw_data)[attr_fgcol(p, c)]; - bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol(p, c)]; - ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx); -} -#endif - -#ifdef FBCON_HAS_CFB4 -static void matrox_cfb4_revc(struct display* p, int xx, int yy) { - CRITFLAGS - MINFO_FROM_DISP(p); - - DBG_LOOP("matroxfb_cfb4_revc"); - - if (fontwidth(p) & 1) { - fbcon_cfb4_revc(p, xx, yy); - return; - } - yy *= fontheight(p); - xx *= fontwidth(p); - xx |= (xx + fontwidth(p)) << 16; - xx >>= 1; - - CRITBEGIN - - mga_fifo(5); - mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR); - mga_outl(M_FCOL, 0xFFFFFFFF); - mga_outl(M_FXBNDRY, xx); - mga_outl(M_YDST, yy * p->var.xres_virtual >> 6); - mga_outl(M_LEN | M_EXEC, fontheight(p)); - WaitTillIdle(); - - CRITEND -} -#endif - -#ifdef FBCON_HAS_CFB8 -static void matrox_cfb8_revc(struct display* p, int xx, int yy) { - CRITFLAGS - MINFO_FROM_DISP(p); - - DBG_LOOP("matrox_cfb8_revc") - - yy *= fontheight(p); - xx *= fontwidth(p); - - CRITBEGIN - - mga_fifo(4); - mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR); - mga_outl(M_FCOL, 0x0F0F0F0F); - mga_outl(M_FXBNDRY, ((xx + fontwidth(p)) << 16) | xx); - mga_ydstlen(yy, fontheight(p)); - WaitTillIdle(); - - CRITEND -} -#endif - -#if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB24) || defined(FBCON_HAS_CFB32) -static void matrox_cfbX_revc(struct display* p, int xx, int yy) { - CRITFLAGS - MINFO_FROM_DISP(p); - - DBG_LOOP("matrox_cfbX_revc") - - yy *= fontheight(p); - xx *= fontwidth(p); - - CRITBEGIN - - mga_fifo(4); - mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR); - mga_outl(M_FCOL, 0xFFFFFFFF); - mga_outl(M_FXBNDRY, ((xx + fontwidth(p)) << 16) | xx); - mga_ydstlen(yy, fontheight(p)); - WaitTillIdle(); - - CRITEND -} -#endif - -static void matrox_cfbX_clear_margins(struct vc_data* conp, struct display* p, int bottom_only) { - unsigned int bottom_height, right_width; - unsigned int bottom_start, right_start; - unsigned int cell_h, cell_w; - - DBG("matrox_cfbX_clear_margins") - - cell_w = fontwidth(p); - if (!cell_w) return; /* PARANOID */ - right_width = p->var.xres % cell_w; - right_start = p->var.xres - right_width; - if (!bottom_only && right_width) { - /* clear whole right margin, not only visible portion */ - matroxfb_accel_clear( PMXINFO(p) - /* color */ 0x00000000, - /* y */ 0, - /* x */ p->var.xoffset + right_start, - /* height */ p->var.yres_virtual, - /* width */ right_width); - } - cell_h = fontheight(p); - if (!cell_h) return; /* PARANOID */ - bottom_height = p->var.yres % cell_h; - if (bottom_height) { - bottom_start = p->var.yres - bottom_height; - matroxfb_accel_clear( PMXINFO(p) - /* color */ 0x00000000, - /* y */ p->var.yoffset + bottom_start, - /* x */ p->var.xoffset, - /* height */ bottom_height, - /* width */ right_start); - } -} - -static void matrox_text_setup(struct display* p) { - MINFO_FROM_DISP(p); - - p->next_line = ACCESS_FBINFO(fbcon).fix.line_length ? ACCESS_FBINFO(fbcon).fix.line_length : ((p->var.xres_virtual / (fontwidth(p)?fontwidth(p):8)) * ACCESS_FBINFO(devflags.textstep)); - p->next_plane = 0; -} - -static void matrox_text_bmove(struct display* p, int sy, int sx, int dy, int dx, - int height, int width) { - unsigned int srcoff; - unsigned int dstoff; - unsigned int step; - CRITFLAGS - MINFO_FROM_DISP(p); - - CRITBEGIN - - step = ACCESS_FBINFO(devflags.textstep); - srcoff = (sy * p->next_line) + (sx * step); - dstoff = (dy * p->next_line) + (dx * step); - if (dstoff < srcoff) { - while (height > 0) { - int i; - for (i = width; i > 0; dstoff += step, srcoff += step, i--) - mga_writew(ACCESS_FBINFO(video.vbase), dstoff, mga_readw(ACCESS_FBINFO(video.vbase), srcoff)); - height--; - dstoff += p->next_line - width * step; - srcoff += p->next_line - width * step; - } - } else { - unsigned int off; - - off = (height - 1) * p->next_line + (width - 1) * step; - srcoff += off; - dstoff += off; - while (height > 0) { - int i; - for (i = width; i > 0; dstoff -= step, srcoff -= step, i--) - mga_writew(ACCESS_FBINFO(video.vbase), dstoff, mga_readw(ACCESS_FBINFO(video.vbase), srcoff)); - dstoff -= p->next_line - width * step; - srcoff -= p->next_line - width * step; - height--; - } - } - CRITEND -} - -static void matrox_text_clear(struct vc_data* conp, struct display* p, int sy, int sx, - int height, int width) { - unsigned int offs; - unsigned int val; - unsigned int step; - CRITFLAGS - MINFO_FROM_DISP(p); - - step = ACCESS_FBINFO(devflags.textstep); - offs = sy * p->next_line + sx * step; - val = ntohs((attr_bgcol(p, conp->vc_video_erase_char) << 4) | attr_fgcol(p, conp->vc_video_erase_char) | (' ' << 8)); - - CRITBEGIN - - while (height > 0) { - int i; - for (i = width; i > 0; offs += step, i--) - mga_writew(ACCESS_FBINFO(video.vbase), offs, val); - offs += p->next_line - width * step; - height--; - } - CRITEND -} - -static void matrox_text_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) { - unsigned int offs; - unsigned int chr; - unsigned int step; - CRITFLAGS - MINFO_FROM_DISP(p); - - step = ACCESS_FBINFO(devflags.textstep); - offs = yy * p->next_line + xx * step; - chr = attr_fgcol(p,c) | (attr_bgcol(p,c) << 4) | ((c & p->charmask) << 8); - if (chr & 0x10000) chr |= 0x08; - - CRITBEGIN - - mga_writew(ACCESS_FBINFO(video.vbase), offs, ntohs(chr)); - - CRITEND -} - -static void matrox_text_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, - int count, int yy, int xx) { - unsigned int offs; - unsigned int attr; - unsigned int step; - u_int16_t c; - CRITFLAGS - MINFO_FROM_DISP(p); - - step = ACCESS_FBINFO(devflags.textstep); - offs = yy * p->next_line + xx * step; - c = scr_readw(s); - attr = attr_fgcol(p, c) | (attr_bgcol(p, c) << 4); - - CRITBEGIN - - while (count-- > 0) { - unsigned int chr = ((scr_readw(s++)) & p->charmask) << 8; - if (chr & 0x10000) chr ^= 0x10008; - mga_writew(ACCESS_FBINFO(video.vbase), offs, ntohs(attr|chr)); - offs += step; - } - - CRITEND -} - -static void matrox_text_revc(struct display* p, int xx, int yy) { - unsigned int offs; - unsigned int step; - CRITFLAGS - MINFO_FROM_DISP(p); - - step = ACCESS_FBINFO(devflags.textstep); - offs = yy * p->next_line + xx * step + 1; - - CRITBEGIN - - mga_writeb(ACCESS_FBINFO(video.vbase), offs, mga_readb(ACCESS_FBINFO(video.vbase), offs) ^ 0x77); - - CRITEND -} - -static void matrox_text_createcursor(WPMINFO struct display* p) { - CRITFLAGS - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - matroxfb_createcursorshape(PMINFO p, 0); - - CRITBEGIN - - mga_setr(M_CRTC_INDEX, 0x0A, ACCESS_FBINFO(cursor.u)); - mga_setr(M_CRTC_INDEX, 0x0B, ACCESS_FBINFO(cursor.d) - 1); - - CRITEND -} - -static void matrox_text_cursor(struct display* p, int mode, int x, int y) { - unsigned int pos; - CRITFLAGS - MINFO_FROM_DISP(p); - - if (ACCESS_FBINFO(currcon_display) != p) - return; - - if (mode == CM_ERASE) { - if (ACCESS_FBINFO(cursor.state) != CM_ERASE) { - - CRITBEGIN - - mga_setr(M_CRTC_INDEX, 0x0A, 0x20); - - CRITEND - ACCESS_FBINFO(cursor.state) = CM_ERASE; - } - return; - } - if ((p->conp->vc_cursor_type & CUR_HWMASK) != ACCESS_FBINFO(cursor.type)) - matrox_text_createcursor(PMINFO p); - - /* DO NOT CHECK cursor.x != x because of matroxfb_vgaHWinit moves cursor to 0,0 */ - ACCESS_FBINFO(cursor.x) = x; - ACCESS_FBINFO(cursor.y) = y; - pos = p->next_line / ACCESS_FBINFO(devflags.textstep) * y + x; - - CRITBEGIN +static void matroxfb_imageblit(struct fb_info* info, const struct fb_image* image) { + MINFO_FROM_INFO(info); - mga_setr(M_CRTC_INDEX, 0x0F, pos); - mga_setr(M_CRTC_INDEX, 0x0E, pos >> 8); - - mga_setr(M_CRTC_INDEX, 0x0A, ACCESS_FBINFO(cursor.u)); - - CRITEND - - ACCESS_FBINFO(cursor.state) = CM_DRAW; -} + DBG_HEAVY(__FUNCTION__); -void matrox_text_round(CPMINFO struct fb_var_screeninfo* var, struct display* p) { - unsigned hf; - unsigned vf; - unsigned vxres; - unsigned ych; - - hf = fontwidth(p); - if (!hf) hf = 8; - /* do not touch xres */ - vxres = (var->xres_virtual + hf - 1) / hf; - if (vxres >= 256) - vxres = 255; - if (vxres < 16) - vxres = 16; - vxres = (vxres + 1) & ~1; /* must be even */ - vf = fontheight(p); - if (!vf) vf = 16; - if (var->yres < var->yres_virtual) { - ych = ACCESS_FBINFO(devflags.textvram) / vxres; - var->yres_virtual = ych * vf; - } else - ych = var->yres_virtual / vf; - if (vxres * ych > ACCESS_FBINFO(devflags.textvram)) { - ych = ACCESS_FBINFO(devflags.textvram) / vxres; - var->yres_virtual = ych * vf; - } - var->xres_virtual = vxres * hf; -} - -EXPORT_SYMBOL(matrox_text_round); - -static int matrox_text_setfont(struct display* p, int width, int height) { - DBG("matrox_text_setfont"); - - if (p) { - MINFO_FROM_DISP(p); - - matrox_text_round(PMINFO &p->var, p); - p->next_line = ACCESS_FBINFO(fbcon).fix.line_length = ((p->var.xres_virtual / (fontwidth(p)?fontwidth(p):8)) * ACCESS_FBINFO(devflags.textstep)); - - if (p->conp) - matrox_text_createcursor(PMINFO p); - } - return 0; -} - -#define matrox_cfb16_revc matrox_cfbX_revc -#define matrox_cfb24_revc matrox_cfbX_revc -#define matrox_cfb32_revc matrox_cfbX_revc - -#define matrox_cfb24_clear matrox_cfb32_clear -#define matrox_cfb24_putc matrox_cfb32_putc -#define matrox_cfb24_putcs matrox_cfb32_putcs - -#ifdef FBCON_HAS_VGATEXT -static struct display_switch matroxfb_text = { - .setup = matrox_text_setup, - .bmove = matrox_text_bmove, - .clear = matrox_text_clear, - .putc = matrox_text_putc, - .putcs = matrox_text_putcs, - .revc = matrox_text_revc, - .cursor = matrox_text_cursor, - .set_font = matrox_text_setfont, - .fontwidthmask =FONTWIDTH(8)|FONTWIDTH(9) -}; -#endif - -#ifdef FBCON_HAS_CFB4 -static struct display_switch matroxfb_cfb4 = { - .setup = fbcon_cfb4_setup, - .bmove = matrox_cfb4_bmove, - .clear = matrox_cfb4_clear, - .putc = fbcon_cfb4_putc, - .putcs = fbcon_cfb4_putcs, - .revc = matrox_cfb4_revc, - .fontwidthmask =FONTWIDTH(8) /* fix, fix, fix it */ -}; -#endif - -#ifdef FBCON_HAS_CFB8 -static struct display_switch matroxfb_cfb8 = { - .setup = fbcon_cfb8_setup, - .bmove = matrox_cfbX_bmove, - .clear = matrox_cfb8_clear, - .putc = matrox_cfb8_putc, - .putcs = matrox_cfb8_putcs, - .revc = matrox_cfb8_revc, - .clear_margins =matrox_cfbX_clear_margins, - .fontwidthmask =~1 /* FONTWIDTHS */ -}; -#endif - -#ifdef FBCON_HAS_CFB16 -static struct display_switch matroxfb_cfb16 = { - .setup = fbcon_cfb16_setup, - .bmove = matrox_cfbX_bmove, - .clear = matrox_cfb16_clear, - .putc = matrox_cfb16_putc, - .putcs = matrox_cfb16_putcs, - .revc = matrox_cfb16_revc, - .clear_margins =matrox_cfbX_clear_margins, - .fontwidthmask =~1 /* FONTWIDTHS */ -}; -#endif - -#ifdef FBCON_HAS_CFB24 -static struct display_switch matroxfb_cfb24 = { - .setup = fbcon_cfb24_setup, - .bmove = matrox_cfbX_bmove, - .clear = matrox_cfb24_clear, - .putc = matrox_cfb24_putc, - .putcs = matrox_cfb24_putcs, - .revc = matrox_cfb24_revc, - .clear_margins =matrox_cfbX_clear_margins, - .fontwidthmask =~1 /* FONTWIDTHS */ /* TODO: and what about non-aligned access on BE? I think that there are no in my code */ -}; -#endif + if (image->depth == 0) { + u_int32_t fgx, bgx; -#ifdef FBCON_HAS_CFB32 -static struct display_switch matroxfb_cfb32 = { - .setup = fbcon_cfb32_setup, - .bmove = matrox_cfbX_bmove, - .clear = matrox_cfb32_clear, - .putc = matrox_cfb32_putc, - .putcs = matrox_cfb32_putcs, - .revc = matrox_cfb32_revc, - .clear_margins =matrox_cfbX_clear_margins, - .fontwidthmask =~1 /* FONTWIDTHS */ -}; -#endif - -void initMatrox(WPMINFO struct display* p) { - struct display_switch *swtmp; - - DBG("initMatrox") - - if (ACCESS_FBINFO(currcon_display) != p) - return; - if (p->dispsw && p->conp) - fb_con.con_cursor(p->conp, CM_ERASE); - p->dispsw_data = NULL; - if ((ACCESS_FBINFO(fbcon).var.accel_flags & FB_ACCELF_TEXT) != FB_ACCELF_TEXT) { - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - swtmp = &matroxfb_text; - } else { - switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { -#ifdef FBCON_HAS_CFB4 - case 4: - swtmp = &fbcon_cfb4; - break; -#endif -#ifdef FBCON_HAS_CFB8 - case 8: - swtmp = &fbcon_cfb8; - break; -#endif -#ifdef FBCON_HAS_CFB16 - case 16: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb16); - swtmp = &fbcon_cfb16; - break; -#endif -#ifdef FBCON_HAS_CFB24 - case 24: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb24); - swtmp = &fbcon_cfb24; - break; -#endif -#ifdef FBCON_HAS_CFB32 - case 32: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb32); - swtmp = &fbcon_cfb32; - break; -#endif - default: - p->dispsw = &fbcon_dummy; - return; - } - } - dprintk(KERN_INFO "matroxfb: acceleration disabled\n"); - } else if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - swtmp = &matroxfb_text; - } else { - switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { -#ifdef FBCON_HAS_CFB4 - case 4: - swtmp = &matroxfb_cfb4; - break; -#endif -#ifdef FBCON_HAS_CFB8 - case 8: - swtmp = &matroxfb_cfb8; - break; -#endif -#ifdef FBCON_HAS_CFB16 - case 16: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb16); - swtmp = &matroxfb_cfb16; - break; -#endif -#ifdef FBCON_HAS_CFB24 - case 24: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb24); - swtmp = &matroxfb_cfb24; - break; -#endif -#ifdef FBCON_HAS_CFB32 - case 32: - p->dispsw_data = &ACCESS_FBINFO(cmap.cfb32); - swtmp = &matroxfb_cfb32; - break; -#endif - default: - p->dispsw = &fbcon_dummy; - return; - } - } - memcpy(&ACCESS_FBINFO(dispsw), swtmp, sizeof(ACCESS_FBINFO(dispsw))); - p->dispsw = &ACCESS_FBINFO(dispsw); - if ((ACCESS_FBINFO(fbcon).fix.type != FB_TYPE_TEXT) && ACCESS_FBINFO(devflags.hwcursor)) { - ACCESS_FBINFO(hw_switch)->selhwcursor(PMINFO2); - } -} - -EXPORT_SYMBOL(initMatrox); - -void matrox_init_putc(WPMINFO struct display* p, void (*dac_createcursor)(WPMINFO struct display* p)) { - int i; - - if (p && p->conp) { - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - matrox_text_createcursor(PMINFO p); - matrox_text_loadfont(PMINFO p); - i = 0; - } else { - dac_createcursor(PMINFO p); - i = matroxfb_fastfont_tryset(PMINFO p); - } - } else - i = 0; - if (i) { - ACCESS_FBINFO(curr.putc) = matrox_cfbX_fastputc; - ACCESS_FBINFO(curr.putcs) = matrox_cfbX_fastputcs; + fgx = ((u_int32_t*)info->pseudo_palette)[image->fg_color]; + bgx = ((u_int32_t*)info->pseudo_palette)[image->bg_color]; + matroxfb_1bpp_imageblit(PMINFO fgx, bgx, image->data, image->width, image->height, image->dy, image->dx); } else { - ACCESS_FBINFO(curr.putc) = matrox_cfbX_putc; - ACCESS_FBINFO(curr.putcs) = matrox_cfbX_putcs; + /* 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); } } -EXPORT_SYMBOL(matrox_init_putc); - MODULE_LICENSE("GPL"); diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_accel.h linux-2.5.70-bk6/drivers/video/matrox/matroxfb_accel.h --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_accel.h 2003-05-26 18:00:45.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_accel.h 2003-06-01 04:39:46.000000000 -0700 @@ -3,9 +3,6 @@ #include "matroxfb_base.h" -void matrox_init_putc(WPMINFO struct display* p, void (*)(WPMINFO struct display *p)); void matrox_cfbX_init(WPMINFO2); -void matrox_text_round(CPMINFO struct fb_var_screeninfo* var, struct display* p); -void initMatrox(WPMINFO struct display* p); #endif diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_base.c linux-2.5.70-bk6/drivers/video/matrox/matroxfb_base.c --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_base.c 2003-05-26 18:00:43.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_base.c 2003-06-01 04:39:46.000000000 -0700 @@ -101,6 +101,7 @@ /* make checkconfig does not check included files... */ #include +#include #include "matroxfb_base.h" #include "matroxfb_misc.h" @@ -111,9 +112,10 @@ #include "matroxfb_crtc2.h" #include "matroxfb_g450.h" #include +#include #include -#ifdef CONFIG_PPC +#ifdef CONFIG_ALL_PPC unsigned char nvram_read_byte(int); static int default_vmode = VMODE_NVRAM; static int default_cmode = CMODE_NVRAM; @@ -145,25 +147,136 @@ 39721L,48L,16L,33L,10L, 96L,2L,~0, /* No sync info */ FB_VMODE_NONINTERLACED, - {0,0,0,0,0,0} + 0, {0,0,0,0,0} }; /* --------------------------------------------------------------------- */ -static inline void my_install_cmap(WPMINFO2) +static void update_crtc2(WPMINFO unsigned int pos) { + struct matroxfb_dh_fb_info* info = ACCESS_FBINFO(crtc2.info); + + /* Make sure that displays are compatible */ + if (info && (info->fbcon.var.bits_per_pixel == ACCESS_FBINFO(fbcon).var.bits_per_pixel) + && (info->fbcon.var.xres_virtual == ACCESS_FBINFO(fbcon).var.xres_virtual) + && (info->fbcon.var.green.length == ACCESS_FBINFO(fbcon).var.green.length) + ) { + switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { + case 16: + case 32: + pos = pos * 8; + if (info->interlaced) { + mga_outl(0x3C2C, pos); + mga_outl(0x3C28, pos + ACCESS_FBINFO(fbcon).var.xres_virtual * ACCESS_FBINFO(fbcon).var.bits_per_pixel / 8); + } else { + mga_outl(0x3C28, pos); + } + break; + } + } +} + +static irqreturn_t matrox_irq(int irq, void *dev_id, struct pt_regs *fp) { - /* Do not touch this code if you do not understand what it does! */ - /* Never try to use do_install_cmap() instead. It is crap. */ - struct fb_cmap* cmap = &ACCESS_FBINFO(currcon_display)->cmap; + u_int32_t status; + int handled = 0; + + MINFO_FROM(dev_id); + + status = mga_inl(M_STATUS); + + if (status & 0x20) { + mga_outl(M_ICLEAR, 0x20); + ACCESS_FBINFO(crtc1.vsync.cnt)++; + wake_up_interruptible(&ACCESS_FBINFO(crtc1.vsync.wait)); + handled = 1; + } + if (status & 0x200) { + mga_outl(M_ICLEAR, 0x200); + ACCESS_FBINFO(crtc2.vsync.cnt)++; + wake_up_interruptible(&ACCESS_FBINFO(crtc2.vsync.wait)); + handled = 1; + } + return IRQ_RETVAL(handled); +} - if (cmap->len) - fb_set_cmap(cmap, 1, &ACCESS_FBINFO(fbcon)); +int matroxfb_enable_irq(WPMINFO int reenable) { + u_int32_t bm; + + if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG400) + bm = 0x220; else - fb_set_cmap(fb_default_cmap(ACCESS_FBINFO(curr.cmap_len)), - 1, &ACCESS_FBINFO(fbcon)); + bm = 0x020; + + if (!test_and_set_bit(0, &ACCESS_FBINFO(irq_flags))) { + printk(KERN_DEBUG "matroxfb: enabling IRQ\n"); + if (request_irq(ACCESS_FBINFO(pcidev)->irq, matrox_irq, + SA_SHIRQ, "MGA Vertical Sync", MINFO)) { + clear_bit(0, &ACCESS_FBINFO(irq_flags)); + return -EINVAL; + } + mga_outl(M_IEN, mga_inl(M_IEN) | bm); + } else if (reenable) { + u_int32_t ien; + + ien = mga_inl(M_IEN); + if ((ien & bm) != bm) { + printk(KERN_DEBUG "matroxfb: someone disabled IRQ [%08X]\n", ien); + mga_outl(M_IEN, ien | bm); + } + } + return 0; +} + +static void matroxfb_disable_irq(WPMINFO2) { + if (test_and_clear_bit(0, &ACCESS_FBINFO(irq_flags))) { + printk(KERN_DEBUG "matroxfb: disabling IRQ\n"); + if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG400) + mga_outl(M_IEN, mga_inl(M_IEN) & ~0x220); + else + mga_outl(M_IEN, mga_inl(M_IEN) & ~0x20); + free_irq(ACCESS_FBINFO(pcidev)->irq, MINFO); + } +} + +int matroxfb_wait_for_sync(WPMINFO u_int32_t crtc) { + wait_queue_t __wait; + struct matrox_vsync *vs; + unsigned int cnt; + int ret; + + switch (crtc) { + case 0: + vs = &ACCESS_FBINFO(crtc1.vsync); + break; + case 1: + if (ACCESS_FBINFO(devflags.accelerator) != FB_ACCEL_MATROX_MGAG400) { + return -ENODEV; + } + vs = &ACCESS_FBINFO(crtc2.vsync); + break; + default: + return -ENODEV; + } + ret = matroxfb_enable_irq(PMINFO 0); + if (ret) { + return ret; + } + init_waitqueue_entry(&__wait, current); + + cnt = vs->cnt; + ret = wait_event_interruptible_timeout(vs->wait, cnt != vs->cnt, HZ/10); + if (ret < 0) { + return ret; + } + if (ret == 0) { + matroxfb_enable_irq(PMINFO 1); + return -ETIMEDOUT; + } + return 0; } +/* --------------------------------------------------------------------- */ static void matrox_pan_var(WPMINFO struct fb_var_screeninfo *var) { unsigned int pos; @@ -171,23 +284,17 @@ #ifdef CONFIG_FB_MATROX_32MB unsigned int p3; #endif - struct display *disp; CRITFLAGS - DBG("matrox_pan_var") + DBG(__FUNCTION__) if (ACCESS_FBINFO(dead)) return; ACCESS_FBINFO(fbcon).var.xoffset = var->xoffset; ACCESS_FBINFO(fbcon).var.yoffset = var->yoffset; - disp = ACCESS_FBINFO(currcon_display); - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - pos = ACCESS_FBINFO(fbcon).var.yoffset / fontheight(disp) * disp->next_line / ACCESS_FBINFO(devflags.textstep) + ACCESS_FBINFO(fbcon).var.xoffset / (fontwidth(disp)?fontwidth(disp):8); - } else { - pos = (ACCESS_FBINFO(fbcon).var.yoffset * ACCESS_FBINFO(fbcon).var.xres_virtual + ACCESS_FBINFO(fbcon).var.xoffset) * ACCESS_FBINFO(curr.final_bppShift) / 32; - pos += ACCESS_FBINFO(curr.ydstorg.chunks); - } + pos = (ACCESS_FBINFO(fbcon).var.yoffset * ACCESS_FBINFO(fbcon).var.xres_virtual + ACCESS_FBINFO(fbcon).var.xoffset) * ACCESS_FBINFO(curr.final_bppShift) / 32; + pos += ACCESS_FBINFO(curr.ydstorg.chunks); p0 = ACCESS_FBINFO(hw).CRTC[0x0D] = pos & 0xFF; p1 = ACCESS_FBINFO(hw).CRTC[0x0C] = (pos & 0xFF00) >> 8; p2 = ACCESS_FBINFO(hw).CRTCEXT[0] = (ACCESS_FBINFO(hw).CRTCEXT[0] & 0xB0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40); @@ -204,6 +311,8 @@ mga_setr(M_EXTVGA_INDEX, 0x08, p3); #endif mga_setr(M_EXTVGA_INDEX, 0x00, p2); + + update_crtc2(PMINFO pos); CRITEND } @@ -225,7 +334,6 @@ matroxfb_unregister_device(MINFO); unregister_framebuffer(&ACCESS_FBINFO(fbcon)); matroxfb_g450_shutdown(PMINFO2); - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); #ifdef CONFIG_MTRR if (ACCESS_FBINFO(mtrr.vram_valid)) mtrr_del(ACCESS_FBINFO(mtrr.vram), ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len)); @@ -235,7 +343,6 @@ release_mem_region(ACCESS_FBINFO(video.base), ACCESS_FBINFO(video.len_maximum)); release_mem_region(ACCESS_FBINFO(mmio.base), 16384); #ifdef CONFIG_FB_MATROX_MULTIHEAD - kfree(ACCESS_FBINFO(fbcon.disp)); kfree(minfo); #endif } @@ -246,69 +353,51 @@ static int matroxfb_open(struct fb_info *info, int user) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - DBG_LOOP("matroxfb_open") + MINFO_FROM_INFO(info); + + DBG_LOOP(__FUNCTION__) if (ACCESS_FBINFO(dead)) { return -ENXIO; } ACCESS_FBINFO(usecount)++; -#undef minfo + if (user) { + ACCESS_FBINFO(userusecount)++; + } return(0); } static int matroxfb_release(struct fb_info *info, int user) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - DBG_LOOP("matroxfb_release") - + MINFO_FROM_INFO(info); + + DBG_LOOP(__FUNCTION__) + + if (user) { + if (0 == --ACCESS_FBINFO(userusecount)) { + matroxfb_disable_irq(PMINFO2); + } + } if (!(--ACCESS_FBINFO(usecount)) && ACCESS_FBINFO(dead)) { matroxfb_remove(PMINFO 0); } -#undef minfo return(0); } -static int matroxfb_pan_display(struct fb_var_screeninfo *var, int con, +static int matroxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info* info) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - - DBG("matroxfb_pan_display") + MINFO_FROM_INFO(info); - if (var->vmode & FB_VMODE_YWRAP) { - if (var->yoffset < 0 || var->yoffset >= fb_display[con].var.yres_virtual || var->xoffset) - return -EINVAL; - } else { - if (var->xoffset+fb_display[con].var.xres > fb_display[con].var.xres_virtual || - var->yoffset+fb_display[con].var.yres > fb_display[con].var.yres_virtual) - return -EINVAL; - } - if (con == ACCESS_FBINFO(fbcon.currcon)) - matrox_pan_var(PMINFO var); - fb_display[con].var.xoffset = var->xoffset; - fb_display[con].var.yoffset = var->yoffset; - if (var->vmode & FB_VMODE_YWRAP) - fb_display[con].var.vmode |= FB_VMODE_YWRAP; - else - fb_display[con].var.vmode &= ~FB_VMODE_YWRAP; - return 0; -#undef minfo -} + DBG(__FUNCTION__) -static int matroxfb_updatevar(int con, struct fb_info *info) -{ -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - DBG("matroxfb_updatevar"); - - matrox_pan_var(PMINFO &fb_display[con].var); + matrox_pan_var(PMINFO var); return 0; -#undef minfo } static int matroxfb_get_final_bppShift(CPMINFO int bpp) { int bppshft2; - DBG("matroxfb_get_final_bppShift") + DBG(__FUNCTION__) bppshft2 = bpp; if (!bppshft2) { @@ -325,7 +414,7 @@ int over; int rounding; - DBG("matroxfb_test_and_set_rounding") + DBG(__FUNCTION__) switch (bpp) { case 0: return xres; @@ -356,7 +445,7 @@ const int* width; int xres_new; - DBG("matroxfb_pitch_adjust") + DBG(__FUNCTION__) if (!bpp) return xres; @@ -382,41 +471,27 @@ static int matroxfb_get_cmap_len(struct fb_var_screeninfo *var) { - DBG("matroxfb_get_cmap_len") + DBG(__FUNCTION__) switch (var->bits_per_pixel) { -#ifdef FBCON_HAS_VGATEXT - case 0: - return 16; /* pseudocolor... 16 entries HW palette */ -#endif -#ifdef FBCON_HAS_CFB4 case 4: return 16; /* pseudocolor... 16 entries HW palette */ -#endif -#ifdef FBCON_HAS_CFB8 case 8: return 256; /* pseudocolor... 256 entries HW palette */ -#endif -#ifdef FBCON_HAS_CFB16 case 16: return 16; /* directcolor... 16 entries SW palette */ /* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ -#endif -#ifdef FBCON_HAS_CFB24 case 24: return 16; /* directcolor... 16 entries SW palette */ /* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ -#endif -#ifdef FBCON_HAS_CFB32 case 32: return 16; /* directcolor... 16 entries SW palette */ /* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ -#endif } return 16; /* return something reasonable... or panic()? */ } -static int matroxfb_decode_var(CPMINFO struct display* p, struct fb_var_screeninfo *var, int *visual, int *video_cmap_len, unsigned int* ydstorg) { +static int matroxfb_decode_var(CPMINFO struct fb_var_screeninfo *var, int *visual, int *video_cmap_len, unsigned int* ydstorg) { struct RGBT { unsigned char bpp; struct { @@ -429,51 +504,26 @@ signed char visual; }; static const struct RGBT table[]= { -#if defined FBCON_HAS_VGATEXT - { 0,{ 0,6},{0,6},{0,6},{ 0,0},MX_VISUAL_PSEUDOCOLOR}, -#endif -#if defined FBCON_HAS_CFB4 || defined FBCON_HAS_CFB8 { 8,{ 0,8},{0,8},{0,8},{ 0,0},MX_VISUAL_PSEUDOCOLOR}, -#endif -#if defined FBCON_HAS_CFB16 {15,{10,5},{5,5},{0,5},{15,1},MX_VISUAL_DIRECTCOLOR}, {16,{11,5},{5,6},{0,5},{ 0,0},MX_VISUAL_DIRECTCOLOR}, -#endif -#if defined FBCON_HAS_CFB24 {24,{16,8},{8,8},{0,8},{ 0,0},MX_VISUAL_DIRECTCOLOR}, -#endif -#if defined FBCON_HAS_CFB32 {32,{16,8},{8,8},{0,8},{24,8},MX_VISUAL_DIRECTCOLOR} -#endif }; struct RGBT const *rgbt; unsigned int bpp = var->bits_per_pixel; unsigned int vramlen; unsigned int memlen; - DBG("matroxfb_decode_var") + DBG(__FUNCTION__) switch (bpp) { -#ifdef FBCON_HAS_VGATEXT - case 0: if (!ACCESS_FBINFO(capable.text)) return -EINVAL; - break; -#endif -#ifdef FBCON_HAS_CFB4 case 4: if (!ACCESS_FBINFO(capable.cfb4)) return -EINVAL; break; -#endif -#ifdef FBCON_HAS_CFB8 case 8: break; -#endif -#ifdef FBCON_HAS_CFB16 case 16: break; -#endif -#ifdef FBCON_HAS_CFB24 case 24: break; -#endif -#ifdef FBCON_HAS_CFB32 case 32: break; -#endif default: return -EINVAL; } *ydstorg = 0; @@ -482,50 +532,39 @@ var->yres_virtual = var->yres; if (var->xres_virtual < var->xres) var->xres_virtual = var->xres; - if (bpp) { - var->xres_virtual = matroxfb_pitch_adjust(PMINFO var->xres_virtual, bpp); + + var->xres_virtual = matroxfb_pitch_adjust(PMINFO var->xres_virtual, bpp); + memlen = var->xres_virtual * bpp * var->yres_virtual / 8; + if (memlen > vramlen) { + var->yres_virtual = vramlen * 8 / (var->xres_virtual * bpp); memlen = var->xres_virtual * bpp * var->yres_virtual / 8; - if (memlen > vramlen) { - var->yres_virtual = vramlen * 8 / (var->xres_virtual * bpp); - memlen = var->xres_virtual * bpp * var->yres_virtual / 8; - } - /* There is hardware bug that no line can cross 4MB boundary */ - /* give up for CFB24, it is impossible to easy workaround it */ - /* for other try to do something */ - if (!ACCESS_FBINFO(capable.cross4MB) && (memlen > 0x400000)) { - if (bpp == 24) { - /* sorry */ - } else { - unsigned int linelen; - unsigned int m1 = linelen = var->xres_virtual * bpp / 8; - unsigned int m2 = PAGE_SIZE; /* or 128 if you do not need PAGE ALIGNED address */ - unsigned int max_yres; - - while (m1) { - int t; - - while (m2 >= m1) m2 -= m1; - t = m1; - m1 = m2; - m2 = t; - } - m2 = linelen * PAGE_SIZE / m2; - *ydstorg = m2 = 0x400000 % m2; - max_yres = (vramlen - m2) / linelen; - if (var->yres_virtual > max_yres) - var->yres_virtual = max_yres; - } + } + /* There is hardware bug that no line can cross 4MB boundary */ + /* give up for CFB24, it is impossible to easy workaround it */ + /* for other try to do something */ + if (!ACCESS_FBINFO(capable.cross4MB) && (memlen > 0x400000)) { + if (bpp == 24) { + /* sorry */ + } else { + unsigned int linelen; + unsigned int m1 = linelen = var->xres_virtual * bpp / 8; + unsigned int m2 = PAGE_SIZE; /* or 128 if you do not need PAGE ALIGNED address */ + unsigned int max_yres; + + while (m1) { + int t; + + while (m2 >= m1) m2 -= m1; + t = m1; + m1 = m2; + m2 = t; + } + m2 = linelen * PAGE_SIZE / m2; + *ydstorg = m2 = 0x400000 % m2; + max_yres = (vramlen - m2) / linelen; + if (var->yres_virtual > max_yres) + var->yres_virtual = max_yres; } - } else { - matrox_text_round(PMINFO var, p); -#if 0 -/* we must limit pixclock by mclk... - Millennium I: 66 MHz = 15000 - Millennium II: 61 MHz = 16300 - Millennium G200: 83 MHz = 12000 */ - if (var->pixclock < 15000) - var->pixclock = 15000; /* limit for "normal" gclk & mclk */ -#endif } /* YDSTLEN contains only signed 16bit value */ if (var->yres_virtual > 32767) @@ -576,7 +615,7 @@ struct matrox_fb_info* minfo = container_of(fb_info, struct matrox_fb_info, fbcon); #endif - DBG("matroxfb_setcolreg") + DBG(__FUNCTION__) /* * Set a single color register. The values supplied are @@ -604,61 +643,42 @@ transp = CNVT_TOHW(transp, ACCESS_FBINFO(fbcon).var.transp.length); switch (ACCESS_FBINFO(fbcon).var.bits_per_pixel) { -#if defined(FBCON_HAS_CFB8) || defined(FBCON_HAS_CFB4) || defined(FBCON_HAS_VGATEXT) -#ifdef FBCON_HAS_VGATEXT - case 0: -#endif -#ifdef FBCON_HAS_CFB4 case 4: -#endif -#ifdef FBCON_HAS_CFB8 case 8: -#endif mga_outb(M_DAC_REG, regno); mga_outb(M_DAC_VAL, red); mga_outb(M_DAC_VAL, green); mga_outb(M_DAC_VAL, blue); break; -#endif -#ifdef FBCON_HAS_CFB16 case 16: - ACCESS_FBINFO(cmap.cfb16[regno]) = - (red << ACCESS_FBINFO(fbcon).var.red.offset) | - (green << ACCESS_FBINFO(fbcon).var.green.offset) | - (blue << ACCESS_FBINFO(fbcon).var.blue.offset) | - (transp << ACCESS_FBINFO(fbcon).var.transp.offset); /* for 1:5:5:5 */ + { + u_int16_t col = + (red << ACCESS_FBINFO(fbcon).var.red.offset) | + (green << ACCESS_FBINFO(fbcon).var.green.offset) | + (blue << ACCESS_FBINFO(fbcon).var.blue.offset) | + (transp << ACCESS_FBINFO(fbcon).var.transp.offset); /* for 1:5:5:5 */ + ACCESS_FBINFO(cmap[regno]) = col | (col << 16); + } break; -#endif -#ifdef FBCON_HAS_CFB24 case 24: - ACCESS_FBINFO(cmap.cfb24[regno]) = - (red << ACCESS_FBINFO(fbcon).var.red.offset) | - (green << ACCESS_FBINFO(fbcon).var.green.offset) | - (blue << ACCESS_FBINFO(fbcon).var.blue.offset); - break; -#endif -#ifdef FBCON_HAS_CFB32 case 32: - ACCESS_FBINFO(cmap.cfb32[regno]) = + ACCESS_FBINFO(cmap[regno]) = (red << ACCESS_FBINFO(fbcon).var.red.offset) | (green << ACCESS_FBINFO(fbcon).var.green.offset) | (blue << ACCESS_FBINFO(fbcon).var.blue.offset) | (transp << ACCESS_FBINFO(fbcon).var.transp.offset); /* 8:8:8:8 */ break; -#endif } return 0; } -static void matroxfb_update_fix(WPMINFO2) +static void matroxfb_init_fix(WPMINFO2) { struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; - DBG("matroxfb_get_fix") + DBG(__FUNCTION__) strcpy(fix->id,"MATROX"); - fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); - fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); fix->xpanstep = 8; /* 8 for 8bpp, 4 for 16bpp, 2 for 32bpp */ fix->ypanstep = 1; fix->ywrapstep = 0; @@ -667,91 +687,66 @@ fix->accel = ACCESS_FBINFO(devflags.accelerator); } -static int matroxfb_set_var(struct fb_var_screeninfo *var, int con, - struct fb_info *info) +static void matroxfb_update_fix(WPMINFO2) +{ + struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; + DBG(__FUNCTION__) + + fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); + fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); +} + +static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) +{ + int err; + int visual; + int cmap_len; + unsigned int ydstorg; + MINFO_FROM_INFO(info); + + if (ACCESS_FBINFO(dead)) { + return -ENXIO; + } + if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) + return err; + return 0; +} + +static int matroxfb_set_par(struct fb_info *info) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) int err; int visual; int cmap_len; unsigned int ydstorg; - struct display* display; - int chgvar; + struct fb_var_screeninfo *var; + MINFO_FROM_INFO(info); - DBG("matroxfb_set_var") + DBG(__FUNCTION__) if (ACCESS_FBINFO(dead)) { return -ENXIO; } - if (con >= 0) - display = fb_display + con; - else - display = ACCESS_FBINFO(fbcon.disp); - if ((err = matroxfb_decode_var(PMINFO display, var, &visual, &cmap_len, &ydstorg)) != 0) + var = &info->var; + if ((err = matroxfb_decode_var(PMINFO var, &visual, &cmap_len, &ydstorg)) != 0) return err; - switch (var->activate & FB_ACTIVATE_MASK) { - case FB_ACTIVATE_TEST: return 0; - case FB_ACTIVATE_NXTOPEN: /* ?? */ - case FB_ACTIVATE_NOW: break; /* continue */ - default: return -EINVAL; /* unknown */ - } - if (con >= 0) { - chgvar = ((display->var.xres != var->xres) || - (display->var.yres != var->yres) || - (display->var.xres_virtual != var->xres_virtual) || - (display->var.yres_virtual != var->yres_virtual) || - (display->var.bits_per_pixel != var->bits_per_pixel) || - memcmp(&display->var.red, &var->red, sizeof(var->red)) || - memcmp(&display->var.green, &var->green, sizeof(var->green)) || - memcmp(&display->var.blue, &var->blue, sizeof(var->blue))); - } else { - chgvar = 0; - } - display->var = *var; - /* cmap */ ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase)) + ydstorg; - if (display == ACCESS_FBINFO(currcon_display)) { - ACCESS_FBINFO(fbcon).var = *var; - matroxfb_update_fix(PMINFO2); - ACCESS_FBINFO(fbcon).fix.visual = visual; - if (var->bits_per_pixel) { - ACCESS_FBINFO(fbcon).fix.type = FB_TYPE_PACKED_PIXELS; - ACCESS_FBINFO(fbcon).fix.type_aux = 0; - display->next_line = ACCESS_FBINFO(fbcon).fix.line_length = (var->xres_virtual * var->bits_per_pixel) >> 3; - } else { - ACCESS_FBINFO(fbcon).fix.type = FB_TYPE_TEXT; - ACCESS_FBINFO(fbcon).fix.type_aux = ACCESS_FBINFO(devflags.text_type_aux); - display->next_line = ACCESS_FBINFO(fbcon).fix.line_length = (var->xres_virtual / (fontwidth(display)?fontwidth(display):8)) * ACCESS_FBINFO(devflags.textstep); - } - } - display->can_soft_blank = 1; - display->inverse = ACCESS_FBINFO(devflags.inverse); - /* conp, fb_info, vrows, cursor_x, cursor_y, fgcol, bgcol */ - /* next_plane, fontdata, _font*, userfont */ - initMatrox(PMINFO display); /* dispsw */ - /* dispsw, scrollmode, yscroll */ - /* fgshift, bgshift, charmask */ - if (chgvar && info && info->changevar) - info->changevar(con); - if (con == ACCESS_FBINFO(fbcon.currcon)) { + matroxfb_update_fix(PMINFO2); + ACCESS_FBINFO(fbcon).fix.visual = visual; + ACCESS_FBINFO(fbcon).fix.type = FB_TYPE_PACKED_PIXELS; + ACCESS_FBINFO(fbcon).fix.type_aux = 0; + ACCESS_FBINFO(fbcon).fix.line_length = (var->xres_virtual * var->bits_per_pixel) >> 3; + { unsigned int pos; ACCESS_FBINFO(curr.cmap_len) = cmap_len; - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - /* textmode must be in first megabyte, so no ydstorg allowed */ - ACCESS_FBINFO(curr.ydstorg.bytes) = 0; - ACCESS_FBINFO(curr.ydstorg.chunks) = 0; - ACCESS_FBINFO(curr.ydstorg.pixels) = 0; - } else { - ydstorg += ACCESS_FBINFO(devflags.ydstorg); - ACCESS_FBINFO(curr.ydstorg.bytes) = ydstorg; - ACCESS_FBINFO(curr.ydstorg.chunks) = ydstorg >> (isInterleave(MINFO)?3:2); - if (var->bits_per_pixel == 4) - ACCESS_FBINFO(curr.ydstorg.pixels) = ydstorg; - else - ACCESS_FBINFO(curr.ydstorg.pixels) = (ydstorg * 8) / var->bits_per_pixel; - } + ydstorg += ACCESS_FBINFO(devflags.ydstorg); + ACCESS_FBINFO(curr.ydstorg.bytes) = ydstorg; + ACCESS_FBINFO(curr.ydstorg.chunks) = ydstorg >> (isInterleave(MINFO)?3:2); + if (var->bits_per_pixel == 4) + ACCESS_FBINFO(curr.ydstorg.pixels) = ydstorg; + else + ACCESS_FBINFO(curr.ydstorg.pixels) = (ydstorg * 8) / var->bits_per_pixel; ACCESS_FBINFO(curr.final_bppShift) = matroxfb_get_final_bppShift(PMINFO var->bits_per_pixel); if (visual == MX_VISUAL_PSEUDOCOLOR) { int i; @@ -783,9 +778,6 @@ hw = &ACCESS_FBINFO(hw); - del_timer_sync(&ACCESS_FBINFO(cursor.timer)); - ACCESS_FBINFO(cursor.state) = CM_ERASE; - down_read(&ACCESS_FBINFO(altout).lock); for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { if (ACCESS_FBINFO(outputs[out]).src == MATROXFB_SRC_CRTC1 && @@ -796,22 +788,16 @@ up_read(&ACCESS_FBINFO(altout).lock); ACCESS_FBINFO(crtc1).pixclock = mt.pixclock; ACCESS_FBINFO(crtc1).mnp = mt.mnp; - ACCESS_FBINFO(hw_switch->init(PMINFO &mt, display)); - if (ACCESS_FBINFO(fbcon).fix.type == FB_TYPE_TEXT) { - if (fontheight(display)) - pos = var->yoffset / fontheight(display) * display->next_line / ACCESS_FBINFO(devflags.textstep) + var->xoffset / (fontwidth(display)?fontwidth(display):8); - else - pos = 0; - } else { - pos = (var->yoffset * var->xres_virtual + var->xoffset) * ACCESS_FBINFO(curr.final_bppShift) / 32; - pos += ACCESS_FBINFO(curr.ydstorg.chunks); - } + ACCESS_FBINFO(hw_switch->init(PMINFO &mt)); + pos = (var->yoffset * var->xres_virtual + var->xoffset) * ACCESS_FBINFO(curr.final_bppShift) / 32; + pos += ACCESS_FBINFO(curr.ydstorg.chunks); hw->CRTC[0x0D] = pos & 0xFF; hw->CRTC[0x0C] = (pos & 0xFF00) >> 8; hw->CRTCEXT[0] = (hw->CRTCEXT[0] & 0xF0) | ((pos >> 16) & 0x0F) | ((pos >> 14) & 0x40); hw->CRTCEXT[8] = pos >> 21; - ACCESS_FBINFO(hw_switch->restore(PMINFO display)); + ACCESS_FBINFO(hw_switch->restore(PMINFO2)); + update_crtc2(PMINFO pos); down_read(&ACCESS_FBINFO(altout).lock); for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { if (ACCESS_FBINFO(outputs[out]).src == MATROXFB_SRC_CRTC1 && @@ -819,7 +805,6 @@ ACCESS_FBINFO(outputs[out]).output->program(ACCESS_FBINFO(outputs[out]).data); } } - ACCESS_FBINFO(cursor.redraw) = 1; for (out = 0; out < MATROXFB_MAX_OUTPUTS; out++) { if (ACCESS_FBINFO(outputs[out]).src == MATROXFB_SRC_CRTC1 && ACCESS_FBINFO(outputs[out]).output->start) { @@ -828,94 +813,16 @@ } up_read(&ACCESS_FBINFO(altout).lock); matrox_cfbX_init(PMINFO2); - my_install_cmap(PMINFO2); } } return 0; -#undef minfo -} - -static int matrox_getcolreg(unsigned regno, unsigned *red, unsigned *green, - unsigned *blue, unsigned *transp, - struct fb_info *info) -{ - - DBG("matrox_getcolreg") - -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - /* - * Read a single color register and split it into colors/transparent. - * Return != 0 for invalid regno. - */ - - if (regno >= ACCESS_FBINFO(curr.cmap_len)) - return 1; - - *red = ACCESS_FBINFO(palette[regno].red); - *green = ACCESS_FBINFO(palette[regno].green); - *blue = ACCESS_FBINFO(palette[regno].blue); - *transp = ACCESS_FBINFO(palette[regno].transp); - return 0; -#undef minfo -} - -static int matroxfb_get_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - struct display* dsp = (con < 0) ? ACCESS_FBINFO(fbcon.disp) - : fb_display + con; - - DBG("matroxfb_get_cmap") - - if (ACCESS_FBINFO(dead)) { - return -ENXIO; - } - - if (con == ACCESS_FBINFO(fbcon.currcon)) /* current console? */ - return fb_get_cmap(cmap, kspc, matrox_getcolreg, info); - else if (dsp->cmap.len) /* non default colormap? */ - fb_copy_cmap(&dsp->cmap, cmap, kspc ? 0 : 2); - else - fb_copy_cmap(fb_default_cmap(matroxfb_get_cmap_len(&dsp->var)), - cmap, kspc ? 0 : 2); - return 0; -#undef minfo -} - -static int matroxfb_set_cmap(struct fb_cmap *cmap, int kspc, int con, - struct fb_info *info) -{ - unsigned int cmap_len; - struct display* dsp = (con < 0) ? info->disp : (fb_display + con); -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - - DBG("matroxfb_set_cmap") - - if (ACCESS_FBINFO(dead)) { - return -ENXIO; - } - - cmap_len = matroxfb_get_cmap_len(&dsp->var); - if (dsp->cmap.len != cmap_len) { - int err; - - err = fb_alloc_cmap(&dsp->cmap, cmap_len, 0); - if (err) - return err; - } - if (con == ACCESS_FBINFO(fbcon.currcon)) { /* current console? */ - return fb_set_cmap(cmap, kspc, info); - } else - fb_copy_cmap(cmap, &dsp->cmap, kspc ? 0 : 1); - return 0; -#undef minfo } -static int matroxfb_get_vblank(CPMINFO struct fb_vblank *vblank) +static int matroxfb_get_vblank(WPMINFO struct fb_vblank *vblank) { unsigned int sts1; + matroxfb_enable_irq(PMINFO 0); memset(vblank, 0, sizeof(*vblank)); vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VSYNC | FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_HBLANK; @@ -930,8 +837,12 @@ vblank->flags |= FB_VBLANK_VSYNCING; if (vblank->vcount >= ACCESS_FBINFO(fbcon).var.yres) vblank->flags |= FB_VBLANK_VBLANKING; - vblank->hcount = 0; - vblank->count = 0; + if (test_bit(0, &ACCESS_FBINFO(irq_flags))) { + vblank->flags |= FB_VBLANK_HAVE_COUNT; + /* Only one writer, aligned int value... + it should work without lock and without atomic_t */ + vblank->count = ACCESS_FBINFO(crtc1).vsync.cnt; + } return 0; } @@ -940,11 +851,12 @@ }; static int matroxfb_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, int con, + unsigned int cmd, unsigned long arg, struct fb_info *info) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - DBG("matroxfb_ioctl") + MINFO_FROM_INFO(info); + + DBG(__FUNCTION__) if (ACCESS_FBINFO(dead)) { return -ENXIO; @@ -963,6 +875,15 @@ return -EFAULT; return 0; } + case FBIO_WAITFORVSYNC: + { + u_int32_t crt; + + if (get_user(crt, (u_int32_t *)arg)) + return -EFAULT; + + return matroxfb_wait_for_sync(PMINFO crt); + } case MATROXFB_SET_OUTPUT_MODE: { struct matroxioc_output_mode mom; @@ -997,7 +918,7 @@ return val; switch (ACCESS_FBINFO(outputs[mom.output]).src) { case MATROXFB_SRC_CRTC1: - matroxfb_switch(ACCESS_FBINFO(fbcon.currcon), info); + matroxfb_set_par(info); break; case MATROXFB_SRC_CRTC2: { @@ -1006,7 +927,7 @@ down_read(&ACCESS_FBINFO(crtc2.lock)); crtc2 = ACCESS_FBINFO(crtc2.info); if (crtc2) - crtc2->fbcon.switch_con(crtc2->fbcon.currcon, &crtc2->fbcon); + crtc2->fbcon.fbops->fb_set_par(&crtc2->fbcon); up_read(&ACCESS_FBINFO(crtc2.lock)); } break; @@ -1086,7 +1007,7 @@ } if (!changes) return 0; - matroxfb_switch(ACCESS_FBINFO(fbcon.currcon), info); + matroxfb_set_par(info); return 0; } case MATROXFB_GET_OUTPUT_CONNECTION: @@ -1142,21 +1063,98 @@ return -EFAULT; return 0; } + case VIDIOC_QUERYCAP: + { + struct v4l2_capability r; + + memset(&r, 0, sizeof(r)); + strcpy(r.driver, "matroxfb"); + strcpy(r.card, "Matrox"); + sprintf(r.bus_info, "PCI:%s", ACCESS_FBINFO(pcidev)->slot_name); + r.version = KERNEL_VERSION(1,0,0); + r.capabilities = V4L2_CAP_VIDEO_OUTPUT; + if (copy_to_user((void*)arg, &r, sizeof(r))) + return -EFAULT; + return 0; + + } + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl qctrl; + int err; + + if (copy_from_user(&qctrl, (struct v4l2_queryctrl*)arg, sizeof(qctrl))) + return -EFAULT; + + down_read(&ACCESS_FBINFO(altout).lock); + if (!ACCESS_FBINFO(outputs[1]).output) { + err = -ENXIO; + } else if (ACCESS_FBINFO(outputs[1]).output->getqueryctrl) { + err = ACCESS_FBINFO(outputs[1]).output->getqueryctrl(ACCESS_FBINFO(outputs[1]).data, &qctrl); + } else { + err = -EINVAL; + } + up_read(&ACCESS_FBINFO(altout).lock); + if (err >= 0 && + copy_to_user((struct v4l2_queryctrl*)arg, &qctrl, sizeof(qctrl))) + return -EFAULT; + return err; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control ctrl; + int err; + + if (copy_from_user(&ctrl, (struct v4l2_control*)arg, sizeof(ctrl))) + return -EFAULT; + + down_read(&ACCESS_FBINFO(altout).lock); + if (!ACCESS_FBINFO(outputs[1]).output) { + err = -ENXIO; + } else if (ACCESS_FBINFO(outputs[1]).output->getctrl) { + err = ACCESS_FBINFO(outputs[1]).output->getctrl(ACCESS_FBINFO(outputs[1]).data, &ctrl); + } else { + err = -EINVAL; + } + up_read(&ACCESS_FBINFO(altout).lock); + if (err >= 0 && + copy_to_user((struct v4l2_control*)arg, &ctrl, sizeof(ctrl))) + return -EFAULT; + return err; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control ctrl; + int err; + + if (copy_from_user(&ctrl, (struct v4l2_control*)arg, sizeof(ctrl))) + return -EFAULT; + + down_read(&ACCESS_FBINFO(altout).lock); + if (!ACCESS_FBINFO(outputs[1]).output) { + err = -ENXIO; + } else if (ACCESS_FBINFO(outputs[1]).output->setctrl) { + err = ACCESS_FBINFO(outputs[1]).output->setctrl(ACCESS_FBINFO(outputs[1]).data, &ctrl); + } else { + err = -EINVAL; + } + up_read(&ACCESS_FBINFO(altout).lock); + return err; + } } return -ENOTTY; -#undef minfo } /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ static int matroxfb_blank(int blank, struct fb_info *info) { -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) int seq; int crtc; CRITFLAGS + MINFO_FROM_INFO(info); - DBG("matroxfb_blank") + DBG(__FUNCTION__) if (ACCESS_FBINFO(dead)) return 1; @@ -1178,72 +1176,24 @@ CRITEND return 0; -#undef minfo } static struct fb_ops matroxfb_ops = { .owner = THIS_MODULE, .fb_open = matroxfb_open, .fb_release = matroxfb_release, - .fb_set_var = matroxfb_set_var, - .fb_get_cmap = matroxfb_get_cmap, - .fb_set_cmap = matroxfb_set_cmap, + .fb_check_var = matroxfb_check_var, + .fb_set_par = matroxfb_set_par, .fb_setcolreg = matroxfb_setcolreg, .fb_pan_display =matroxfb_pan_display, .fb_blank = matroxfb_blank, .fb_ioctl = matroxfb_ioctl, +/* .fb_fillrect = , */ +/* .fb_copyarea = , */ +/* .fb_imageblit = , */ +/* .fb_cursor = , */ }; -int matroxfb_switch(int con, struct fb_info *info) -{ -#define minfo (container_of(info, struct matrox_fb_info, fbcon)) - struct fb_cmap* cmap; - struct display *p; - - DBG("matroxfb_switch"); - - if (ACCESS_FBINFO(fbcon.currcon) >= 0) { - /* Do we have to save the colormap? */ - cmap = &(ACCESS_FBINFO(currcon_display)->cmap); - dprintk(KERN_DEBUG "switch1: con = %d, cmap.len = %d\n", ACCESS_FBINFO(fbcon.currcon), cmap->len); - - if (cmap->len) { - dprintk(KERN_DEBUG "switch1a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp); - fb_get_cmap(cmap, 1, matrox_getcolreg, info); -#ifdef DEBUG - if (cmap->red) { - dprintk(KERN_DEBUG "switch1r: %X\n", cmap->red[0]); - } -#endif - } - } - ACCESS_FBINFO(fbcon.currcon) = con; - if (con < 0) - p = ACCESS_FBINFO(fbcon.disp); - else - p = fb_display + con; - ACCESS_FBINFO(currcon_display) = p; - p->var.activate = FB_ACTIVATE_NOW; -#ifdef DEBUG - cmap = &p->cmap; - dprintk(KERN_DEBUG "switch2: con = %d, cmap.len = %d\n", con, cmap->len); - dprintk(KERN_DEBUG "switch2a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp); - if (p->cmap.red) { - dprintk(KERN_DEBUG "switch2r: %X\n", cmap->red[0]); - } -#endif - matroxfb_set_var(&p->var, con, info); -#ifdef DEBUG - dprintk(KERN_DEBUG "switch3: con = %d, cmap.len = %d\n", con, cmap->len); - dprintk(KERN_DEBUG "switch3a: %p %p %p %p\n", cmap->red, cmap->green, cmap->blue, cmap->transp); - if (p->cmap.red) { - dprintk(KERN_DEBUG "switch3r: %X\n", cmap->red[0]); - } -#endif - return 0; -#undef minfo -} - #define RSDepth(X) (((X) >> 8) & 0x0F) #define RS8bpp 0x1 #define RS15bpp 0x2 @@ -1278,14 +1228,11 @@ static int nobios; /* "matrox:nobios" */ static int noinit = 1; /* "matrox:init" */ static int inverse; /* "matrox:inverse" */ -static int hwcursor = 1; /* "matrox:nohwcursor" */ -static int blink = 1; /* "matrox:noblink" */ static int sgram; /* "matrox:sgram" */ #ifdef CONFIG_MTRR static int mtrr = 1; /* "matrox:nomtrr" */ #endif static int grayscale; /* "matrox:grayscale" */ -static unsigned int fastfont; /* "matrox:fastfont:xxxxx" */ static int dev = -1; /* "matrox:dev:xxxxx" */ static unsigned int vesa = ~0; /* "matrox:vesa:xxxxx" */ static int depth = -1; /* "matrox:depth:xxxxx" */ @@ -1305,7 +1252,6 @@ static int dfp; /* "matrox:dfp */ static int dfp_type = -1; /* "matrox:dfp:xxx */ static int memtype = -1; /* "matrox:memtype:xxx" */ -static char fontname[64]; /* "matrox:font:xxxxx" */ #ifndef MODULE static char videomode[64]; /* "matrox:mode:xxxxx" or "matrox:xxxxx" */ @@ -1319,7 +1265,7 @@ unsigned char bytes[32]; unsigned char* tmp; - DBG("matroxfb_getmemory") + DBG(__FUNCTION__) vm = ACCESS_FBINFO(video.vbase); maxSize &= ~0x1FFFFF; /* must be X*2MB (really it must be 2 or X*4MB) */ @@ -1571,13 +1517,13 @@ static int hotplug = 0; -static int initMatrox2(WPMINFO struct display* d, struct board* b){ +static int initMatrox2(WPMINFO struct board* b){ unsigned long ctrlptr_phys = 0; unsigned long video_base_phys = 0; unsigned int memsize; int err; - DBG("initMatrox2") + DBG(__FUNCTION__) /* set default values... */ vesafb_defined.accel_flags = FB_ACCELF_TEXT; @@ -1713,7 +1659,6 @@ ACCESS_FBINFO(devflags.ydstorg) = 0; ACCESS_FBINFO(fbcon.currcon) = -1; - ACCESS_FBINFO(currcon_display) = d; ACCESS_FBINFO(video.base) = video_base_phys; ACCESS_FBINFO(video.len_usable) = ACCESS_FBINFO(video.len); if (ACCESS_FBINFO(video.len_usable) > b->base->maxdisplayable) @@ -1738,9 +1683,6 @@ ACCESS_FBINFO(fbcon.monspecs.dpms) = 0; /* TBD */ /* static settings */ - if ((depth == RSText8) && (!*ACCESS_FBINFO(fbcon.fontname))) { - strcpy(ACCESS_FBINFO(fbcon.fontname), "VGA8x8"); - } vesafb_defined.red = colors[depth-1].red; vesafb_defined.green = colors[depth-1].green; vesafb_defined.blue = colors[depth-1].blue; @@ -1750,12 +1692,9 @@ if (noaccel) vesafb_defined.accel_flags &= ~FB_ACCELF_TEXT; - strcpy(ACCESS_FBINFO(fbcon.modename), "MATROX VGA"); - ACCESS_FBINFO(fbcon.changevar) = NULL; - ACCESS_FBINFO(fbcon.fbops) = &matroxfb_ops; - ACCESS_FBINFO(fbcon.disp) = d; - ACCESS_FBINFO(fbcon.switch_con) = &matroxfb_switch; - ACCESS_FBINFO(fbcon.updatevar) = &matroxfb_updatevar; + ACCESS_FBINFO(fbops) = matroxfb_ops; + ACCESS_FBINFO(fbcon.fbops) = &ACCESS_FBINFO(fbops); + ACCESS_FBINFO(fbcon.pseudo_palette) = ACCESS_FBINFO(cmap); /* after __init time we are like module... no logo */ ACCESS_FBINFO(fbcon.flags) = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT; ACCESS_FBINFO(video.len_usable) &= PAGE_MASK; @@ -1852,11 +1791,8 @@ vesafb_defined.yres_virtual = 65536; /* large enough to be INF, but small enough to yres_virtual * xres_virtual < 2^32 */ } + matroxfb_init_fix(PMINFO2); err = -EINVAL; - if (matroxfb_set_var(&vesafb_defined, -2, &ACCESS_FBINFO(fbcon))) { - printk(KERN_ERR "matroxfb: cannot set required parameters\n"); - goto failVideoIO; - } printk(KERN_INFO "matroxfb: %dx%dx%dbpp (virtual: %dx%d)\n", vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, @@ -1871,13 +1807,13 @@ goto failVideoIO; } printk("fb%d: %s frame buffer device\n", - ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.modename)); + ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id)); if (ACCESS_FBINFO(fbcon.currcon) < 0) { /* there is no console on this fb... but we have to initialize hardware * until someone tells me what is proper thing to do */ printk(KERN_INFO "fb%d: initializing hardware\n", ACCESS_FBINFO(fbcon.node)); - matroxfb_set_var(&vesafb_defined, -1, &ACCESS_FBINFO(fbcon)); + fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); } return 0; failVideoIO:; @@ -1977,14 +1913,12 @@ u_int16_t svid; u_int16_t sid; struct matrox_fb_info* minfo; - struct display* d; int err; u_int32_t cmd; #ifndef CONFIG_FB_MATROX_MULTIHEAD static int registered = 0; - static struct display global_disp; #endif - DBG("matroxfb_probe") + DBG(__FUNCTION__) pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); svid = pdev->subsystem_vendor; @@ -2012,28 +1946,20 @@ minfo = (struct matrox_fb_info*)kmalloc(sizeof(*minfo), GFP_KERNEL); if (!minfo) return -1; - d = (struct display*)kmalloc(sizeof(*d), GFP_KERNEL); - if (!d) { - kfree(minfo); - return -1; - } #else if (registered) /* singlehead driver... */ return -1; minfo = &matroxfb_global_mxinfo; - d = &global_disp; #endif memset(MINFO, 0, sizeof(*MINFO)); - memset(d, 0, sizeof(*d)); ACCESS_FBINFO(pcidev) = pdev; ACCESS_FBINFO(dead) = 0; ACCESS_FBINFO(usecount) = 0; + ACCESS_FBINFO(userusecount) = 0; + pci_set_drvdata(pdev, MINFO); - /* CMDLINE */ - memcpy(ACCESS_FBINFO(fbcon.fontname), fontname, sizeof(ACCESS_FBINFO(fbcon.fontname))); /* DEVFLAGS */ - ACCESS_FBINFO(devflags.inverse) = inverse; ACCESS_FBINFO(devflags.memtype) = memtype; if (memtype != -1) noinit = 0; @@ -2054,22 +1980,18 @@ ACCESS_FBINFO(devflags.nopciretry) = no_pci_retry; ACCESS_FBINFO(devflags.mga_24bpp_fix) = inv24; ACCESS_FBINFO(devflags.precise_width) = option_precise_width; - ACCESS_FBINFO(devflags.hwcursor) = hwcursor; - ACCESS_FBINFO(devflags.blink) = blink; ACCESS_FBINFO(devflags.sgram) = sgram; ACCESS_FBINFO(capable.cross4MB) = cross4MB; - ACCESS_FBINFO(fastfont.size) = fastfont; - - ACCESS_FBINFO(cursor.state) = CM_ERASE; - init_timer (&ACCESS_FBINFO(cursor.timer)); - ACCESS_FBINFO(cursor.timer.data) = (unsigned long)MINFO; spin_lock_init(&ACCESS_FBINFO(lock.DAC)); spin_lock_init(&ACCESS_FBINFO(lock.accel)); init_rwsem(&ACCESS_FBINFO(crtc2.lock)); init_rwsem(&ACCESS_FBINFO(altout.lock)); + ACCESS_FBINFO(irq_flags) = 0; + init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait)); + init_waitqueue_head(&ACCESS_FBINFO(crtc2.vsync.wait)); - err = initMatrox2(PMINFO d, b); + err = initMatrox2(PMINFO b); if (!err) { #ifndef CONFIG_FB_MATROX_MULTIHEAD registered = 1; @@ -2078,7 +2000,6 @@ return 0; } #ifdef CONFIG_FB_MATROX_MULTIHEAD - kfree(d); kfree(minfo); #endif return -1; @@ -2172,7 +2093,6 @@ #define RSCreate(X,Y) ((X) | ((Y) << 8)) static struct { unsigned int vesa; unsigned int info; } *RSptr, vesamap[] __initdata = { /* default must be first */ -#ifdef FBCON_HAS_CFB8 { ~0, RSCreate(RSNoxNo, RS8bpp ) }, { 0x101, RSCreate(RS640x480, RS8bpp ) }, { 0x100, RSCreate(RS640x400, RS8bpp ) }, @@ -2184,9 +2104,6 @@ { 0x107, RSCreate(RS1280x1024, RS8bpp ) }, { 0x198, RSCreate(RS1408x1056, RS8bpp ) }, { 0x11C, RSCreate(RS1600x1200, RS8bpp ) }, -#endif -#ifdef FBCON_HAS_CFB16 - { ~0, RSCreate(RSNoxNo, RS15bpp) }, { 0x110, RSCreate(RS640x480, RS15bpp) }, { 0x181, RSCreate(RS768x576, RS15bpp) }, { 0x113, RSCreate(RS800x600, RS15bpp) }, @@ -2205,9 +2122,6 @@ { 0x11A, RSCreate(RS1280x1024, RS16bpp) }, { 0x19A, RSCreate(RS1408x1056, RS16bpp) }, { 0x11E, RSCreate(RS1600x1200, RS16bpp) }, -#endif -#ifdef FBCON_HAS_CFB24 - { ~0, RSCreate(RSNoxNo, RS24bpp) }, { 0x1B2, RSCreate(RS640x480, RS24bpp) }, { 0x184, RSCreate(RS768x576, RS24bpp) }, { 0x1B5, RSCreate(RS800x600, RS24bpp) }, @@ -2217,9 +2131,6 @@ { 0x1BB, RSCreate(RS1280x1024, RS24bpp) }, { 0x19C, RSCreate(RS1408x1056, RS24bpp) }, { 0x1BF, RSCreate(RS1600x1200, RS24bpp) }, -#endif -#ifdef FBCON_HAS_CFB32 - { ~0, RSCreate(RSNoxNo, RS32bpp) }, { 0x112, RSCreate(RS640x480, RS32bpp) }, { 0x183, RSCreate(RS768x576, RS32bpp) }, { 0x115, RSCreate(RS800x600, RS32bpp) }, @@ -2229,27 +2140,11 @@ { 0x11B, RSCreate(RS1280x1024, RS32bpp) }, { 0x19B, RSCreate(RS1408x1056, RS32bpp) }, { 0x11F, RSCreate(RS1600x1200, RS32bpp) }, -#endif -#ifdef FBCON_HAS_VGATEXT - { ~0, RSCreate(RSNoxNo, RSText ) }, - { 0x002, RSCreate(RS640x400, RSText ) }, /* 80x25 */ - { 0x003, RSCreate(RS640x400, RSText ) }, /* 80x25 */ - { 0x007, RSCreate(RS640x400, RSText ) }, /* 80x25 */ - { 0x1C0, RSCreate(RS640x400, RSText8) }, /* 80x50 */ - { 0x108, RSCreate(RS640x480, RSText8) }, /* 80x60 */ - { 0x109, RSCreate(RS1056x400, RSText ) }, /* 132x25 */ - { 0x10A, RSCreate(RS1056x344, RSText8) }, /* 132x43 */ - { 0x10B, RSCreate(RS1056x400, RSText8) }, /* 132x50 */ - { 0x10C, RSCreate(RS1056x480, RSText8) }, /* 132x60 */ -#endif -#ifdef FBCON_HAS_CFB4 - { ~0, RSCreate(RSNoxNo, RS4bpp ) }, { 0x010, RSCreate(RS640x350, RS4bpp ) }, { 0x012, RSCreate(RS640x480, RS4bpp ) }, { 0x102, RSCreate(RS800x600, RS4bpp ) }, { 0x104, RSCreate(RS1024x768, RS4bpp ) }, { 0x106, RSCreate(RS1280x1024, RS4bpp ) }, -#endif { 0, 0 }}; static void __init matroxfb_init_params(void) { @@ -2315,9 +2210,7 @@ int __init matroxfb_setup(char *options) { char *this_opt; - DBG("matroxfb_setup") - - fontname[0] = '\0'; + DBG(__FUNCTION__) if (!options || !*options) return 0; @@ -2363,8 +2256,6 @@ sync = simple_strtoul(this_opt+5, NULL, 0); else if (!strncmp(this_opt, "vesa:", 5)) vesa = simple_strtoul(this_opt+5, NULL, 0); - else if (!strncmp(this_opt, "font:", 5)) - strlcpy(fontname, this_opt+5, sizeof(fontname)); else if (!strncmp(this_opt, "maxclk:", 7)) maxclk = simple_strtoul(this_opt+7, NULL, 0); else if (!strncmp(this_opt, "fh:", 3)) @@ -2379,7 +2270,7 @@ dfp_type = simple_strtoul(this_opt+4, NULL, 0); dfp = 1; } -#ifdef CONFIG_PPC +#ifdef CONFIG_ALL_PPC else if (!strncmp(this_opt, "vmode:", 6)) { unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0); if (vmode > 0 && vmode <= VMODE_MAX) @@ -2402,10 +2293,6 @@ } } #endif - else if (!strncmp(this_opt, "fastfont:", 9)) - fastfont = simple_strtoul(this_opt+9, NULL, 0); - else if (!strcmp(this_opt, "nofastfont")) /* fastfont:N and nofastfont (nofastfont = fastfont:0) */ - fastfont = 0; else if (!strcmp(this_opt, "disabled")) /* nodisabled does not exist */ disabled = 1; else if (!strcmp(this_opt, "enabled")) /* noenabled does not exist */ @@ -2445,10 +2332,6 @@ inv24 = value; else if (!strcmp(this_opt, "cross4MB")) cross4MB = value; - else if (!strcmp(this_opt, "hwcursor")) - hwcursor = value; - else if (!strcmp(this_opt, "blink")) - blink = value; else if (!strcmp(this_opt, "grayscale")) grayscale = value; else if (!strcmp(this_opt, "dfp")) @@ -2465,7 +2348,7 @@ int __init matroxfb_init(void) { - DBG("matroxfb_init") + DBG(__FUNCTION__) if (disabled) return -ENXIO; @@ -2550,12 +2433,6 @@ MODULE_PARM(fv, "i"); MODULE_PARM_DESC(fv, "Startup vertical frequency, 0-INF Hz\n" "You should specify \"fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock\"\n"); -MODULE_PARM(hwcursor, "i"); -MODULE_PARM_DESC(hwcursor, "Enables hardware cursor (0 or 1) (default=0)"); -MODULE_PARM(blink, "i"); -MODULE_PARM_DESC(blink, "Enables hardware cursor blinking (0 or 1) (default=1)"); -MODULE_PARM(fastfont, "i"); -MODULE_PARM_DESC(fastfont, "Specifies, how much memory should be used for font data (0, 1024-65536 are reasonable) (default=0)"); MODULE_PARM(grayscale, "i"); MODULE_PARM_DESC(grayscale, "Sets display into grayscale. Works perfectly with paletized videomode (4, 8bpp), some limitations apply to 16, 24 and 32bpp videomodes (default=nograyscale)"); MODULE_PARM(cross4MB, "i"); @@ -2564,7 +2441,7 @@ MODULE_PARM_DESC(dfp, "Specifies whether to use digital flat panel interface of G200/G400 (0 or 1) (default=0)"); MODULE_PARM(dfp_type, "i"); MODULE_PARM_DESC(dfp_type, "Specifies DFP interface type (0 to 255) (default=read from hardware)"); -#ifdef CONFIG_PPC +#ifdef CONFIG_ALL_PPC MODULE_PARM(vmode, "i"); MODULE_PARM_DESC(vmode, "Specify the vmode mode number that should be used (640x480 default)"); MODULE_PARM(cmode, "i"); @@ -2573,7 +2450,7 @@ int __init init_module(void){ - DBG("init_module") + DBG(__FUNCTION__) if (disabled) return -ENXIO; @@ -2605,7 +2482,7 @@ module_exit(matrox_done); EXPORT_SYMBOL(matroxfb_register_driver); EXPORT_SYMBOL(matroxfb_unregister_driver); -EXPORT_SYMBOL(matroxfb_switch); +EXPORT_SYMBOL(matroxfb_wait_for_sync); /* * Overrides for Emacs so that we follow Linus's tabbing style. @@ -2614,3 +2491,4 @@ * c-basic-offset: 8 * End: */ + diff -urN linux-2.5.70-bk5/drivers/video/matrox/matroxfb_base.h linux-2.5.70-bk6/drivers/video/matrox/matroxfb_base.h --- linux-2.5.70-bk5/drivers/video/matrox/matroxfb_base.h 2003-05-26 18:00:40.000000000 -0700 +++ linux-2.5.70-bk6/drivers/video/matrox/matroxfb_base.h 2003-06-01 04:39:46.000000000 -0700 @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -49,12 +50,7 @@ #include #endif -#include