SiS driver:
[xf86-video-sis/mirage.git] / src / sis_opt.c
blobce6b975874c2a43e0b65bb310bfa19d0033981cb
1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4 * SiS driver option evaluation
6 * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1) Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2) Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3) The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Authors: Thomas Winischhofer <thomas@winischhofer.net>
31 * ?
34 #include "sis.h"
36 #include "xf86str.h"
37 #include "xf86Cursor.h"
39 extern const customttable mycustomttable[];
41 typedef enum {
42 OPTION_SW_CURSOR,
43 OPTION_HW_CURSOR,
44 OPTION_ACCEL,
45 OPTION_TURBOQUEUE,
46 OPTION_FAST_VRAM,
47 OPTION_HOSTBUS,
48 OPTION_RENDER,
49 OPTION_FORCE_CRT1TYPE,
50 OPTION_FORCE_CRT2TYPE,
51 OPTION_YPBPRAR,
52 OPTION_SHADOW_FB,
53 OPTION_DRI,
54 OPTION_AGP_SIZE,
55 OPTION_ROTATE,
56 OPTION_REFLECT,
57 OPTION_XVIDEO,
58 OPTION_VESA,
59 OPTION_MAXXFBMEM,
60 OPTION_FORCECRT1,
61 OPTION_XVONCRT2,
62 OPTION_PDC,
63 OPTION_PDCA,
64 OPTION_EMI,
65 OPTION_TVSTANDARD,
66 OPTION_USEROMDATA,
67 OPTION_INTERNALMODES,
68 OPTION_USEOEM,
69 OPTION_YV12,
70 OPTION_CHTVOVERSCAN,
71 OPTION_CHTVSOVERSCAN,
72 OPTION_CHTVLUMABANDWIDTHCVBS,
73 OPTION_CHTVLUMABANDWIDTHSVIDEO,
74 OPTION_CHTVLUMAFLICKERFILTER,
75 OPTION_CHTVCHROMABANDWIDTH,
76 OPTION_CHTVCHROMAFLICKERFILTER,
77 OPTION_CHTVCVBSCOLOR,
78 OPTION_CHTVTEXTENHANCE,
79 OPTION_CHTVCONTRAST,
80 OPTION_SISTVEDGEENHANCE,
81 OPTION_SISTVANTIFLICKER,
82 OPTION_SISTVSATURATION,
83 OPTION_SISTVCHROMAFILTER,
84 OPTION_SISTVLUMAFILTER,
85 OPTION_SISTVCOLCALIBFINE,
86 OPTION_SISTVCOLCALIBCOARSE,
87 OPTION_TVXPOSOFFSET,
88 OPTION_TVYPOSOFFSET,
89 OPTION_TVXSCALE,
90 OPTION_TVYSCALE,
91 OPTION_SIS6326ANTIFLICKER,
92 OPTION_SIS6326ENABLEYFILTER,
93 OPTION_SIS6326YFILTERSTRONG,
94 OPTION_SIS6326FORCETVPPLUG,
95 OPTION_SIS6326FSCADJUST,
96 OPTION_CHTVTYPE,
97 OPTION_USERGBCURSOR,
98 OPTION_USERGBCURSORBLEND,
99 OPTION_USERGBCURSORBLENDTH,
100 OPTION_RESTOREBYSET,
101 OPTION_DDCFORCRT2,
102 OPTION_FORCECRT2REDETECTION,
103 OPTION_SENSEYPBPR,
104 OPTION_CRT1GAMMA,
105 OPTION_CRT2GAMMA,
106 OPTION_XVGAMMA,
107 OPTION_XVDEFCONTRAST,
108 OPTION_XVDEFBRIGHTNESS,
109 OPTION_XVDEFHUE,
110 OPTION_XVDEFSATURATION,
111 OPTION_XVDEFDISABLEGFX,
112 OPTION_XVDEFDISABLEGFXLR,
113 OPTION_XVMEMCPY,
114 OPTION_XVBENCHCPY,
115 #ifndef SISCHECKOSSSE
116 OPTION_XVSSECOPY,
117 #endif
118 OPTION_XVUSECHROMAKEY,
119 OPTION_XVCHROMAMIN,
120 OPTION_XVCHROMAMAX,
121 OPTION_XVDISABLECOLORKEY,
122 OPTION_XVINSIDECHROMAKEY,
123 OPTION_XVYUVCHROMAKEY,
124 OPTION_XVDEFAULTADAPTOR,
125 OPTION_SCALELCD,
126 OPTION_CENTERLCD,
127 OPTION_SPECIALTIMING,
128 OPTION_LVDSHL,
129 OPTION_PRGB,
130 OPTION_ENABLEHOTKEY,
131 OPTION_MERGEDFB,
132 OPTION_MERGEDFBAUTO,
133 OPTION_CRT2HSYNC,
134 OPTION_CRT2VREFRESH,
135 OPTION_CRT2POS,
136 OPTION_METAMODES,
137 OPTION_SISXINERAMA,
138 OPTION_CRT2ISSCRN0,
139 OPTION_MERGEDDPI,
140 OPTION_MERGEDFBNONRECT,
141 OPTION_MERGEDFBMOUSER,
142 OPTION_ENABLESISCTRL,
143 OPTION_STOREDBRI,
144 OPTION_STOREDPBRI,
145 OPTION_STOREDBRI2,
146 OPTION_STOREDPBRI2,
147 OPTION_OVERRULERANGES,
148 OPTION_FORCE1ASPECT,
149 OPTION_FORCE2ASPECT,
150 #ifdef SIS_CP
151 SIS_CP_OPT_OPTIONS
152 #endif
153 OPTION_PSEUDO
154 } SISOpts;
156 static const OptionInfoRec SISOptions[] = {
157 { OPTION_ACCEL, "Accel", OPTV_BOOLEAN, {0}, FALSE },
158 { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE },
159 { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
160 { OPTION_HOSTBUS, "HostBus", OPTV_BOOLEAN, {0}, FALSE },
161 { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
162 { OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE },
163 { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE },
164 { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
165 { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE },
166 { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
167 { OPTION_AGP_SIZE, "GARTSize", OPTV_INTEGER, {0}, FALSE },
168 { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE },
169 { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, FALSE },
170 { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, FALSE },
171 { OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
172 { OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
173 { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, FALSE },
174 { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
175 { OPTION_REFLECT, "Reflect", OPTV_STRING, {0}, FALSE },
176 { OPTION_XVIDEO, "Xvideo", OPTV_BOOLEAN, {0}, FALSE },
177 { OPTION_INTERNALMODES, "InternalModes", OPTV_BOOLEAN, {0}, FALSE },
178 { OPTION_OVERRULERANGES, "OverruleFrequencyRanges", OPTV_BOOLEAN, {0}, FALSE },
179 { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, FALSE },
180 { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE },
181 { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE },
182 { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, FALSE },
183 { OPTION_PDC, "PDC", OPTV_INTEGER, {0}, FALSE },
184 { OPTION_PDC, "PanelDelayCompensation2", OPTV_INTEGER, {0}, FALSE },
185 { OPTION_PDC, "PDC2", OPTV_INTEGER, {0}, FALSE },
186 { OPTION_PDCA, "PanelDelayCompensation1", OPTV_INTEGER, {0}, FALSE },
187 { OPTION_PDCA, "PDC1", OPTV_INTEGER, {0}, FALSE },
188 { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, FALSE },
189 { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, FALSE },
190 { OPTION_PRGB, "ForcePanelRGB", OPTV_INTEGER, {0}, FALSE },
191 { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, FALSE },
192 { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, FALSE },
193 { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, FALSE },
194 { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, FALSE },
195 { OPTION_YV12, "YV12", OPTV_BOOLEAN, {0}, FALSE },
196 { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, FALSE },
197 { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, FALSE },
198 { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, FALSE },
199 { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, FALSE },
200 { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO", OPTV_INTEGER, {0}, FALSE },
201 { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
202 { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, FALSE },
203 { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
204 { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, FALSE },
205 { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, FALSE },
206 { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, FALSE },
207 { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, FALSE },
208 { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_STRING, {0}, FALSE },
209 { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, FALSE },
210 { OPTION_SISTVCHROMAFILTER, "SISTVCFilter", OPTV_BOOLEAN, {0}, FALSE },
211 { OPTION_SISTVLUMAFILTER, "SISTVYFilter", OPTV_INTEGER, {0}, FALSE },
212 { OPTION_SISTVCOLCALIBFINE, "SISTVColorCalibFine", OPTV_INTEGER, {0}, FALSE },
213 { OPTION_SISTVCOLCALIBCOARSE, "SISTVColorCalibCoarse", OPTV_INTEGER, {0}, FALSE },
214 { OPTION_TVXSCALE, "SISTVXScale", OPTV_INTEGER, {0}, FALSE },
215 { OPTION_TVYSCALE, "SISTVYScale", OPTV_INTEGER, {0}, FALSE },
216 { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, FALSE },
217 { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, FALSE },
218 { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE },
219 { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, FALSE },
220 { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, FALSE },
221 { OPTION_SIS6326FORCETVPPLUG, "SIS6326TVForcePlug", OPTV_STRING, {0}, FALSE },
222 { OPTION_SIS6326FSCADJUST, "SIS6326FSCAdjust", OPTV_INTEGER, {0}, FALSE },
223 { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE },
224 { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, FALSE },
225 { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER, {0},FALSE},
226 { OPTION_DDCFORCRT2, "CRT2Detection", OPTV_BOOLEAN, {0}, FALSE },
227 { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, FALSE },
228 { OPTION_SENSEYPBPR, "SenseYPbPr", OPTV_BOOLEAN, {0}, FALSE },
229 { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, FALSE },
230 { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_ANYSTR, {0}, FALSE },
231 { OPTION_STOREDBRI, "GammaBrightness", OPTV_STRING, {0}, FALSE },
232 { OPTION_STOREDPBRI, "GammaPreBrightness", OPTV_STRING, {0}, FALSE },
233 { OPTION_STOREDBRI, "StoredGammaBrightness", OPTV_STRING, {0}, FALSE },
234 { OPTION_STOREDPBRI, "StoredGammaPreBrightness", OPTV_STRING, {0}, FALSE },
235 { OPTION_STOREDBRI2, "GammaBrightnessCRT2", OPTV_STRING, {0}, FALSE },
236 { OPTION_STOREDPBRI2, "GammaPreBrightnessCRT2", OPTV_STRING, {0}, FALSE },
237 { OPTION_XVGAMMA, "XvGamma", OPTV_ANYSTR, {0}, FALSE },
238 { OPTION_XVDEFCONTRAST, "XvDefaultContrast", OPTV_INTEGER, {0}, FALSE },
239 { OPTION_XVDEFBRIGHTNESS, "XvDefaultBrightness", OPTV_INTEGER, {0}, FALSE },
240 { OPTION_XVDEFHUE, "XvDefaultHue", OPTV_INTEGER, {0}, FALSE },
241 { OPTION_XVDEFSATURATION, "XvDefaultSaturation", OPTV_INTEGER, {0}, FALSE },
242 { OPTION_XVDEFDISABLEGFX, "XvDefaultDisableGfx", OPTV_BOOLEAN, {0}, FALSE },
243 { OPTION_XVDEFDISABLEGFXLR, "XvDefaultDisableGfxLR", OPTV_BOOLEAN, {0}, FALSE },
244 { OPTION_XVCHROMAMIN, "XvChromaMin", OPTV_INTEGER, {0}, FALSE },
245 { OPTION_XVCHROMAMAX, "XvChromaMax", OPTV_INTEGER, {0}, FALSE },
246 { OPTION_XVUSECHROMAKEY, "XvUseChromaKey", OPTV_BOOLEAN, {0}, FALSE },
247 { OPTION_XVINSIDECHROMAKEY, "XvInsideChromaKey", OPTV_BOOLEAN, {0}, FALSE },
248 { OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, FALSE },
249 { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, FALSE },
250 { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, FALSE },
251 { OPTION_XVBENCHCPY, "BenchmarkMemcpy", OPTV_BOOLEAN, {0}, FALSE },
252 #ifndef SISCHECKOSSSE
253 { OPTION_XVSSECOPY, "UseSSE", OPTV_BOOLEAN, {0}, FALSE },
254 #endif
255 { OPTION_XVDEFAULTADAPTOR, "XvDefaultAdaptor", OPTV_STRING, {0}, FALSE },
256 { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, FALSE },
257 { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, FALSE },
258 { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, FALSE },
259 { OPTION_FORCE1ASPECT, "ForceCRT1VGAAspect", OPTV_STRING, {0}, FALSE },
260 { OPTION_FORCE2ASPECT, "ForceCRT2VGAAspect", OPTV_STRING, {0}, FALSE },
261 #ifdef SISMERGED
262 { OPTION_MERGEDFB, "MergedFB", OPTV_ANYSTR, {0}, FALSE },
263 { OPTION_MERGEDFB, "TwinView", OPTV_ANYSTR, {0}, FALSE }, /* alias */
264 { OPTION_MERGEDFBAUTO, "MergedFBAuto", OPTV_BOOLEAN, {0}, FALSE },
265 { OPTION_CRT2HSYNC, "CRT2HSync", OPTV_STRING, {0}, FALSE },
266 { OPTION_CRT2HSYNC, "SecondMonitorHorizSync", OPTV_STRING, {0}, FALSE }, /* alias */
267 { OPTION_CRT2VREFRESH, "CRT2VRefresh", OPTV_STRING, {0}, FALSE },
268 { OPTION_CRT2VREFRESH, "SecondMonitorVertRefresh", OPTV_STRING, {0}, FALSE }, /* alias */
269 { OPTION_CRT2POS, "CRT2Position", OPTV_STRING, {0}, FALSE },
270 { OPTION_CRT2POS, "TwinViewOrientation", OPTV_STRING, {0}, FALSE }, /* alias */
271 { OPTION_METAMODES, "MetaModes", OPTV_STRING, {0}, FALSE },
272 { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE },
273 #ifdef SISXINERAMA
274 { OPTION_SISXINERAMA, "MergedXinerama", OPTV_BOOLEAN, {0}, FALSE },
275 { OPTION_SISXINERAMA, "TwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
276 { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0", OPTV_BOOLEAN, {0}, FALSE },
277 { OPTION_MERGEDFBNONRECT, "MergedNonRectangular", OPTV_BOOLEAN, {0}, FALSE },
278 { OPTION_MERGEDFBMOUSER, "MergedMouseRestriction", OPTV_BOOLEAN, {0}, FALSE },
279 #endif
280 #endif
281 #ifdef SIS_CP
282 SIS_CP_OPTION_DETAIL
283 #endif
284 { -1, NULL, OPTV_NONE, {0}, FALSE }
287 static int
288 SiS_FIFT(const OptionInfoRec *options, int token)
290 /* Find index from token */
291 int i = 0;
292 while(options[i].token >= 0) {
293 if(options[i].token == token) return i;
294 i++;
296 return 0; /* Should not happen */
299 static void
300 SiS_PrintBadOpt(ScrnInfoPtr pScrn, char *strptr, int token)
302 SISPtr pSiS = SISPTR(pScrn);
304 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
305 "\"%s\" is is not a valid parameter for option \"%s\"\n",
306 strptr, pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
309 static void
310 SiS_PrintIlRange(ScrnInfoPtr pScrn, int token, int min, int max, UChar showhex)
312 SISPtr pSiS = SISPTR(pScrn);
313 static const char *ilparmd = "Invalid parameter for \"%s\". Valid range is %d - %d\n";
314 static const char *ilparmh = "Invalid parameter for \"%s\". Valid range is 0x%x - 0x%x\n";
316 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
317 showhex ? ilparmh : ilparmd,
318 pSiS->Options[SiS_FIFT(pSiS->Options, token)].name, min, max);
321 #ifdef SISDUALHEAD
322 static void
323 SiS_PrintOverruleDHM(ScrnInfoPtr pScrn, int token1, int token2)
325 SISPtr pSiS = SISPTR(pScrn);
327 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
328 "\"%s\" overrules \"%s\" in CRT2 (Master) device section\n",
329 pSiS->Options[SiS_FIFT(pSiS->Options, token1)].name,
330 pSiS->Options[SiS_FIFT(pSiS->Options, token2)].name);
332 #endif
334 static Bool
335 SiS_StrIsBoolOn(char *strptr)
337 if( (*strptr == '\0') ||
338 (!xf86NameCmp(strptr,"on")) ||
339 (!xf86NameCmp(strptr,"true")) ||
340 (!xf86NameCmp(strptr,"yes")) ||
341 (!xf86NameCmp(strptr,"1")) ) return TRUE;
342 return FALSE;
345 static Bool
346 SiS_StrIsBoolOff(char *strptr)
348 if( (!xf86NameCmp(strptr,"off")) ||
349 (!xf86NameCmp(strptr,"false")) ||
350 (!xf86NameCmp(strptr,"no")) ||
351 (!xf86NameCmp(strptr,"0")) ) return TRUE;
352 return FALSE;
355 static Bool
356 SiS_EvalOneOrThreeFloats(ScrnInfoPtr pScrn, int token, const char *myerror,
357 char *strptr, int *v1, int *v2, int *v3)
359 SISPtr pSiS = SISPTR(pScrn);
360 float val1 = 0.0, val2 = 0.0, val3 = 0.0;
361 Bool valid = FALSE;
362 int result = sscanf(strptr, "%f %f %f", &val1, &val2, &val3);
363 if(result == 1) {
364 if((val1 >= 0.1) && (val1 <= 10.0)) {
365 valid = TRUE;
366 *v1 = *v2 = *v3 = (int)(val1 * 1000);
368 } else if(result == 3) {
369 if((val1 >= 0.1) && (val1 <= 10.0) &&
370 (val2 >= 0.1) && (val2 <= 10.0) &&
371 (val3 >= 0.1) && (val3 <= 10.0)) {
372 valid = TRUE;
373 *v1 = (int)(val1 * 1000);
374 *v2 = (int)(val2 * 1000);
375 *v3 = (int)(val3 * 1000);
378 if(!valid) {
379 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, myerror,
380 pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
382 return (valid);
385 void
386 SiSOptions(ScrnInfoPtr pScrn)
388 SISPtr pSiS = SISPTR(pScrn);
389 MessageType from;
390 char *strptr;
391 int ival;
392 static const char *baddhm = "Option \"%s\" ignored in Dual Head mode\n";
393 static const char *validparm = "Valid parameters are";
394 static const char *disabledstr= "disabled";
395 static const char *enabledstr = "enabled";
396 static const char *gammaopt = "%s expects either a boolean, or 1 or 3 real numbers (0.1 - 10.0)\n";
397 static const char *briopt = "%s expects 1 or 3 real numbers (0.1 - 10.0)\n";
398 Bool val, IsDHM = FALSE;
399 Bool IsSecondHead = FALSE;
401 /* Collect all of the relevant option flags (fill in pScrn->options) */
402 xf86CollectOptions(pScrn, NULL);
404 /* Process the options */
405 if(!(pSiS->Options = xalloc(sizeof(SISOptions)))) return;
407 memcpy(pSiS->Options, SISOptions, sizeof(SISOptions));
409 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSiS->Options);
411 /* Set defaults */
413 pSiS->newFastVram = -1;
414 pSiS->HostBus = TRUE;
415 pSiS->TurboQueue = TRUE;
416 #ifdef SISVRAMQ
417 /* TODO: Option (315 series VRAM command queue) */
418 /* But beware: sisfb does not know about this!!! */
419 pSiS->cmdQueueSize = 512*1024;
420 #endif
421 pSiS->doRender = TRUE;
422 pSiS->HWCursor = TRUE;
423 pSiS->Rotate = 0;
424 pSiS->Reflect = 0;
425 pSiS->NoAccel = FALSE;
426 pSiS->ShadowFB = FALSE;
427 pSiS->loadDRI = FALSE;
428 pSiS->agpWantedPages = AGP_PAGES;
429 pSiS->VESA = -1;
430 pSiS->NoXvideo = FALSE;
431 pSiS->maxxfbmem = 0;
432 pSiS->forceCRT1 = -1;
433 pSiS->DSTN = FALSE;
434 pSiS->FSTN = FALSE;
435 pSiS->XvOnCRT2 = FALSE;
436 pSiS->NoYV12 = -1;
437 pSiS->PDC = -1;
438 pSiS->PDCA = -1;
439 pSiS->EMI = -1;
440 pSiS->PRGB = -1;
441 pSiS->OptTVStand = -1;
442 pSiS->OptROMUsage = -1;
443 pSiS->noInternalModes = FALSE;
444 pSiS->OptUseOEM = -1;
445 pSiS->OptTVOver = -1;
446 pSiS->OptTVSOver = -1;
447 pSiS->chtvlumabandwidthcvbs = -1;
448 pSiS->chtvlumabandwidthsvideo = -1;
449 pSiS->chtvlumaflickerfilter = -1;
450 pSiS->chtvchromabandwidth = -1;
451 pSiS->chtvchromaflickerfilter = -1;
452 pSiS->chtvcvbscolor = -1;
453 pSiS->chtvtextenhance = -1;
454 pSiS->chtvcontrast = -1;
455 pSiS->sistvedgeenhance = -1;
456 pSiS->sistvantiflicker = -1;
457 pSiS->sistvsaturation = -1;
458 pSiS->sistvcfilter = -1;
459 pSiS->sistvyfilter = 1; /* 0 = off, 1 = default, 2-8 = filter no */
460 pSiS->sistvcolcalibc = 0;
461 pSiS->sistvcolcalibf = 0;
462 pSiS->sis6326enableyfilter = -1;
463 pSiS->sis6326yfilterstrong = -1;
464 pSiS->sis6326tvplug = -1;
465 pSiS->sis6326fscadjust = 0;
466 pSiS->tvxpos = 0;
467 pSiS->tvypos = 0;
468 pSiS->tvxscale = 0;
469 pSiS->tvyscale = 0;
470 pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
471 pSiS->chtvtype = -1;
472 pSiS->restorebyset = TRUE;
473 pSiS->nocrt2ddcdetection = FALSE;
474 pSiS->forcecrt2redetection = TRUE;
475 pSiS->SenseYPbPr = TRUE;
476 pSiS->ForceCRT1Type = CRT1_VGA;
477 pSiS->CRT1TypeForced = FALSE;
478 pSiS->ForceCRT2Type = CRT2_DEFAULT;
479 pSiS->ForceYPbPrAR = TV_YPBPR169;
480 pSiS->ForceTVType = -1;
481 pSiS->CRT1gamma = TRUE;
482 pSiS->CRT1gammaGiven = FALSE;
483 pSiS->CRT2gamma = TRUE;
484 pSiS->XvGamma = FALSE;
485 pSiS->XvGammaGiven = FALSE;
486 pSiS->enablesisctrl = FALSE;
487 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
488 pSiS->XvDefBri = 10;
489 pSiS->XvDefCon = 2;
490 } else {
491 pSiS->XvDefBri = 0;
492 pSiS->XvDefCon = 4;
494 pSiS->XvDefHue = 0;
495 pSiS->XvDefSat = 0;
496 pSiS->XvDefDisableGfx = FALSE;
497 pSiS->XvDefDisableGfxLR = FALSE;
498 pSiS->XvDefAdaptorBlit = FALSE;
499 pSiS->UsePanelScaler = -1;
500 pSiS->CenterLCD = -1;
501 pSiS->XvUseMemcpy = TRUE;
502 pSiS->XvUseChromaKey = FALSE;
503 pSiS->XvDisableColorKey = FALSE;
504 pSiS->XvInsideChromaKey = FALSE;
505 pSiS->XvYUVChromaKey = FALSE;
506 pSiS->XvChromaMin = 0x000101fe;
507 pSiS->XvChromaMax = 0x000101ff;
508 pSiS->XvGammaRed = pSiS->XvGammaGreen = pSiS->XvGammaBlue =
509 pSiS->XvGammaRedDef = pSiS->XvGammaGreenDef = pSiS->XvGammaBlueDef = 1000;
510 pSiS->GammaBriR = pSiS->GammaBriG = pSiS->GammaBriB = 1000;
511 pSiS->GammaPBriR = pSiS->GammaPBriG = pSiS->GammaPBriB = 1000;
512 pSiS->CRT2SepGamma = FALSE;
513 pSiS->GammaR2 = pSiS->GammaG2 = pSiS->GammaB2 = 1.0;
514 pSiS->GammaBriR2 = pSiS->GammaBriG2 = pSiS->GammaBriB2 = 1000;
515 pSiS->GammaPBriR2 = pSiS->GammaPBriG2 = pSiS->GammaPBriB2 = 1000;
516 pSiS->HideHWCursor = FALSE;
517 pSiS->HWCursorIsVisible = FALSE;
518 pSiS->OverruleRanges = TRUE;
519 pSiS->BenchMemCpy = TRUE;
520 #ifndef SISCHECKOSSSE
521 pSiS->XvSSEMemcpy = FALSE;
522 #endif
523 #ifdef SISMERGED
524 pSiS->MergedFB = pSiS->MergedFBAuto = FALSE;
525 pSiS->CRT2Position = sisRightOf;
526 pSiS->CRT2HSync = NULL;
527 pSiS->CRT2VRefresh = NULL;
528 pSiS->MetaModes = NULL;
529 pSiS->MergedFBXDPI = pSiS->MergedFBYDPI = 0;
530 pSiS->CRT1XOffs = pSiS->CRT1YOffs = pSiS->CRT2XOffs = pSiS->CRT2YOffs = 0;
531 pSiS->NonRect = pSiS->HaveNonRect = pSiS->HaveOffsRegions = FALSE;
532 pSiS->MBXNR1XMAX = pSiS->MBXNR1YMAX = pSiS->MBXNR2XMAX = pSiS->MBXNR2YMAX = 65536;
533 pSiS->MouseRestrictions = TRUE;
534 #ifdef SISXINERAMA
535 pSiS->UseSiSXinerama = TRUE;
536 pSiS->CRT2IsScrn0 = FALSE;
537 #endif
538 #endif
539 #ifdef SIS_CP
540 SIS_CP_OPT_DEFAULT
541 #endif
543 /* Chipset dependent defaults */
545 if(pSiS->Chipset == PCI_CHIP_SIS530) {
546 /* TQ still broken on 530/620? */
547 pSiS->TurboQueue = FALSE;
550 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
551 pSiS->newFastVram = 1;
554 if(pSiS->sishw_ext.jChipType == SIS_315H ||
555 pSiS->sishw_ext.jChipType == SIS_315) {
556 /* Cursor engine seriously broken */
557 pSiS->HWCursor = FALSE;
560 if(pSiS->Chipset == PCI_CHIP_SIS550) {
561 /* Alpha blending not supported */
562 pSiS->doRender = FALSE;
565 /* DRI only supported on 300 series,
566 * so don't load DRI by default on
567 * others.
569 if(pSiS->VGAEngine == SIS_300_VGA) {
570 pSiS->loadDRI = TRUE;
573 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
574 pSiS->OptUseColorCursor = 0;
575 #else
576 if(pSiS->VGAEngine == SIS_300_VGA) {
577 pSiS->OptUseColorCursor = 0;
578 pSiS->OptUseColorCursorBlend = 1;
579 pSiS->OptColorCursorBlendThreshold = 0x37000000;
580 } else if(pSiS->VGAEngine == SIS_315_VGA) {
581 pSiS->OptUseColorCursor = 1;
583 #endif
585 if(pSiS->VGAEngine == SIS_300_VGA) {
586 pSiS->AllowHotkey = 0;
587 } else if(pSiS->VGAEngine == SIS_315_VGA) {
588 pSiS->AllowHotkey = 1;
591 /* Collect the options */
593 /* FastVRAM (5597/5598, 6326 and 530/620 only)
595 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
596 from = X_DEFAULT;
597 if(xf86GetOptValBool(pSiS->Options, OPTION_FAST_VRAM, &pSiS->newFastVram)) {
598 from = X_CONFIG;
600 xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM timing %s\n",
601 (pSiS->newFastVram == -1) ?
602 ((pSiS->oldChipset == OC_SIS620) ? "enabled (for read only)" :
603 "enabled (for write only)") :
604 (pSiS->newFastVram ? "enabled (for read and write)" : disabledstr));
607 /* HostBus (5597/5598 only)
609 if(pSiS->Chipset == PCI_CHIP_SIS5597) {
610 from = X_DEFAULT;
611 if(xf86GetOptValBool(pSiS->Options, OPTION_HOSTBUS, &pSiS->HostBus)) {
612 from = X_CONFIG;
614 xf86DrvMsg(pScrn->scrnIndex, from, "SiS5597/5598 VGA-to-CPU host bus %s\n",
615 pSiS->HostBus ? enabledstr : disabledstr);
618 /* MaxXFBMem
619 * This options limits the amount of video memory X uses for screen
620 * and off-screen buffers. This option should be used if using DRI
621 * is intended. The kernel framebuffer driver required for DRM will
622 * start its memory heap at 12MB if it detects more than 16MB, at 8MB if
623 * between 8 and 16MB are available, otherwise at 4MB. So, if the amount
624 * of memory X uses, a clash between the framebuffer's memory heap
625 * and X is avoided. The amount is to be specified in KB.
627 if(xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM, &pSiS->maxxfbmem)) {
628 if(pSiS->maxxfbmem >= 2048) {
629 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
630 "MaxXFBMem: Framebuffer memory shall be limited to %ld KB\n",
631 pSiS->maxxfbmem);
632 pSiS->maxxfbmem *= 1024;
633 } else {
634 pSiS->maxxfbmem = 0;
635 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
636 "Invalid MaxXFBMem setting; minimum is 2048\n");
640 /* Accel
641 * Turns on/off 2D acceleration
643 if(!xf86ReturnOptValBool(pSiS->Options, OPTION_ACCEL, TRUE)) {
644 pSiS->NoAccel = TRUE;
645 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
646 pSiS->NoXvideo = TRUE;
647 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration and Xv disabled\n");
648 #else
649 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration disabled\n");
650 #endif
653 /* RenderAcceleration
654 * En/Disables RENDER acceleration (315/330 series only, not 550)
656 if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->Chipset != PCI_CHIP_SIS550) && (!pSiS->NoAccel)) {
657 if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) {
658 if(!pSiS->doRender) {
659 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n");
664 /* SWCursor, HWCursor
665 * Chooses whether to use the hardware or software cursor
667 from = X_DEFAULT;
668 if(xf86GetOptValBool(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) {
669 from = X_CONFIG;
671 if(xf86ReturnOptValBool(pSiS->Options, OPTION_SW_CURSOR, FALSE)) {
672 from = X_CONFIG;
673 pSiS->HWCursor = FALSE;
674 pSiS->OptUseColorCursor = 0;
676 xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
677 pSiS->HWCursor ? "HW" : "SW");
680 * UseColorHWCursor
681 * ColorHWCursorBlending
682 * ColorHWCursorBlendThreshold
684 * Enable/disable color hardware cursors;
685 * enable/disable color hw cursor emulation for 300 series
686 * select emultation transparency threshold for 300 series
689 #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
690 #ifdef ARGB_CURSOR
691 #ifdef SIS_ARGB_CURSOR
692 if((pSiS->HWCursor) && ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA))) {
694 from = X_DEFAULT;
695 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSOR, &pSiS->OptUseColorCursor)) {
696 from = X_CONFIG;
698 xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n",
699 pSiS->OptUseColorCursor ? enabledstr : disabledstr);
701 if(pSiS->VGAEngine == SIS_300_VGA) {
702 from = X_DEFAULT;
703 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) {
704 from = X_CONFIG;
706 if(pSiS->OptUseColorCursor) {
707 xf86DrvMsg(pScrn->scrnIndex, from,
708 "HW cursor color blending emulation is %s\n",
709 (pSiS->OptUseColorCursorBlend) ? enabledstr : disabledstr);
711 from = X_DEFAULT;
712 if(xf86GetOptValInteger(pSiS->Options, OPTION_USERGBCURSORBLENDTH, &ival)) {
713 if((ival >= 0) && (ival <= 255)) {
714 from = X_CONFIG;
715 pSiS->OptColorCursorBlendThreshold = (ival << 24);
716 } else {
717 ival = pSiS->OptColorCursorBlendThreshold >> 24;
718 SiS_PrintIlRange(pScrn, OPTION_USERGBCURSORBLENDTH, 0, 255, 0);
720 } else {
721 ival = pSiS->OptColorCursorBlendThreshold >> 24;
723 if(pSiS->OptUseColorCursor) {
724 if(pSiS->OptUseColorCursorBlend) {
725 xf86DrvMsg(pScrn->scrnIndex, from,
726 "HW cursor color blending emulation threshold is %d\n", ival);
731 #endif
732 #endif
733 #endif
735 /* OverruleFrequencyRanges
736 * Enable/disable overruling bogus frequency ranges for TV and LCD(A)
738 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
739 if(xf86GetOptValBool(pSiS->Options, OPTION_OVERRULERANGES, &val)) {
740 if(!val) {
741 pSiS->OverruleRanges = FALSE;
742 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overruling frequency ranges disabled\n");
747 #ifdef SISDUALHEAD
748 if(pSiS->DualHeadMode) {
749 IsDHM = TRUE;
750 if(pSiS->SecondHead) IsSecondHead = TRUE;
752 #endif
754 /* MergedFB
755 * Enable/disable and configure merged framebuffer mode
757 #ifdef SISMERGED
758 #ifdef SISDUALHEAD
759 if(pSiS->DualHeadMode) {
760 if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFB)) {
761 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
762 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFB)].name);
764 if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFBAUTO)) {
765 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
766 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFBAUTO)].name);
768 } else
769 #endif
770 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
771 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDFB))) {
772 if(SiS_StrIsBoolOn(strptr)) {
773 pSiS->MergedFB = TRUE;
774 pSiS->MergedFBAuto = FALSE;
775 } else if(!xf86NameCmp(strptr, "AUTO")) {
776 pSiS->MergedFB = TRUE;
777 pSiS->MergedFBAuto = TRUE;
780 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBAUTO, &val)) {
781 if(!pSiS->MergedFB) {
782 if(val) pSiS->MergedFB = pSiS->MergedFBAuto = TRUE;
783 } else {
784 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
785 "Option \"MergedFB\" overrules option \"MergedFBAuto\"\n");
789 if(pSiS->MergedFB) {
790 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS))) {
791 int result;
792 Bool valid = FALSE;
793 char *tempstr = xalloc(strlen(strptr) + 1);
794 result = sscanf(strptr, "%s %d", tempstr, &ival);
795 if(result >= 1) {
796 if(!xf86NameCmp(tempstr,"LeftOf")) {
797 pSiS->CRT2Position = sisLeftOf;
798 valid = TRUE;
799 if(result == 2) {
800 if(ival < 0) pSiS->CRT1YOffs = -ival;
801 else pSiS->CRT2YOffs = ival;
803 #ifdef SISXINERAMA
804 pSiS->CRT2IsScrn0 = TRUE;
805 #endif
806 } else if(!xf86NameCmp(tempstr,"RightOf")) {
807 pSiS->CRT2Position = sisRightOf;
808 if(result == 2) {
809 if(ival < 0) pSiS->CRT1YOffs = -ival;
810 else pSiS->CRT2YOffs = ival;
812 #ifdef SISXINERAMA
813 pSiS->CRT2IsScrn0 = FALSE;
814 #endif
815 } else if(!xf86NameCmp(tempstr,"Above")) {
816 pSiS->CRT2Position = sisAbove;
817 valid = TRUE;
818 if(result == 2) {
819 if(ival < 0) pSiS->CRT1XOffs = -ival;
820 else pSiS->CRT2XOffs = ival;
822 #ifdef SISXINERAMA
823 pSiS->CRT2IsScrn0 = FALSE;
824 #endif
825 } else if(!xf86NameCmp(tempstr,"Below")) {
826 pSiS->CRT2Position = sisBelow;
827 valid = TRUE;
828 if(result == 2) {
829 if(ival < 0) pSiS->CRT1XOffs = -ival;
830 else pSiS->CRT2XOffs = ival;
832 #ifdef SISXINERAMA
833 pSiS->CRT2IsScrn0 = TRUE;
834 #endif
835 } else if(!xf86NameCmp(tempstr,"Clone")) {
836 pSiS->CRT2Position = sisClone;
837 if(result == 1) valid = TRUE;
838 #ifdef SISXINERAMA
839 pSiS->CRT2IsScrn0 = TRUE;
840 #endif
843 if(!valid) {
844 SiS_PrintBadOpt(pScrn, strptr, OPTION_CRT2POS);
845 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
846 "%s \"RightOf\", \"LeftOf\", \"Above\", \"Below\", or \"Clone\"\n", validparm);
847 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
848 "Except for \"Clone\", the parameter may be followed by an integer.\n");
850 xfree(tempstr);
852 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES))) {
853 pSiS->MetaModes = xalloc(strlen(strptr) + 1);
854 if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
856 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC))) {
857 pSiS->CRT2HSync = xalloc(strlen(strptr) + 1);
858 if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
860 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH))) {
861 pSiS->CRT2VRefresh = xalloc(strlen(strptr) + 1);
862 if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
864 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDDPI))) {
865 int val1 = 0, val2 = 0;
866 sscanf(strptr, "%d %d", &val1, &val2);
867 if(val1 && val2) {
868 pSiS->MergedFBXDPI = val1;
869 pSiS->MergedFBYDPI = val2;
870 } else {
871 SiS_PrintBadOpt(pScrn, strptr, OPTION_MERGEDDPI);
874 #ifdef SISXINERAMA
875 if(pSiS->MergedFB) {
876 if(xf86GetOptValBool(pSiS->Options, OPTION_SISXINERAMA, &val)) {
877 if(!val) pSiS->UseSiSXinerama = FALSE;
879 if(pSiS->UseSiSXinerama) {
880 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
881 pSiS->CRT2IsScrn0 = val ? TRUE : FALSE;
883 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBNONRECT, &val)) {
884 pSiS->NonRect = val ? TRUE : FALSE;
886 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBMOUSER, &val)) {
887 pSiS->MouseRestrictions = val ? TRUE : FALSE;
891 #endif
894 #endif
896 /* Some options can only be specified in the Master Head's Device
897 * section. Here we give the user a hint in the log.
899 #ifdef SISDUALHEAD
900 if((pSiS->DualHeadMode) && (pSiS->SecondHead)) {
901 static const char *mystring = "Option \"%s\" only accepted in CRT2 (Master) Device section\n";
902 int i;
903 const short forbiddenopts[] = {
904 OPTION_TURBOQUEUE, OPTION_RESTOREBYSET, OPTION_ENABLEHOTKEY,
905 OPTION_ENABLESISCTRL, OPTION_USEROMDATA, OPTION_USEOEM,
906 OPTION_FORCECRT1, OPTION_DDCFORCRT2, OPTION_FORCECRT2REDETECTION,
907 OPTION_SENSEYPBPR, OPTION_FORCE_CRT1TYPE, OPTION_FORCE_CRT2TYPE,
908 OPTION_YPBPRAR, OPTION_SCALELCD, OPTION_CENTERLCD, OPTION_PDC,
909 OPTION_PDCA, OPTION_EMI, OPTION_SPECIALTIMING, OPTION_LVDSHL,
910 OPTION_TVSTANDARD, OPTION_CHTVTYPE, OPTION_CHTVOVERSCAN,
911 OPTION_CHTVSOVERSCAN, OPTION_CHTVLUMABANDWIDTHCVBS,
912 OPTION_CHTVLUMABANDWIDTHSVIDEO, OPTION_CHTVLUMAFLICKERFILTER,
913 OPTION_CHTVCHROMABANDWIDTH, OPTION_CHTVCHROMAFLICKERFILTER,
914 OPTION_CHTVCVBSCOLOR, OPTION_CHTVTEXTENHANCE, OPTION_CHTVCONTRAST,
915 OPTION_SISTVEDGEENHANCE, OPTION_SISTVANTIFLICKER, OPTION_SISTVSATURATION,
916 OPTION_SISTVCHROMAFILTER, OPTION_SISTVLUMAFILTER, OPTION_SISTVCOLCALIBCOARSE,
917 OPTION_SISTVCOLCALIBFINE, OPTION_TVXPOSOFFSET, OPTION_TVYPOSOFFSET,
918 OPTION_TVXSCALE, OPTION_TVYSCALE, OPTION_CRT2GAMMA, OPTION_XVONCRT2,
919 OPTION_XVDEFAULTADAPTOR, OPTION_XVMEMCPY, OPTION_XVBENCHCPY, OPTION_FORCE2ASPECT,
920 #ifndef SISCHECKOSSSE
921 OPTION_XVSSECOPY,
922 #endif
923 #ifdef SIS_CP
924 SIS_CP_OPT_DH_WARN
925 #endif
929 i = 0;
930 while(forbiddenopts[i] >= 0) {
931 if(xf86IsOptionSet(pSiS->Options, (int)forbiddenopts[i])) {
932 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring,
933 pSiS->Options[SiS_FIFT(pSiS->Options, (int)forbiddenopts[i])].name);
935 i++;
938 } else
939 #endif
941 if(pSiS->VGAEngine == SIS_315_VGA) {
943 #ifdef SISVRAMQ
944 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using VRAM command queue, size %dk\n",
945 pSiS->cmdQueueSize / 1024);
946 #else
947 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MMIO command queue, size 512k\n");
948 #endif
950 } else {
952 /* TurboQueue */
953 from = X_DEFAULT;
954 if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
955 from = X_CONFIG;
957 xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
958 pSiS->TurboQueue ? enabledstr : disabledstr);
961 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
963 /* RestoreBySetMode (300/315/330 series only)
964 * Set this to force the driver to set the old mode instead of restoring
965 * the register contents. This can be used to overcome problems with
966 * LCD panels and video bridges.
968 if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
969 pSiS->restorebyset = val ? TRUE : FALSE;
972 /* EnableHotkey (300/315/330 series only)
973 * Enables or disables the BIOS hotkey switch for
974 * switching the output device on laptops.
975 * This key causes a total machine hang on many 300 series
976 * machines, it is therefore by default disabled on such.
977 * In dual head mode, using the hotkey is lethal, so we
978 * forbid it then in any case.
979 * However, although the driver disables the hotkey as
980 * BIOS developers intented to do that, some buggy BIOSes
981 * still cause the machine to freeze. Hence the warning.
983 ival = 0;
984 from = X_DEFAULT;
985 #ifdef SISDUALHEAD
986 if(pSiS->DualHeadMode) {
987 pSiS->AllowHotkey = 0;
988 ival = 1;
989 } else
990 #endif
991 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLEHOTKEY, &val)) {
992 pSiS->AllowHotkey = val ? 1 : 0;
993 from = X_CONFIG;
995 xf86DrvMsg(pScrn->scrnIndex, from, "Hotkey display switching is %s%s\n",
996 pSiS->AllowHotkey ? enabledstr : disabledstr,
997 ival ? " in dual head mode" : "");
998 if(pSiS->Chipset == PCI_CHIP_SIS630 ||
999 pSiS->Chipset == PCI_CHIP_SIS650 ||
1000 pSiS->Chipset == PCI_CHIP_SIS660) {
1001 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1002 "WARNING: Using the Hotkey might freeze your machine, regardless\n");
1003 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1004 " whether enabled or disabled. This is no driver bug.\n");
1007 /* UseROMData (300/315/330 series only)
1008 * This option is enabling/disabling usage of some machine
1009 * specific data from the BIOS ROM. This option can - and
1010 * should - be used in case the driver makes problems
1011 * because SiS changed the location of this data.
1013 if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
1014 pSiS->OptROMUsage = val ? 1 : 0;
1015 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1016 "Video ROM data usage shall be %s\n",
1017 val ? enabledstr : disabledstr);
1020 /* UseOEMData (300/315/330 series only)
1021 * The driver contains quite a lot data for OEM LCD panels
1022 * and TV connector specifics which override the defaults.
1023 * If this data is incorrect, the TV may lose color and
1024 * the LCD panel might show some strange effects. Use this
1025 * option to disable the usage of this data.
1027 if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
1028 pSiS->OptUseOEM = val ? 1 : 0;
1029 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1030 "Internal CRT2 OEM data usage shall be %s\n",
1031 val ? enabledstr : disabledstr);
1034 /* CRT2DDCDetection (315/330 series only)
1035 * If set to true, this disables CRT2 detection using DDC. This is
1036 * to avoid problems with not entirely DDC compiant LCD panels or
1037 * VGA monitors connected to the secondary VGA plug. Since LCD and
1038 * VGA share the same DDC channel, it might in some cases be impossible
1039 * to determine if the device is a CRT monitor or a flat panel.
1041 if(xf86GetOptValBool(pSiS->Options, OPTION_DDCFORCRT2, &val)) {
1042 pSiS->nocrt2ddcdetection = val ? FALSE : TRUE;
1045 /* ForceCRT2ReDetection (315/330 series only)
1046 * If set to true, it forces re-detection of the LCD panel and
1047 * a secondary VGA connection even if the BIOS already had found
1048 * about it. This is meant for custom panels (ie such with
1049 * non-standard resolutions) which the BIOS will "detect" according
1050 * to the established timings, resulting in only a very vague idea
1051 * about the panels real resolution. As for secondary VGA, this
1052 * enables us to include a Plasma panel's proprietary modes.
1054 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
1055 if(val) {
1056 pSiS->forcecrt2redetection = TRUE;
1057 pSiS->nocrt2ddcdetection = FALSE;
1058 } else
1059 pSiS->forcecrt2redetection = FALSE;
1062 /* SenseYPbPr (315/330 series only)
1063 * If set to true, the driver will sense for YPbPr TV. This is
1064 * inconvenient for folks connecting SVideo and CVBS at the same
1065 * time, because this condition will be detected as YPbPr (since
1066 * the TV output pins are shared). "False" will not sense for
1067 * YPbPr and detect SVideo or CVBS only.
1069 if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) {
1070 if(val) pSiS->SenseYPbPr = TRUE;
1071 else pSiS->SenseYPbPr = FALSE;
1074 /* ForceCRT1Type (315/330 series only)
1075 * Used for forcing the driver to initialize CRT1 as
1076 * VGA (analog) or LCDA (for simultanious LCD and TV
1077 * display) - on M650/651 and 661 or later with 301C/30xLV only!
1079 if(pSiS->VGAEngine == SIS_315_VGA) {
1080 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE))) {
1081 if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"CRT"))) {
1082 pSiS->ForceCRT1Type = CRT1_VGA;
1083 pSiS->CRT1TypeForced = TRUE;
1084 } else if( (!xf86NameCmp(strptr,"LCD")) ||
1085 (!xf86NameCmp(strptr,"LCDA")) ||
1086 (!xf86NameCmp(strptr,"DVI-D")) ||
1087 (!xf86NameCmp(strptr,"DVID")) ||
1088 (!xf86NameCmp(strptr,"DVI")) ||
1089 (!xf86NameCmp(strptr,"LCD-A")) ) {
1090 pSiS->ForceCRT1Type = CRT1_LCDA;
1091 pSiS->CRT1TypeForced = TRUE;
1092 } else if((!xf86NameCmp(strptr,"NONE")) || (!xf86NameCmp(strptr,"OFF"))) {
1093 pSiS->ForceCRT1Type = CRT1_VGA;
1094 pSiS->forceCRT1 = 0;
1095 pSiS->CRT1TypeForced = TRUE;
1096 } else {
1097 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT1TYPE);
1098 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1099 "%s \"VGA\" (alias \"CRT\"), \"LCD\" (alias \"DVI-D\") or NONE\n", validparm);
1104 /* ForceCRT1 (300/315/330 series only)
1105 * This option can be used to force CRT1 (VGA) to be switched on/off. Its
1106 * intention is mainly for old monitors that can't be detected
1107 * automatically. This is only useful on machines with a video bridge.
1108 * In normal cases, this option won't be necessary.
1110 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1111 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
1112 pSiS->forceCRT1 = val ? 1 : 0;
1113 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1114 "CRT1 shall be forced %s\n",
1115 val ? "ON" : "OFF");
1119 /* ForceCRT2Type (300/315/330 series only)
1120 * Used for forcing the driver to use a given CRT2 device type.
1121 * (SVIDEO, COMPOSITE and SCART for overriding detection)
1123 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
1124 if(strptr != NULL) {
1125 if(!xf86NameCmp(strptr,"TV"))
1126 pSiS->ForceCRT2Type = CRT2_TV;
1127 else if( (!xf86NameCmp(strptr,"SVIDEO")) ||
1128 (!xf86NameCmp(strptr,"SVHS")) ) {
1129 pSiS->ForceCRT2Type = CRT2_TV;
1130 pSiS->ForceTVType = TV_SVIDEO;
1131 } else if( (!xf86NameCmp(strptr,"COMPOSITE")) ||
1132 (!xf86NameCmp(strptr,"CVBS")) ) {
1133 pSiS->ForceCRT2Type = CRT2_TV;
1134 pSiS->ForceTVType = TV_AVIDEO;
1135 } else if( (!xf86NameCmp(strptr,"COMPOSITE SVIDEO")) || /* Ugly, but shorter than a parsing function */
1136 (!xf86NameCmp(strptr,"COMPOSITE+SVIDEO")) ||
1137 (!xf86NameCmp(strptr,"SVIDEO+COMPOSITE")) ||
1138 (!xf86NameCmp(strptr,"SVIDEO COMPOSITE")) ) {
1139 pSiS->ForceCRT2Type = CRT2_TV;
1140 pSiS->ForceTVType = (TV_SVIDEO | TV_AVIDEO);
1141 } else if(!xf86NameCmp(strptr,"SCART")) {
1142 pSiS->ForceCRT2Type = CRT2_TV;
1143 pSiS->ForceTVType = TV_SCART;
1144 } else if((!xf86NameCmp(strptr,"LCD")) || (!xf86NameCmp(strptr,"DVI-D"))) {
1145 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1146 pSiS->ForceCRT2Type = CRT2_LCD;
1147 } else {
1148 pSiS->ForceCRT2Type = 0;
1149 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1150 "Can't set both CRT1 and CRT2 type to LCD; CRT2 disabled\n");
1152 } else if((!xf86NameCmp(strptr,"VGA")) ||
1153 (!xf86NameCmp(strptr,"DVI-A")) ||
1154 (!xf86NameCmp(strptr,"CRT"))) {
1155 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1156 pSiS->ForceCRT2Type = CRT2_VGA;
1157 } else {
1158 pSiS->ForceCRT2Type = 0;
1159 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1160 "CRT2 can only be TV or off while CRT1 is LCD; CRT2 disabled\n");
1162 } else if(!xf86NameCmp(strptr,"NONE"))
1163 pSiS->ForceCRT2Type = 0;
1164 else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
1165 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1166 pSiS->ForceCRT2Type = CRT2_LCD;
1167 pSiS->DSTN = TRUE;
1169 } else if((!xf86NameCmp(strptr,"FSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
1170 if(pSiS->ForceCRT1Type == CRT1_VGA) {
1171 pSiS->ForceCRT2Type = CRT2_LCD;
1172 pSiS->FSTN = TRUE;
1174 #ifdef ENABLE_YPBPR
1175 } else if(!xf86NameCmp(strptr,"HIVISION")) {
1176 pSiS->ForceCRT2Type = CRT2_TV;
1177 pSiS->ForceTVType = TV_HIVISION;
1178 } else if((!xf86NameCmp(strptr,"YPBPR1080I")) && (pSiS->VGAEngine == SIS_315_VGA)) {
1179 pSiS->ForceCRT2Type = CRT2_TV;
1180 pSiS->ForceTVType = TV_YPBPR;
1181 pSiS->ForceYPbPrType = TV_YPBPR1080I;
1182 } else if(((!xf86NameCmp(strptr,"YPBPR525I")) || (!xf86NameCmp(strptr,"YPBPR480I"))) &&
1183 (pSiS->VGAEngine == SIS_315_VGA)) {
1184 pSiS->ForceCRT2Type = CRT2_TV;
1185 pSiS->ForceTVType = TV_YPBPR;
1186 pSiS->ForceYPbPrType = TV_YPBPR525I;
1187 } else if(((!xf86NameCmp(strptr,"YPBPR525P")) || (!xf86NameCmp(strptr,"YPBPR480P"))) &&
1188 (pSiS->VGAEngine == SIS_315_VGA)) {
1189 pSiS->ForceCRT2Type = CRT2_TV;
1190 pSiS->ForceTVType = TV_YPBPR;
1191 pSiS->ForceYPbPrType = TV_YPBPR525P;
1192 } else if(((!xf86NameCmp(strptr,"YPBPR750P")) || (!xf86NameCmp(strptr,"YPBPR720P"))) &&
1193 (pSiS->VGAEngine == SIS_315_VGA)) {
1194 pSiS->ForceCRT2Type = CRT2_TV;
1195 pSiS->ForceTVType = TV_YPBPR;
1196 pSiS->ForceYPbPrType = TV_YPBPR750P;
1197 #endif
1198 } else {
1199 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT2TYPE);
1200 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1201 "%s \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
1202 "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\"; on the SiS550\n"
1203 "\talso \"DSTN\" and \"FSTN\""
1204 #ifdef ENABLE_YPBPR
1205 "; on SiS 301/301B bridges also \"HIVISION\", and on\n"
1206 "\tSiS315/330 series with 301C/30xLV bridge also \"YPBPR480I\", \"YPBPR480P\",\n"
1207 "\t\"YPBPR720P\" and \"YPBPR1080I\""
1208 #endif
1209 "\n", validparm);
1212 if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
1213 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1214 "CRT2 type shall be %s\n", strptr);
1217 if(pSiS->ForceTVType == TV_YPBPR) {
1218 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR);
1219 if(strptr != NULL) {
1220 if(!xf86NameCmp(strptr,"4:3LB"))
1221 pSiS->ForceYPbPrAR = TV_YPBPR43LB;
1222 else if(!xf86NameCmp(strptr,"4:3"))
1223 pSiS->ForceYPbPrAR = TV_YPBPR43;
1224 else if(!xf86NameCmp(strptr,"16:9"))
1225 pSiS->ForceYPbPrAR = TV_YPBPR169;
1226 else {
1227 SiS_PrintBadOpt(pScrn, strptr, OPTION_YPBPRAR);
1228 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1229 "%s \"4:3LB\", \"4:3\" and \"16:9\"\n", validparm);
1234 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING);
1235 if(strptr != NULL) {
1236 int i = 0;
1237 Bool found = FALSE;
1238 if(!xf86NameCmp(strptr,"NONE")) {
1239 pSiS->SiS_Pr->SiS_CustomT = CUT_FORCENONE;
1240 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1241 "Special timing disabled\n");
1242 } else {
1243 while(mycustomttable[i].chipID != 0) {
1244 if(!xf86NameCmp(strptr,mycustomttable[i].optionName)) {
1245 pSiS->SiS_Pr->SiS_CustomT = mycustomttable[i].SpecialID;
1246 found = TRUE;
1247 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1248 "Special timing for %s %s forced\n",
1249 mycustomttable[i].vendorName, mycustomttable[i].cardName);
1250 break;
1252 i++;
1254 if(!found) {
1255 SiS_PrintBadOpt(pScrn, strptr, OPTION_SPECIALTIMING);
1256 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
1257 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NONE\" (to disable special timings)\n");
1258 i = 0;
1259 while(mycustomttable[i].chipID != 0) {
1260 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1261 "\t\"%s\" (for %s %s)\n",
1262 mycustomttable[i].optionName,
1263 mycustomttable[i].vendorName,
1264 mycustomttable[i].cardName);
1265 i++;
1271 /* EnableSiSCtrl */
1272 /* Allow sisctrl tool to change driver settings */
1273 from = X_DEFAULT;
1274 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLESISCTRL, &val)) {
1275 if(val) pSiS->enablesisctrl = TRUE;
1276 from = X_CONFIG;
1278 xf86DrvMsg(pScrn->scrnIndex, from, "SiSCtrl utility interface is %s\n",
1279 pSiS->enablesisctrl ? enabledstr : disabledstr);
1282 /* ForceCRT1Aspect, ForceCRT2Aspect */
1283 /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
1284 * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
1285 * output devices, not TV or DVI/LCD.
1287 if(pSiS->VGAEngine == SIS_315_VGA) {
1288 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE2ASPECT);
1289 if(strptr != NULL) {
1290 if(!xf86NameCmp(strptr,"WIDE")) {
1291 pSiS->SiS_Pr->SiS_UseWideCRT2 = TRUE;
1292 } else if(!xf86NameCmp(strptr,"NORMAL")) {
1293 pSiS->SiS_Pr->SiS_UseWideCRT2 = FALSE;
1294 } else {
1295 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE2ASPECT);
1296 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
1297 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
1299 /* Print status later */
1303 /* ScaleLCD (300/315/330 series only)
1304 * Can be used to force the bridge/panel link to [do|not do] the
1305 * scaling of modes lower than the panel's native resolution.
1306 * Setting this to TRUE will force the bridge/panel link
1307 * to scale; FALSE will rely on the panel's capabilities.
1308 * Not supported on all machines.
1310 if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
1311 pSiS->UsePanelScaler = val ? 0 : 1;
1312 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD scaling is %s\n",
1313 pSiS->UsePanelScaler ? disabledstr : enabledstr);
1316 /* CenterLCD (300/315/330 + SiS video bridge only)
1317 * If LCD shall not be scaled, this selects whether 1:1 data
1318 * will be sent to the output, or the image shall be centered
1319 * on the LCD. For LVDS panels, screen will always be centered,
1320 * since these have no built-in scaler. For TMDS, this is
1321 * selectable. Non-centered means that the driver will pass
1322 * 1:1 data to the output and that the panel will have to
1323 * scale by itself (if supported by the panel).
1325 if(xf86GetOptValBool(pSiS->Options, OPTION_CENTERLCD, &val)) {
1326 pSiS->CenterLCD = val ? 1 : 0;
1327 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Non-scaled LCD output will %sbe centered\n",
1328 pSiS->CenterLCD ? "not " : "");
1331 /* PanelDelayCompensation (300/315/330 series only)
1332 * This might be required if the LCD panel shows "small waves"
1333 * or wrong colors.
1334 * The parameter is an integer, (on 300 series usually either
1335 * 4, 32 or 24; on 315 series + LV bridge usually 3 or 51)
1336 * Why this option? Simply because SiS did poor BIOS design.
1337 * The PDC value depends on the very LCD panel used in a
1338 * particular machine. For most panels, the driver is able
1339 * to detect the correct value. However, some panels require
1340 * a different setting. For 300 series, the value given must
1341 * be within the mask 0x3c. For 661 and later, if must be
1342 * within the range of 0 to 31.
1344 ival = -1;
1345 xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &ival);
1346 if(ival != -1) {
1347 pSiS->PDC = ival;
1348 if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) {
1349 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1350 "Invalid PanelDelayCompensation parameter\n");
1351 pSiS->PDC = -1;
1352 } else {
1353 if(pSiS->VGAEngine == SIS_315_VGA) pSiS->PDC &= 0x1f;
1354 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1355 "Panel delay compensation shall be %d (for LCD=CRT2)\n",
1356 pSiS->PDC);
1360 /* PanelDelayCompensation1 (315/330 series only)
1361 * Same as above, but for LCD-via-CRT1 ("LCDA")
1363 if(pSiS->VGAEngine == SIS_315_VGA) {
1364 ival = -1;
1365 xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &ival);
1366 if(ival != -1) {
1367 pSiS->PDCA = ival;
1368 if(pSiS->PDCA > 0x1f) {
1369 SiS_PrintIlRange(pScrn, OPTION_PDCA, 0, 31, 0);
1370 pSiS->PDCA = -1;
1371 } else {
1372 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1373 "Panel delay compensation shall be %d (for LCD=CRT1)\n",
1374 pSiS->PDCA);
1379 /* LVDSHL (300/315/330 series + 30xLV bridge only)
1380 * This might be required if the LCD panel is too dark.
1381 * The parameter is an integer from 0 to 3.
1383 if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
1384 if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) {
1385 SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 3, 0);
1386 pSiS->SiS_Pr->LVDSHL = -1;
1387 } else {
1388 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1389 "LVDSHL will be %d\n",
1390 pSiS->SiS_Pr->LVDSHL);
1394 /* EMI (315/330 series + 302LV/302ELV bridge only)
1395 * This might be required if the LCD panel loses sync on
1396 * mode switches. So far, this problem should not show up
1397 * due to the auto-detection (from reading the values set
1398 * by the BIOS; however, the BIOS values are wrong sometimes
1399 * such as in the case of some Compal machines with a
1400 * 1400x1050, or some Inventec(Compaq) machines with a
1401 * 1280x1024 panel.
1402 * The parameter is an integer from 0 to 0x60ffffff.
1404 if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) {
1405 if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) {
1406 SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 0x60ffffff, 1);
1407 pSiS->EMI = -1;
1408 } else {
1409 pSiS->EMI &= 0x60ffffff;
1410 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1411 "EMI will be 0x%04x\n", pSiS->EMI);
1415 /* ForcePanelRGB (300/315/330 series only)
1416 * Can be used to force the bridge/panel link to assume a
1417 * specified LCD color capability of 18 or 24 bit in cases
1418 * where the BIOS carries incorrect information (such as in
1419 * the case of the MSI m250).
1421 if(xf86GetOptValInteger(pSiS->Options, OPTION_PRGB, &pSiS->PRGB)) {
1422 if((pSiS->PRGB != 18 && pSiS->PRGB != 24)) {
1423 pSiS->PRGB = -1;
1424 SiS_PrintBadOpt(pScrn, strptr, OPTION_PRGB);
1425 } else {
1426 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1427 "LCD panel color depth is %d\n",
1428 pSiS->PRGB);
1435 /* TVStandard (300/315/330 series and 6326 w/ TV only)
1436 * This option is for overriding the autodetection of
1437 * the BIOS/Jumper option for PAL / NTSC
1439 if((pSiS->VGAEngine == SIS_300_VGA) ||
1440 (pSiS->VGAEngine == SIS_315_VGA) ||
1441 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1442 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD);
1443 if(strptr != NULL) {
1444 if(!xf86NameCmp(strptr,"PAL"))
1445 pSiS->OptTVStand = 1;
1446 else if((!xf86NameCmp(strptr,"PALM")) ||
1447 (!xf86NameCmp(strptr,"PAL-M"))) {
1448 pSiS->OptTVStand = 1;
1449 pSiS->NonDefaultPAL = 1;
1450 } else if((!xf86NameCmp(strptr,"PALN")) ||
1451 (!xf86NameCmp(strptr,"PAL-N"))) {
1452 pSiS->OptTVStand = 1;
1453 pSiS->NonDefaultPAL = 0;
1454 } else if((!xf86NameCmp(strptr,"NTSCJ")) ||
1455 (!xf86NameCmp(strptr,"NTSC-J"))) {
1456 pSiS->OptTVStand = 0;
1457 pSiS->NonDefaultNTSC = 1;
1458 } else if(!xf86NameCmp(strptr,"NTSC"))
1459 pSiS->OptTVStand = 0;
1460 else {
1461 SiS_PrintBadOpt(pScrn, strptr, OPTION_TVSTANDARD);
1462 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1463 "%s \"PAL\", \"PALM\", \"PALN\", \"NTSC\", \"NTSCJ\"\n", validparm);
1466 if(pSiS->OptTVStand != -1) {
1467 static const char *tvstdstr = "TV standard shall be %s\n";
1468 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
1469 pSiS->NonDefaultPAL = -1;
1470 pSiS->NonDefaultNTSC = -1;
1471 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1472 pSiS->OptTVStand ? "PAL" : "NTSC");
1473 } else {
1474 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1475 (pSiS->OptTVStand ?
1476 ( (pSiS->NonDefaultPAL == -1) ? "PAL" :
1477 ((pSiS->NonDefaultPAL) ? "PALM" : "PALN") ) :
1478 (pSiS->NonDefaultNTSC == -1) ? "NTSC" : "NTSCJ"));
1484 /* CHTVType (315/330 series + Chrontel only)
1485 * Used for telling the driver if the TV output shall
1486 * be 525i YPbPr or SCART.
1488 if(pSiS->VGAEngine == SIS_315_VGA) {
1489 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
1490 if(strptr != NULL) {
1491 if(!xf86NameCmp(strptr,"SCART"))
1492 pSiS->chtvtype = 1;
1493 else if(!xf86NameCmp(strptr,"YPBPR525I"))
1494 pSiS->chtvtype = 0;
1495 else {
1496 SiS_PrintBadOpt(pScrn, strptr, OPTION_CHTVTYPE);
1497 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1498 "%s \"SCART\" or \"YPBPR525I\"\n", validparm);
1500 if(pSiS->chtvtype != -1)
1501 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1502 "Chrontel: TV type shall be %s\n", strptr);
1506 /* CHTVOverscan (300/315/330 series only)
1507 * CHTVSuperOverscan (300/315/330 series only)
1508 * These options are for overriding the BIOS option for
1509 * TV Overscan. Some BIOSes don't even have such an option.
1510 * SuperOverscan is only supported with PAL.
1511 * Both options are only effective on machines with a
1512 * CHRONTEL TV encoder. SuperOverscan is only available
1513 * on the 700x.
1515 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1516 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) {
1517 pSiS->OptTVOver = val ? 1 : 0;
1518 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1519 "Chrontel: TV overscan shall be %s\n",
1520 val ? enabledstr : disabledstr);
1522 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) {
1523 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1524 "Chrontel: TV super overscan shall be %s\n",
1525 pSiS->OptTVSOver ? enabledstr : disabledstr);
1529 /* Various parameters for TV output via SiS bridge, Chrontel or SiS6326
1531 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1532 int tmp = 0;
1533 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS,
1534 &pSiS->chtvlumabandwidthcvbs);
1535 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO,
1536 &pSiS->chtvlumabandwidthsvideo);
1537 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER,
1538 &pSiS->chtvlumaflickerfilter);
1539 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH,
1540 &pSiS->chtvchromabandwidth);
1541 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER,
1542 &pSiS->chtvchromaflickerfilter);
1543 xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR,
1544 &pSiS->chtvcvbscolor);
1545 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE,
1546 &pSiS->chtvtextenhance);
1547 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST,
1548 &pSiS->chtvcontrast);
1549 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE,
1550 &pSiS->sistvedgeenhance);
1551 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION,
1552 &pSiS->sistvsaturation);
1553 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVLUMAFILTER,
1554 &pSiS->sistvyfilter);
1555 if((pSiS->sistvyfilter < 0) || (pSiS->sistvyfilter > 8)) {
1556 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1557 "Illegal Y Filter number; valid is 0 (off), 1 (default), 2-8 (filter number 1-7)\n");
1558 pSiS->sistvyfilter = 1;
1560 xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER,
1561 &pSiS->sistvcfilter);
1562 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBCOARSE,
1563 &pSiS->sistvcolcalibc);
1564 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE,
1565 &pSiS->sistvcolcalibf);
1566 if((pSiS->sistvcolcalibf > 127) || (pSiS->sistvcolcalibf < -128) ||
1567 (pSiS->sistvcolcalibc > 120) || (pSiS->sistvcolcalibc < -120)) {
1568 pSiS->sistvcolcalibf = pSiS->sistvcolcalibc = 0;
1569 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1570 "Illegal Color Calibration. Range is -128 to 127 (fine), -120 to 120 (coarse)\n");
1572 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1573 &pSiS->tvxpos);
1574 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1575 &pSiS->tvypos);
1576 if(pSiS->tvxpos > 32) { pSiS->tvxpos = 32; tmp = 1; }
1577 if(pSiS->tvxpos < -32) { pSiS->tvxpos = -32; tmp = 1; }
1578 if(pSiS->tvypos > 32) { pSiS->tvypos = 32; tmp = 1; }
1579 if(pSiS->tvypos < -32) { pSiS->tvypos = -32; tmp = 1; }
1580 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1581 "Illegal TV x or y offset. Range is from -32 to 32\n");
1582 tmp = 0;
1583 xf86GetOptValInteger(pSiS->Options, OPTION_TVXSCALE,
1584 &pSiS->tvxscale);
1585 xf86GetOptValInteger(pSiS->Options, OPTION_TVYSCALE,
1586 &pSiS->tvyscale);
1587 if(pSiS->tvxscale > 16) { pSiS->tvxscale = 16; tmp = 1; }
1588 if(pSiS->tvxscale < -16) { pSiS->tvxscale = -16; tmp = 1; }
1589 if(pSiS->tvyscale > 3) { pSiS->tvyscale = 3; tmp = 1; }
1590 if(pSiS->tvyscale < -4) { pSiS->tvyscale = -4; tmp = 1; }
1591 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1592 "Illegal TV x or y scaling parameter. Range is from -16 to 16 (X), -4 to 3 (Y)\n");
1595 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
1596 int tmp = 0;
1597 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326FORCETVPPLUG);
1598 if(strptr) {
1599 if(!xf86NameCmp(strptr,"COMPOSITE"))
1600 pSiS->sis6326tvplug = 1;
1601 else if(!xf86NameCmp(strptr,"SVIDEO"))
1602 pSiS->sis6326tvplug = 0;
1603 else {
1604 SiS_PrintBadOpt(pScrn, strptr, OPTION_SIS6326FORCETVPPLUG);
1605 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1606 "%s \"COMPOSITE\" or \"SVIDEO\"\n", validparm);
1609 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326ENABLEYFILTER,
1610 &pSiS->sis6326enableyfilter);
1611 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326YFILTERSTRONG,
1612 &pSiS->sis6326yfilterstrong);
1613 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1614 &pSiS->tvxpos);
1615 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1616 &pSiS->tvypos);
1617 if(pSiS->tvxpos > 16) { pSiS->tvxpos = 16; tmp = 1; }
1618 if(pSiS->tvxpos < -16) { pSiS->tvxpos = -16; tmp = 1; }
1619 if(pSiS->tvypos > 16) { pSiS->tvypos = 16; tmp = 1; }
1620 if(pSiS->tvypos < -16) { pSiS->tvypos = -16; tmp = 1; }
1621 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1622 "Illegal TV x or y offset. Range is from -16 to 16\n");
1623 xf86GetOptValInteger(pSiS->Options, OPTION_SIS6326FSCADJUST,
1624 &pSiS->sis6326fscadjust);
1625 if(pSiS->sis6326fscadjust) {
1626 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1627 "Adjusting the default FSC by %d\n",
1628 pSiS->sis6326fscadjust);
1632 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA) ||
1633 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1634 Bool Is6326 = FALSE;
1635 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER);
1636 if(!strptr) {
1637 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER);
1638 Is6326 = TRUE;
1640 if(strptr) {
1641 if(!xf86NameCmp(strptr,"OFF"))
1642 pSiS->sistvantiflicker = 0;
1643 else if(!xf86NameCmp(strptr,"LOW"))
1644 pSiS->sistvantiflicker = 1;
1645 else if(!xf86NameCmp(strptr,"MED"))
1646 pSiS->sistvantiflicker = 2;
1647 else if(!xf86NameCmp(strptr,"HIGH"))
1648 pSiS->sistvantiflicker = 3;
1649 else if(!xf86NameCmp(strptr,"ADAPTIVE"))
1650 pSiS->sistvantiflicker = 4;
1651 else {
1652 pSiS->sistvantiflicker = -1;
1653 SiS_PrintBadOpt(pScrn, strptr, Is6326 ? OPTION_SIS6326FORCETVPPLUG : OPTION_SISTVANTIFLICKER);
1654 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1655 "%s \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n", validparm);
1660 /* CRT2Gamma - enable/disable/set gamma correction for CRT2
1661 * Since 2004/11/26, this option is a boolean and string option
1662 * simulaniously. "TRUE" (or other valid bool values) have the
1663 * same effect as before: The driver uses the (global) Gamma
1664 * for both CRT1 and CRT2. Otherwise, this option takes one or
1665 * three floats between 0.1 and 10.0 which define a separate
1666 * gamma correction for CRT2. (SiS video bridges only.)
1668 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1669 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2GAMMA))) {
1670 if(SiS_StrIsBoolOn(strptr)) {
1671 pSiS->CRT2gamma = TRUE;
1672 pSiS->CRT2SepGamma = FALSE;
1673 } else if(SiS_StrIsBoolOff(strptr)) {
1674 pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
1675 } else {
1676 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_CRT2GAMMA, gammaopt, strptr,
1677 &pSiS->GammaR2i, &pSiS->GammaG2i, &pSiS->GammaB2i)) {
1678 pSiS->GammaR2 = (float)pSiS->GammaR2i / 1000.0;
1679 pSiS->GammaG2 = (float)pSiS->GammaG2i / 1000.0;
1680 pSiS->GammaB2 = (float)pSiS->GammaB2i / 1000.0;
1681 pSiS->CRT2gamma = TRUE;
1682 if(!IsDHM) pSiS->CRT2SepGamma = TRUE;
1683 else {
1684 #ifdef SISDUALHEAD
1685 pSiS->CRT2SepGamma = FALSE;
1686 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1687 "CRT2Gamma values overrule default and Monitor Gamma\n");
1688 if(pScrn->monitor) {
1689 pScrn->monitor->gamma.red = pSiS->GammaR2;
1690 pScrn->monitor->gamma.green = pSiS->GammaG2;
1691 pScrn->monitor->gamma.blue = pSiS->GammaB2;
1693 #endif
1700 /* Default adaptor: Overlay (default) or blitter */
1701 if(pSiS->VGAEngine == SIS_315_VGA) {
1702 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVDEFAULTADAPTOR))) {
1703 if(!xf86NameCmp(strptr, "OVERLAY")) {
1704 pSiS->XvDefAdaptorBlit = FALSE;
1705 } else if(!xf86NameCmp(strptr, "BLITTER")) {
1706 pSiS->XvDefAdaptorBlit = TRUE;
1707 } else {
1708 SiS_PrintBadOpt(pScrn, strptr, OPTION_XVDEFAULTADAPTOR);
1709 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1710 "%s \"OVERLAY\" or \"BLITTER\"\n", validparm);
1715 if(xf86GetOptValBool(pSiS->Options, OPTION_XVMEMCPY, &val)) {
1716 pSiS->XvUseMemcpy = val ? TRUE : FALSE;
1717 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv will %suse memcpy()\n",
1718 val ? "" : "not ");
1721 #if defined(__i386__) || defined(__AMD64__) || defined(__amd64__)
1722 if(xf86GetOptValBool(pSiS->Options, OPTION_XVBENCHCPY, &val)) {
1723 pSiS->BenchMemCpy = val ? TRUE : FALSE;
1724 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1725 "Will %sbenchmark methods for system RAM to video RAM transfers\n",
1726 val ? "" : "not ");
1729 #ifndef SISCHECKOSSSE
1730 if(xf86GetOptValBool(pSiS->Options, OPTION_XVSSECOPY, &val)) {
1731 pSiS->XvSSEMemcpy = val ? TRUE : FALSE;
1732 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1733 "Will %s use SSE CPU instructions\n",
1734 val ? "eventually" : "not");
1736 #endif
1737 #endif /* __i386__ || __AMD64__ || __amd64__ */
1739 #ifdef SIS_CP
1740 SIS_CP_OPT_DOOPT
1741 #endif
1743 } /* DualHead */
1745 /* CRT1Gamma - enable/disable gamma correction for CRT1
1747 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT1GAMMA, &val)) {
1748 pSiS->CRT1gamma = val;
1749 pSiS->CRT1gammaGiven = TRUE;
1752 /* ForceCRT1Aspect, ForceCRT2Aspect */
1753 /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
1754 * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
1755 * output devices, not TV or DVI/LCD.
1757 if(pSiS->VGAEngine == SIS_315_VGA) {
1758 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE1ASPECT);
1759 if(strptr != NULL) {
1760 if(!xf86NameCmp(strptr,"WIDE")) {
1761 pSiS->SiS_Pr->SiS_UseWide = 1;
1762 } else if(!xf86NameCmp(strptr,"NORMAL")) {
1763 pSiS->SiS_Pr->SiS_UseWide = 0;
1764 } else {
1765 SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE1ASPECT);
1766 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
1767 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
1769 if(pSiS->SiS_Pr->SiS_UseWide != -1) {
1770 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1771 "CRT1 (VGA) aspect ratio will be assumed %s\n",
1772 pSiS->SiS_Pr->SiS_UseWide ? "wide" : "normal");
1775 if(pSiS->SiS_Pr->SiS_UseWideCRT2 != -1) {
1776 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1777 "CRT2 (VGA) aspect ratio will be assumed %s\n",
1778 pSiS->SiS_Pr->SiS_UseWideCRT2 ? "wide" : "normal");
1782 /* VESA - DEPRECATED
1783 * This option is for forcing the driver to use
1784 * the VESA BIOS extension for mode switching.
1786 if(xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) {
1787 if(IsDHM) {
1788 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
1789 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_VESA)].name);
1790 } else {
1791 pSiS->VESA = val ? 1 : 0;
1792 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1793 "VESA: VESA usage shall be %s\n",
1794 val ? enabledstr : disabledstr);
1795 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1796 "*** Option \"VESA\" is deprecated. *** \n");
1797 if(pSiS->VESA) pSiS->ForceCRT1Type = CRT1_VGA;
1801 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1802 /* InternalModes (300/315/330 series only)
1803 * The default behavior is to replace X's default modes with
1804 * a mode list generated out of the known and supported modes. Use
1805 * this option to disable this. NOT RECOMMENDED.
1807 if(xf86GetOptValBool(pSiS->Options, OPTION_INTERNALMODES, &val)) {
1808 pSiS->noInternalModes = val ? FALSE : TRUE;
1809 if(pSiS->noInternalModes) {
1810 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Usage of built-in modes is %s\n", disabledstr);
1816 /* ShadowFB */
1817 from = X_DEFAULT;
1818 if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) {
1819 #ifdef SISMERGED
1820 if(pSiS->MergedFB) {
1821 pSiS->ShadowFB = FALSE;
1822 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1823 "Shadow Framebuffer not supported in MergedFB mode\n");
1824 } else
1825 #endif
1826 from = X_CONFIG;
1828 if(pSiS->ShadowFB) {
1829 pSiS->NoAccel = TRUE;
1830 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
1831 pSiS->NoXvideo = TRUE;
1832 xf86DrvMsg(pScrn->scrnIndex, from,
1833 "Using \"Shadow Framebuffer\" - 2D acceleration and Xv disabled\n");
1834 #else
1835 xf86DrvMsg(pScrn->scrnIndex, from,
1836 "Using \"Shadow Framebuffer\" - 2D acceleration disabled\n");
1837 #endif
1840 /* Rotate */
1841 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) {
1842 #ifdef SISMERGED
1843 if(pSiS->MergedFB) {
1844 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1845 "Screen rotation not supported in MergedFB mode\n");
1846 } else
1847 #endif
1848 if(IsDHM) {
1849 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
1850 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_ROTATE)].name);
1851 } else if(!xf86NameCmp(strptr, "CW")) {
1852 pSiS->Rotate = 1;
1853 } else if(!xf86NameCmp(strptr, "CCW")) {
1854 pSiS->Rotate = -1;
1855 } else {
1856 SiS_PrintBadOpt(pScrn, strptr, OPTION_ROTATE);
1857 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1858 "%s \"CW\" or \"CCW\"\n", validparm);
1861 if(pSiS->Rotate) {
1862 pSiS->ShadowFB = TRUE;
1863 pSiS->NoAccel = TRUE;
1864 pSiS->HWCursor = FALSE;
1865 pSiS->NoXvideo = TRUE;
1866 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1867 "Rotating screen %sclockwise (2D acceleration and Xv disabled)\n",
1868 (pSiS->Rotate == -1) ? "counter " : "");
1872 /* Reflect */
1873 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_REFLECT))) {
1874 #ifdef SISMERGED
1875 if(pSiS->MergedFB) {
1876 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1877 "Screen reflection not supported in MergedFB mode\n");
1878 } else
1879 #endif
1880 if(IsDHM) {
1881 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
1882 pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_REFLECT)].name);
1883 } else if(pSiS->Rotate) {
1884 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1885 "Screen rotation and reflection are mutually exclusive\n");
1886 } else if(!xf86NameCmp(strptr, "X")) {
1887 pSiS->Reflect = 1;
1888 } else if(!xf86NameCmp(strptr, "Y")) {
1889 pSiS->Reflect = 2;
1890 } else if((!xf86NameCmp(strptr, "XY")) ||
1891 (!xf86NameCmp(strptr, "YX"))) {
1892 pSiS->Reflect = 3;
1893 } else {
1894 SiS_PrintBadOpt(pScrn, strptr, OPTION_REFLECT);
1895 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1896 "%s \"X\", \"Y\" or \"XY\"\n", validparm);
1899 if(pSiS->Reflect) {
1900 pSiS->ShadowFB = TRUE;
1901 pSiS->NoAccel = TRUE;
1902 pSiS->HWCursor = FALSE;
1903 pSiS->NoXvideo = TRUE;
1904 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1905 "Reflecting screen (2D acceleration and Xv disabled)\n");
1909 #ifdef XF86DRI
1910 /* DRI */
1911 from = X_DEFAULT;
1912 if(xf86GetOptValBool(pSiS->Options, OPTION_DRI, &pSiS->loadDRI)) {
1913 from = X_CONFIG;
1915 xf86DrvMsg(pScrn->scrnIndex, from, "DRI %s\n",
1916 pSiS->loadDRI ? enabledstr : disabledstr);
1918 /* AGPSize = GARTSize */
1919 if(xf86GetOptValInteger(pSiS->Options, OPTION_AGP_SIZE, &ival)) {
1920 if((ival >= 8) && (ival <= 512)) {
1921 pSiS->agpWantedPages = (ival * 1024 * 1024) / AGP_PAGE_SIZE;
1922 } else {
1923 SiS_PrintIlRange(pScrn, OPTION_AGP_SIZE, 8, 512, 0);
1926 #endif
1928 /* XVideo
1929 * Set enables/disables Xv hardware video acceleration
1931 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
1932 if((!pSiS->NoAccel) && (!pSiS->NoXvideo)) {
1933 #else
1934 if(!pSiS->NoXvideo) {
1935 #endif
1936 if(!xf86ReturnOptValBool(pSiS->Options, OPTION_XVIDEO, TRUE)) {
1937 pSiS->NoXvideo = TRUE;
1938 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension (Xv) disabled\n");
1941 if(!pSiS->NoXvideo) {
1943 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1944 /* XvOnCRT2
1945 * On chipsets with only one overlay (315, 650, 740, 330), the user can
1946 * choose to display the overlay on CRT1 or CRT2. By setting this
1947 * option to TRUE, the overlay will be displayed on CRT2. The
1948 * default is: CRT1 if only CRT1 available, CRT2 if only CRT2
1949 * available, and CRT1 if both is available and detected.
1950 * Since implementation of the XV_SWITCHCRT Xv property this only
1951 * selects the default CRT.
1953 if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
1954 pSiS->XvOnCRT2 = val ? TRUE : FALSE;
1958 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
1959 /* NoYV12 (for 5597/5598, 6326 and 530/620 only)
1960 * YV12 has problems with videos larger than 384x288. So
1961 * allow the user to disable YV12 support to force the
1962 * application to use YUV2 instead.
1964 if(xf86GetOptValBool(pSiS->Options, OPTION_YV12, &val)) {
1965 pSiS->NoYV12 = val ? 0 : 1;
1966 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1967 "Xv YV12/I420 support is %s\n",
1968 pSiS->NoYV12 ? disabledstr : enabledstr);
1972 /* Some Xv properties' defaults can be set by options */
1973 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFCONTRAST, &ival)) {
1974 if((ival >= 0) && (ival <= 7)) pSiS->XvDefCon = ival;
1975 else SiS_PrintIlRange(pScrn, OPTION_XVDEFCONTRAST, 0, 7, 0);
1977 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFBRIGHTNESS, &ival)) {
1978 if((ival >= -128) && (ival <= 127)) pSiS->XvDefBri = ival;
1979 else SiS_PrintIlRange(pScrn, OPTION_XVDEFBRIGHTNESS, -128, 127, 0);
1981 if(pSiS->VGAEngine == SIS_315_VGA) {
1982 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFHUE, &ival)) {
1983 if((ival >= -8) && (ival <= 7)) pSiS->XvDefHue = ival;
1984 else SiS_PrintIlRange(pScrn, OPTION_XVDEFHUE, -8, 7, 0);
1986 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFSATURATION, &ival)) {
1987 if((ival >= -7) && (ival <= 7)) pSiS->XvDefSat = ival;
1988 else SiS_PrintIlRange(pScrn, OPTION_XVDEFSATURATION, -7, 7, 0);
1991 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFX, &val)) {
1992 if(val) pSiS->XvDefDisableGfx = TRUE;
1993 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1994 "Graphics display will be %s during Xv usage\n",
1995 val ? disabledstr : enabledstr);
1997 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1998 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFXLR, &val)) {
1999 if(val) pSiS->XvDefDisableGfxLR = TRUE;
2000 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2001 "Graphics display left/right of overlay will be %s during Xv usage\n",
2002 val ? disabledstr : enabledstr);
2004 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDISABLECOLORKEY, &val)) {
2005 if(val) pSiS->XvDisableColorKey = TRUE;
2006 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2007 "Xv Color key is %s\n",
2008 val ? disabledstr : enabledstr);
2010 if(xf86GetOptValBool(pSiS->Options, OPTION_XVUSECHROMAKEY, &val)) {
2011 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2012 "Xv Chroma-keying is %s\n",
2013 val ? enabledstr : disabledstr);
2014 if(val) pSiS->XvUseChromaKey = TRUE;
2016 if(xf86GetOptValBool(pSiS->Options, OPTION_XVINSIDECHROMAKEY, &val)) {
2017 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2018 "Xv: Video is transparent if %s chroma key range\n",
2019 val ? "inside" : "outside");
2020 if(val) pSiS->XvInsideChromaKey = TRUE;
2022 if(pSiS->VGAEngine == SIS_300_VGA) {
2023 if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
2024 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
2025 "Xv: Chroma key is in %s format\n",
2026 val ? "YUV" : "RGB");
2027 if(val) pSiS->XvYUVChromaKey = TRUE;
2029 } else {
2030 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
2031 "Xv: Chroma key is of same format as video source\n");
2033 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMIN, &ival)) {
2034 if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMin = ival;
2035 else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMIN, 0, 0xffffff, 1);
2037 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMAX, &ival)) {
2038 if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMax = ival;
2039 else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMAX, 0, 0xffffff, 1);
2043 if(pSiS->VGAEngine == SIS_315_VGA) {
2044 /* XvGamma - enable/disable gamma correction for Xv
2045 * Supported for CRT1 only
2047 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVGAMMA))) {
2048 if(SiS_StrIsBoolOn(strptr)) {
2049 pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
2050 } else if(SiS_StrIsBoolOff(strptr)) {
2051 pSiS->XvGamma = FALSE;
2052 pSiS->XvGammaGiven = TRUE;
2053 } else {
2054 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_XVGAMMA, gammaopt, strptr,
2055 &pSiS->XvGammaRed, &pSiS->XvGammaGreen, &pSiS->XvGammaBlue)) {
2056 pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
2057 pSiS->XvGammaRedDef = pSiS->XvGammaRed;
2058 pSiS->XvGammaGreenDef = pSiS->XvGammaGreen;
2059 pSiS->XvGammaBlue = pSiS->XvGammaBlue;
2067 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
2068 Bool GotBri = FALSE, GotPBri = FALSE;
2069 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI))) {
2070 SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI, briopt, strptr,
2071 &pSiS->GammaBriR, &pSiS->GammaBriG, &pSiS->GammaBriB);
2072 GotBri = TRUE;
2074 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDPBRI))) {
2075 SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDPBRI, briopt, strptr,
2076 &pSiS->GammaPBriR, &pSiS->GammaPBriG, &pSiS->GammaPBriB);
2077 GotPBri = TRUE;
2079 if((!IsDHM) || (IsDHM && !IsSecondHead)) {
2080 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI2))) {
2081 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI2, briopt, strptr,
2082 &pSiS->GammaBriR2, &pSiS->GammaBriG2, &pSiS->GammaBriB2)) {
2083 if(IsDHM) {
2084 #ifdef SISDUALHEAD
2085 if(GotBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDBRI2, OPTION_STOREDBRI);
2086 pSiS->GammaBriR = pSiS->GammaBriR2;
2087 pSiS->GammaBriG = pSiS->GammaBriG2;
2088 pSiS->GammaBriB = pSiS->GammaBriB2;
2089 #endif
2090 } else pSiS->CRT2SepGamma = TRUE;
2093 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDPBRI2))) {
2094 if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDPBRI2, briopt, strptr,
2095 &pSiS->GammaPBriR2, &pSiS->GammaPBriG2, &pSiS->GammaPBriB2)) {
2096 if(IsDHM) {
2097 #ifdef SISDUALHEAD
2098 if(GotPBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDPBRI2, OPTION_STOREDPBRI);
2099 pSiS->GammaPBriR = pSiS->GammaPBriR2;
2100 pSiS->GammaPBriG = pSiS->GammaPBriG2;
2101 pSiS->GammaPBriB = pSiS->GammaPBriB2;
2102 #endif
2103 } else pSiS->CRT2SepGamma = TRUE;
2111 const OptionInfoRec *
2112 SISAvailableOptions(int chipid, int busid)
2114 return SISOptions;