Fix BIOS read on 650 and 760. (#19070)
[xf86-video-sis/mirage.git] / src / sis_opt.c
blob24e1d6c7fd3a75ea5db4cfe1ae8fbc7fdc6b9cb1
1 /*
2 * SiS driver option evaluation
4 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1) Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2) Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3) The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Author: Thomas Winischhofer <thomas@winischhofer.net>
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
36 #include "sis.h"
38 #include "xf86str.h"
39 #include "xf86Cursor.h"
41 typedef enum {
42 OPTION_SW_CURSOR,
43 OPTION_HW_CURSOR,
44 OPTION_ACCEL,
45 OPTION_ACCELMETHOD,
46 OPTION_TURBOQUEUE,
47 OPTION_FAST_VRAM,
48 OPTION_HOSTBUS,
49 OPTION_RENDER,
50 OPTION_FORCE_CRT1TYPE,
51 OPTION_FORCE_CRT2TYPE,
52 OPTION_YPBPRAR,
53 OPTION_SHADOW_FB,
54 OPTION_DRI,
55 OPTION_AGP_SIZE,
56 OPTION_ROTATE,
57 OPTION_REFLECT,
58 OPTION_XVIDEO,
59 OPTION_VESA,
60 OPTION_MAXXFBMEM,
61 OPTION_FORCECRT1,
62 OPTION_XVONCRT2,
63 OPTION_PDC,
64 OPTION_PDCA,
65 OPTION_EMI,
66 OPTION_TVSTANDARD,
67 OPTION_USEROMDATA,
68 OPTION_INTERNALMODES,
69 #ifdef SIS_INCL_DYNMODELIST
70 OPTION_DYNMODES,
71 #endif
72 #ifdef SIS_INCL_RANDR_RESIZE
73 OPTION_RESERVEVIRTUAL,
74 #endif
75 OPTION_CONSTANTDPI,
76 OPTION_USEOEM,
77 OPTION_YV12,
78 OPTION_CHTVOVERSCAN,
79 OPTION_CHTVSOVERSCAN,
80 OPTION_CHTVLUMABANDWIDTHCVBS,
81 OPTION_CHTVLUMABANDWIDTHSVIDEO,
82 OPTION_CHTVLUMAFLICKERFILTER,
83 OPTION_CHTVCHROMABANDWIDTH,
84 OPTION_CHTVCHROMAFLICKERFILTER,
85 OPTION_CHTVCVBSCOLOR,
86 OPTION_CHTVTEXTENHANCE,
87 OPTION_CHTVCONTRAST,
88 OPTION_SISTVEDGEENHANCE,
89 OPTION_SISTVANTIFLICKER,
90 OPTION_SISTVSATURATION,
91 OPTION_SISTVCHROMAFILTER,
92 OPTION_SISTVLUMAFILTER,
93 OPTION_SISTVCOLCALIBFINE,
94 OPTION_SISTVCOLCALIBCOARSE,
95 OPTION_TVXPOSOFFSET,
96 OPTION_TVYPOSOFFSET,
97 OPTION_TVXSCALE,
98 OPTION_TVYSCALE,
99 OPTION_SIS6326ANTIFLICKER,
100 OPTION_SIS6326ENABLEYFILTER,
101 OPTION_SIS6326YFILTERSTRONG,
102 OPTION_SIS6326FORCETVPPLUG,
103 OPTION_SIS6326FSCADJUST,
104 OPTION_CHTVTYPE,
105 OPTION_USERGBCURSOR,
106 OPTION_USERGBCURSORBLEND,
107 OPTION_USERGBCURSORBLENDTH,
108 OPTION_RESTOREBYSET,
109 OPTION_DDCFORCRT2,
110 OPTION_FORCECRT2REDETECTION,
111 OPTION_SENSEYPBPR,
112 OPTION_CRT1GAMMA,
113 OPTION_CRT2GAMMA,
114 OPTION_XVGAMMA,
115 OPTION_XVDEFCONTRAST,
116 OPTION_XVDEFBRIGHTNESS,
117 OPTION_XVDEFHUE,
118 OPTION_XVDEFSATURATION,
119 OPTION_XVDEFDISABLEGFX,
120 OPTION_XVDEFDISABLEGFXLR,
121 OPTION_XVBENCHCPY,
122 #ifndef SISCHECKOSSSE
123 OPTION_XVSSECOPY,
124 #endif
125 OPTION_XVUSECHROMAKEY,
126 OPTION_XVCHROMAMIN,
127 OPTION_XVCHROMAMAX,
128 OPTION_XVDISABLECOLORKEY,
129 OPTION_XVINSIDECHROMAKEY,
130 OPTION_XVYUVCHROMAKEY,
131 OPTION_XVDEFAULTADAPTOR,
132 OPTION_SCALELCD,
133 OPTION_CENTERLCD,
134 OPTION_SPECIALTIMING,
135 OPTION_LVDSHL,
136 OPTION_PRGB,
137 OPTION_ENABLEHOTKEY,
138 OPTION_MERGEDFB,
139 OPTION_MERGEDFBAUTO,
140 OPTION_CRT2HSYNC,
141 OPTION_CRT2VREFRESH,
142 OPTION_CRT2POS,
143 OPTION_METAMODES,
144 OPTION_SISXINERAMA,
145 OPTION_SCR0,
146 OPTION_CRT2ISSCRN0,
147 OPTION_MERGEDDPI,
148 OPTION_MERGEDFBNONRECT,
149 OPTION_MERGEDFBMOUSER,
150 OPTION_ENABLESISCTRL,
151 OPTION_STOREDBRI,
152 OPTION_STOREDBRI2,
153 OPTION_NEWSTOREDBRI,
154 OPTION_NEWSTOREDBRI2,
155 OPTION_NEWSTOREDCON,
156 OPTION_NEWSTOREDCON2,
157 OPTION_CRT1SATGAIN,
158 OPTION_OVERRULERANGES,
159 OPTION_FORCE1ASPECT,
160 OPTION_FORCE2ASPECT,
161 OPTION_TVBLUE,
162 #ifdef SIS_INCL_RRROT
163 OPTION_RANDRROT,
164 OPTION_RANDRROT90,
165 #endif
166 #ifdef SIS_CP
167 SIS_CP_OPT_OPTIONS
168 #endif
169 OPTION_PSEUDO
170 } SISOpts;
172 static const OptionInfoRec SISOptions[] = {
173 { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
174 { OPTION_HOSTBUS, "HostBus", OPTV_BOOLEAN, {0}, FALSE },
175 { OPTION_XVBENCHCPY, "BenchmarkMemcpy", OPTV_BOOLEAN, {0}, FALSE },
176 #ifndef SISCHECKOSSSE
177 { OPTION_XVSSECOPY, "UseSSE", OPTV_BOOLEAN, {0}, FALSE },
178 #endif
179 { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, FALSE },
180 { OPTION_ACCEL, "Accel", OPTV_BOOLEAN, {0}, FALSE },
181 #if defined(SIS_USE_XAA) && defined(SIS_USE_EXA)
182 { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
183 #endif
184 { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE },
185 { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
186 { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE },
187 { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
188 { OPTION_AGP_SIZE, "GARTSize", OPTV_INTEGER, {0}, FALSE },
189 { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
190 { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
191 { OPTION_REFLECT, "Reflect", OPTV_STRING, {0}, FALSE },
192 #ifdef SIS_INCL_RRROT
193 { OPTION_RANDRROT, "RandRRotationSupport", OPTV_BOOLEAN, {0}, FALSE },
194 { OPTION_RANDRROT, "RandRRotation", OPTV_BOOLEAN, {0}, FALSE },
195 { OPTION_RANDRROT90, "RandRRotation90", OPTV_BOOLEAN, {0}, FALSE },
196 { OPTION_RANDRROT90, "RandRRotation90Support", OPTV_BOOLEAN, {0}, FALSE },
197 #endif
198 { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, FALSE },
199 { OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
200 { OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
201 { OPTION_USERGBCURSOR, "ColorHWCursor", OPTV_BOOLEAN, {0}, FALSE },
202 { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, FALSE },
203 { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, FALSE },
204 { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER, {0}, FALSE },
205 { OPTION_INTERNALMODES, "InternalModes", OPTV_BOOLEAN, {0}, FALSE },
206 #ifdef SIS_INCL_DYNMODELIST
207 { OPTION_DYNMODES, "DynamicModelist", OPTV_BOOLEAN, {0}, FALSE },
208 #endif
209 #ifdef SIS_INCL_RANDR_RESIZE
210 { OPTION_RESERVEVIRTUAL, "ScreenGrow", OPTV_BOOLEAN, {0}, FALSE },
211 #endif
212 #ifdef RANDR
213 { OPTION_CONSTANTDPI, "ConstantDPI", OPTV_BOOLEAN, {0}, FALSE },
214 #endif
215 { OPTION_OVERRULERANGES, "OverruleFrequencyRanges", OPTV_BOOLEAN, {0}, FALSE },
216 { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, FALSE },
217 { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE },
218 { OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE },
219 { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE },
220 { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE },
221 { OPTION_DDCFORCRT2, "CRT2Detection", OPTV_BOOLEAN, {0}, FALSE },
222 { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, FALSE },
223 { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, FALSE },
224 { OPTION_FORCE1ASPECT, "ForceCRT1VGAAspect", OPTV_STRING, {0}, FALSE },
225 { OPTION_FORCE2ASPECT, "ForceCRT2VGAAspect", OPTV_STRING, {0}, FALSE },
226 { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, FALSE },
227 { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, FALSE },
228 { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, FALSE },
229 { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, FALSE },
230 { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, FALSE },
231 { OPTION_PDC, "PDC", OPTV_INTEGER, {0}, FALSE },
232 { OPTION_PDC, "PanelDelayCompensation2", OPTV_INTEGER, {0}, FALSE },
233 { OPTION_PDC, "PDC2", OPTV_INTEGER, {0}, FALSE },
234 { OPTION_PDCA, "PanelDelayCompensation1", OPTV_INTEGER, {0}, FALSE },
235 { OPTION_PDCA, "PDC1", OPTV_INTEGER, {0}, FALSE },
236 { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, FALSE },
237 { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, FALSE },
238 { OPTION_PRGB, "ForcePanelRGB", OPTV_INTEGER, {0}, FALSE },
239 { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, FALSE },
240 { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, FALSE },
241 { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, FALSE },
242 { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, FALSE },
243 { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, FALSE },
244 { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_STRING, {0}, FALSE },
245 { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, FALSE },
246 { OPTION_SISTVCHROMAFILTER, "SISTVCFilter", OPTV_BOOLEAN, {0}, FALSE },
247 { OPTION_SISTVLUMAFILTER, "SISTVYFilter", OPTV_INTEGER, {0}, FALSE },
248 { OPTION_SISTVCOLCALIBFINE, "SISTVColorCalibFine", OPTV_INTEGER, {0}, FALSE },
249 { OPTION_SISTVCOLCALIBCOARSE, "SISTVColorCalibCoarse", OPTV_INTEGER, {0}, FALSE },
250 { OPTION_TVXSCALE, "SISTVXScale", OPTV_INTEGER, {0}, FALSE },
251 { OPTION_TVYSCALE, "SISTVYScale", OPTV_INTEGER, {0}, FALSE },
252 { OPTION_SENSEYPBPR, "SenseYPbPr", OPTV_BOOLEAN, {0}, FALSE },
253 { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE },
254 { OPTION_TVBLUE, "TVBlueWorkAround", OPTV_BOOLEAN, {0}, FALSE },
255 { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, FALSE },
256 { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, FALSE },
257 { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, FALSE },
258 { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, FALSE },
259 { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO", OPTV_INTEGER, {0}, FALSE },
260 { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
261 { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, FALSE },
262 { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
263 { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, FALSE },
264 { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, FALSE },
265 { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, FALSE },
266 { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE },
267 { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, FALSE },
268 { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, FALSE },
269 { OPTION_SIS6326FORCETVPPLUG, "SIS6326TVForcePlug", OPTV_STRING, {0}, FALSE },
270 { OPTION_SIS6326FSCADJUST, "SIS6326FSCAdjust", OPTV_INTEGER, {0}, FALSE },
271 { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, FALSE },
272 { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_ANYSTR, {0}, FALSE },
273 { OPTION_STOREDBRI, "GammaBrightness", OPTV_STRING, {0}, FALSE },
274 { OPTION_STOREDBRI2, "GammaBrightnessCRT2", OPTV_STRING, {0}, FALSE },
275 { OPTION_STOREDBRI2, "CRT2GammaBrightness", OPTV_STRING, {0}, FALSE },
276 { OPTION_NEWSTOREDBRI, "Brightness", OPTV_STRING, {0}, FALSE },
277 { OPTION_NEWSTOREDBRI, "NewGammaBrightness", OPTV_STRING, {0}, FALSE },
278 { OPTION_NEWSTOREDBRI2, "CRT2Brightness", OPTV_STRING, {0}, FALSE },
279 { OPTION_NEWSTOREDBRI2, "CRT2NewGammaBrightness", OPTV_STRING, {0}, FALSE },
280 { OPTION_NEWSTOREDCON, "Contrast", OPTV_STRING, {0}, FALSE },
281 { OPTION_NEWSTOREDCON, "NewGammaContrast", OPTV_STRING, {0}, FALSE },
282 { OPTION_NEWSTOREDCON2, "CRT2Contrast", OPTV_STRING, {0}, FALSE },
283 { OPTION_NEWSTOREDCON2, "CRT2NewGammaContrast", OPTV_STRING, {0}, FALSE },
284 { OPTION_CRT1SATGAIN, "CRT1Saturation", OPTV_INTEGER, {0}, FALSE },
285 { OPTION_XVIDEO, "Xvideo", OPTV_BOOLEAN, {0}, FALSE },
286 { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE },
287 { OPTION_XVGAMMA, "XvGamma", OPTV_ANYSTR, {0}, FALSE },
288 { OPTION_XVDEFCONTRAST, "XvDefaultContrast", OPTV_INTEGER, {0}, FALSE },
289 { OPTION_XVDEFBRIGHTNESS, "XvDefaultBrightness", OPTV_INTEGER, {0}, FALSE },
290 { OPTION_XVDEFHUE, "XvDefaultHue", OPTV_INTEGER, {0}, FALSE },
291 { OPTION_XVDEFSATURATION, "XvDefaultSaturation", OPTV_INTEGER, {0}, FALSE },
292 { OPTION_XVDEFDISABLEGFX, "XvDefaultDisableGfx", OPTV_BOOLEAN, {0}, FALSE },
293 { OPTION_XVDEFDISABLEGFXLR, "XvDefaultDisableGfxLR", OPTV_BOOLEAN, {0}, FALSE },
294 { OPTION_XVCHROMAMIN, "XvChromaMin", OPTV_INTEGER, {0}, FALSE },
295 { OPTION_XVCHROMAMAX, "XvChromaMax", OPTV_INTEGER, {0}, FALSE },
296 { OPTION_XVUSECHROMAKEY, "XvUseChromaKey", OPTV_BOOLEAN, {0}, FALSE },
297 { OPTION_XVINSIDECHROMAKEY, "XvInsideChromaKey", OPTV_BOOLEAN, {0}, FALSE },
298 { OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, FALSE },
299 { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, FALSE },
300 { OPTION_XVDEFAULTADAPTOR, "XvDefaultAdaptor", OPTV_STRING, {0}, FALSE },
301 { OPTION_YV12, "YV12", OPTV_BOOLEAN, {0}, FALSE },
302 #ifdef SISMERGED
303 { OPTION_MERGEDFB, "MergedFB", OPTV_ANYSTR, {0}, FALSE },
304 { OPTION_MERGEDFB, "TwinView", OPTV_ANYSTR, {0}, FALSE }, /* alias */
305 { OPTION_MERGEDFBAUTO, "MergedFBAuto", OPTV_BOOLEAN, {0}, FALSE },
306 { OPTION_CRT2HSYNC, "CRT2HSync", OPTV_STRING, {0}, FALSE },
307 { OPTION_CRT2HSYNC, "SecondMonitorHorizSync", OPTV_STRING, {0}, FALSE }, /* alias */
308 { OPTION_CRT2VREFRESH, "CRT2VRefresh", OPTV_STRING, {0}, FALSE },
309 { OPTION_CRT2VREFRESH, "SecondMonitorVertRefresh", OPTV_STRING, {0}, FALSE }, /* alias */
310 { OPTION_CRT2POS, "CRT2Position", OPTV_STRING, {0}, FALSE },
311 { OPTION_CRT2POS, "TwinViewOrientation", OPTV_STRING, {0}, FALSE }, /* alias */
312 { OPTION_METAMODES, "MetaModes", OPTV_STRING, {0}, FALSE },
313 { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE },
314 #ifdef SISXINERAMA
315 { OPTION_SISXINERAMA, "MergedXinerama", OPTV_BOOLEAN, {0}, FALSE },
316 { OPTION_SISXINERAMA, "TwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
317 { OPTION_SCR0, "MergedXineramaScreen0", OPTV_ANYSTR, {0}, FALSE },
318 { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0", OPTV_BOOLEAN, {0}, FALSE },
319 { OPTION_MERGEDFBNONRECT, "MergedNonRectangular", OPTV_BOOLEAN, {0}, FALSE },
320 { OPTION_MERGEDFBMOUSER, "MergedMouseRestriction", OPTV_BOOLEAN, {0}, FALSE },
321 #endif
322 #endif
323 #ifdef SIS_CP
324 SIS_CP_OPTION_DETAIL
325 #endif
326 { -1, NULL, OPTV_NONE, {0}, FALSE }
329 static int
330 SiS_FIFT(const OptionInfoRec *options, int token)
332 /* Find index from token */
333 int i = 0;
334 while(options[i].token >= 0) {
335 if(options[i].token == token) return i;
336 i++;
338 return 0; /* Should not happen */
341 static void
342 SiS_PrintBadOpt(ScrnInfoPtr pScrn, char *strptr, int token)
344 SISPtr pSiS = SISPTR(pScrn);
346 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
347 "\"%s\" is is not a valid parameter for option \"%s\"\n",
348 strptr, pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
351 static void
352 SiS_PrintIlRange(ScrnInfoPtr pScrn, int token, int min, int max, UChar showhex)
354 SISPtr pSiS = SISPTR(pScrn);
355 static const char *ilparmd = "Invalid parameter for \"%s\". Valid range is %d - %d\n";
356 static const char *ilparmh = "Invalid parameter for \"%s\". Valid range is 0x%x - 0x%x\n";
358 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
359 showhex ? ilparmh : ilparmd,
360 pSiS->Options[SiS_FIFT(pSiS->Options, token)].name, min, max);
363 #ifdef SISDUALHEAD
364 static void
365 SiS_PrintOverruleDHM(ScrnInfoPtr pScrn, int token1, int token2)
367 SISPtr pSiS = SISPTR(pScrn);
369 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
370 "\"%s\" overrules \"%s\" in CRT2 (Master) device section\n",
371 pSiS->Options[SiS_FIFT(pSiS->Options, token1)].name,
372 pSiS->Options[SiS_FIFT(pSiS->Options, token2)].name);
374 #endif
376 static Bool
377 SiS_StrIsBoolOn(char *strptr)
379 if( (*strptr == '\0') ||
380 (!xf86NameCmp(strptr,"on")) ||
381 (!xf86NameCmp(strptr,"true")) ||
382 (!xf86NameCmp(strptr,"yes")) ||
383 (!xf86NameCmp(strptr,"1")) ) return TRUE;
384 return FALSE;
387 static Bool
388 SiS_StrIsBoolOff(char *strptr)
390 if( (!xf86NameCmp(strptr,"off")) ||
391 (!xf86NameCmp(strptr,"false")) ||
392 (!xf86NameCmp(strptr,"no")) ||
393 (!xf86NameCmp(strptr,"0")) ) return TRUE;
394 return FALSE;
397 static Bool
398 SiS_EvalOneOrThreeFloats(ScrnInfoPtr pScrn, int token, const char *myerror,
399 char *strptr, int *v1, int *v2, int *v3)
401 SISPtr pSiS = SISPTR(pScrn);
402 float val1 = 0.0, val2 = 0.0, val3 = 0.0;
403 Bool valid = FALSE;
404 int result = sscanf(strptr, "%f %f %f", &val1, &val2, &val3);
405 if(result == 1) {
406 if((val1 >= 0.1) && (val1 <= 10.0)) {
407 valid = TRUE;
408 *v1 = *v2 = *v3 = (int)(val1 * 1000);
410 } else if(result == 3) {
411 if((val1 >= 0.1) && (val1 <= 10.0) &&
412 (val2 >= 0.1) && (val2 <= 10.0) &&
413 (val3 >= 0.1) && (val3 <= 10.0)) {
414 valid = TRUE;
415 *v1 = (int)(val1 * 1000);
416 *v2 = (int)(val2 * 1000);
417 *v3 = (int)(val3 * 1000);
420 if(!valid) {
421 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, myerror,
422 pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
424 return (valid);
427 static Bool
428 SiS_EvalOneOrThreeFloats2(ScrnInfoPtr pScrn, int token, const char *myerror,
429 char *strptr, float *v1, float *v2, float *v3)
431 SISPtr pSiS = SISPTR(pScrn);
432 float val1 = 0.0, val2 = 0.0, val3 = 0.0;
433 Bool valid = FALSE;
434 int result = sscanf(strptr, "%f %f %f", &val1, &val2, &val3);
435 if(result == 1) {
436 if((val1 >= -1.0) && (val1 <= 1.0)) {
437 valid = TRUE;
438 *v1 = *v2 = *v3 = val1;
440 } else if(result == 3) {
441 if((val1 >= -1.0) && (val1 <= 1.0) &&
442 (val2 >= -1.0) && (val2 <= 1.0) &&
443 (val3 >= -1.0) && (val3 <= 1.0)) {
444 valid = TRUE;
445 *v1 = val1;
446 *v2 = val2;
447 *v3 = val3;
450 if(!valid) {
451 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, myerror,
452 pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
454 return (valid);
457 void
458 SiSOptions(ScrnInfoPtr pScrn)
460 SISPtr pSiS = SISPTR(pScrn);
461 MessageType from;
462 char *strptr;
463 int ival;
464 Bool val, IsDHM = FALSE;
465 Bool IsSecondHead = FALSE;
466 static const char *baddhm = "Option \"%s\" ignored in Dual Head mode\n";
467 static const char *validparm = "Valid parameters are";
468 static const char *disabledstr= "disabled";
469 static const char *enabledstr = "enabled";
470 static const char *gammaopt = "%s expects either a boolean, or 1 or 3 real numbers (0.1 - 10.0)\n";
471 static const char *briopt = "%s expects 1 or 3 real numbers (0.1 - 10.0)\n";
472 static const char *newbriopt = "%s expects 1 or 3 real numbers (-1.0 - 1.0)\n";
474 /* Collect all of the relevant option flags (fill in pScrn->options) */
475 xf86CollectOptions(pScrn, NULL);
477 /* Process the options */
478 if(!(pSiS->Options = xalloc(sizeof(SISOptions)))) return;
480 memcpy(pSiS->Options, SISOptions, sizeof(SISOptions));
482 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSiS->Options);
484 /* Set defaults */
486 pSiS->newFastVram = -1;
487 pSiS->HostBus = TRUE;
488 pSiS->TurboQueue = TRUE;
489 #ifdef SISVRAMQ
490 /* TODO: Option (315 series VRAM command queue) */
491 /* But beware: sisfb does not know about this!!! */
492 pSiS->cmdQueueSize = 512*1024;
493 if(pSiS->ChipType == XGI_20) {
494 /* Hardware maximum on Z7: 128k */
495 pSiS->cmdQueueSize = 128*1024;
497 #endif
498 pSiS->doRender = TRUE;
499 pSiS->HWCursor = TRUE;
500 pSiS->Rotate = 0;
501 pSiS->Reflect = 0;
502 #ifdef SIS_INCL_RRROT
503 pSiS->RRRotate = 0;
504 pSiS->SupportRRRotation = FALSE;
505 pSiS->SupportRRRotation90270 = -1;
506 #endif
507 pSiS->NoAccel = FALSE;
508 #if (defined(SIS_USE_EXA) && defined(SIS_USE_XAA)) || !defined(SIS_USE_EXA)
509 pSiS->useEXA = FALSE;
510 #else
511 pSiS->useEXA = TRUE;
512 #endif
513 pSiS->ShadowFB = FALSE;
514 pSiS->loadDRI = FALSE;
515 #ifdef XF86DRI
516 pSiS->agpWantedPages = AGP_PAGES;
517 #endif
518 pSiS->VESA = -1;
519 pSiS->NoXvideo = FALSE;
520 pSiS->maxxfbmem = 0;
521 pSiS->forceCRT1 = -1;
522 pSiS->DSTN = FALSE;
523 pSiS->FSTN = FALSE;
524 pSiS->XvOnCRT2 = FALSE;
525 pSiS->NoYV12 = -1;
526 pSiS->PDC = -1;
527 pSiS->PDCA = -1;
528 pSiS->EMI = -1;
529 pSiS->PRGB = -1;
530 pSiS->OptTVStand = -1;
531 pSiS->OptROMUsage = -1;
532 pSiS->noInternalModes = FALSE;
533 #ifdef SIS_INCL_DYNMODELIST
534 #ifdef SISISXORG6899900
535 pSiS->UseDynamicModelists = TRUE;
536 #else
537 pSiS->UseDynamicModelists = FALSE;
538 #endif
539 #endif
540 #ifdef SIS_INCL_RANDR_RESIZE
541 pSiS->ReserveLargerVirtual = -1;
542 #endif
543 #ifdef RANDR
544 pSiS->constantDPI = -1;
545 #else
546 pSiS->constantDPI = FALSE;
547 #endif
548 pSiS->OptUseOEM = -1;
549 pSiS->OptTVOver = -1;
550 pSiS->OptTVSOver = -1;
551 pSiS->chtvlumabandwidthcvbs = -1;
552 pSiS->chtvlumabandwidthsvideo = -1;
553 pSiS->chtvlumaflickerfilter = -1;
554 pSiS->chtvchromabandwidth = -1;
555 pSiS->chtvchromaflickerfilter = -1;
556 pSiS->chtvcvbscolor = -1;
557 pSiS->chtvtextenhance = -1;
558 pSiS->chtvcontrast = -1;
559 pSiS->sistvedgeenhance = -1;
560 pSiS->sistvantiflicker = -1;
561 pSiS->sistvsaturation = -1;
562 pSiS->sistvcfilter = -1;
563 pSiS->sistvyfilter = 1; /* 0 = off, 1 = default, 2-8 = filter no */
564 pSiS->sistvcolcalibc = 0;
565 pSiS->sistvcolcalibf = 0;
566 pSiS->sis6326enableyfilter = -1;
567 pSiS->sis6326yfilterstrong = -1;
568 pSiS->sis6326tvplug = -1;
569 pSiS->sis6326fscadjust = 0;
570 pSiS->tvxpos = 0;
571 pSiS->tvypos = 0;
572 pSiS->tvxscale = 0;
573 pSiS->tvyscale = 0;
574 pSiS->siscrt1satgain = 0;
575 pSiS->crt1satgaingiven = FALSE;
576 pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
577 pSiS->chtvtype = -1;
578 pSiS->restorebyset = TRUE;
579 pSiS->nocrt2ddcdetection = FALSE;
580 pSiS->forcecrt2redetection = TRUE;
581 pSiS->havewide1 = pSiS->havewide2 = FALSE;
582 pSiS->SenseYPbPr = TRUE;
583 pSiS->ForceCRT1Type = CRT1_VGA;
584 pSiS->CRT1TypeForced = FALSE;
585 pSiS->ForceCRT2Type = CRT2_DEFAULT;
586 pSiS->ForceYPbPrAR = TV_YPBPR169;
587 pSiS->ForceTVType = -1;
588 pSiS->CRT1gamma = TRUE;
589 pSiS->CRT1gammaGiven = FALSE;
590 pSiS->CRT2gamma = TRUE;
591 pSiS->XvGamma = FALSE;
592 pSiS->XvGammaGiven = FALSE;
593 pSiS->enablesisctrl = FALSE;
594 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
595 pSiS->XvDefBri = 10;
596 pSiS->XvDefCon = 2;
597 } else {
598 pSiS->XvDefBri = 0;
599 pSiS->XvDefCon = 4;
601 pSiS->XvDefHue = 0;
602 pSiS->XvDefSat = 0;
603 pSiS->XvDefDisableGfx = FALSE;
604 pSiS->XvDefDisableGfxLR = FALSE;
605 pSiS->XvDefAdaptorBlit = FALSE;
606 pSiS->UsePanelScaler = -1;
607 pSiS->CenterLCD = -1;
608 pSiS->XvUseChromaKey = FALSE;
609 pSiS->XvDisableColorKey = FALSE;
610 pSiS->XvInsideChromaKey = FALSE;
611 pSiS->XvYUVChromaKey = FALSE;
612 pSiS->XvChromaMin = 0x000101fe;
613 pSiS->XvChromaMax = 0x000101ff;
614 pSiS->XvGammaRed = pSiS->XvGammaGreen = pSiS->XvGammaBlue =
615 pSiS->XvGammaRedDef = pSiS->XvGammaGreenDef = pSiS->XvGammaBlueDef = 1000;
616 pSiS->GammaBriR = pSiS->GammaBriG = pSiS->GammaBriB = 1000;
617 pSiS->CRT2SepGamma = FALSE;
618 pSiS->GammaR2 = pSiS->GammaG2 = pSiS->GammaB2 = 1.0;
619 pSiS->GammaBriR2 = pSiS->GammaBriG2 = pSiS->GammaBriB2 = 1000;
620 pSiS->NewGammaBriR = pSiS->NewGammaBriG = pSiS->NewGammaBriB = 0.0;
621 pSiS->NewGammaConR = pSiS->NewGammaConG = pSiS->NewGammaConB = 0.0;
622 pSiS->NewGammaBriR2 = pSiS->NewGammaBriG2 = pSiS->NewGammaBriB2 = 0.0;
623 pSiS->NewGammaConR2 = pSiS->NewGammaConG2 = pSiS->NewGammaConB2 = 0.0;
624 pSiS->HideHWCursor = FALSE;
625 pSiS->HWCursorIsVisible = FALSE;
626 pSiS->OverruleRanges = TRUE;
627 pSiS->BenchMemCpy = TRUE;
628 #ifndef SISCHECKOSSSE
629 pSiS->XvSSEMemcpy = FALSE;
630 #endif
631 #ifdef SISMERGED
632 pSiS->MergedFB = pSiS->MergedFBAuto = FALSE;
633 pSiS->CRT2Position = sisRightOf;
634 pSiS->CRT2HSync = NULL;
635 pSiS->CRT2VRefresh = NULL;
636 pSiS->MetaModes = NULL;
637 pSiS->MergedFBXDPI = pSiS->MergedFBYDPI = 0;
638 pSiS->CRT1XOffs = pSiS->CRT1YOffs = pSiS->CRT2XOffs = pSiS->CRT2YOffs = 0;
639 pSiS->NonRect = TRUE;
640 pSiS->HaveNonRect = pSiS->HaveOffsRegions = FALSE;
641 pSiS->MBXNRXMAX = pSiS->MBXNRYMAX = 65536;
642 pSiS->MouseRestrictions = TRUE;
643 #ifdef SISXINERAMA
644 pSiS->UseSiSXinerama = TRUE;
645 pSiS->MFBScr0LR = TRUE; /* By default: Left/bottom are screen 0 */
646 pSiS->MFBScr0TB = FALSE;
647 pSiS->CRT2IsScrn0 = FALSE;
648 #endif
649 #endif
650 #ifdef SIS_CP
651 SIS_CP_OPT_DEFAULT
652 #endif
654 /* Chipset dependent defaults */
656 if(pSiS->Chipset == PCI_CHIP_SIS530) {
657 /* TQ still broken on 530/620? */
658 pSiS->TurboQueue = FALSE;
661 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
662 pSiS->newFastVram = 1;
665 if(pSiS->ChipType == SIS_315H ||
666 pSiS->ChipType == SIS_315) {
667 /* Cursor engine seriously broken */
668 pSiS->HWCursor = FALSE;
671 if((pSiS->Chipset == PCI_CHIP_SIS550) ||
672 (pSiS->Chipset == PCI_CHIP_XGIXG20)) {
673 /* Alpha blending not supported */
674 pSiS->doRender = FALSE;
677 if(pSiS->Chipset == PCI_CHIP_XGIXG20) {
678 /* No video overlay, no video blitter */
679 pSiS->NoXvideo = TRUE;
682 /* DRI only supported on 300 series,
683 * so don't load DRI by default on
684 * others.
686 if(pSiS->VGAEngine == SIS_300_VGA) {
687 pSiS->loadDRI = TRUE;
690 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
691 pSiS->OptUseColorCursor = 0;
692 #else
693 if(pSiS->VGAEngine == SIS_300_VGA) {
694 pSiS->OptUseColorCursor = 0;
695 pSiS->OptUseColorCursorBlend = 1;
696 pSiS->OptColorCursorBlendThreshold = 0x37000000;
697 } else if(pSiS->VGAEngine == SIS_315_VGA) {
698 if(pSiS->Chipset == PCI_CHIP_XGIXG20) {
699 /* No color HW cursor on Z7 */
700 pSiS->OptUseColorCursor = 0;
701 } else {
702 pSiS->OptUseColorCursor = 1;
705 #endif
707 if(pSiS->VGAEngine == SIS_300_VGA) {
708 pSiS->AllowHotkey = 0;
709 } else if(pSiS->VGAEngine == SIS_315_VGA) {
710 pSiS->AllowHotkey = 1;
713 #ifdef SIS_INCL_RRROT
714 #ifdef SISISXORG6899900
715 /* RandR rotation support by default enabled on 315 and later
716 * but only for X.org 6.9+ because it needs the dynamic mode
717 * list which only works with DGA from 6.9 on.
719 if(pSiS->VGAEngine == SIS_315_VGA) {
720 pSiS->SupportRRRotation = TRUE;
722 #endif
723 #endif
725 /* Collect the options */
727 /* FastVRAM (5597/5598, 6326 and 530/620 only)
729 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
730 from = X_DEFAULT;
731 if(xf86GetOptValBool(pSiS->Options, OPTION_FAST_VRAM, &pSiS->newFastVram)) {
732 from = X_CONFIG;
734 xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM timing %s\n",
735 (pSiS->newFastVram == -1) ?
736 ((pSiS->oldChipset == OC_SIS620) ? "enabled (for read only)" :
737 "enabled (for write only)") :
738 (pSiS->newFastVram ? "enabled (for read and write)" : disabledstr));
741 /* HostBus (5597/5598 only)
743 if(pSiS->Chipset == PCI_CHIP_SIS5597) {
744 from = X_DEFAULT;
745 if(xf86GetOptValBool(pSiS->Options, OPTION_HOSTBUS, &pSiS->HostBus)) {
746 from = X_CONFIG;
748 xf86DrvMsg(pScrn->scrnIndex, from, "SiS5597/5598 VGA-to-CPU host bus %s\n",
749 pSiS->HostBus ? enabledstr : disabledstr);
752 /* MaxXFBMem
753 * This options limits the amount of video memory X uses for screen
754 * and off-screen buffers. This option should be used if using DRI
755 * is intended. The kernel framebuffer driver (formerly required for DRM)
756 * will start its memory heap at 12MB if it detects more than 16MB, at 8MB
757 * if between 8 and 16MB are available, otherwise at 4MB. So, if the amount
758 * of memory X uses, a clash between the framebuffer's memory heap
759 * and X is avoided. The amount is to be specified in KB.
760 * Starting with Linux 2.6.3, this option is no longer needed. And
761 * neither is sisfb for DRI, since the DRM got a memory manager of its
762 * own.
764 if(xf86GetOptValInteger(pSiS->Options, OPTION_MAXXFBMEM, (int *)&pSiS->maxxfbmem)) {
765 if(pSiS->maxxfbmem >= 2048) {
766 pSiS->maxxfbmem *= 1024;
767 } else {
768 pSiS->maxxfbmem = 0;
769 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
770 "Invalid MaxXFBMem setting; minimum is 2048\n");
774 /* Accel
775 * Turns on/off 2D acceleration
777 if(!xf86ReturnOptValBool(pSiS->Options, OPTION_ACCEL, TRUE)) {
778 pSiS->NoAccel = TRUE;
779 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
780 pSiS->NoXvideo = TRUE;
781 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration and Xv disabled\n");
782 #else
783 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration disabled\n");
784 #endif
787 /* AccelMethod
788 * Chooses between XAA and EXA
790 #if defined(SIS_USE_XAA) && defined(SIS_USE_EXA)
791 if(!pSiS->NoAccel) {
792 from = X_DEFAULT;
793 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ACCELMETHOD))) {
794 if(!xf86NameCmp(strptr,"XAA")) {
795 from = X_CONFIG;
796 pSiS->useEXA = FALSE;
797 } else if(!xf86NameCmp(strptr,"EXA")) {
798 from = X_CONFIG;
799 pSiS->useEXA = TRUE;
802 xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n",
803 pSiS->useEXA ? "EXA" : "XAA");
805 #endif
807 /* RenderAcceleration (for XAA only)
808 * En/Disables RENDER acceleration (315 and later only, not 550, not XGI Z7)
810 #ifdef SIS_USE_XAA
811 if((pSiS->VGAEngine == SIS_315_VGA) &&
812 (pSiS->Chipset != PCI_CHIP_SIS550) &&
813 (pSiS->Chipset != PCI_CHIP_XGIXG20) &&
814 (!pSiS->NoAccel)) {
815 if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) {
816 if(!pSiS->doRender) {
817 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n");
821 #else
822 pSiS->doRender = FALSE;
823 #endif
825 #ifdef SIS_INCL_RRROT
826 /* RandRRotationSupport, RandRRotation90Support
827 * En/Disables RandR rotation support. This requires
828 * the dynamic mode list.
829 * Note that on X.org prior to 6.9, this defaults to
830 * off, due to the requirement of the dyn mode list
831 * which disables DGA. 6.9+ supports dynamic mode
832 * lists + DGA.
834 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
835 from = X_DEFAULT;
836 if(xf86GetOptValBool(pSiS->Options, OPTION_RANDRROT, &pSiS->SupportRRRotation)) {
837 from = X_CONFIG;
839 if(pSiS->SupportRRRotation) {
840 if(xf86GetOptValBool(pSiS->Options, OPTION_RANDRROT90, &pSiS->SupportRRRotation90270)) {
841 from = X_CONFIG;
843 } else {
844 pSiS->SupportRRRotation90270 = FALSE;
846 xf86DrvMsg(pScrn->scrnIndex, from, "RandR rotation support %s%s\n",
847 pSiS->SupportRRRotation ? enabledstr : disabledstr,
848 pSiS->SupportRRRotation ? (pSiS->SupportRRRotation90270 ?
849 "" : " (0 and 180 degrees only)") : "");
851 #endif
853 /* SWCursor, HWCursor
854 * Chooses whether to use the hardware or software cursor
856 from = X_DEFAULT;
857 if(xf86GetOptValBool(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) {
858 from = X_CONFIG;
860 if(xf86ReturnOptValBool(pSiS->Options, OPTION_SW_CURSOR, FALSE)) {
861 from = X_CONFIG;
862 pSiS->HWCursor = FALSE;
863 pSiS->OptUseColorCursor = 0;
865 if(!pSiS->HWCursor) {
866 xf86DrvMsg(pScrn->scrnIndex, from, "Using SW cursor\n");
869 /* UseColorHWCursor
870 * ColorHWCursorBlending
871 * ColorHWCursorBlendThreshold
873 * Enable/disable color hardware cursors;
874 * enable/disable color hw cursor emulation for 300 series
875 * select emultation transparency threshold for 300 series
878 #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
879 #ifdef ARGB_CURSOR
880 #ifdef SIS_ARGB_CURSOR
881 if((pSiS->HWCursor) &&
882 ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) &&
883 (pSiS->Chipset != PCI_CHIP_XGIXG20)) {
885 from = X_DEFAULT;
886 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSOR, &pSiS->OptUseColorCursor)) {
887 from = X_CONFIG;
889 xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n",
890 pSiS->OptUseColorCursor ? enabledstr : disabledstr);
892 if(pSiS->VGAEngine == SIS_300_VGA) {
893 from = X_DEFAULT;
894 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) {
895 from = X_CONFIG;
897 if(pSiS->OptUseColorCursor) {
898 xf86DrvMsg(pScrn->scrnIndex, from,
899 "HW cursor color blending emulation is %s\n",
900 (pSiS->OptUseColorCursorBlend) ? enabledstr : disabledstr);
902 from = X_DEFAULT;
903 if(xf86GetOptValInteger(pSiS->Options, OPTION_USERGBCURSORBLENDTH, &ival)) {
904 if((ival >= 0) && (ival <= 255)) {
905 from = X_CONFIG;
906 pSiS->OptColorCursorBlendThreshold = (ival << 24);
907 } else {
908 ival = pSiS->OptColorCursorBlendThreshold >> 24;
909 SiS_PrintIlRange(pScrn, OPTION_USERGBCURSORBLENDTH, 0, 255, 0);
911 } else {
912 ival = pSiS->OptColorCursorBlendThreshold >> 24;
914 if(pSiS->OptUseColorCursor) {
915 if(pSiS->OptUseColorCursorBlend) {
916 xf86DrvMsg(pScrn->scrnIndex, from,
917 "HW cursor color blending emulation threshold is %d\n", ival);
922 #endif
923 #endif
924 #endif
926 /* OverruleFrequencyRanges
927 * Enable/disable overruling bogus frequency ranges for TV and LCD(A)
929 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
930 if(xf86GetOptValBool(pSiS->Options, OPTION_OVERRULERANGES, &val)) {
931 if(!val) {
932 pSiS->OverruleRanges = FALSE;
933 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overruling frequency ranges disabled\n");
938 #ifdef SISDUALHEAD
939 if(pSiS->DualHeadMode) {
940 IsDHM = TRUE;
941 if(pSiS->SecondHead) IsSecondHead = TRUE;
943 #endif
945 /* MergedFB
946 * Enable/disable and configure merged framebuffer mode
948 #ifdef SISMERGED
949 #ifdef SISDUALHEAD
950 if(pSiS->DualHeadMode) {
951 if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFB)) {
952 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
953 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFB)].name);
955 if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFBAUTO)) {
956 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
957 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFBAUTO)].name);
959 } else
960 #endif
961 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
962 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDFB))) {
963 if(SiS_StrIsBoolOn(strptr)) {
964 pSiS->MergedFB = TRUE;
965 pSiS->MergedFBAuto = FALSE;
966 } else if(!xf86NameCmp(strptr, "AUTO")) {
967 pSiS->MergedFB = TRUE;
968 pSiS->MergedFBAuto = TRUE;
971 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBAUTO, &val)) {
972 if(!pSiS->MergedFB) {
973 if(val) pSiS->MergedFB = pSiS->MergedFBAuto = TRUE;
974 } else {
975 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
976 "Option \"MergedFB\" overrules option \"MergedFBAuto\"\n");
980 if(pSiS->MergedFB) {
981 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS))) {
982 int result;
983 Bool valid = FALSE;
984 char *tempstr = xalloc(strlen(strptr) + 1);
985 result = sscanf(strptr, "%s %d", tempstr, &ival);
986 if(result >= 1) {
987 if(!xf86NameCmp(tempstr,"LeftOf")) {
988 pSiS->CRT2Position = sisLeftOf;
989 valid = TRUE;
990 if(result == 2) {
991 if(ival < 0) pSiS->CRT1YOffs = -ival;
992 else pSiS->CRT2YOffs = ival;
993 #ifdef SIS_INCL_RRROT
994 pSiS->SupportRRRotation = FALSE;
995 #endif
997 #ifdef SISXINERAMA
998 pSiS->CRT2IsScrn0 = TRUE;
999 #endif
1000 } else if(!xf86NameCmp(tempstr,"RightOf")) {
1001 pSiS->CRT2Position = sisRightOf;
1002 valid = TRUE;
1003 if(result == 2) {
1004 if(ival < 0) pSiS->CRT1YOffs = -ival;
1005 else pSiS->CRT2YOffs = ival;
1006 #ifdef SIS_INCL_RRROT
1007 pSiS->SupportRRRotation = FALSE;
1008 #endif
1010 #ifdef SISXINERAMA
1011 pSiS->CRT2IsScrn0 = FALSE;
1012 #endif
1013 } else if(!xf86NameCmp(tempstr,"Above")) {
1014 pSiS->CRT2Position = sisAbove;
1015 valid = TRUE;
1016 if(result == 2) {
1017 if(ival < 0) pSiS->CRT1XOffs = -ival;
1018 else pSiS->CRT2XOffs = ival;
1019 #ifdef SIS_INCL_RRROT
1020 pSiS->SupportRRRotation = FALSE;
1021 #endif
1023 #ifdef SISXINERAMA
1024 pSiS->CRT2IsScrn0 = FALSE;
1025 #endif
1026 } else if(!xf86NameCmp(tempstr,"Below")) {
1027 pSiS->CRT2Position = sisBelow;
1028 valid = TRUE;
1029 if(result == 2) {
1030 if(ival < 0) pSiS->CRT1XOffs = -ival;
1031 else pSiS->CRT2XOffs = ival;
1032 #ifdef SIS_INCL_RRROT
1033 pSiS->SupportRRRotation = FALSE;
1034 #endif
1036 #ifdef SISXINERAMA
1037 pSiS->CRT2IsScrn0 = TRUE;
1038 #endif
1039 } else if(!xf86NameCmp(tempstr,"Clone")) {
1040 pSiS->CRT2Position = sisClone;
1041 if(result == 1) valid = TRUE;
1042 #ifdef SISXINERAMA
1043 pSiS->CRT2IsScrn0 = TRUE;
1044 #endif
1047 if(!valid) {
1048 SiS_PrintBadOpt(pScrn, strptr, OPTION_CRT2POS);
1049 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1050 "%s \"RightOf\", \"LeftOf\", \"Above\", \"Below\", or \"Clone\"\n", validparm);
1051 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1052 "Except for \"Clone\", the parameter may be followed by an integer.\n");
1054 xfree(tempstr);
1056 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES))) {
1057 pSiS->MetaModes = xalloc(strlen(strptr) + 1);
1058 if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
1060 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC))) {
1061 pSiS->CRT2HSync = xalloc(strlen(strptr) + 1);
1062 if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
1064 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH))) {
1065 pSiS->CRT2VRefresh = xalloc(strlen(strptr) + 1);
1066 if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
1068 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDDPI))) {
1069 int val1 = 0, val2 = 0;
1070 sscanf(strptr, "%d %d", &val1, &val2);
1071 if(val1 && val2) {
1072 pSiS->MergedFBXDPI = val1;
1073 pSiS->MergedFBYDPI = val2;
1074 } else {
1075 SiS_PrintBadOpt(pScrn, strptr, OPTION_MERGEDDPI);
1078 #ifdef SISXINERAMA
1079 if(pSiS->MergedFB) {
1080 if(xf86GetOptValBool(pSiS->Options, OPTION_SISXINERAMA, &val)) {
1081 if(!val) pSiS->UseSiSXinerama = FALSE;
1083 if(pSiS->UseSiSXinerama) {
1084 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SCR0))) {
1085 char *tempstr1 = xalloc(strlen(strptr) + 1);
1086 char *tempstr2 = xalloc(strlen(strptr) + 1);
1087 char *tempstr;
1088 int i, result;
1089 pSiS->MFBScr0LR = pSiS->MFBScr0TB = -1;
1090 if((tempstr = strpbrk(strptr, ",;-"))) {
1091 *tempstr = ' ';
1093 tempstr = tempstr1;
1094 if((result = sscanf(strptr, "%s %s", tempstr1, tempstr2)) > 0) {
1095 for(i = 1; i <= max(result, 2); i++) {
1096 if(!xf86NameCmp(tempstr, "left")) {
1097 pSiS->MFBScr0LR = TRUE;
1098 } else if(!xf86NameCmp(tempstr, "right")) {
1099 pSiS->MFBScr0LR = FALSE;
1100 } else if(!xf86NameCmp(tempstr, "top")) {
1101 pSiS->MFBScr0TB = TRUE;
1102 } else if(!xf86NameCmp(tempstr, "bottom")) {
1103 pSiS->MFBScr0TB = FALSE;
1105 tempstr = tempstr2;
1108 if(pSiS->MFBScr0LR == -1 || pSiS->MFBScr0TB == -1) {
1109 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1110 "Bad or incomplete argument(s) for Option \"%s\"\n",
1111 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_SCR0)].name);
1113 xfree(tempstr1);
1114 xfree(tempstr2);
1115 } else if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
1116 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1117 "Option \"%s\" is deprecated, use \"%s\"\n",
1118 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_CRT2ISSCRN0)].name,
1119 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_SCR0)].name);
1120 pSiS->CRT2IsScrn0 = val ? TRUE : FALSE;
1121 pSiS->MFBScr0LR = pSiS->MFBScr0TB = -1;
1123 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBNONRECT, &val)) {
1124 pSiS->NonRect = val ? TRUE : FALSE;
1126 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBMOUSER, &val)) {
1127 pSiS->MouseRestrictions = val ? TRUE : FALSE;
1131 #endif
1134 #endif
1136 /* Some options can only be specified in the Master Head's Device
1137 * section. Here we give the user a hint in the log.
1139 #ifdef SISDUALHEAD
1140 if((pSiS->DualHeadMode) && (pSiS->SecondHead)) {
1141 static const char *mystring = "Option \"%s\" only accepted in CRT2 (Master) Device section\n";
1142 int i;
1143 const short forbiddenopts[] = {
1144 OPTION_TURBOQUEUE, OPTION_RESTOREBYSET, OPTION_ENABLEHOTKEY,
1145 OPTION_ENABLESISCTRL, OPTION_USEROMDATA, OPTION_USEOEM,
1146 OPTION_FORCECRT1, OPTION_DDCFORCRT2, OPTION_FORCECRT2REDETECTION,
1147 OPTION_SENSEYPBPR, OPTION_FORCE_CRT1TYPE, OPTION_FORCE_CRT2TYPE,
1148 OPTION_YPBPRAR, OPTION_SCALELCD, OPTION_CENTERLCD, OPTION_PDC,
1149 OPTION_PDCA, OPTION_EMI, OPTION_SPECIALTIMING, OPTION_LVDSHL,
1150 OPTION_TVSTANDARD, OPTION_CHTVTYPE, OPTION_CHTVOVERSCAN,
1151 OPTION_CHTVSOVERSCAN, OPTION_CHTVLUMABANDWIDTHCVBS,
1152 OPTION_CHTVLUMABANDWIDTHSVIDEO, OPTION_CHTVLUMAFLICKERFILTER,
1153 OPTION_CHTVCHROMABANDWIDTH, OPTION_CHTVCHROMAFLICKERFILTER,
1154 OPTION_CHTVCVBSCOLOR, OPTION_CHTVTEXTENHANCE, OPTION_CHTVCONTRAST,
1155 OPTION_SISTVEDGEENHANCE, OPTION_SISTVANTIFLICKER, OPTION_SISTVSATURATION,
1156 OPTION_SISTVCHROMAFILTER, OPTION_SISTVLUMAFILTER, OPTION_SISTVCOLCALIBCOARSE,
1157 OPTION_SISTVCOLCALIBFINE, OPTION_TVXPOSOFFSET, OPTION_TVYPOSOFFSET,
1158 OPTION_TVXSCALE, OPTION_TVYSCALE, OPTION_TVBLUE, OPTION_CRT2GAMMA, OPTION_XVONCRT2,
1159 OPTION_XVDEFAULTADAPTOR, OPTION_XVBENCHCPY, OPTION_FORCE2ASPECT,
1160 #if defined(SIS_USE_XAA) && defined(SIS_USE_EXA)
1161 OPTION_ACCELMETHOD,
1162 #endif
1163 #ifndef SISCHECKOSSSE
1164 OPTION_XVSSECOPY,
1165 #endif
1166 #ifdef SIS_CP
1167 SIS_CP_OPT_DH_WARN
1168 #endif
1172 i = 0;
1173 while(forbiddenopts[i] >= 0) {
1174 if(xf86IsOptionSet(pSiS->Options, (int)forbiddenopts[i])) {
1175 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring,
1176 pSiS->Options[SiS_FIFT(pSiS->Options, (int)forbiddenopts[i])].name);
1178 i++;
1181 } else
1182 #endif
1184 if(pSiS->VGAEngine == SIS_315_VGA) {
1186 #ifdef SISVRAMQ
1187 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using VRAM command queue, size %dk\n",
1188 pSiS->cmdQueueSize / 1024);
1189 #else
1190 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MMIO command queue\n");
1191 #endif
1193 } else {
1195 /* TurboQueue */
1196 from = X_DEFAULT;
1197 if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
1198 from = X_CONFIG;
1200 xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
1201 pSiS->TurboQueue ? enabledstr : disabledstr);
1205 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1207 /* RestoreBySetMode (300/315/330 series and later only)
1208 * Set this to force the driver to set the old mode instead of restoring
1209 * the register contents. This can be used to overcome problems with
1210 * LCD panels and video bridges.
1212 if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
1213 pSiS->restorebyset = val ? TRUE : FALSE;
1216 /* EnableHotkey (300/315/330 series and later only)
1217 * Enables or disables the BIOS hotkey switch for
1218 * switching the output device on laptops.
1219 * This key causes a total machine hang on many 300 series
1220 * machines, it is therefore by default disabled on such.
1221 * In dual head mode, using the hotkey is lethal, so we
1222 * forbid it then in any case.
1223 * However, although the driver disables the hotkey as
1224 * BIOS developers intented to do that, some buggy BIOSes
1225 * still cause the machine to freeze. Hence the warning.
1227 ival = 0;
1228 from = X_DEFAULT;
1229 #ifdef SISDUALHEAD
1230 if(pSiS->DualHeadMode) {
1231 pSiS->AllowHotkey = 0;
1232 ival = 1;
1233 } else
1234 #endif
1235 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLEHOTKEY, &val)) {
1236 pSiS->AllowHotkey = val ? 1 : 0;
1237 from = X_CONFIG;
1239 xf86DrvMsg(pScrn->scrnIndex, from, "Hotkey display switching is %s%s\n",
1240 pSiS->AllowHotkey ? enabledstr : disabledstr,
1241 ival ? " in dual head mode" : "");
1242 if(pSiS->Chipset == PCI_CHIP_SIS630 ||
1243 pSiS->Chipset == PCI_CHIP_SIS650 ||
1244 pSiS->Chipset == PCI_CHIP_SIS660 ||
1245 pSiS->Chipset == PCI_CHIP_SIS670) {
1246 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1247 "WARNING: Using the Hotkey might freeze your machine, regardless\n");
1248 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1249 " whether enabled or disabled. This is no driver bug.\n");
1252 /* UseROMData (300/315/330 series and later only)
1253 * This option is enabling/disabling usage of some machine
1254 * specific data from the BIOS ROM. This option can - and
1255 * should - be used in case the driver makes problems
1256 * because SiS changed the location of this data.
1257 * Generally, don't use this.
1259 if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
1260 pSiS->OptROMUsage = val ? 1 : 0;
1261 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1262 "Video ROM data usage shall be %s\n",
1263 val ? enabledstr : disabledstr);
1266 /* UseOEMData (300/315/330 series and later only)
1267 * The driver contains quite a lot data for OEM LCD panels
1268 * and TV connector specifics which override the defaults.
1269 * If this data is incorrect, the TV may lose color and
1270 * the LCD panel might show some strange effects. Use this
1271 * option to disable the usage of this data.
1272 * Generally, don't use this.
1274 if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
1275 pSiS->OptUseOEM = val ? 1 : 0;
1276 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1277 "Internal CRT2 OEM data usage shall be %s\n",
1278 val ? enabledstr : disabledstr);
1281 /* CRT2DDCDetection (315/330 series and later only)
1282 * If set to true, this disables CRT2 detection using DDC. This is
1283 * to avoid problems with not entirely DDC compiant LCD panels or
1284 * VGA monitors connected to the secondary VGA plug. Since LCD and
1285 * VGA share the same DDC channel, it might in some cases be impossible
1286 * to determine if the device is a CRT monitor or a flat panel.
1288 if(xf86GetOptValBool(pSiS->Options, OPTION_DDCFORCRT2, &val)) {
1289 pSiS->nocrt2ddcdetection = val ? FALSE : TRUE;
1292 /* ForceCRT2ReDetection (315/330 series and later only)
1293 * If set to true, it forces re-detection of the LCD panel and
1294 * a secondary VGA connection even if the BIOS already had found
1295 * about it. This is meant for custom panels (ie such with
1296 * non-standard resolutions) which the BIOS will "detect" according
1297 * to the established timings, resulting in only a very vague idea
1298 * about the panels real resolution. As for secondary VGA, this
1299 * enables us to include a Plasma panel's proprietary modes.
1301 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
1302 if(val) {
1303 pSiS->forcecrt2redetection = TRUE;
1304 pSiS->nocrt2ddcdetection = FALSE;
1305 } else
1306 pSiS->forcecrt2redetection = FALSE;
1309 /* SenseYPbPr (315/330 series and later only)
1310 * If set to true, the driver will sense for YPbPr TV. This is
1311 * inconvenient for folks connecting SVideo and CVBS at the same
1312 * time, because this condition will be detected as YPbPr (since
1313 * the TV output pins are shared). "False" will not sense for
1314 * YPbPr and detect SVideo or CVBS only.
1316 if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) {
1317 pSiS->SenseYPbPr = val ? TRUE : FALSE;
1320 /* ForceCRT1Type (315/330 series and later only)
1321 * Used for forcing the driver to initialize CRT1 as
1322 * VGA (analog) or LCDA (for simultanious LCD and TV
1323 * display) - on M650/651 and 661 or later with 301C/30xLV or later only!
1325 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE))) {
1326 if( (!xf86NameCmp(strptr,"VGA")) ||
1327 (!xf86NameCmp(strptr,"CRT")) ||
1328 SiS_StrIsBoolOn(strptr) ) {
1329 pSiS->ForceCRT1Type = CRT1_VGA;
1330 pSiS->CRT1TypeForced = TRUE;
1331 } else if( (!xf86NameCmp(strptr,"LCD")) ||
1332 (!xf86NameCmp(strptr,"LCDA")) ||
1333 (!xf86NameCmp(strptr,"DVI-D")) ||
1334 (!xf86NameCmp(strptr,"DVID")) ||
1335 (!xf86NameCmp(strptr,"DVI")) ||
1336 (!xf86NameCmp(strptr,"LCD-A")) ) {
1337 pSiS->ForceCRT1Type = CRT1_LCDA;
1338 pSiS->CRT1TypeForced = TRUE;
1339 } else if( (!xf86NameCmp(strptr,"NONE")) ||
1340 SiS_StrIsBoolOff(strptr) ) {
1341 pSiS->ForceCRT1Type = CRT1_VGA;
1342 pSiS->forceCRT1 = 0;
1343 pSiS->CRT1TypeForced = TRUE;
1344 } else {
1345 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT1TYPE);
1346 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1347 "%s \"VGA\" (alias \"CRT\" or \"ON\"), \"LCD\" (alias \"DVI-D\") or NONE (alias \"OFF\")\n", validparm);
1351 /* ForceCRT1 (300/315/330 series and later only)
1352 * This option can be used to force CRT1 (VGA) to be switched on/off. Its
1353 * intention is mainly for old monitors that can't be detected
1354 * automatically. This is only useful on machines with a video bridge.
1355 * In normal cases, this option won't be necessary.
1356 * This option is deprecated. Use ForceCRT1Type instead.
1358 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1359 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
1360 pSiS->forceCRT1 = val ? 1 : 0;
1361 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1362 "CRT1 shall be forced %s\n",
1363 val ? "ON" : "OFF");
1364 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1365 "Option \"ForceCRT1\" is deprecated. Use Option \"ForceCRT1Type\" instead.\n");
1369 /* ForceCRT2Type (300/315/330 series and later only)
1370 * Used for forcing the driver to use a given CRT2 device type.
1371 * (SVIDEO, COMPOSITE and SCART for overriding detection)
1373 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
1374 if(strptr != NULL) {
1375 if(!xf86NameCmp(strptr,"TV"))
1376 pSiS->ForceCRT2Type = CRT2_TV;
1377 else if( (!xf86NameCmp(strptr,"SVIDEO")) ||
1378 (!xf86NameCmp(strptr,"SVHS")) ) {
1379 pSiS->ForceCRT2Type = CRT2_TV;
1380 pSiS->ForceTVType = TV_SVIDEO;
1381 } else if( (!xf86NameCmp(strptr,"COMPOSITE")) ||
1382 (!xf86NameCmp(strptr,"CVBS")) ) {
1383 pSiS->ForceCRT2Type = CRT2_TV;
1384 pSiS->ForceTVType = TV_AVIDEO;
1385 } else if( (!xf86NameCmp(strptr,"COMPOSITE SVIDEO")) || /* Ugly, but shorter than a parsing function */
1386 (!xf86NameCmp(strptr,"COMPOSITE+SVIDEO")) ||
1387 (!xf86NameCmp(strptr,"SVIDEO+COMPOSITE")) ||
1388 (!xf86NameCmp(strptr,"SVIDEO COMPOSITE")) ) {
1389 pSiS->ForceCRT2Type = CRT2_TV;
1390 pSiS->ForceTVType = (TV_SVIDEO | TV_AVIDEO);
1391 } else if(!xf86NameCmp(strptr,"SCART")) {
1392 pSiS->ForceCRT2Type = CRT2_TV;
1393 pSiS->ForceTVType = TV_SCART;
1394 } else if( (!xf86NameCmp(strptr,"LCD")) ||
1395 (!xf86NameCmp(strptr,"DVI-D")) ) {
1396 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1397 pSiS->ForceCRT2Type = CRT2_LCD;
1398 } else {
1399 pSiS->ForceCRT2Type = 0;
1400 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1401 "Can't set both CRT1 and CRT2 type to LCD; CRT2 disabled\n");
1403 } else if((!xf86NameCmp(strptr,"VGA")) ||
1404 (!xf86NameCmp(strptr,"DVI-A")) ||
1405 (!xf86NameCmp(strptr,"CRT"))) {
1406 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1407 pSiS->ForceCRT2Type = CRT2_VGA;
1408 } else {
1409 pSiS->ForceCRT2Type = 0;
1410 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1411 "CRT2 can only be TV or off while CRT1 is LCD; CRT2 disabled\n");
1413 } else if( (!xf86NameCmp(strptr,"NONE")) ||
1414 SiS_StrIsBoolOff(strptr) )
1415 pSiS->ForceCRT2Type = 0;
1416 else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
1417 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1418 pSiS->ForceCRT2Type = CRT2_LCD;
1419 pSiS->DSTN = TRUE;
1421 } else if((!xf86NameCmp(strptr,"FSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
1422 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1423 pSiS->ForceCRT2Type = CRT2_LCD;
1424 pSiS->FSTN = TRUE;
1426 } else if(!xf86NameCmp(strptr,"HIVISION")) {
1427 pSiS->ForceCRT2Type = CRT2_TV;
1428 pSiS->ForceTVType = TV_HIVISION;
1429 } else if( (!xf86NameCmp(strptr,"YPBPR1080I")) &&
1430 (pSiS->VGAEngine == SIS_315_VGA) ) {
1431 pSiS->ForceCRT2Type = CRT2_TV;
1432 pSiS->ForceTVType = TV_YPBPR;
1433 pSiS->ForceYPbPrType = TV_YPBPR1080I;
1434 } else if( ( (!xf86NameCmp(strptr,"YPBPR525I")) ||
1435 (!xf86NameCmp(strptr,"YPBPR480I")) ) &&
1436 (pSiS->VGAEngine == SIS_315_VGA) ) {
1437 pSiS->ForceCRT2Type = CRT2_TV;
1438 pSiS->ForceTVType = TV_YPBPR;
1439 pSiS->ForceYPbPrType = TV_YPBPR525I;
1440 } else if( ( (!xf86NameCmp(strptr,"YPBPR525P")) ||
1441 (!xf86NameCmp(strptr,"YPBPR480P")) ) &&
1442 (pSiS->VGAEngine == SIS_315_VGA) ) {
1443 pSiS->ForceCRT2Type = CRT2_TV;
1444 pSiS->ForceTVType = TV_YPBPR;
1445 pSiS->ForceYPbPrType = TV_YPBPR525P;
1446 } else if( ( (!xf86NameCmp(strptr,"YPBPR625I")) ||
1447 (!xf86NameCmp(strptr,"YPBPR576I")) ) &&
1448 (pSiS->VGAEngine == SIS_315_VGA)) {
1449 pSiS->ForceCRT2Type = CRT2_TV;
1450 pSiS->ForceTVType = TV_YPBPR;
1451 pSiS->ForceYPbPrType = TV_YPBPR625I;
1452 } else if( ( (!xf86NameCmp(strptr,"YPBPR625P")) ||
1453 (!xf86NameCmp(strptr,"YPBPR576P"))) &&
1454 (pSiS->VGAEngine == SIS_315_VGA) ) {
1455 pSiS->ForceCRT2Type = CRT2_TV;
1456 pSiS->ForceTVType = TV_YPBPR;
1457 pSiS->ForceYPbPrType = TV_YPBPR625P;
1458 } else if( ( (!xf86NameCmp(strptr,"YPBPR750P")) ||
1459 (!xf86NameCmp(strptr,"YPBPR720P"))) &&
1460 (pSiS->VGAEngine == SIS_315_VGA) ) {
1461 pSiS->ForceCRT2Type = CRT2_TV;
1462 pSiS->ForceTVType = TV_YPBPR;
1463 pSiS->ForceYPbPrType = TV_YPBPR750P;
1464 } else {
1465 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT2TYPE);
1466 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1467 "%s \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
1468 "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\"; on the SiS550\n"
1469 "\talso \"DSTN\" and \"FSTN\""
1470 "; on SiS 301/301B bridges also \"HIVISION\", and on\n"
1471 "\tSiS315/330/340 series with 301C/30xLV/307 also \"YPBPR480I\", \"YPBPR480P\",\n"
1472 "\t\"YPBPR576I\", \"YPBPR576P\", \"YPBPR720P\" and \"YPBPR1080I\"\n", validparm);
1475 if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
1476 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1477 "CRT2 type shall be %s\n", strptr);
1480 if(pSiS->ForceTVType == TV_YPBPR) {
1481 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR);
1482 if(strptr != NULL) {
1483 if(!xf86NameCmp(strptr,"4:3LB"))
1484 pSiS->ForceYPbPrAR = TV_YPBPR43LB;
1485 else if(!xf86NameCmp(strptr,"4:3"))
1486 pSiS->ForceYPbPrAR = TV_YPBPR43;
1487 else if(!xf86NameCmp(strptr,"16:9"))
1488 pSiS->ForceYPbPrAR = TV_YPBPR169;
1489 else {
1490 SiS_PrintBadOpt(pScrn, strptr, OPTION_YPBPRAR);
1491 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1492 "%s \"4:3LB\", \"4:3\" and \"16:9\"\n", validparm);
1497 /* SpecialTiming
1498 * Override the driver's autodetection of some special
1499 * systems requiring some hacks.
1501 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING);
1502 if(strptr != NULL) {
1503 int i = 0;
1504 Bool found = FALSE;
1505 if(!xf86NameCmp(strptr,"NONE")) {
1506 pSiS->SiS_Pr->SiS_CustomT = CUT_FORCENONE;
1507 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1508 "Special timing disabled\n");
1509 } else {
1510 while(SiS_customttable[i].chipID != 0) {
1511 if(!xf86NameCmp(strptr,SiS_customttable[i].optionName)) {
1512 pSiS->SiS_Pr->SiS_CustomT = SiS_customttable[i].SpecialID;
1513 found = TRUE;
1514 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1515 "Special timing for %s %s forced\n",
1516 SiS_customttable[i].vendorName, SiS_customttable[i].cardName);
1517 break;
1519 i++;
1521 if(!found) {
1522 SiS_PrintBadOpt(pScrn, strptr, OPTION_SPECIALTIMING);
1523 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
1524 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NONE\" (to disable special timings)\n");
1525 i = 0;
1526 while(SiS_customttable[i].chipID != 0) {
1527 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1528 "\t\"%s\" (for %s %s)\n",
1529 SiS_customttable[i].optionName,
1530 SiS_customttable[i].vendorName,
1531 SiS_customttable[i].cardName);
1532 i++;
1538 /* EnableSiSCtrl */
1539 /* Allow sisctrl tool to change driver settings */
1540 from = X_DEFAULT;
1541 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLESISCTRL, &val)) {
1542 if(val) pSiS->enablesisctrl = TRUE;
1543 from = X_CONFIG;
1545 xf86DrvMsg(pScrn->scrnIndex, from, "SiSCtrl utility interface is %s\n",
1546 pSiS->enablesisctrl ? enabledstr : disabledstr);
1548 if((from == X_DEFAULT) && (!pSiS->enablesisctrl)) {
1549 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1550 "For information on SiSCtrl, see\n\t\thttp://www.winischhofer.at/linuxsispart1.shtml#sisctrl\n");
1554 /* ForceCRT1Aspect, ForceCRT2Aspect */
1555 /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
1556 * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
1557 * output devices, not TV or DVI/LCD.
1559 if(pSiS->VGAEngine == SIS_315_VGA) {
1560 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE2ASPECT);
1561 if(strptr != NULL) {
1562 if(!xf86NameCmp(strptr,"WIDE")) {
1563 pSiS->SiS_Pr->SiS_UseWideCRT2 = TRUE;
1564 pSiS->havewide2 = TRUE;
1565 } else if(!xf86NameCmp(strptr,"NORMAL")) {
1566 pSiS->SiS_Pr->SiS_UseWideCRT2 = FALSE;
1567 pSiS->havewide2 = TRUE;
1568 } else {
1569 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE2ASPECT);
1570 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
1571 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
1573 /* Print status later */
1577 /* ScaleLCD (300/315/330 series and later only)
1578 * Can be used to force the bridge/panel link to [do|not do] the
1579 * scaling of modes lower than the panel's native resolution.
1580 * Setting this to TRUE will force the bridge/panel link
1581 * to scale; FALSE will rely on the panel's capabilities.
1582 * Not supported on all machines.
1584 if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
1585 pSiS->UsePanelScaler = val ? 0 : 1;
1586 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD scaling is %s\n",
1587 pSiS->UsePanelScaler ? disabledstr : enabledstr);
1590 /* CenterLCD (300/315/330/later + SiS video bridge only)
1591 * If LCD shall not be scaled, this selects whether 1:1 data
1592 * will be sent to the output, or the image shall be centered
1593 * on the LCD. For LVDS panels, screen will always be centered,
1594 * since these have no built-in scaler. For TMDS, this is
1595 * selectable. Non-centered means that the driver will pass
1596 * 1:1 data to the output and that the panel will have to
1597 * scale by itself (if supported by the panel).
1599 if(xf86GetOptValBool(pSiS->Options, OPTION_CENTERLCD, &val)) {
1600 pSiS->CenterLCD = val ? 1 : 0;
1601 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Non-scaled LCD output will %sbe centered\n",
1602 pSiS->CenterLCD ? "not " : "");
1605 /* PanelDelayCompensation (300/315/330 series and later only)
1606 * This might be required if the LCD panel shows "small waves"
1607 * or wrong colors.
1608 * The parameter is an integer, (on 300 series usually either
1609 * 4, 32 or 24; on 315 series + LV bridge usually 3 or 51)
1610 * Why this option? Simply because SiS did poor BIOS design.
1611 * The PDC value depends on the very LCD panel used in a
1612 * particular machine. For most panels, the driver is able
1613 * to detect the correct value. However, some panels require
1614 * a different setting. For 300 series, the value given must
1615 * be within the mask 0x3c. For 661 and later, if must be
1616 * within the range of 0 to 31.
1618 ival = -1;
1619 xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &ival);
1620 if(ival != -1) {
1621 pSiS->PDC = ival;
1622 if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) {
1623 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1624 "Invalid PanelDelayCompensation parameter\n");
1625 pSiS->PDC = -1;
1626 } else {
1627 if(pSiS->VGAEngine == SIS_315_VGA) pSiS->PDC &= 0x1f;
1628 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1629 "Panel delay compensation shall be %d (for LCD=CRT2)\n",
1630 pSiS->PDC);
1634 /* PanelDelayCompensation1 (315/330 series and later only)
1635 * Same as above, but for LCD-via-CRT1 ("LCDA")
1637 if(pSiS->VGAEngine == SIS_315_VGA) {
1638 ival = -1;
1639 xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &ival);
1640 if(ival != -1) {
1641 pSiS->PDCA = ival;
1642 if(pSiS->PDCA > 0x1f) {
1643 SiS_PrintIlRange(pScrn, OPTION_PDCA, 0, 31, 0);
1644 pSiS->PDCA = -1;
1645 } else {
1646 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1647 "Panel delay compensation shall be %d (for LCD=CRT1)\n",
1648 pSiS->PDCA);
1653 /* LVDSHL (300/315/330/later series + 30xLV bridge only)
1654 * This might be required if the LCD panel is too dark.
1655 * The parameter is an integer from 0 to 3.
1657 if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
1658 if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) {
1659 SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 3, 0);
1660 pSiS->SiS_Pr->LVDSHL = -1;
1661 } else {
1662 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1663 "LVDSHL will be %d\n",
1664 pSiS->SiS_Pr->LVDSHL);
1668 /* EMI (315/330/later series + 302LV/302ELV bridge only)
1669 * This might be required if the LCD panel loses sync on
1670 * mode switches. So far, this problem should not show up
1671 * due to the auto-detection (from reading the values set
1672 * by the BIOS; however, the BIOS values are wrong sometimes
1673 * such as in the case of some Compal machines with a
1674 * 1400x1050, or some Inventec(Compaq) machines with a
1675 * 1280x1024 panel.
1676 * The parameter is an integer from 0 to 0x60ffffff.
1678 if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) {
1679 if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) {
1680 SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 0x60ffffff, 1);
1681 pSiS->EMI = -1;
1682 } else {
1683 pSiS->EMI &= 0x60ffffff;
1684 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1685 "EMI will be 0x%04x\n", pSiS->EMI);
1689 /* TVBlueWorkAround (315 series until 661 only)
1690 * TRUE and FALSE are two ways to work around a "blue shade" on
1691 * TV output. This work-around is disabled by not setting the
1692 * option. 315 series + 301B-DH only. For 661 and later, the
1693 * BIOS contains the respective values so we can read them
1694 * from there.
1696 if(pSiS->VGAEngine == SIS_315_VGA) {
1697 if(xf86GetOptValBool(pSiS->Options, OPTION_TVBLUE, &val)) {
1698 pSiS->SiS_Pr->SiS_TVBlue = val ? 1 : 0;
1702 /* ForcePanelRGB (300/315/330 series and later only)
1703 * Can be used to force the bridge/panel link to assume a
1704 * specified LCD color capability of 18 or 24 bit in cases
1705 * where the BIOS carries incorrect information (such as in
1706 * the case of the MSI m250).
1708 if(xf86GetOptValInteger(pSiS->Options, OPTION_PRGB, &pSiS->PRGB)) {
1709 if((pSiS->PRGB != 18 && pSiS->PRGB != 24)) {
1710 pSiS->PRGB = -1;
1711 SiS_PrintBadOpt(pScrn, strptr, OPTION_PRGB);
1712 } else {
1713 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1714 "LCD panel color depth is %d\n",
1715 pSiS->PRGB);
1722 /* TVStandard (300/315/330/later series and 6326 w/ TV only)
1723 * This option is for overriding the autodetection of
1724 * the BIOS/Jumper option for PAL / NTSC
1726 if((pSiS->VGAEngine == SIS_300_VGA) ||
1727 (pSiS->VGAEngine == SIS_315_VGA) ||
1728 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1729 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD);
1730 if(strptr != NULL) {
1731 if(!xf86NameCmp(strptr,"PAL"))
1732 pSiS->OptTVStand = 1;
1733 else if((!xf86NameCmp(strptr,"PALM")) ||
1734 (!xf86NameCmp(strptr,"PAL-M"))) {
1735 pSiS->OptTVStand = 1;
1736 pSiS->NonDefaultPAL = 1;
1737 } else if((!xf86NameCmp(strptr,"PALN")) ||
1738 (!xf86NameCmp(strptr,"PAL-N"))) {
1739 pSiS->OptTVStand = 1;
1740 pSiS->NonDefaultPAL = 0;
1741 } else if((!xf86NameCmp(strptr,"NTSCJ")) ||
1742 (!xf86NameCmp(strptr,"NTSC-J"))) {
1743 pSiS->OptTVStand = 0;
1744 pSiS->NonDefaultNTSC = 1;
1745 } else if(!xf86NameCmp(strptr,"NTSC"))
1746 pSiS->OptTVStand = 0;
1747 else {
1748 SiS_PrintBadOpt(pScrn, strptr, OPTION_TVSTANDARD);
1749 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1750 "%s \"PAL\", \"PALM\", \"PALN\", \"NTSC\", \"NTSCJ\"\n", validparm);
1753 if(pSiS->OptTVStand != -1) {
1754 static const char *tvstdstr = "TV standard shall be %s\n";
1755 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
1756 pSiS->NonDefaultPAL = -1;
1757 pSiS->NonDefaultNTSC = -1;
1758 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1759 pSiS->OptTVStand ? "PAL" : "NTSC");
1760 } else {
1761 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1762 (pSiS->OptTVStand ?
1763 ( (pSiS->NonDefaultPAL == -1) ? "PAL" :
1764 ((pSiS->NonDefaultPAL) ? "PALM" : "PALN") ) :
1765 (pSiS->NonDefaultNTSC == -1) ? "NTSC" : "NTSCJ"));
1771 /* CHTVType (315/330/later series + Chrontel only)
1772 * Used for telling the driver if the TV output shall
1773 * be 525i YPbPr or SCART.
1775 if(pSiS->VGAEngine == SIS_315_VGA) {
1776 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
1777 if(strptr != NULL) {
1778 if(!xf86NameCmp(strptr,"SCART"))
1779 pSiS->chtvtype = 1;
1780 else if(!xf86NameCmp(strptr,"YPBPR525I"))
1781 pSiS->chtvtype = 0;
1782 else {
1783 SiS_PrintBadOpt(pScrn, strptr, OPTION_CHTVTYPE);
1784 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1785 "%s \"SCART\" or \"YPBPR525I\"\n", validparm);
1787 if(pSiS->chtvtype != -1)
1788 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1789 "Chrontel: TV type shall be %s\n", strptr);
1793 /* CHTVOverscan (300/315/330 series and later only)
1794 * CHTVSuperOverscan (300/315/330 series and later only)
1795 * These options are for overriding the BIOS option for
1796 * TV Overscan. Some BIOSes don't even have such an option.
1797 * SuperOverscan is only supported with PAL.
1798 * Both options are only effective on machines with a
1799 * CHRONTEL TV encoder. SuperOverscan is only available
1800 * on the 700x.
1802 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1803 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) {
1804 pSiS->OptTVOver = val ? 1 : 0;
1805 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1806 "Chrontel: TV overscan shall be %s\n",
1807 val ? enabledstr : disabledstr);
1809 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) {
1810 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1811 "Chrontel: TV super overscan shall be %s\n",
1812 pSiS->OptTVSOver ? enabledstr : disabledstr);
1816 /* Various parameters for TV output via SiS bridge, Chrontel or SiS6326
1818 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1819 int tmp = 0;
1820 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS,
1821 &pSiS->chtvlumabandwidthcvbs);
1822 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO,
1823 &pSiS->chtvlumabandwidthsvideo);
1824 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER,
1825 &pSiS->chtvlumaflickerfilter);
1826 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH,
1827 &pSiS->chtvchromabandwidth);
1828 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER,
1829 &pSiS->chtvchromaflickerfilter);
1830 xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR,
1831 &pSiS->chtvcvbscolor);
1832 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE,
1833 &pSiS->chtvtextenhance);
1834 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST,
1835 &pSiS->chtvcontrast);
1836 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE,
1837 &pSiS->sistvedgeenhance);
1838 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION,
1839 &pSiS->sistvsaturation);
1840 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVLUMAFILTER,
1841 &pSiS->sistvyfilter);
1842 if((pSiS->sistvyfilter < 0) || (pSiS->sistvyfilter > 8)) {
1843 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1844 "Illegal Y Filter number; valid is 0 (off), 1 (default), 2-8 (filter number 1-7)\n");
1845 pSiS->sistvyfilter = 1;
1847 xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER,
1848 &pSiS->sistvcfilter);
1849 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBCOARSE,
1850 &pSiS->sistvcolcalibc);
1851 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE,
1852 &pSiS->sistvcolcalibf);
1853 if((pSiS->sistvcolcalibf > 127) || (pSiS->sistvcolcalibf < -128) ||
1854 (pSiS->sistvcolcalibc > 120) || (pSiS->sistvcolcalibc < -120)) {
1855 pSiS->sistvcolcalibf = pSiS->sistvcolcalibc = 0;
1856 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1857 "Illegal Color Calibration. Range is -128 to 127 (fine), -120 to 120 (coarse)\n");
1859 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1860 &pSiS->tvxpos);
1861 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1862 &pSiS->tvypos);
1863 if(pSiS->tvxpos > 32) { pSiS->tvxpos = 32; tmp = 1; }
1864 if(pSiS->tvxpos < -32) { pSiS->tvxpos = -32; tmp = 1; }
1865 if(pSiS->tvypos > 32) { pSiS->tvypos = 32; tmp = 1; }
1866 if(pSiS->tvypos < -32) { pSiS->tvypos = -32; tmp = 1; }
1867 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1868 "Illegal TV x or y offset. Range is from -32 to 32\n");
1869 tmp = 0;
1870 xf86GetOptValInteger(pSiS->Options, OPTION_TVXSCALE,
1871 &pSiS->tvxscale);
1872 xf86GetOptValInteger(pSiS->Options, OPTION_TVYSCALE,
1873 &pSiS->tvyscale);
1874 if(pSiS->tvxscale > 16) { pSiS->tvxscale = 16; tmp = 1; }
1875 if(pSiS->tvxscale < -16) { pSiS->tvxscale = -16; tmp = 1; }
1876 if(pSiS->tvyscale > 3) { pSiS->tvyscale = 3; tmp = 1; }
1877 if(pSiS->tvyscale < -4) { pSiS->tvyscale = -4; tmp = 1; }
1878 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1879 "Illegal TV x or y scaling parameter. Range is from -16 to 16 (X), -4 to 3 (Y)\n");
1882 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
1883 int tmp = 0;
1884 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326FORCETVPPLUG);
1885 if(strptr) {
1886 if(!xf86NameCmp(strptr,"COMPOSITE"))
1887 pSiS->sis6326tvplug = 1;
1888 else if(!xf86NameCmp(strptr,"SVIDEO"))
1889 pSiS->sis6326tvplug = 0;
1890 else {
1891 SiS_PrintBadOpt(pScrn, strptr, OPTION_SIS6326FORCETVPPLUG);
1892 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1893 "%s \"COMPOSITE\" or \"SVIDEO\"\n", validparm);
1896 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326ENABLEYFILTER,
1897 &pSiS->sis6326enableyfilter);
1898 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326YFILTERSTRONG,
1899 &pSiS->sis6326yfilterstrong);
1900 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1901 &pSiS->tvxpos);
1902 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1903 &pSiS->tvypos);
1904 if(pSiS->tvxpos > 16) { pSiS->tvxpos = 16; tmp = 1; }
1905 if(pSiS->tvxpos < -16) { pSiS->tvxpos = -16; tmp = 1; }
1906 if(pSiS->tvypos > 16) { pSiS->tvypos = 16; tmp = 1; }
1907 if(pSiS->tvypos < -16) { pSiS->tvypos = -16; tmp = 1; }
1908 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1909 "Illegal TV x or y offset. Range is from -16 to 16\n");
1910 xf86GetOptValInteger(pSiS->Options, OPTION_SIS6326FSCADJUST,
1911 &pSiS->sis6326fscadjust);
1912 if(pSiS->sis6326fscadjust) {
1913 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1914 "Adjusting the default FSC by %d\n",
1915 pSiS->sis6326fscadjust);
1919 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA) ||
1920 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1921 Bool Is6326 = FALSE;
1922 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER);
1923 if(!strptr) {
1924 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER);
1925 Is6326 = TRUE;
1927 if(strptr) {
1928 if(!xf86NameCmp(strptr,"OFF"))
1929 pSiS->sistvantiflicker = 0;
1930 else if(!xf86NameCmp(strptr,"LOW"))
1931 pSiS->sistvantiflicker = 1;
1932 else if(!xf86NameCmp(strptr,"MED"))
1933 pSiS->sistvantiflicker = 2;
1934 else if(!xf86NameCmp(strptr,"HIGH"))
1935 pSiS->sistvantiflicker = 3;
1936 else if(!xf86NameCmp(strptr,"ADAPTIVE"))
1937 pSiS->sistvantiflicker = 4;
1938 else {
1939 pSiS->sistvantiflicker = -1;
1940 SiS_PrintBadOpt(pScrn, strptr, Is6326 ? OPTION_SIS6326FORCETVPPLUG : OPTION_SISTVANTIFLICKER);
1941 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1942 "%s \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n", validparm);
1947 /* CRT2Gamma - enable/disable/set gamma correction for CRT2
1948 * Since 2004/11/26, this option is a boolean and string option
1949 * simulaniously. "TRUE" (or other valid bool values) have the
1950 * same effect as before: The driver uses the (global) Gamma
1951 * for both CRT1 and CRT2. Otherwise, this option takes one or
1952 * three floats between 0.1 and 10.0 which define a separate
1953 * gamma correction for CRT2. (SiS video bridges only.)
1955 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1956 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2GAMMA))) {
1957 if(SiS_StrIsBoolOn(strptr)) {
1958 pSiS->CRT2gamma = TRUE;
1959 pSiS->CRT2SepGamma = FALSE;
1960 } else if(SiS_StrIsBoolOff(strptr)) {
1961 pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
1962 } else {
1963 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_CRT2GAMMA, gammaopt, strptr,
1964 &pSiS->GammaR2i, &pSiS->GammaG2i, &pSiS->GammaB2i)) {
1965 pSiS->GammaR2 = (float)pSiS->GammaR2i / 1000.0;
1966 pSiS->GammaG2 = (float)pSiS->GammaG2i / 1000.0;
1967 pSiS->GammaB2 = (float)pSiS->GammaB2i / 1000.0;
1968 pSiS->CRT2gamma = TRUE;
1969 if(!IsDHM) pSiS->CRT2SepGamma = TRUE;
1970 else {
1971 #ifdef SISDUALHEAD
1972 pSiS->CRT2SepGamma = FALSE;
1973 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1974 "CRT2Gamma values overrule default and Monitor Gamma\n");
1975 if(pScrn->monitor) {
1976 pScrn->monitor->gamma.red = pSiS->GammaR2;
1977 pScrn->monitor->gamma.green = pSiS->GammaG2;
1978 pScrn->monitor->gamma.blue = pSiS->GammaB2;
1980 #endif
1987 /* Default adaptor: Overlay (default) or blitter */
1988 if(pSiS->VGAEngine == SIS_315_VGA) {
1989 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVDEFAULTADAPTOR))) {
1990 if(!xf86NameCmp(strptr, "OVERLAY")) {
1991 pSiS->XvDefAdaptorBlit = FALSE;
1992 } else if(!xf86NameCmp(strptr, "BLITTER")) {
1993 pSiS->XvDefAdaptorBlit = TRUE;
1994 } else {
1995 SiS_PrintBadOpt(pScrn, strptr, OPTION_XVDEFAULTADAPTOR);
1996 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1997 "%s \"OVERLAY\" or \"BLITTER\"\n", validparm);
2002 #if defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__)
2003 if(xf86GetOptValBool(pSiS->Options, OPTION_XVBENCHCPY, &val)) {
2004 pSiS->BenchMemCpy = val ? TRUE : FALSE;
2005 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2006 "Will %sbenchmark methods for system RAM to video RAM transfers\n",
2007 val ? "" : "not ");
2010 #ifndef SISCHECKOSSSE
2011 if(xf86GetOptValBool(pSiS->Options, OPTION_XVSSECOPY, &val)) {
2012 pSiS->XvSSEMemcpy = val ? TRUE : FALSE;
2013 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2014 "Will %s use SSE CPU instructions\n",
2015 val ? "eventually" : "not");
2017 #endif
2018 #endif /* __i386__ || __AMD64__ || __amd64__ */
2020 #ifdef SIS_CP
2021 SIS_CP_OPT_DOOPT
2022 #endif
2024 } /* DualHead */
2026 /* CRT1Gamma - enable/disable gamma correction for CRT1
2028 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT1GAMMA, &val)) {
2029 pSiS->CRT1gamma = val;
2030 pSiS->CRT1gammaGiven = TRUE;
2033 /* ForceCRT1Aspect, ForceCRT2Aspect */
2034 /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
2035 * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
2036 * output devices, not TV or DVI/LCD.
2038 if(pSiS->VGAEngine == SIS_315_VGA) {
2039 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE1ASPECT);
2040 if(strptr != NULL) {
2041 if(!xf86NameCmp(strptr,"WIDE")) {
2042 pSiS->SiS_Pr->SiS_UseWide = 1;
2043 pSiS->havewide1 = TRUE;
2044 } else if(!xf86NameCmp(strptr,"NORMAL")) {
2045 pSiS->SiS_Pr->SiS_UseWide = 0;
2046 pSiS->havewide1 = TRUE;
2047 } else {
2048 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE1ASPECT);
2049 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
2050 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
2052 if(pSiS->havewide1) {
2053 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2054 "CRT1 (VGA) aspect ratio will be assumed %s\n",
2055 pSiS->SiS_Pr->SiS_UseWide ? "wide" : "normal");
2058 if(pSiS->havewide2) {
2059 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2060 "CRT2 (VGA) aspect ratio will be assumed %s\n",
2061 pSiS->SiS_Pr->SiS_UseWideCRT2 ? "wide" : "normal");
2065 /* VESA - DEPRECATED
2066 * This option is for forcing the driver to use
2067 * the VESA BIOS extension for mode switching.
2069 if(xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) {
2070 if(IsDHM) {
2071 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
2072 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_VESA)].name);
2073 } else {
2074 pSiS->VESA = val ? 1 : 0;
2075 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2076 "VESA: VESA usage shall be %s\n",
2077 val ? enabledstr : disabledstr);
2078 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
2079 "*** Option \"VESA\" is deprecated. *** \n");
2080 if(pSiS->VESA) pSiS->ForceCRT1Type = CRT1_VGA;
2084 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
2085 /* InternalModes (300/315/330 series and later only)
2086 * The default behavior is to replace X's default modes with
2087 * a mode list generated out of the known and supported modes. Use
2088 * this option to disable this. NOT RECOMMENDED.
2090 if(xf86GetOptValBool(pSiS->Options, OPTION_INTERNALMODES, &val)) {
2091 pSiS->noInternalModes = val ? FALSE : TRUE;
2092 if(pSiS->noInternalModes) {
2093 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2094 "Usage of built-in modes is %s\n", disabledstr);
2098 #ifdef SIS_INCL_DYNMODELIST
2099 /* DynamicModelist (300/315/330 series and later only)
2100 * If enabled (which is the default for 6.9+), the driver will
2101 * rebuild its modelist upon every output device switch. This
2102 * might lead to problems with (badly written) applications which
2103 * only query the VidModExtension and the RandR extension once
2104 * and assume the data to be static.
2106 #ifdef SIS_INCL_RRROT
2107 /* This is needed for RandR rotation support because changing
2108 * the rotation also leads to a mode switch, which fails in case
2109 * the current display size is not at the same time supported
2110 * as a display mode.
2111 * X.org prior to 6.9 has a serious bug in RRSetMode which leads
2112 * to a server crash if the mode switch fails.
2113 * Also, X.org prior to 6.9 does not allow reinitializing DGA's
2114 * modes. So for versions of X.org < 6.9, it's either RandR
2115 * rotation support (with a dynamic modelist) - or DGA. But not
2116 * both.
2118 #endif
2119 /* For pre-6.9, to preserve compatibility, dynamic modelist is
2120 * off (due to DGA not being usable). For later versions, the
2121 * default is on.
2123 from = X_DEFAULT;
2124 if(xf86GetOptValBool(pSiS->Options, OPTION_DYNMODES, &val)) {
2125 pSiS->UseDynamicModelists = val ? TRUE : FALSE;
2126 from = X_CONFIG;
2128 xf86DrvMsg(pScrn->scrnIndex, from,
2129 "Dynamic mode list support is %s\n",
2130 pSiS->UseDynamicModelists ? enabledstr : disabledstr);
2131 #ifdef SIS_INCL_RRROT
2132 #ifndef SISISXORG6899900
2133 if(!pSiS->UseDynamicModelists) {
2134 if(pSiS->SupportRRRotation) {
2135 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2136 "\tThis version of " SISMYSERVERNAME " does not support RandR\n");
2137 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2138 "\trotation without a dynamic modelist.\n");
2139 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2140 "\tRandR rotation support disabled.\n");
2141 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2142 "\t(Use Option \"DynamicModelist\" \"on\" to enable.)\n");
2143 pSiS->SupportRRRotation = FALSE;
2144 pSiS->SupportRRRotation90270 = FALSE;
2147 #endif
2148 #endif
2149 #endif
2151 #ifdef SIS_INCL_DYNMODELIST
2152 #ifdef SIS_INCL_RANDR_RESIZE
2153 /* ReserveLargeVirtual (300/315/330 series and later only)
2154 * If enabled, the driver will scan through the user specified Modes
2155 * in the Display section and take the largest as the user-desired
2156 * maximum virtual screen. It will reserve enough video memory for
2157 * this screen size. However, the driver will start as usual, ie
2158 * with the screen size resulting from the validated modes (unless
2159 * the user specified a specific Virtual size in the Display section).
2160 * This allows to "grow" the screen upon a later change of output
2161 * devices with different capabilities. Hence, it is only useful if
2162 * dynamic modelists are enabled.
2163 * This is not supported in dual head mode (as device changing isn't
2164 * supported).
2166 if(pSiS->UseDynamicModelists && !IsDHM) {
2167 if(xf86GetOptValBool(pSiS->Options, OPTION_RESERVEVIRTUAL, &val)) {
2168 pSiS->ReserveLargerVirtual = val ? TRUE : FALSE;
2170 } else {
2171 pSiS->ReserveLargerVirtual = FALSE;
2173 #endif
2174 #endif
2177 #ifdef RANDR
2178 /* Constant DPI (all chipsets) */
2179 /* RandR causes a change of the screen's DPI on size changes
2180 * by supplying constant mmWidth/mmHeight dimensions to
2181 * the root window. Clients calculate the DPI of the
2182 * screen by using mmWidth/mmHeight and projecting these
2183 * on the current virtual screen size.
2184 * I, for one, hate fonts being resized upon screen size
2185 * changes (especially in windows which are already open
2186 * when the size change takes place; leads to a nice font
2187 * size mixture). If you share this feeling, enable this
2188 * option and you will be presented with constant DPI values
2189 * even upon size changes.
2190 * If RR_GET_MODE_MM is not available, this done more or
2191 * less automatically in MergedFB mode. We recalc the DPI
2192 * often in order to keep them sane if the user switched
2193 * from a normal (side by side) mode to a clone mode/screen
2194 * size.
2195 * The -dpi command line switch has a special meaning here.
2196 * I herewith overrule the idea that -dpi means "use this
2197 * dpi only for the default screen size". If you want that,
2198 * please give a DisplaySize in your config file. -dpi is now
2199 * stronger as it automatically enables constant DPI (unless
2200 * the user disables it).
2202 from = X_DEFAULT;
2203 if(xf86GetOptValBool(pSiS->Options, OPTION_CONSTANTDPI, &pSiS->constantDPI)) {
2204 from = X_CONFIG;
2205 } else {
2206 if(monitorResolution > 0) {
2207 pSiS->constantDPI = TRUE;
2208 from = X_CMDLINE;
2209 xf86DrvMsg(pScrn->scrnIndex, from,
2210 "\"-dpi %d\" given in command line, assuming \"ConstantDPI\" set\n",
2211 monitorResolution);
2212 } else {
2213 pSiS->constantDPI = FALSE;
2216 xf86DrvMsg(pScrn->scrnIndex, from,
2217 "X server will %skeep DPI constant for all screen sizes\n",
2218 pSiS->constantDPI ? "" : "not ");
2219 #endif
2221 /* ShadowFB */
2222 from = X_DEFAULT;
2223 if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) {
2224 from = X_CONFIG;
2225 #ifdef SISMERGED
2226 if(pSiS->MergedFB) {
2227 pSiS->ShadowFB = FALSE;
2228 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
2229 "Shadow Framebuffer not supported in MergedFB mode\n");
2231 #endif
2233 if(pSiS->ShadowFB) {
2234 pSiS->NoAccel = TRUE;
2235 #ifdef SIS_INCL_RRROT
2236 pSiS->SupportRRRotation = FALSE;
2237 #endif
2238 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
2239 pSiS->NoXvideo = TRUE;
2240 xf86DrvMsg(pScrn->scrnIndex, from,
2241 "Using \"Shadow Framebuffer\" - 2D acceleration and Xv disabled\n");
2242 #else
2243 xf86DrvMsg(pScrn->scrnIndex, from,
2244 "Using \"Shadow Framebuffer\" - 2D acceleration disabled\n");
2245 #endif
2248 /* Rotate */
2249 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) {
2250 #ifdef SISMERGED
2251 if(pSiS->MergedFB) {
2252 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
2253 "Screen rotation not supported in MergedFB mode\n");
2254 } else
2255 #endif
2256 if(IsDHM) {
2257 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
2258 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_ROTATE)].name);
2259 } else if(!xf86NameCmp(strptr, "CW")) {
2260 pSiS->Rotate = 1;
2261 } else if(!xf86NameCmp(strptr, "CCW")) {
2262 pSiS->Rotate = -1;
2263 } else {
2264 SiS_PrintBadOpt(pScrn, strptr, OPTION_ROTATE);
2265 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2266 "%s \"CW\" (clock-wise) or \"CCW\" (counter clock-wise)\n", validparm);
2269 if(pSiS->Rotate) {
2270 pSiS->ShadowFB = TRUE;
2271 pSiS->NoAccel = TRUE;
2272 pSiS->NoXvideo = TRUE;
2273 #ifdef SIS_INCL_RRROT
2274 pSiS->SupportRRRotation = FALSE;
2275 #else
2276 pSiS->HWCursor = FALSE;
2277 #endif
2278 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2279 "Rotating screen %sclockwise (2D acceleration and Xv disabled)\n",
2280 (pSiS->Rotate == -1) ? "counter " : "");
2284 /* Reflect */
2285 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_REFLECT))) {
2286 #ifdef SISMERGED
2287 if(pSiS->MergedFB) {
2288 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
2289 "Screen reflection not supported in MergedFB mode\n");
2290 } else
2291 #endif
2292 if(IsDHM) {
2293 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
2294 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_REFLECT)].name);
2295 } else if(pSiS->Rotate) {
2296 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
2297 "Screen rotation and reflection are mutually exclusive\n");
2298 } else if(!xf86NameCmp(strptr, "X")) {
2299 pSiS->Reflect = 1;
2300 } else if(!xf86NameCmp(strptr, "Y")) {
2301 pSiS->Reflect = 2;
2302 } else if((!xf86NameCmp(strptr, "XY")) ||
2303 (!xf86NameCmp(strptr, "YX"))) {
2304 pSiS->Reflect = 3;
2305 } else {
2306 SiS_PrintBadOpt(pScrn, strptr, OPTION_REFLECT);
2307 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
2308 "%s \"X\", \"Y\" or \"XY\"\n", validparm);
2311 if(pSiS->Reflect) {
2312 pSiS->ShadowFB = TRUE;
2313 pSiS->NoAccel = TRUE;
2314 pSiS->NoXvideo = TRUE;
2315 #ifdef SIS_INCL_RRROT
2316 pSiS->SupportRRRotation = FALSE;
2317 #else
2318 pSiS->HWCursor = FALSE;
2319 #endif
2320 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2321 "Reflecting screen (2D acceleration and Xv disabled)\n");
2325 #ifdef SIS_INCL_RRROT
2326 if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) {
2327 if(pSiS->Rotate || (pSiS->Reflect && pSiS->Reflect != 2)) {
2328 pSiS->HWCursor = FALSE;
2331 #endif
2333 #ifdef XF86DRI
2334 /* DRI */
2335 from = X_DEFAULT;
2336 if(xf86GetOptValBool(pSiS->Options, OPTION_DRI, &pSiS->loadDRI)) {
2337 from = X_CONFIG;
2339 xf86DrvMsg(pScrn->scrnIndex, from, "DRI %s\n",
2340 pSiS->loadDRI ? enabledstr : disabledstr);
2342 /* AGPSize = GARTSize */
2343 if(xf86GetOptValInteger(pSiS->Options, OPTION_AGP_SIZE, &ival)) {
2344 if((ival >= 8) && (ival <= 512)) {
2345 pSiS->agpWantedPages = (ival * 1024 * 1024) / AGP_PAGE_SIZE;
2346 } else {
2347 SiS_PrintIlRange(pScrn, OPTION_AGP_SIZE, 8, 512, 0);
2350 #endif
2352 /* XVideo
2353 * Set enables/disables Xv hardware video acceleration
2355 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
2356 if((!pSiS->NoAccel) && (!pSiS->NoXvideo)) {
2357 #else
2358 if(!pSiS->NoXvideo) {
2359 #endif
2360 if(!xf86ReturnOptValBool(pSiS->Options, OPTION_XVIDEO, TRUE)) {
2361 pSiS->NoXvideo = TRUE;
2362 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension (Xv) disabled\n");
2365 if(!pSiS->NoXvideo) {
2367 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
2368 /* XvOnCRT2
2369 * On chipsets with only one overlay (315, 650, 740, 330), the user can
2370 * choose to display the overlay on CRT1 or CRT2. By setting this
2371 * option to TRUE, the overlay will be displayed on CRT2. The
2372 * default is: CRT1 if only CRT1 available, CRT2 if only CRT2
2373 * available, and CRT1 if both is available and detected.
2374 * Since implementation of the XV_SWITCHCRT Xv property this only
2375 * selects the default CRT.
2377 if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
2378 pSiS->XvOnCRT2 = val ? TRUE : FALSE;
2382 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
2383 /* NoYV12 (for 5597/5598, 6326 and 530/620 only)
2384 * YV12 has problems with videos larger than 384x288. So
2385 * allow the user to disable YV12 support to force the
2386 * application to use YUV2 instead.
2388 if(xf86GetOptValBool(pSiS->Options, OPTION_YV12, &val)) {
2389 pSiS->NoYV12 = val ? 0 : 1;
2390 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2391 "Xv YV12/I420 support is %s\n",
2392 pSiS->NoYV12 ? disabledstr : enabledstr);
2396 /* Some Xv properties' defaults can be set by options */
2397 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFCONTRAST, &ival)) {
2398 if((ival >= 0) && (ival <= 7)) pSiS->XvDefCon = ival;
2399 else SiS_PrintIlRange(pScrn, OPTION_XVDEFCONTRAST, 0, 7, 0);
2401 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFBRIGHTNESS, &ival)) {
2402 if((ival >= -128) && (ival <= 127)) pSiS->XvDefBri = ival;
2403 else SiS_PrintIlRange(pScrn, OPTION_XVDEFBRIGHTNESS, -128, 127, 0);
2405 if(pSiS->VGAEngine == SIS_315_VGA) {
2406 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFHUE, &ival)) {
2407 if((ival >= -8) && (ival <= 7)) pSiS->XvDefHue = ival;
2408 else SiS_PrintIlRange(pScrn, OPTION_XVDEFHUE, -8, 7, 0);
2410 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFSATURATION, &ival)) {
2411 if((ival >= -7) && (ival <= 7)) pSiS->XvDefSat = ival;
2412 else SiS_PrintIlRange(pScrn, OPTION_XVDEFSATURATION, -7, 7, 0);
2415 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFX, &val)) {
2416 if(val) pSiS->XvDefDisableGfx = TRUE;
2417 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2418 "Graphics display will be %s during Xv usage\n",
2419 val ? disabledstr : enabledstr);
2421 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
2422 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFXLR, &val)) {
2423 if(val) pSiS->XvDefDisableGfxLR = TRUE;
2424 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2425 "Graphics display left/right of overlay will be %s during Xv usage\n",
2426 val ? disabledstr : enabledstr);
2428 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDISABLECOLORKEY, &val)) {
2429 if(val) pSiS->XvDisableColorKey = TRUE;
2430 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2431 "Xv Color key is %s\n",
2432 val ? disabledstr : enabledstr);
2434 if(xf86GetOptValBool(pSiS->Options, OPTION_XVUSECHROMAKEY, &val)) {
2435 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2436 "Xv Chroma-keying is %s\n",
2437 val ? enabledstr : disabledstr);
2438 if(val) pSiS->XvUseChromaKey = TRUE;
2440 if(xf86GetOptValBool(pSiS->Options, OPTION_XVINSIDECHROMAKEY, &val)) {
2441 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2442 "Xv: Video is transparent if %s chroma key range\n",
2443 val ? "inside" : "outside");
2444 if(val) pSiS->XvInsideChromaKey = TRUE;
2446 if(pSiS->VGAEngine == SIS_300_VGA) {
2447 if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
2448 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2449 "Xv: Chroma key is in %s format\n",
2450 val ? "YUV" : "RGB");
2451 if(val) pSiS->XvYUVChromaKey = TRUE;
2453 } else {
2454 if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
2455 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
2456 "Xv: Chroma key is of same format as video source\n");
2459 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMIN, &ival)) {
2460 if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMin = ival;
2461 else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMIN, 0, 0xffffff, 1);
2463 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMAX, &ival)) {
2464 if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMax = ival;
2465 else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMAX, 0, 0xffffff, 1);
2469 if(pSiS->VGAEngine == SIS_315_VGA) {
2470 /* XvGamma - enable/disable gamma correction for Xv
2471 * Supported for CRT1 only
2473 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVGAMMA))) {
2474 if(SiS_StrIsBoolOn(strptr)) {
2475 pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
2476 } else if(SiS_StrIsBoolOff(strptr)) {
2477 pSiS->XvGamma = FALSE;
2478 pSiS->XvGammaGiven = TRUE;
2479 } else {
2480 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_XVGAMMA, gammaopt, strptr,
2481 &pSiS->XvGammaRed, &pSiS->XvGammaGreen, &pSiS->XvGammaBlue)) {
2482 pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
2483 pSiS->XvGammaRedDef = pSiS->XvGammaRed;
2484 pSiS->XvGammaGreenDef = pSiS->XvGammaGreen;
2485 pSiS->XvGammaBlue = pSiS->XvGammaBlue;
2493 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
2494 Bool GotNewBri = FALSE, GotOldBri = FALSE, GotCon = FALSE;
2495 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_NEWSTOREDCON))) {
2496 SiS_EvalOneOrThreeFloats2(pScrn, OPTION_NEWSTOREDCON, newbriopt, strptr,
2497 &pSiS->NewGammaConR, &pSiS->NewGammaConG, &pSiS->NewGammaConB);
2498 GotCon = TRUE;
2500 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_NEWSTOREDBRI))) {
2501 SiS_EvalOneOrThreeFloats2(pScrn, OPTION_NEWSTOREDBRI, newbriopt, strptr,
2502 &pSiS->NewGammaBriR, &pSiS->NewGammaBriG, &pSiS->NewGammaBriB);
2503 GotNewBri = TRUE;
2505 if(!GotCon && !GotNewBri) {
2506 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI))) {
2507 SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI, briopt, strptr,
2508 &pSiS->GammaBriR, &pSiS->GammaBriG, &pSiS->GammaBriB);
2509 GotOldBri = TRUE;
2510 pSiS->SiS_SD3_Flags |= SiS_SD3_OLDGAMMAINUSE;
2514 if((!IsDHM) || (IsDHM && !IsSecondHead)) {
2515 Bool GotCon2 = FALSE, GotNewBri2 = FALSE;
2516 if(!GotOldBri) {
2517 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_NEWSTOREDCON2))) {
2518 SiS_EvalOneOrThreeFloats2(pScrn, OPTION_NEWSTOREDCON2, newbriopt, strptr,
2519 &pSiS->NewGammaConR2, &pSiS->NewGammaConG2, &pSiS->NewGammaConB2);
2520 GotCon2 = TRUE;
2522 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_NEWSTOREDBRI2))) {
2523 if(SiS_EvalOneOrThreeFloats2(pScrn, OPTION_NEWSTOREDBRI2, newbriopt, strptr,
2524 &pSiS->NewGammaBriR2, &pSiS->NewGammaBriG2, &pSiS->NewGammaBriB2)) {
2525 if(IsDHM) {
2526 #ifdef SISDUALHEAD
2527 if(GotNewBri) SiS_PrintOverruleDHM(pScrn, OPTION_NEWSTOREDBRI2, OPTION_NEWSTOREDBRI);
2528 pSiS->NewGammaBriR = pSiS->NewGammaBriR2;
2529 pSiS->NewGammaBriG = pSiS->NewGammaBriG2;
2530 pSiS->NewGammaBriB = pSiS->NewGammaBriB2;
2531 #endif
2532 } else pSiS->CRT2SepGamma = TRUE;
2534 GotNewBri2 = TRUE;
2537 if(!GotCon2 && !GotNewBri2 && !GotNewBri && !GotCon) {
2538 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI2))) {
2539 pSiS->SiS_SD3_Flags |= SiS_SD3_OLDGAMMAINUSE;
2540 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI2, briopt, strptr,
2541 &pSiS->GammaBriR2, &pSiS->GammaBriG2, &pSiS->GammaBriB2)) {
2542 if(IsDHM) {
2543 #ifdef SISDUALHEAD
2544 if(GotOldBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDBRI2, OPTION_STOREDBRI);
2545 pSiS->GammaBriR = pSiS->GammaBriR2;
2546 pSiS->GammaBriG = pSiS->GammaBriG2;
2547 pSiS->GammaBriB = pSiS->GammaBriB2;
2548 #endif
2549 } else pSiS->CRT2SepGamma = TRUE;
2556 if(pSiS->SiS_SD3_Flags & SiS_SD3_CRT1SATGAIN) {
2557 if(xf86GetOptValInteger(pSiS->Options, OPTION_CRT1SATGAIN, &ival)) {
2558 if((ival >= 0) && (ival <= 7)) {
2559 pSiS->siscrt1satgain = ival;
2560 pSiS->crt1satgaingiven = TRUE;
2561 } else SiS_PrintIlRange(pScrn, OPTION_CRT1SATGAIN, 0, 7, 0);
2567 const OptionInfoRec *
2568 SISAvailableOptions(int chipid, int busid)
2570 return SISOptions;