1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
S3 Savage/MX and Savage/IX patches for XFree86 3.3.6 post fix-08
http://www.probo.com/timr/savagemx.html
from: Sun Oct 22 10:12:06 CEST 2000
--- programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_cursor.c.orig Sun Oct 22 09:52:21 2000
+++ programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_cursor.c Fri Sep 1 22:12:56 2000
@@ -250,7 +250,7 @@
/* VerticalRetraceWait(); */
/* turn cursor off */
- S3VHideCursor();
+ S3SAVHideCursor();
/* move cursor off-screen */
outb(vgaCRIndex, 0x46);
--- programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_driver.c.orig Sun Oct 22 09:52:21 2000
+++ programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_driver.c Fri Sep 29 23:19:23 2000
@@ -94,6 +94,7 @@
static void S3SAVRestore();
static void S3SAVAdjust();
static void S3SAVFbInit();
+static int S3SAVPitchAdjust();
void S3SAVSetRead();
void S3SAVAccelInit();
void S3SAVInitialize2DEngine();
@@ -721,12 +722,12 @@
/* Restore the desired video mode with CR67 */
- outb(vgaCRIndex, 0x67);
#if 0
+ outb(vgaCRIndex, 0x67);
cr67 = inb(vgaCRReg) & 0xf; /* Possible hardware bug on VX? */
-#endif
outb(vgaCRReg, 0x50 | cr67);
usleep(10000);
+#endif
outb(vgaCRIndex, 0x67);
outb(vgaCRReg, restore->CR67 & ~0x0c); /* Don't enable STREAMS yet */
@@ -745,9 +746,11 @@
outb(vgaCRReg, restore->CR51);
/* Memory timings */
- outb(vgaCRIndex, 0x36);
+ outb(vgaCRIndex, 0x36);
outb(vgaCRReg, restore->CR36);
- outb(vgaCRIndex, 0x68);
+ outb(vgaCRIndex, 0x60);
+ outb(vgaCRReg, restore->CR60);
+ outb(vgaCRIndex, 0x68);
outb(vgaCRReg, restore->CR68);
outb(vgaCRIndex, 0x69);
outb(vgaCRReg, restore->CR69);
@@ -764,8 +767,11 @@
outb(vgaCRReg, restore->CR90);
outb(vgaCRIndex, 0x91);
outb(vgaCRReg, restore->CR91);
- outb(vgaCRIndex, 0xB0); /* Savage4 config3 */
- outb(vgaCRReg, restore->CRB0);
+ if( s3vPriv.chip == S3_SAVAGE4 )
+ {
+ outb(vgaCRIndex, 0xB0); /* Savage4 config3 */
+ outb(vgaCRReg, restore->CRB0);
+ }
outb(vgaCRIndex, 0x32);
outb(vgaCRReg, restore->CR32);
@@ -981,6 +987,8 @@
save->CR53 = inb(vgaCRReg);
outb(vgaCRIndex, 0x58);
save->CR58 = inb(vgaCRReg);
+ outb(vgaCRIndex, 0x60);
+ save->CR60 = inb(vgaCRReg);
outb(vgaCRIndex, 0x66);
save->CR66 = inb(vgaCRReg);
outb(vgaCRIndex, 0x67);
@@ -1135,10 +1143,29 @@
}
+/*
+ * This function adjusts the pitch to a multiple of 16 pixels.
+ */
+
+static int
+S3SAVPitchAdjust( void )
+{
+ int pitch = vga256InfoRec.virtualX;
+
+ if( pitch % 16 != 0 )
+ {
+ pitch = (pitch + 15) & ~15;
+
+ ErrorF("%s %s: %s: Display width padded to %d bytes.\n",
+ XCONFIG_PROBED, vga256InfoRec.name, vga256InfoRec.chipset,
+ pitch);
+ }
+ return pitch;
+}
+
+
/*
- * This is the main probe function for the virge chipsets.
- * Right now, I have taken a shortcut and get most of the info from
- * PCI probing.
+ * This is the main probe function for the Savage chipsets.
*/
static Bool
@@ -1511,6 +1538,8 @@
S3V.ChipLinearBase = vga256InfoRec.MemBase;
S3V.ChipLinearSize = vga256InfoRec.videoRam * 1024;
+ vgaSetPitchAdjustHook(S3SAVPitchAdjust);
+
return TRUE;
}
@@ -1782,9 +1811,9 @@
outb(vgaCRIndex, 0x3a);
tmp = inb(vgaCRReg);
if(!OFLG_ISSET(OPTION_PCI_BURST_ON, &vga256InfoRec.options))
- new->CR3A = tmp | 0x95; /* ENH 256, no PCI burst! */
+ new->CR3A = tmp | 0x90; /* ENH 256, no PCI burst! */
else
- new->CR3A = (tmp & 0x7f) | 0x15; /* ENH 256, PCI burst */
+ new->CR3A = (tmp & 0x7f) | 0x10; /* ENH 256, PCI burst */
new->CR53 &= ~0x08; /* Enables MMIO */
new->CR31 = 0x8c; /* Dis. 64k window, en. ENH maps */
@@ -1806,12 +1835,22 @@
dclk = vga256InfoRec.clock[mode->Clock];
new->CR67 = 0x00; /* Defaults */
- new->SR15 = 0x03 | 0x80;
+ if( s3vPriv.chip != S3_SAVAGE2000 )
+ new->SR15 = 0x03 | 0x80;
+ else
+ /* One-cycle writes broken on Savage2000? */
+ new->SR15 = 0x03;
new->SR18 = 0x00;
new->CR43 = 0x00;
new->CR45 = 0x00;
new->CR65 = 0x00;
+ outb(vgaCRIndex, 0x60);
+ new->CR60 = inb(vgaCRReg);
+
+ if( s3vPriv.chip == S3_SAVAGE_MX )
+ new->CR60 = 0x09;
+
outb(vgaCRIndex, 0x40);
new->CR40 = inb(vgaCRReg) & ~0x01;
@@ -1852,16 +1891,19 @@
{
if (vgaBitsPerPixel == 8) {
- if (dclk <= 110000) new->CR67 = 0x00; /* 8bpp, 135MHz */
- else new->CR67 = 0x10; /* 8bpp, 220MHz */
+ new->CR67 = 0x00; /* 8bpp, 220MHz */
}
else if ((vgaBitsPerPixel == 16) && (vga256InfoRec.weight.green == 5)) {
- if (dclk <= 110000) new->CR67 = 0x20; /* 15bpp, 135MHz */
- else new->CR67 = 0x30; /* 15bpp, 220MHz */
+ if( s3vPriv.chip == S3_SAVAGE_MX )
+ new->CR67 = 0x30; /* 15bpp, 220MHz */
+ else
+ new->CR67 = 0x20;
}
else if (vgaBitsPerPixel == 16) {
- if (dclk <= 110000) new->CR67 = 0x40; /* 16bpp, 135MHz */
- else new->CR67 = 0x50; /* 16bpp, 220MHz */
+ if( s3vPriv.chip == S3_SAVAGE_MX )
+ new->CR67 = 0x50; /* 16bpp, 220MHz */
+ else
+ new->CR67 = 0x40;
}
else if ((vgaBitsPerPixel == 24) || (vgaBitsPerPixel == 32)) {
new->CR67 = 0xd0; /* 24bpp, 135MHz */
@@ -1967,8 +2009,12 @@
else
new->CR50 |= 0xC1; /* default to use GlobalBD */
- new->CR33 = 0x20;
+ if( s3vPriv.chip == S3_SAVAGE2000 )
+ new->CR33 = 0x08;
+ else
+ new->CR33 = 0x20;
+ new->std.CRTC[0x17] = 0xeb;
/* Now we handle various XConfig memory options and others */
--- programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_driver.h.orig Sun Oct 22 09:52:21 2000
+++ programs/Xserver/hw/xfree86/vga256/drivers/s3_savage/s3sav_driver.h Sat Sep 2 02:57:01 2000
@@ -25,7 +25,7 @@
unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C;
unsigned char CR40, CR42, CR43, CR45;
unsigned char CR50, CR51, CR53, CR58, CR5B, CR5D, CR5E;
- unsigned char CR65, CR66, CR67, CR68, CR69, CR6F; /* Video attrib. */
+ unsigned char CR60, CR65, CR66, CR67, CR68, CR69, CR6F; /* Video attrib. */
unsigned char CR86, CR88;
unsigned char CR90, CR91, CRB0;
unsigned char ColorStack[8]; /* S3 hw cursor color stack CR4A/CR4B */
|