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
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.15tsi Exp $*/
/*
* Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of Marc Aurele La France not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Marc Aurele La France makes no representations
* about the suitability of this software for any purpose. It is provided
* "as-is" without express or implied warranty.
*
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "ati.h"
#include "atiadapter.h"
#include "atichip.h"
#include "aticonfig.h"
#include "aticursor.h"
#include "atioption.h"
#include "atistruct.h"
/*
* Non-publicised XF86Config options.
*/
typedef enum
{
ATI_OPTION_BIOS_DISPLAY, /* Allow BIOS interference */
ATI_OPTION_CRT_SCREEN, /* Legacy negation of "PanelDisplay" */
ATI_OPTION_DEVEL, /* Intentionally undocumented */
ATI_OPTION_BLEND, /* Force horizontal blending of small modes */
ATI_OPTION_LCDSYNC /* Use XF86Config panel mode porches */
} ATIPrivateOptionType;
/*
* ATIProcessOptions --
*
* This function extracts options from what was parsed out of the XF86Config
* file.
*/
void
ATIProcessOptions
(
ScrnInfoPtr pScreenInfo,
ATIPtr pATI
)
{
OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize);
OptionInfoRec PrivateOption[] =
{
{ /* ON: Let BIOS change display(s) */
ATI_OPTION_BIOS_DISPLAY, /* OFF: Don't */
"biosdisplay",
OPTV_BOOLEAN,
{0, },
FALSE
},
{ /* Negation of "PanelDisplay" public option */
ATI_OPTION_CRT_SCREEN,
"crtscreen",
OPTV_BOOLEAN,
{0, },
FALSE
},
{ /* ON: Ease exploration of loose ends */
ATI_OPTION_DEVEL, /* OFF: Fit for public consumption */
"tsi",
OPTV_BOOLEAN,
{0, },
FALSE
},
{ /* ON: Horizontally blend most modes */
ATI_OPTION_BLEND, /* OFF: Use pixel replication more often */
"lcdblend",
OPTV_BOOLEAN,
{0, },
FALSE
},
{ /* ON: Use XF86Config porch timings */
ATI_OPTION_LCDSYNC, /* OFF: Use porches from mode on entry */
"lcdsync",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
-1,
NULL,
OPTV_NONE,
{0, },
FALSE
}
};
(void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize);
# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool
# define BIOSDisplay PrivateOption[ATI_OPTION_BIOS_DISPLAY].value.bool
# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool
# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.bool
# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.bool
# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool
# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool
# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool
#ifndef AVOID_CPIO
# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool
#endif /* AVOID_CPIO */
# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool
# define TestCacheMMIO PublicOption[ATI_OPTION_TEST_MMIO_CACHE].value.bool
# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.bool
# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool
# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool
# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool
# define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.bool
# define ReferenceClock \
PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq
/* Pick up XF86Config options */
xf86CollectOptions(pScreenInfo, NULL);
/* Set non-zero defaults */
#ifndef AVOID_CPIO
if (pATI->Adapter >= ATI_ADAPTER_MACH64)
#endif /* AVOID_CPIO */
{
Accel = CacheMMIO = HWCursor = TRUE;
#ifndef AVOID_CPIO
Linear = TRUE;
#endif /* AVOID_CPIO */
}
ReferenceClock = ((double)157500000.0) / ((double)11.0);
#ifndef AVOID_CPIO
if (pATI->PCIInfo)
#endif /* AVOID_CPIO */
{
ShadowFB = TRUE;
}
Blend = PanelDisplay = TRUE;
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
PublicOption);
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
PrivateOption);
#ifndef AVOID_CPIO
/* Disable linear apertures if the OS doesn't support them */
if (!xf86LinearVidMem() && Linear)
{
if (PublicOption[ATI_OPTION_LINEAR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"OS does not support linear apertures.\n");
Linear = FALSE;
}
#endif /* AVOID_CPIO */
/* Move option values into driver private structure */
pATI->OptionAccel = Accel;
pATI->OptionBIOSDisplay = BIOSDisplay;
pATI->OptionBlend = Blend;
pATI->OptionCRTDisplay = CRTDisplay;
pATI->OptionCSync = CSync;
pATI->OptionDevel = Devel;
#ifndef AVOID_CPIO
pATI->OptionLinear = Linear;
#endif /* AVOID_CPIO */
pATI->OptionMMIOCache = CacheMMIO;
pATI->OptionTestMMIOCache = TestCacheMMIO;
pATI->OptionProbeClocks = ProbeClocks;
pATI->OptionShadowFB = ShadowFB;
pATI->OptionLCDSync = LCDSync;
/* "CRTScreen" is now "NoPanelDisplay" */
if ((PanelDisplay != CRTScreen) ||
PublicOption[ATI_OPTION_PANEL_DISPLAY].found)
pATI->OptionPanelDisplay = PanelDisplay;
else
pATI->OptionPanelDisplay = !CRTScreen;
/* Validate and set cursor options */
pATI->Cursor = ATI_CURSOR_SOFTWARE;
if (SWCursor || !HWCursor)
{
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"Option \"sw_cursor\" overrides Option \"hw_cursor\".\n");
}
else if (pATI->Chip < ATI_CHIP_264CT)
{
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"Option \"hw_cursor\" not supported in this configuration.\n");
}
else
{
pATI->Cursor = ATI_CURSOR_HARDWARE;
}
/* Only set the reference clock if it hasn't already been determined */
if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
{
switch ((int)(ReferenceClock / ((double)100000.0)))
{
case 143:
pATI->ReferenceNumerator = 157500;
pATI->ReferenceDenominator = 11;
break;
case 286:
pATI->ReferenceNumerator = 315000;
pATI->ReferenceDenominator = 11;
break;
default:
pATI->ReferenceNumerator =
(int)(ReferenceClock / ((double)1000.0));
pATI->ReferenceDenominator = 1;
break;
}
}
xfree(PublicOption);
}
|