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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/* $XFree86$ */
/*
* Reformatted with GNU indent (2.2.8), using the following options:
*
* -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78
* -lp -npcs -psl -sob -ss -br -ce -sc -hnl
*
* This provides a good match with the original i810 code and preferred
* XFree86 formatting conventions.
*
* When editing this driver, please follow the existing formatting, and edit
* with <TAB> characters expanded at 8-column intervals.
*/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#include "xf86.h"
#include "i810.h"
struct wm_info {
double freq;
unsigned int wm;
};
struct wm_info i810_wm_8_100[] = {
{0, 0x22003000},
{25.2, 0x22003000},
{28.0, 0x22003000},
{31.5, 0x22003000},
{36.0, 0x22007000},
{40.0, 0x22007000},
{45.0, 0x22007000},
{49.5, 0x22008000},
{50.0, 0x22008000},
{56.3, 0x22008000},
{65.0, 0x22008000},
{75.0, 0x22008000},
{78.8, 0x22008000},
{80.0, 0x22008000},
{94.0, 0x22008000},
{96.0, 0x22107000},
{99.0, 0x22107000},
{108.0, 0x22107000},
{121.0, 0x22107000},
{128.9, 0x22107000},
{132.0, 0x22109000},
{135.0, 0x22109000},
{157.5, 0x2210b000},
{162.0, 0x2210b000},
{175.5, 0x2210b000},
{189.0, 0x2220e000},
{202.5, 0x2220e000}
};
struct wm_info i810_wm_16_100[] = {
{0, 0x22004000},
{25.2, 0x22006000},
{28.0, 0x22006000},
{31.5, 0x22007000},
{36.0, 0x22007000},
{40.0, 0x22007000},
{45.0, 0x22007000},
{49.5, 0x22009000},
{50.0, 0x22009000},
{56.3, 0x22108000},
{65.0, 0x2210e000},
{75.0, 0x2210e000},
{78.8, 0x2210e000},
{80.0, 0x22210000},
{94.5, 0x22210000},
{96.0, 0x22210000},
{99.0, 0x22210000},
{108.0, 0x22210000},
{121.0, 0x22210000},
{128.9, 0x22210000},
{132.0, 0x22314000},
{135.0, 0x22314000},
{157.5, 0x22415000},
{162.0, 0x22416000},
{175.5, 0x22416000},
{189.0, 0x22416000},
{195.0, 0x22416000},
{202.5, 0x22416000}
};
struct wm_info i810_wm_24_100[] = {
{0, 0x22006000},
{25.2, 0x22009000},
{28.0, 0x22009000},
{31.5, 0x2200a000},
{36.0, 0x2210c000},
{40.0, 0x2210c000},
{45.0, 0x2210c000},
{49.5, 0x22111000},
{50.0, 0x22111000},
{56.3, 0x22111000},
{65.0, 0x22214000},
{75.0, 0x22214000},
{78.8, 0x22215000},
{80.0, 0x22216000},
{94.5, 0x22218000},
{96.0, 0x22418000},
{99.0, 0x22418000},
{108.0, 0x22418000},
{121.0, 0x22418000},
{128.9, 0x22419000},
{132.0, 0x22519000},
{135.0, 0x4441d000},
{157.5, 0x44419000},
{162.0, 0x44419000},
{175.5, 0x44419000},
{189.0, 0x44419000},
{195.0, 0x44419000},
{202.5, 0x44419000}
};
struct wm_info i810_wm_32_100[] = {
{0, 0x2210b000},
{60, 0x22415000}, /* 0x314000 works too */
{80, 0x22419000} /* 0x518000 works too */
};
struct wm_info i810_wm_8_133[] = {
{0, 0x22003000},
{25.2, 0x22003000},
{28.0, 0x22003000},
{31.5, 0x22003000},
{36.0, 0x22007000},
{40.0, 0x22007000},
{45.0, 0x22007000},
{49.5, 0x22008000},
{50.0, 0x22008000},
{56.3, 0x22008000},
{65.0, 0x22008000},
{75.0, 0x22008000},
{78.8, 0x22008000},
{80.0, 0x22008000},
{94.0, 0x22008000},
{96.0, 0x22107000},
{99.0, 0x22107000},
{108.0, 0x22107000},
{121.0, 0x22107000},
{128.9, 0x22107000},
{132.0, 0x22109000},
{135.0, 0x22109000},
{157.5, 0x2210b000},
{162.0, 0x2210b000},
{175.5, 0x2210b000},
{189.0, 0x2220e000},
{202.5, 0x2220e000}
};
struct wm_info i810_wm_16_133[] = {
{0, 0x22004000},
{25.2, 0x22006000},
{28.0, 0x22006000},
{31.5, 0x22007000},
{36.0, 0x22007000},
{40.0, 0x22007000},
{45.0, 0x22007000},
{49.5, 0x22009000},
{50.0, 0x22009000},
{56.3, 0x22108000},
{65.0, 0x2210e000},
{75.0, 0x2210e000},
{78.8, 0x2210e000},
{80.0, 0x22210000},
{94.5, 0x22210000},
{96.0, 0x22210000},
{99.0, 0x22210000},
{108.0, 0x22210000},
{121.0, 0x22210000},
{128.9, 0x22210000},
{132.0, 0x22314000},
{135.0, 0x22314000},
{157.5, 0x22415000},
{162.0, 0x22416000},
{175.5, 0x22416000},
{189.0, 0x22416000},
{195.0, 0x22416000},
{202.5, 0x22416000}
};
struct wm_info i810_wm_24_133[] = {
{0, 0x22006000},
{25.2, 0x22009000},
{28.0, 0x22009000},
{31.5, 0x2200a000},
{36.0, 0x2210c000},
{40.0, 0x2210c000},
{45.0, 0x2210c000},
{49.5, 0x22111000},
{50.0, 0x22111000},
{56.3, 0x22111000},
{65.0, 0x22214000},
{75.0, 0x22214000},
{78.8, 0x22215000},
{80.0, 0x22216000},
{94.5, 0x22218000},
{96.0, 0x22418000},
{99.0, 0x22418000},
{108.0, 0x22418000},
{121.0, 0x22418000},
{128.9, 0x22419000},
{132.0, 0x22519000},
{135.0, 0x4441d000},
{157.5, 0x44419000},
{162.0, 0x44419000},
{175.5, 0x44419000},
{189.0, 0x44419000},
{195.0, 0x44419000},
{202.5, 0x44419000}
};
#define Elements(x) (sizeof(x)/sizeof(*x))
/*
* I810CalcFIFO --
*
* Calculate burst length and FIFO watermark.
*/
unsigned int
I810CalcWatermark(ScrnInfoPtr pScrn, double freq, Bool dcache)
{
I810Ptr pI810 = I810PTR(pScrn);
struct wm_info *tab;
int nr;
int i;
if (pI810->LmFreqSel == 100) {
switch (pScrn->bitsPerPixel) {
case 8:
tab = i810_wm_8_100;
nr = Elements(i810_wm_8_100);
break;
case 16:
tab = i810_wm_16_100;
nr = Elements(i810_wm_16_100);
break;
case 24:
tab = i810_wm_24_100;
nr = Elements(i810_wm_24_100);
break;
default:
return 0;
}
} else {
switch (pScrn->bitsPerPixel) {
case 8:
tab = i810_wm_8_133;
nr = Elements(i810_wm_8_133);
break;
case 16:
tab = i810_wm_16_133;
nr = Elements(i810_wm_16_133);
break;
case 24:
tab = i810_wm_24_133;
nr = Elements(i810_wm_24_133);
break;
default:
return 0;
}
}
for (i = 0; i < nr && tab[i].freq < freq; i++) ;
if (i == nr)
i--;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"chose watermark 0x%x: (tab.freq %.1f)\n",
tab[i].wm, tab[i].freq);
/* None of these values (sourced from intel) have watermarks for
* the dcache memory. Fake it for now by using the same watermark
* for both...
*
* Update: this is probably because dcache isn't real useful as
* framebuffer memory, so intel's drivers don't need watermarks
* for that memory because they never use it to feed the ramdacs.
* We do use it in the fallback mode, so keep the watermarks for
* now.
*/
if (dcache)
return (tab[i].wm & ~0xffffff) | ((tab[i].wm >> 12) & 0xfff);
else
return tab[i].wm;
}
|