1
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.12 2003/01/01 19:16:31 tsi Exp $ */
3
* Copyright 2000 through 2003 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
5
* Permission to use, copy, modify, distribute, and sell this software and its
6
* documentation for any purpose is hereby granted without fee, provided that
7
* the above copyright notice appear in all copies and that both that copyright
8
* notice and this permission notice appear in supporting documentation, and
9
* that the name of Marc Aurele La France not be used in advertising or
10
* publicity pertaining to distribution of the software without specific,
11
* written prior permission. Marc Aurele La France makes no representations
12
* about the suitability of this software for any purpose. It is provided
13
* "as-is" without express or implied warranty.
15
* MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
17
* EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
* PERFORMANCE OF THIS SOFTWARE.
25
#include "atiadapter.h"
27
#include "aticonfig.h"
28
#include "aticursor.h"
29
#include "atioption.h"
30
#include "atistruct.h"
33
* Non-publicised XF86Config options.
37
ATI_OPTION_CRT_SCREEN, /* Legacy negation of "PanelDisplay" */
38
ATI_OPTION_DEVEL, /* Intentionally undocumented */
39
ATI_OPTION_BLEND, /* Force horizontal blending of small modes */
40
ATI_OPTION_SYNC /* Use XF86Config panel mode porches */
41
} ATIPrivateOptionType;
44
* ATIProcessOptions --
46
* This function extracts options from what was parsed out of the XF86Config
52
ScrnInfoPtr pScreenInfo,
56
OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize);
57
OptionInfoRec PrivateOption[] =
59
{ /* Negation of "PanelDisplay" public option */
60
ATI_OPTION_CRT_SCREEN,
66
{ /* ON: Horizontally blend most modes */
67
ATI_OPTION_BLEND, /* OFF: Use pixel replication more often */
73
{ /* ON: Use XF86Config porch timings */
74
ATI_OPTION_SYNC, /* OFF: Use porches from mode on entry */
80
{ /* ON: Ease exploration of loose ends */
81
ATI_OPTION_DEVEL, /* OFF: Fit for public consumption */
96
(void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize);
98
# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool
99
# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool
100
# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.bool
101
# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.bool
102
# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool
103
# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool
104
# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool
108
# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool
110
#endif /* AVOID_CPIO */
112
# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool
113
# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.bool
114
# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool
115
# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool
116
# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool
117
# define Sync PrivateOption[ATI_OPTION_SYNC].value.bool
119
# define ReferenceClock \
120
PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq
122
/* Pick up XF86Config options */
123
xf86CollectOptions(pScreenInfo, NULL);
125
/* Set non-zero defaults */
129
if (pATI->Adapter >= ATI_ADAPTER_MACH64)
131
#endif /* AVOID_CPIO */
134
Accel = CacheMMIO = HWCursor = TRUE;
140
#endif /* AVOID_CPIO */
144
ReferenceClock = ((double)157500000.0) / ((double)11.0);
150
#endif /* AVOID_CPIO */
156
Blend = PanelDisplay = TRUE;
158
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
160
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
165
/* Disable linear apertures if the OS doesn't support them */
166
if (!xf86LinearVidMem() && Linear)
168
if (PublicOption[ATI_OPTION_LINEAR].found)
169
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
170
"OS does not support linear apertures.\n");
174
#endif /* AVOID_CPIO */
176
/* Move option values into driver private structure */
177
pATI->OptionAccel = Accel;
178
pATI->OptionBlend = Blend;
179
pATI->OptionCRTDisplay = CRTDisplay;
180
pATI->OptionCSync = CSync;
181
pATI->OptionDevel = Devel;
185
pATI->OptionLinear = Linear;
187
#endif /* AVOID_CPIO */
189
pATI->OptionMMIOCache = CacheMMIO;
190
pATI->OptionProbeClocks = ProbeClocks;
191
pATI->OptionShadowFB = ShadowFB;
192
pATI->OptionSync = Sync;
194
/* "CRTScreen" is now "NoPanelDisplay" */
195
if ((PanelDisplay != CRTScreen) ||
196
PublicOption[ATI_OPTION_PANEL_DISPLAY].found)
197
pATI->OptionPanelDisplay = PanelDisplay;
199
pATI->OptionPanelDisplay = !CRTScreen;
201
/* Validate and set cursor options */
202
pATI->Cursor = ATI_CURSOR_SOFTWARE;
203
if (SWCursor || !HWCursor)
205
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
206
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
207
"Option \"sw_cursor\" overrides Option \"hw_cursor\".\n");
209
else if (pATI->Chip < ATI_CHIP_264CT)
211
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
212
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
213
"Option \"hw_cursor\" not supported in this configuration.\n");
217
pATI->Cursor = ATI_CURSOR_HARDWARE;
220
/* Only set the reference clock if it hasn't already been determined */
221
if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
223
switch ((int)(ReferenceClock / ((double)100000.0)))
226
pATI->ReferenceNumerator = 157500;
227
pATI->ReferenceDenominator = 11;
231
pATI->ReferenceNumerator = 315000;
232
pATI->ReferenceDenominator = 11;
236
pATI->ReferenceNumerator =
237
(int)(ReferenceClock / ((double)1000.0));
238
pATI->ReferenceDenominator = 1;