2 * fix for hardware cursor
3 (Voodoo4/Voodoo5 specific problem? bottom 48 lines contained random data
4 if cursor start address was not aligned down to even page boundary...)
6 (I'm not sure about hardware, but at least this driver doesn't support colour
7 lookup tables in 16/24/32bpp, so visual must be TRUECOLOR, not DIRECTCOLOR)
8 * interlace support (works on Voodoo4 (50 Hz only?), problably Voodoo[35] too)
9 * partial doublescan support (hardware cursor still doesn't work correctly,
10 but such modes doesn't just turn monitor out-of-sync)
12 -- Jakub Bogusz <qboosh@pld.org.pl>
14 --- linux-2.4.20/drivers/video/tdfxfb.c.orig Mon Feb 25 20:38:07 2002
15 +++ linux-2.4.20/drivers/video/tdfxfb.c Mon Dec 2 23:19:54 2002
17 #define VGAINIT1_MASK 0x1fffff
18 #define VIDCFG_VIDPROC_ENABLE BIT(0)
19 #define VIDCFG_CURS_X11 BIT(1)
20 +#define VIDCFG_INTERLACE BIT(3)
21 #define VIDCFG_HALF_MODE BIT(4)
22 #define VIDCFG_DESK_ENABLE BIT(7)
23 #define VIDCFG_CLUT_BYPASS BIT(10)
25 #define TDFXF_VSYNC_ACT_LOW 0x08
26 #define TDFXF_LINE_DOUBLE 0x10
27 #define TDFXF_VIDEO_ENABLE 0x20
28 +#define TDFXF_INTERLACE 0x40
30 #define TDFXF_HSYNC_MASK 0x03
31 #define TDFXF_VSYNC_MASK 0x0c
32 @@ -1321,10 +1323,17 @@
36 - vd = par->vdispend - 1;
37 - vs = par->vsyncsta - 1;
38 - ve = par->vsyncend - 1;
39 - vt = par->vtotal - 2;
40 + if (par->video & TDFXF_LINE_DOUBLE) {
41 + vd = (par->vdispend << 1) - 1;
42 + vs = (par->vsyncsta << 1) - 1;
43 + ve = (par->vsyncend << 1) - 1;
44 + vt = (par->vtotal << 1) - 2;
46 + vd = par->vdispend - 1;
47 + vs = par->vsyncsta - 1;
48 + ve = par->vsyncend - 1;
49 + vt = par->vtotal - 2;
56 reg.vgainit1 = tdfx_inl(VGAINIT1) & 0x1fffff;
58 - fb_info.cursor.enable=reg.vidcfg | VIDCFG_HWCURSOR_ENABLE;
59 - fb_info.cursor.disable=reg.vidcfg;
61 reg.stride = par->width*cpp;
64 @@ -1450,9 +1456,20 @@
65 reg.gfxpll = do_calc_pll(..., &fout);
68 - reg.screensize = par->width | (par->height << 12);
69 - reg.vidcfg &= ~VIDCFG_HALF_MODE;
70 + if (par->video & TDFXF_LINE_DOUBLE) {
71 + reg.screensize = par->width | (par->height << 13);
72 + reg.vidcfg |= VIDCFG_HALF_MODE;
73 + reg.crt[0x09] |= 0x80;
75 + reg.screensize = par->width | (par->height << 12);
76 + reg.vidcfg &= ~VIDCFG_HALF_MODE;
78 + if (par->video & TDFXF_INTERLACE)
79 + reg.vidcfg |= VIDCFG_INTERLACE;
81 + fb_info.cursor.enable=reg.vidcfg | VIDCFG_HWCURSOR_ENABLE;
82 + fb_info.cursor.disable=reg.vidcfg;
84 reg.miscinit0 = tdfx_inl(MISCINIT0);
86 #if defined(__BIG_ENDIAN)
87 @@ -1496,11 +1513,6 @@
91 - if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
92 - DPRINTK("interlace not supported\n");
97 DPRINTK("xoffset not supported\n");
99 @@ -1516,9 +1528,10 @@
103 - /* fixme: does Voodoo3 support interlace? Banshee doesn't */
104 - if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
105 - DPRINTK("interlace not supported\n");
106 + /* Banshee doesn't support interlace, but Voodoo4 and probably Voodoo3 do. */
107 + if(((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
108 + && (i->dev == PCI_DEVICE_ID_3DFX_BANSHEE)) {
109 + DPRINTK("interlace not supported on Banshee\n");
113 @@ -1578,6 +1591,8 @@
114 par->video |= TDFXF_VSYNC_ACT_LOW;
115 if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
116 par->video |= TDFXF_LINE_DOUBLE;
117 + else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
118 + par->video |= TDFXF_INTERLACE;
119 if(var->activate == FB_ACTIVATE_NOW)
120 par->video |= TDFXF_VIDEO_ENABLE;
122 @@ -1639,6 +1654,8 @@
123 v.sync |= FB_SYNC_VERT_HIGH_ACT;
124 if(par->video & TDFXF_LINE_DOUBLE)
125 v.vmode = FB_VMODE_DOUBLE;
126 + else if(par->video & TDFXF_INTERLACE)
127 + v.vmode = FB_VMODE_INTERLACED;
131 @@ -1672,7 +1689,7 @@
132 fix->line_length = par->lpitch;
133 fix->visual = (par->bpp == 8)
134 ? FB_VISUAL_PSEUDOCOLOR
135 - : FB_VISUAL_DIRECTCOLOR;
136 + : FB_VISUAL_TRUECOLOR;
139 fix->ypanstep = nopan ? 0 : 1;
140 @@ -2386,7 +2403,9 @@
141 static void tdfxfb_hwcursor_init(void)
144 - start = (fb_info.bufbase_size-1024) & PAGE_MASK;
145 + start = (fb_info.bufbase_size-1024) & (PAGE_MASK << 1);
146 + /* even page boundary - on Voodoo4 4500 bottom 48 lines
147 + * contained trash when just page boundary was used... */
148 fb_info.bufbase_size=start;
149 fb_info.cursor.cursorimage=fb_info.bufbase_size;
150 printk("tdfxfb: reserving 1024 bytes for the hwcursor at %p\n",