DRI XFree86-4_3_99_12-merge import
[xf86-video-sis/mirage.git] / src / sis_opt.c
blobb0e06774b69ebc077f88a3daec9c147cb37748ef
1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.31 2003/09/04 15:32:44 twini Exp $ */
2 /*
3 * SiS driver option evaluation
5 * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria
7 * Based on code by ? (included in XFree86 4.1)
9 * Permission to use, copy, modify, distribute, and sell this software and its
10 * documentation for any purpose is hereby granted without fee, provided that
11 * the above copyright notice appear in all copies and that both that
12 * copyright notice and this permission notice appear in supporting
13 * documentation, and that the name of the supplier not be used in
14 * advertising or publicity pertaining to distribution of the software without
15 * specific, written prior permission. The supplier makes no representations
16 * about the suitability of this software for any purpose. It is provided
17 * "as is" without express or implied warranty.
19 * THE SUPPLIER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
21 * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
23 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
24 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25 * PERFORMANCE OF THIS SOFTWARE.
27 * Authors: Thomas Winischhofer <thomas@winischhofer.net>
28 * ?
31 #include "xf86.h"
32 #include "xf86PciInfo.h"
33 #include "xf86str.h"
34 #include "xf86Cursor.h"
36 #include "sis.h"
38 extern const customttable mycustomttable[];
40 typedef enum {
41 OPTION_SW_CURSOR,
42 OPTION_HW_CURSOR,
43 /* OPTION_PCI_RETRY, */
44 OPTION_NOACCEL,
45 OPTION_TURBOQUEUE,
46 OPTION_FAST_VRAM,
47 OPTION_NOHOSTBUS,
48 /* OPTION_SET_MEMCLOCK, */
49 OPTION_RENDER,
50 OPTION_FORCE_CRT2TYPE,
51 OPTION_SHADOW_FB,
52 OPTION_ROTATE,
53 OPTION_NOXVIDEO,
54 OPTION_VESA,
55 OPTION_MAXXFBMEM,
56 OPTION_FORCECRT1,
57 OPTION_XVONCRT2,
58 OPTION_PDC,
59 OPTION_TVSTANDARD,
60 OPTION_USEROMDATA,
61 OPTION_NOINTERNALMODES,
62 OPTION_USEOEM,
63 OPTION_NOYV12,
64 OPTION_CHTVOVERSCAN,
65 OPTION_CHTVSOVERSCAN,
66 OPTION_CHTVLUMABANDWIDTHCVBS,
67 OPTION_CHTVLUMABANDWIDTHSVIDEO,
68 OPTION_CHTVLUMAFLICKERFILTER,
69 OPTION_CHTVCHROMABANDWIDTH,
70 OPTION_CHTVCHROMAFLICKERFILTER,
71 OPTION_CHTVCVBSCOLOR,
72 OPTION_CHTVTEXTENHANCE,
73 OPTION_CHTVCONTRAST,
74 OPTION_SISTVEDGEENHANCE,
75 OPTION_SISTVANTIFLICKER,
76 OPTION_SISTVSATURATION,
77 OPTION_SISTVCHROMAFILTER,
78 OPTION_SISTVLUMAFILTER,
79 OPTION_SISTVCOLCALIBFINE,
80 OPTION_SISTVCOLCALIBCOARSE,
81 OPTION_TVXPOSOFFSET,
82 OPTION_TVYPOSOFFSET,
83 OPTION_TVXSCALE,
84 OPTION_TVYSCALE,
85 OPTION_SIS6326ANTIFLICKER,
86 OPTION_SIS6326ENABLEYFILTER,
87 OPTION_SIS6326YFILTERSTRONG,
88 OPTION_SIS6326FORCETVPPLUG,
89 OPTION_SIS6326FSCADJUST,
90 OPTION_CHTVTYPE,
91 OPTION_USERGBCURSOR,
92 OPTION_USERGBCURSORBLEND,
93 OPTION_USERGBCURSORBLENDTH,
94 OPTION_RESTOREBYSET,
95 OPTION_NODDCFORCRT2,
96 OPTION_FORCECRT2REDETECTION,
97 OPTION_CRT1GAMMA,
98 OPTION_CRT2GAMMA,
99 OPTION_XVDEFCONTRAST,
100 OPTION_XVDEFBRIGHTNESS,
101 OPTION_XVDEFHUE,
102 OPTION_XVDEFSATURATION,
103 OPTION_XVDEFDISABLEGFX,
104 OPTION_XVDEFDISABLEGFXLR,
105 OPTION_XVMEMCPY,
106 OPTION_XVUSECHROMAKEY,
107 OPTION_XVCHROMAMIN,
108 OPTION_XVCHROMAMAX,
109 OPTION_XVDISABLECOLORKEY,
110 OPTION_XVINSIDECHROMAKEY,
111 OPTION_XVYUVCHROMAKEY,
112 OPTION_SCALELCD,
113 OPTION_SPECIALTIMING,
114 OPTION_LVDSHL,
115 OPTION_ENABLEHOTKEY,
116 OPTION_MERGEDFB,
117 OPTION_CRT2HSYNC,
118 OPTION_CRT2VREFRESH,
119 OPTION_CRT2POS,
120 OPTION_METAMODES,
121 OPTION_MERGEDFB2,
122 OPTION_CRT2HSYNC2,
123 OPTION_CRT2VREFRESH2,
124 OPTION_CRT2POS2,
125 OPTION_NOSISXINERAMA,
126 OPTION_NOSISXINERAMA2,
127 OPTION_CRT2ISSCRN0,
128 OPTION_ENABLESISCTRL,
129 OPTION_STOREDBRIR,
130 OPTION_STOREDBRIG,
131 OPTION_STOREDBRIB,
132 OPTION_STOREDPBRIR,
133 OPTION_STOREDPBRIG,
134 OPTION_STOREDPBRIB,
135 #ifdef SIS_CP
136 SIS_CP_OPT_OPTIONS
137 #endif
138 OPTION_PSEUDO
139 } SISOpts;
141 static const OptionInfoRec SISOptions[] = {
142 { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
143 { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
144 /* { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, */
145 { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
146 { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE },
147 /* { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, */
148 { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
149 { OPTION_NOHOSTBUS, "NoHostBus", OPTV_BOOLEAN, {0}, FALSE },
150 { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
151 { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_ANYSTR, {0}, FALSE },
152 { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
153 { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
154 { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE },
155 { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE },
156 { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, -1 },
157 { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE },
158 { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE },
159 { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, -1 },
160 { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, -1 },
161 { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, -1 },
162 { OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE },
163 { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, -1 },
164 { OPTION_NOYV12, "NoYV12", OPTV_BOOLEAN, {0}, -1 },
165 { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, -1 },
166 { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, -1 },
167 { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, -1 },
168 { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, -1 },
169 { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO",OPTV_INTEGER, {0}, -1 },
170 { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, -1 },
171 { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, -1 },
172 { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter",OPTV_INTEGER, {0}, -1 },
173 { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, -1 },
174 { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, -1 },
175 { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, -1 },
176 { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, -1 },
177 { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_STRING, {0}, FALSE },
178 { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, -1 },
179 { OPTION_SISTVCHROMAFILTER, "SISTVCFilter", OPTV_BOOLEAN, {0}, -1 },
180 { OPTION_SISTVLUMAFILTER, "SISTVYFilter", OPTV_INTEGER, {0}, -1 },
181 { OPTION_SISTVCOLCALIBFINE, "SISTVColorCalibFine", OPTV_INTEGER, {0}, -1 },
182 { OPTION_SISTVCOLCALIBCOARSE, "SISTVColorCalibCoarse", OPTV_INTEGER, {0}, -1 },
183 { OPTION_TVXSCALE, "SISTVXScale", OPTV_INTEGER, {0}, -1 },
184 { OPTION_TVYSCALE, "SISTVYScale", OPTV_INTEGER, {0}, -1 },
185 { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, -1 },
186 { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, -1 },
187 { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE },
188 { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, -1 },
189 { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, -1 },
190 { OPTION_SIS6326FORCETVPPLUG, "SIS6326TVForcePlug", OPTV_STRING, {0}, -1 },
191 { OPTION_SIS6326FSCADJUST, "SIS6326FSCAdjust", OPTV_INTEGER, {0}, -1 },
192 { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, -1 },
193 { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, -1 },
194 { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER, {0}, -1 },
195 { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, -1 },
196 { OPTION_NODDCFORCRT2, "NoCRT2Detection", OPTV_BOOLEAN, {0}, -1 },
197 { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, -1 },
198 { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, -1 },
199 { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_BOOLEAN, {0}, -1 },
200 { OPTION_XVDEFCONTRAST, "XvDefaultContrast", OPTV_INTEGER, {0}, -1 },
201 { OPTION_XVDEFBRIGHTNESS, "XvDefaultBrightness", OPTV_INTEGER, {0}, -1 },
202 { OPTION_XVDEFHUE, "XvDefaultHue", OPTV_INTEGER, {0}, -1 },
203 { OPTION_XVDEFSATURATION, "XvDefaultSaturation", OPTV_INTEGER, {0}, -1 },
204 { OPTION_XVDEFDISABLEGFX, "XvDefaultDisableGfx", OPTV_BOOLEAN, {0}, -1 },
205 { OPTION_XVDEFDISABLEGFXLR, "XvDefaultDisableGfxLR", OPTV_BOOLEAN, {0}, -1 },
206 { OPTION_XVCHROMAMIN, "XvChromaMin", OPTV_INTEGER, {0}, -1 },
207 { OPTION_XVCHROMAMAX, "XvChromaMax", OPTV_INTEGER, {0}, -1 },
208 { OPTION_XVUSECHROMAKEY, "XvUseChromaKey", OPTV_BOOLEAN, {0}, -1 },
209 { OPTION_XVINSIDECHROMAKEY, "XvInsideChromaKey", OPTV_BOOLEAN, {0}, -1 },
210 { OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, -1 },
211 { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, -1 },
212 { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, -1 },
213 { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, -1 },
214 { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, -1 },
215 { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 },
216 { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 },
217 { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, -1 },
218 { OPTION_STOREDBRIR, "StoredGammaBrightnessRed", OPTV_INTEGER, {0}, -1 },
219 { OPTION_STOREDBRIG, "StoredGammaBrightnessGreen", OPTV_INTEGER, {0}, -1 },
220 { OPTION_STOREDBRIB, "StoredGammaBrightnessBlue", OPTV_INTEGER, {0}, -1 },
221 { OPTION_STOREDPBRIR, "StoredGammaPreBrightnessRed", OPTV_INTEGER, {0}, -1 },
222 { OPTION_STOREDPBRIG, "StoredGammaPreBrightnessGreen", OPTV_INTEGER, {0}, -1 },
223 { OPTION_STOREDPBRIB, "StoredGammaPreBrightnessBlue", OPTV_INTEGER, {0}, -1 },
224 #ifdef SISMERGED
225 { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE },
226 { OPTION_CRT2HSYNC, "CRT2HSync", OPTV_ANYSTR, {0}, FALSE },
227 { OPTION_CRT2VREFRESH, "CRT2VRefresh", OPTV_ANYSTR, {0}, FALSE },
228 { OPTION_CRT2POS, "CRT2Position", OPTV_ANYSTR, {0}, FALSE },
229 { OPTION_METAMODES, "MetaModes", OPTV_ANYSTR, {0}, FALSE },
230 { OPTION_MERGEDFB2, "TwinView", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
231 { OPTION_CRT2HSYNC2, "SecondMonitorHorizSync", OPTV_ANYSTR, {0}, FALSE }, /* alias */
232 { OPTION_CRT2VREFRESH2, "SecondMonitorVertRefresh", OPTV_ANYSTR, {0}, FALSE }, /* alias */
233 { OPTION_CRT2POS2, "TwinViewOrientation", OPTV_ANYSTR, {0}, FALSE }, /* alias */
234 #ifdef SISXINERAMA
235 { OPTION_NOSISXINERAMA, "NoMergedXinerama", OPTV_BOOLEAN, {0}, FALSE },
236 { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0", OPTV_BOOLEAN, {0}, FALSE },
237 { OPTION_NOSISXINERAMA2, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
238 #endif
239 #endif
240 #ifdef SIS_CP
241 SIS_CP_OPTION_DETAIL
242 #endif
243 { -1, NULL, OPTV_NONE, {0}, FALSE }
246 void
247 SiSOptions(ScrnInfoPtr pScrn)
249 SISPtr pSiS = SISPTR(pScrn);
250 MessageType from;
251 /* double temp; */
252 char *strptr;
253 static const char *mybadparm = "\"%s\" is is not a valid parameter for option \"%s\"\n";
254 static const char *disabledstr = "disabled";
255 static const char *enabledstr = "enabled";
256 static const char *ilrangestr = "Illegal %s parameter. Valid range is %d through %d\n";
258 /* Collect all of the relevant option flags (fill in pScrn->options) */
259 xf86CollectOptions(pScrn, NULL);
261 /* Process the options */
262 if(!(pSiS->Options = xalloc(sizeof(SISOptions))))
263 return;
265 memcpy(pSiS->Options, SISOptions, sizeof(SISOptions));
267 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSiS->Options);
269 /* Set defaults */
271 pSiS->newFastVram = -1;
272 pSiS->NoHostBus = FALSE;
273 /* pSiS->UsePCIRetry = TRUE; */
274 pSiS->TurboQueue = TRUE;
275 #ifdef SISVRAMQ
276 /* TODO: Option (315 series VRAM command queue) */
277 /* But beware: sisfb does not know about this!!! */
278 pSiS->cmdQueueSize = 512*1024;
279 #endif
280 pSiS->doRender = TRUE;
281 pSiS->HWCursor = TRUE;
282 pSiS->Rotate = FALSE;
283 pSiS->ShadowFB = FALSE;
284 pSiS->VESA = -1;
285 pSiS->NoXvideo = FALSE;
286 pSiS->maxxfbmem = 0;
287 pSiS->forceCRT1 = -1;
288 pSiS->DSTN = FALSE;
289 pSiS->FSTN = FALSE;
290 pSiS->XvOnCRT2 = FALSE;
291 pSiS->NoYV12 = -1;
292 pSiS->PDC = -1;
293 pSiS->OptTVStand = -1;
294 pSiS->OptROMUsage = -1;
295 pSiS->noInternalModes = FALSE;
296 pSiS->OptUseOEM = -1;
297 pSiS->OptTVOver = -1;
298 pSiS->OptTVSOver = -1;
299 pSiS->chtvlumabandwidthcvbs = -1;
300 pSiS->chtvlumabandwidthsvideo = -1;
301 pSiS->chtvlumaflickerfilter = -1;
302 pSiS->chtvchromabandwidth = -1;
303 pSiS->chtvchromaflickerfilter = -1;
304 pSiS->chtvcvbscolor = -1;
305 pSiS->chtvtextenhance = -1;
306 pSiS->chtvcontrast = -1;
307 pSiS->sistvedgeenhance = -1;
308 pSiS->sistvantiflicker = -1;
309 pSiS->sistvsaturation = -1;
310 pSiS->sistvcfilter = -1;
311 pSiS->sistvyfilter = 1; /* 0 = off, 1 = default, 2-8 = filter no */
312 pSiS->sistvcolcalibc = 0;
313 pSiS->sistvcolcalibf = 0;
314 pSiS->sis6326enableyfilter = -1;
315 pSiS->sis6326yfilterstrong = -1;
316 pSiS->sis6326tvplug = -1;
317 pSiS->sis6326fscadjust = 0;
318 pSiS->tvxpos = 0;
319 pSiS->tvypos = 0;
320 pSiS->tvxscale = 0;
321 pSiS->tvyscale = 0;
322 pSiS->NonDefaultPAL = -1;
323 pSiS->chtvtype = -1;
324 pSiS->restorebyset = TRUE;
325 pSiS->nocrt2ddcdetection = FALSE;
326 pSiS->forcecrt2redetection = FALSE;
327 pSiS->ForceCRT2Type = CRT2_DEFAULT;
328 pSiS->ForceTVType = -1;
329 pSiS->CRT1gamma = TRUE;
330 pSiS->CRT2gamma = TRUE;
331 pSiS->enablesisctrl = FALSE;
332 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
333 pSiS->XvDefBri = 10;
334 pSiS->XvDefCon = 5;
335 } else {
336 pSiS->XvDefBri = 0;
337 pSiS->XvDefCon = 4;
339 pSiS->XvDefHue = 0;
340 pSiS->XvDefSat = 0;
341 pSiS->XvDefDisableGfx = FALSE;
342 pSiS->XvDefDisableGfxLR = FALSE;
343 pSiS->UsePanelScaler = -1;
344 pSiS->XvUseMemcpy = TRUE;
345 pSiS->XvUseChromaKey = FALSE;
346 pSiS->XvDisableColorKey = FALSE;
347 pSiS->XvInsideChromaKey = FALSE;
348 pSiS->XvYUVChromaKey = FALSE;
349 pSiS->XvChromaMin = 0x000101fe;
350 pSiS->XvChromaMax = 0x000101ff;
351 pSiS->GammaBriR = pSiS->GammaBriG = pSiS->GammaBriB = 1000;
352 pSiS->GammaPBriR = pSiS->GammaPBriG = pSiS->GammaPBriB = 1000;
353 pSiS->HideHWCursor = FALSE;
354 pSiS->HWCursorIsVisible = FALSE;
355 #ifdef SISMERGED
356 pSiS->MergedFB = FALSE;
357 pSiS->CRT2Position = sisRightOf;
358 pSiS->CRT2HSync = NULL;
359 pSiS->CRT2VRefresh = NULL;
360 pSiS->MetaModes = NULL;
361 #ifdef SISXINERAMA
362 pSiS->UseSiSXinerama = TRUE;
363 pSiS->CRT2IsScrn0 = FALSE;
364 #endif
365 #endif
366 #ifdef SIS_CP
367 SIS_CP_OPT_DEFAULT
368 #endif
370 /* Chipset dependent defaults */
372 if(pSiS->Chipset == PCI_CHIP_SIS530) {
373 /* TW: TQ still broken on 530/620? */
374 pSiS->TurboQueue = FALSE;
377 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
378 pSiS->newFastVram = 1;
381 if(pSiS->sishw_ext.jChipType == SIS_315H ||
382 pSiS->sishw_ext.jChipType == SIS_315) {
383 /* Cursor engine seriously broken */
384 pSiS->HWCursor = FALSE;
387 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
388 pSiS->OptUseColorCursor = 0;
389 #else
390 if(pSiS->VGAEngine == SIS_300_VGA) {
391 pSiS->OptUseColorCursor = 0;
392 pSiS->OptUseColorCursorBlend = 1;
393 pSiS->OptColorCursorBlendThreshold = 0x37000000;
394 } else if(pSiS->VGAEngine == SIS_315_VGA) {
395 pSiS->OptUseColorCursor = 1;
397 #endif
398 if(pSiS->VGAEngine == SIS_300_VGA) {
399 pSiS->AllowHotkey = 0;
400 } else if(pSiS->VGAEngine == SIS_315_VGA) {
401 pSiS->AllowHotkey = 1;
404 /* Collect the options */
406 #if 0
407 /* PCI retry - What the heck is/was this for? */
408 from = X_DEFAULT;
409 if(xf86GetOptValBool(pSiS->Options, OPTION_PCI_RETRY, &pSiS->UsePCIRetry)) {
410 from = X_CONFIG;
412 xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry %s\n",
413 pSiS->UsePCIRetry ? enabledstr : disabledstr);
414 #endif
416 /* Mem clock */
417 #if 0 /* This is not used */
418 if(xf86GetOptValFreq(pSiS->Options, OPTION_SET_MEMCLOCK, OPTUNITS_MHZ,
419 &temp)) {
420 pSiS->MemClock = (int)(temp * 1000.0);
421 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
422 "Memory clock set to %.3f MHz\n", pSiS->MemClock/1000.0);
424 #endif
426 /* FastVRAM (5597/5598, 6326 and 530/620 only)
428 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
429 from = X_DEFAULT;
430 if(xf86GetOptValBool(pSiS->Options, OPTION_FAST_VRAM, &pSiS->newFastVram)) {
431 from = X_CONFIG;
433 xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM %s\n",
434 (pSiS->newFastVram == -1) ?
435 ((pSiS->oldChipset == OC_SIS620) ? "enabled (for read only)" :
436 "enabled (for write only)") :
437 (pSiS->newFastVram ? "enabled (for read and write)" : disabledstr));
440 /* NoHostBus (5597/5598 only)
442 if((pSiS->Chipset == PCI_CHIP_SIS5597)) {
443 from = X_DEFAULT;
444 if(xf86GetOptValBool(pSiS->Options, OPTION_NOHOSTBUS, &pSiS->NoHostBus)) {
445 from = X_CONFIG;
447 xf86DrvMsg(pScrn->scrnIndex, from, "SiS5597/5598 VGA-to-CPU host bus %s\n",
448 pSiS->NoHostBus ? disabledstr : enabledstr);
451 /* MaxXFBMem
452 * This options limits the amount of video memory X uses for screen
453 * and off-screen buffers. This option should be used if using DRI
454 * is intended. The kernel framebuffer driver required for DRM will
455 * start its memory heap at 12MB if it detects more than 16MB, at 8MB if
456 * between 8 and 16MB are available, otherwise at 4MB. So, if the amount
457 * of memory X uses, a clash between the framebuffer's memory heap
458 * and X is avoided. The amount is to be specified in KB.
460 if(xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM,
461 &pSiS->maxxfbmem)) {
462 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
463 "MaxXFBMem: Framebuffer memory shall be limited to %d KB\n",
464 pSiS->maxxfbmem);
465 pSiS->maxxfbmem *= 1024;
468 /* NoAccel
469 * Turns off 2D acceleration
471 if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOACCEL, FALSE)) {
472 pSiS->NoAccel = TRUE;
473 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
474 pSiS->NoXvideo = TRUE;
475 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration and Xv disabled\n");
476 #else
477 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration disabled\n");
478 #endif
482 /* RenderAcceleration
483 * En/Disables RENDER acceleration (315/330 series only)
485 if((pSiS->VGAEngine == SIS_315_VGA) && (!pSiS->NoAccel)) {
486 if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) {
487 if(!pSiS->doRender) {
488 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n");
493 /* SWCursor
494 * HWCursor
495 * Chooses whether to use the hardware or software cursor
497 from = X_DEFAULT;
498 if(xf86GetOptValBool(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) {
499 from = X_CONFIG;
501 if(xf86ReturnOptValBool(pSiS->Options, OPTION_SW_CURSOR, FALSE)) {
502 from = X_CONFIG;
503 pSiS->HWCursor = FALSE;
504 pSiS->OptUseColorCursor = 0;
506 xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
507 pSiS->HWCursor ? "HW" : "SW");
510 * UseColorHWCursor
511 * ColorHWCursorBlending
512 * ColorHWCursorBlendThreshold
514 * Enable/disable color hardware cursors;
515 * enable/disable color hw cursor emulation for 300 series
516 * select emultation transparency threshold for 300 series
519 #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
520 #ifdef ARGB_CURSOR
521 #ifdef SIS_ARGB_CURSOR
522 if((pSiS->HWCursor) && ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA))) {
523 from = X_DEFAULT;
524 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSOR, &pSiS->OptUseColorCursor)) {
525 from = X_CONFIG;
527 xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n",
528 pSiS->OptUseColorCursor ? enabledstr : disabledstr);
530 if(pSiS->VGAEngine == SIS_300_VGA) {
531 from = X_DEFAULT;
532 if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) {
533 from = X_CONFIG;
535 if(pSiS->OptUseColorCursor) {
536 xf86DrvMsg(pScrn->scrnIndex, from,
537 "HW cursor color blending emulation is %s\n",
538 (pSiS->OptUseColorCursorBlend) ? enabledstr : disabledstr);
541 int temp;
542 from = X_DEFAULT;
543 if(xf86GetOptValInteger(pSiS->Options, OPTION_USERGBCURSORBLENDTH, &temp)) {
544 if((temp >= 0) && (temp <= 255)) {
545 from = X_CONFIG;
546 pSiS->OptColorCursorBlendThreshold = (temp << 24);
547 } else {
548 temp = pSiS->OptColorCursorBlendThreshold >> 24;
549 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
550 "Illegal color HW cursor blending threshold, valid range 0-255\n");
552 } else {
553 temp = pSiS->OptColorCursorBlendThreshold >> 24;
555 if(pSiS->OptUseColorCursor) {
556 if(pSiS->OptUseColorCursorBlend) {
557 xf86DrvMsg(pScrn->scrnIndex, from,
558 "HW cursor color blending emulation threshold is %d\n", temp);
564 #endif
565 #endif
566 #endif
569 * MergedFB
571 * Enable/disable and configure merged framebuffer mode
574 #ifdef SISMERGED
575 #ifdef SISDUALHEAD
576 if(pSiS->DualHeadMode) {
577 Bool val;
578 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFB, &val)) {
579 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
580 "Option \"MergedFB\" cannot be used in Dual Head mode\n");
582 } else
583 #endif
584 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
585 Bool val;
586 if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFB, &val)) {
587 if(val) pSiS->MergedFB = TRUE;
588 } else if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFB2, &val)) {
589 if(val) pSiS->MergedFB = TRUE;
592 if(pSiS->MergedFB) {
593 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS);
594 if(!strptr) {
595 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS2);
597 if(strptr) {
598 if(!xf86NameCmp(strptr,"LeftOf")) {
599 pSiS->CRT2Position = sisLeftOf;
600 #ifdef SISXINERAMA
601 pSiS->CRT2IsScrn0 = TRUE;
602 #endif
603 } else if(!xf86NameCmp(strptr,"RightOf")) {
604 pSiS->CRT2Position = sisRightOf;
605 #ifdef SISXINERAMA
606 pSiS->CRT2IsScrn0 = FALSE;
607 #endif
608 } else if(!xf86NameCmp(strptr,"Above")) {
609 pSiS->CRT2Position = sisAbove;
610 #ifdef SISXINERAMA
611 pSiS->CRT2IsScrn0 = FALSE;
612 #endif
613 } else if(!xf86NameCmp(strptr,"Below")) {
614 pSiS->CRT2Position = sisBelow;
615 #ifdef SISXINERAMA
616 pSiS->CRT2IsScrn0 = TRUE;
617 #endif
618 } else if(!xf86NameCmp(strptr,"Clone")) {
619 pSiS->CRT2Position = sisClone;
620 #ifdef SISXINERAMA
621 pSiS->CRT2IsScrn0 = TRUE;
622 #endif
623 } else {
624 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "CRT2Position");
625 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
626 "Valid parameters are \"RightOf\", \"LeftOf\", \"Above\", \"Below\", or \"Clone\"\n");
629 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_METAMODES);
630 if(strptr) {
631 pSiS->MetaModes = xalloc(strlen(strptr) + 1);
632 if(pSiS->MetaModes) memcpy(pSiS->MetaModes, strptr, strlen(strptr) + 1);
634 if(pSiS->MetaModes) {
635 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC);
636 if(!strptr) {
637 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2HSYNC2);
639 if(strptr) {
640 pSiS->CRT2HSync = xalloc(strlen(strptr) + 1);
641 if(pSiS->CRT2HSync) memcpy(pSiS->CRT2HSync, strptr, strlen(strptr) + 1);
643 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH);
644 if(!strptr) {
645 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2VREFRESH2);
647 if(strptr) {
648 pSiS->CRT2VRefresh = xalloc(strlen(strptr) + 1);
649 if(pSiS->CRT2VRefresh) memcpy(pSiS->CRT2VRefresh, strptr, strlen(strptr) + 1);
651 } else {
652 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
653 "Option \"MergedFB\" (alias \"TwinView\") requires Option \"MetaModes\".\n");
654 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
655 "MergedFB (alias TwinView) mode disabled.\n");
656 pSiS->MergedFB = FALSE;
658 #ifdef SISXINERAMA
659 if(pSiS->MergedFB) {
660 if(xf86GetOptValBool(pSiS->Options, OPTION_NOSISXINERAMA, &val)) {
661 if(val) pSiS->UseSiSXinerama = FALSE;
662 } else if(xf86GetOptValBool(pSiS->Options, OPTION_NOSISXINERAMA2, &val)) {
663 if(val) pSiS->UseSiSXinerama = FALSE;
665 if(pSiS->UseSiSXinerama) {
666 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
667 pSiS->CRT2IsScrn0 = val ? TRUE : FALSE;
671 #endif
674 #endif
676 /* Some options can only be specified in the Master Head's Device
677 * section. Here we give the user a hint in the log.
679 #ifdef SISDUALHEAD
680 if((pSiS->DualHeadMode) && (pSiS->SecondHead)) {
681 static const char *mystring = "Option \"%s\" is only accepted in Master Head's device section\n";
682 Bool val;
683 int vali;
684 if(pSiS->VGAEngine != SIS_315_VGA) {
685 if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &val)) {
686 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "TurboQueue");
689 if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
690 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "RestoreBySetMode");
692 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLEHOTKEY, &val)) {
693 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EnableHotKey");
695 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLESISCTRL, &val)) {
696 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EnableSiSCtrl");
698 if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
699 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "UseROMData");
701 if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
702 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "UseOEMData");
704 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
705 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT1");
707 if(xf86GetOptValBool(pSiS->Options, OPTION_NODDCFORCRT2, &val)) {
708 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "NoCRT2Detection");
710 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
711 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2ReDetection");
713 if(xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE)) {
714 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2Type");
716 if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
717 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ScaleLCD");
719 if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &vali)) {
720 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "PanelDelayCompensation");
722 if(xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING)) {
723 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SpecialTiming");
725 if(xf86GetOptValString(pSiS->Options, OPTION_LVDSHL)) {
726 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "LVDSHL");
728 if(xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD)) {
729 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "TVStandard");
731 if(xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE)) {
732 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CHTVType");
734 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) {
735 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CHTVOverscan");
737 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &val)) {
738 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CHTVSuperOverscan");
740 if((xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS, &vali)) ||
741 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO, &vali)) ||
742 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER, &vali)) ||
743 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH, &vali)) ||
744 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER, &vali)) ||
745 (xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR, &val)) ||
746 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE, &vali)) ||
747 (xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST, &vali)) ||
748 (xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE, &vali)) ||
749 (xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER)) ||
750 (xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION, &vali)) ||
751 (xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER, &val)) ||
752 (xf86GetOptValInteger(pSiS->Options, OPTION_SISTVLUMAFILTER, &vali)) ||
753 (xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBCOARSE, &vali)) ||
754 (xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE, &vali)) ||
755 (xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET, &vali)) ||
756 (xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET, &vali)) ||
757 (xf86GetOptValInteger(pSiS->Options, OPTION_TVXSCALE, &vali)) ||
758 (xf86GetOptValInteger(pSiS->Options, OPTION_TVYSCALE, &vali))) {
759 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
760 "TV related options are only accepted in Master Head's device section");
762 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT1GAMMA, &val)) {
763 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CRT1Gamma");
765 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2GAMMA, &val)) {
766 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CRT2Gamma");
768 if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
769 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "XvOnCRT2");
771 #ifdef SIS_CP
772 SIS_CP_OPT_DH_WARN
773 #endif
774 } else
775 #endif
777 if(pSiS->VGAEngine == SIS_315_VGA) {
779 #ifdef SISVRAMQ
780 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using VRAM command queue, size %dk\n",
781 pSiS->cmdQueueSize / 1024);
782 #else
783 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MMIO command queue, size 512k\n");
784 #endif
786 } else {
788 /* TurboQueue */
790 from = X_DEFAULT;
791 if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
792 from = X_CONFIG;
794 xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
795 pSiS->TurboQueue ? enabledstr : disabledstr);
798 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
800 Bool val;
802 /* RestoreBySetMode (300/315/330 series only)
803 * Set this to force the driver to set the old mode instead of restoring
804 * the register contents. This can be used to overcome problems with
805 * LCD panels and video bridges.
807 if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
808 pSiS->restorebyset = val ? TRUE : FALSE;
811 /* EnableHotkey (300/315/330 series only)
812 * Enables or disables the BIOS hotkey switch for
813 * switching the output device on laptops.
814 * This key causes a total machine hang on many 300 series
815 * machines, it is therefore by default disabled on such.
816 * In dual head mode, using the hotkey is lethal, so we
817 * forbid it then in any case.
818 * However, although the driver disables the hotkey as
819 * BIOS developers intented to do that, some buggy BIOSes
820 * still cause the machine to freeze. Hence the warning.
823 int flag = 0;
824 #ifdef SISDUALHEAD
825 if(pSiS->DualHeadMode) {
826 pSiS->AllowHotkey = 0;
827 flag = 1;
828 } else
829 #endif
830 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLEHOTKEY, &val)) {
831 pSiS->AllowHotkey = val ? 1 : 0;
833 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hotkey display switching is %s%s\n",
834 pSiS->AllowHotkey ? enabledstr : disabledstr,
835 flag ? " in dual head mode" : "");
836 if(pSiS->Chipset == PCI_CHIP_SIS630 ||
837 pSiS->Chipset == PCI_CHIP_SIS650 ||
838 pSiS->Chipset == PCI_CHIP_SIS660) {
839 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
840 "WARNING: Using the Hotkey might freeze your machine, regardless\n");
841 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
842 "\twhether enabled or disabled. This is no driver bug.\n");
846 /* UseROMData (300/315/330 series only)
847 * This option is enabling/disabling usage of some machine
848 * specific data from the BIOS ROM. This option can - and
849 * should - be used in case the driver makes problems
850 * because SiS changed the location of this data.
852 if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
853 pSiS->OptROMUsage = val ? 1 : 0;
854 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
855 "Video ROM data usage shall be %s\n",
856 val ? enabledstr : disabledstr);
859 /* UseOEMData (300/315/330 series only)
860 * The driver contains quite a lot data for OEM LCD panels
861 * and TV connector specifics which override the defaults.
862 * If this data is incorrect, the TV may lose color and
863 * the LCD panel might show some strange effects. Use this
864 * option to disable the usage of this data.
866 if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
867 pSiS->OptUseOEM = val ? 1 : 0;
868 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
869 "Internal LCD/TV/VGA2 OEM data usage shall be %s\n",
870 val ? enabledstr : disabledstr);
873 /* ForceCRT1 (300/315/330 series only)
874 * This option can be used to force CRT1 to be switched on/off. Its
875 * intention is mainly for old monitors that can't be detected
876 * automatically. This is only useful on machines with a video bridge.
877 * In normal cases, this option won't be necessary.
879 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
880 pSiS->forceCRT1 = val ? 1 : 0;
881 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
882 "CRT1 shall be forced to %s\n",
883 val ? "ON" : "OFF");
886 /* NoCRT2DDCDetection (315/330 series only)
887 * If set to true, this disables CRT2 detection using DDC. This is
888 * to avoid problems with not entirely DDC compiant LCD panels or
889 * VGA monitors connected to the secondary VGA plug. Since LCD and
890 * VGA share the same DDC channel, it might in some cases be impossible
891 * to determine if the device is a CRT monitor or a flat panel.
893 if(xf86GetOptValBool(pSiS->Options, OPTION_NODDCFORCRT2, &val)) {
894 pSiS->nocrt2ddcdetection = val ? TRUE : FALSE;
897 /* ForceCRT2ReDetection (315/330 series only)
898 * If set to true, it forces re-detection of the LCD panel and
899 * a secondary VGA connection even if the BIOS already had found
900 * about it. This is meant for custom panels (ie such with
901 * non-standard resolutions) which the BIOS will "detect" according
902 * to the established timings, resulting in only a very vague idea
903 * about the panels real resolution. As for secondary VGA, this
904 * enables us to include a Plasma panel's proprietary modes.
906 if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
907 if(val) {
908 pSiS->forcecrt2redetection = TRUE;
909 pSiS->nocrt2ddcdetection = FALSE;
910 } else pSiS->forcecrt2redetection = FALSE;
913 /* ForceCRT2Type (300/315/330 series only)
914 * Used for forcing the driver to initialize a given
915 * CRT2 device type.
916 * (SVIDEO, COMPOSITE and SCART for overriding detection)
918 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
919 if(strptr != NULL) {
920 if(!xf86NameCmp(strptr,"TV"))
921 pSiS->ForceCRT2Type = CRT2_TV;
922 else if(!xf86NameCmp(strptr,"SVIDEO")) {
923 pSiS->ForceCRT2Type = CRT2_TV;
924 pSiS->ForceTVType = TV_SVIDEO;
925 } else if(!xf86NameCmp(strptr,"COMPOSITE")) {
926 pSiS->ForceCRT2Type = CRT2_TV;
927 pSiS->ForceTVType = TV_AVIDEO;
928 } else if(!xf86NameCmp(strptr,"SCART")) {
929 pSiS->ForceCRT2Type = CRT2_TV;
930 pSiS->ForceTVType = TV_SCART;
931 } else if((!xf86NameCmp(strptr,"LCD")) || (!xf86NameCmp(strptr,"DVI-D")))
932 pSiS->ForceCRT2Type = CRT2_LCD;
933 else if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"DVI-A")))
934 pSiS->ForceCRT2Type = CRT2_VGA;
935 else if(!xf86NameCmp(strptr,"NONE"))
936 pSiS->ForceCRT2Type = 0;
937 else if(pSiS->Chipset == PCI_CHIP_SIS550) {
938 if(!xf86NameCmp(strptr,"DSTN")) {
939 pSiS->ForceCRT2Type = CRT2_LCD;
940 pSiS->DSTN = TRUE;
941 } else if(!xf86NameCmp(strptr,"FSTN")) {
942 pSiS->ForceCRT2Type = CRT2_LCD;
943 pSiS->FSTN = TRUE;
945 } else {
946 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "ForceCRT2Type");
947 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
948 "Valid parameters are \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
949 "\t\"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\", on the SiS550 also \"DSTN\"\n"
950 "\tand \"FSTN\"\n");
953 if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
954 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
955 "CRT2 type shall be %s\n", strptr);
958 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING);
959 if(strptr != NULL) {
960 int i = 0;
961 BOOLEAN found = FALSE;
962 if(!xf86NameCmp(strptr,"NONE")) {
963 pSiS->SiS_Pr->SiS_CustomT = CUT_FORCENONE;
964 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
965 "Special timing disabled\n");
966 } else {
967 while(mycustomttable[i].chipID != 0) {
968 if(!xf86NameCmp(strptr,mycustomttable[i].optionName)) {
969 pSiS->SiS_Pr->SiS_CustomT = mycustomttable[i].SpecialID;
970 found = TRUE;
971 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
972 "Special timing for %s %s forced\n",
973 mycustomttable[i].vendorName, mycustomttable[i].cardName);
974 break;
976 i++;
978 if(!found) {
979 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "SpecialTiming");
980 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid parameters are:\n");
981 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NONE\" (to disable special timings)\n");
982 i = 0;
983 while(mycustomttable[i].chipID != 0) {
984 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
985 "\t\"%s\" (for %s %s)\n",
986 mycustomttable[i].optionName,
987 mycustomttable[i].vendorName,
988 mycustomttable[i].cardName);
989 i++;
995 /* EnableSiSCtrl */
996 /* Allow sisctrl tool to change driver settings */
997 from = X_DEFAULT;
998 if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLESISCTRL, &val)) {
999 if(val) pSiS->enablesisctrl = TRUE;
1000 from = X_CONFIG;
1002 xf86DrvMsg(pScrn->scrnIndex, from, "SiSCtrl utility interface is %s\n",
1003 pSiS->enablesisctrl ? enabledstr : disabledstr);
1005 /* ScaleLCD (300/315/330 series only)
1006 * Can be used to force the bridge/panel link to [do|not do] the
1007 * scaling of modes lower than the panel's native resolution.
1008 * Setting this to TRUE will force the bridge/panel link
1009 * to scale; FALSE will rely on the panel's capabilities.
1010 * Not supported on all machines.
1012 if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
1013 pSiS->UsePanelScaler = val ? 0 : 1;
1014 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD scaling is %s\n",
1015 pSiS->UsePanelScaler ? disabledstr : enabledstr);
1018 /* PanelDelayCompensation (300/315/330 series only)
1019 * This might be required if the LCD panel shows "small waves".
1020 * The parameter is an integer, (on 300 series usually either
1021 * 4, 32 or 24; on 315 series + LV bridge usually 3 or 51)
1022 * Why this option? Simply because SiS did poor BIOS design.
1023 * The PDC value depends on the very LCD panel used in a
1024 * particular machine. For most panels, the driver is able
1025 * to detect the correct value. However, some panels require
1026 * a different setting. For 300 series, the value given must
1027 * be within the mask 0x3c.
1029 if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &pSiS->PDC)) {
1030 if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) {
1031 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1032 "Illegal PanelDelayCompensation parameter\n");
1033 pSiS->PDC = -1;
1034 } else {
1035 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1036 "Panel delay compensation shall be %d\n",
1037 pSiS->PDC);
1041 /* LVDSHL (300/315/330 series + 30xLV bridge only)
1042 * This might be required if the LCD panel is too dark.
1043 * The parameter is an integer from 0 to 3.
1045 if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
1046 if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) {
1047 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1048 "Illegal LVDSHL parameter, valid is 0 through 3\n");
1049 pSiS->SiS_Pr->LVDSHL = -1;
1050 } else {
1051 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1052 "LVDSHL will be %d\n",
1053 pSiS->SiS_Pr->LVDSHL);
1060 /* TVStandard (300/315/330 series and 6326 w/ TV only)
1061 * This option is for overriding the autodetection of
1062 * the BIOS/Jumper option for PAL / NTSC
1064 if((pSiS->VGAEngine == SIS_300_VGA) ||
1065 (pSiS->VGAEngine == SIS_315_VGA) ||
1066 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1067 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD);
1068 if(strptr != NULL) {
1069 if(!xf86NameCmp(strptr,"PAL"))
1070 pSiS->OptTVStand = 1;
1071 else if((!xf86NameCmp(strptr,"PALM")) ||
1072 (!xf86NameCmp(strptr,"PAL-M"))) {
1073 pSiS->OptTVStand = 1;
1074 pSiS->NonDefaultPAL = 1;
1075 } else if((!xf86NameCmp(strptr,"PALN")) ||
1076 (!xf86NameCmp(strptr,"PAL-N"))) {
1077 pSiS->OptTVStand = 1;
1078 pSiS->NonDefaultPAL = 0;
1079 } else if(!xf86NameCmp(strptr,"NTSC"))
1080 pSiS->OptTVStand = 0;
1081 else {
1082 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "TVStandard");
1083 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1084 "Valid parameters are \"PAL\", \"PALM\", \"PALN\" or \"NTSC\"\n");
1087 if(pSiS->OptTVStand != -1) {
1088 static const char *tvstdstr = "TV standard shall be %s\n";
1089 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
1090 pSiS->NonDefaultPAL = -1;
1091 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1092 pSiS->OptTVStand ? "PAL" : "NTSC");
1093 } else {
1094 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
1095 (pSiS->OptTVStand ?
1096 ( (pSiS->NonDefaultPAL == -1) ? "PAL" :
1097 ((pSiS->NonDefaultPAL) ? "PALM" : "PALN") )
1098 : "NTSC"));
1104 /* CHTVType (315/330 series only)
1105 * Used for telling the driver if the TV output shall
1106 * be i480 HDTV or SCART.
1108 if(pSiS->VGAEngine == SIS_315_VGA) {
1109 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
1110 if(strptr != NULL) {
1111 if(!xf86NameCmp(strptr,"SCART"))
1112 pSiS->chtvtype = 1;
1113 else if(!xf86NameCmp(strptr,"HDTV"))
1114 pSiS->chtvtype = 0;
1115 else {
1116 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "CHTVType");
1117 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1118 "Valid parameters are \"SCART\" or \"HDTV\"\n");
1120 if(pSiS->chtvtype != -1)
1121 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1122 "Chrontel: TV type shall be %s\n", strptr);
1126 /* CHTVOverscan (300/315/330 series only)
1127 * CHTVSuperOverscan (300/315/330 series only)
1128 * These options are for overriding the BIOS option for
1129 * TV Overscan. Some BIOS don't even have such an option.
1130 * SuperOverscan is only supported with PAL.
1131 * Both options are only effective on machines with a
1132 * CHRONTEL TV encoder. SuperOverscan is only available
1133 * on the 700x.
1135 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1136 Bool val;
1137 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) {
1138 pSiS->OptTVOver = val ? 1 : 0;
1139 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1140 "Chrontel: TV overscan shall be %s\n",
1141 val ? enabledstr : disabledstr);
1143 if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) {
1144 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1145 "Chrontel: TV super overscan shall be %s\n",
1146 pSiS->OptTVSOver ? enabledstr : disabledstr);
1150 /* Various parameters for TV output via SiS bridge, Chrontel or SiS6326
1152 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1153 int tmp = 0;
1154 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS,
1155 &pSiS->chtvlumabandwidthcvbs);
1156 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO,
1157 &pSiS->chtvlumabandwidthsvideo);
1158 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER,
1159 &pSiS->chtvlumaflickerfilter);
1160 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH,
1161 &pSiS->chtvchromabandwidth);
1162 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER,
1163 &pSiS->chtvchromaflickerfilter);
1164 xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR,
1165 &pSiS->chtvcvbscolor);
1166 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE,
1167 &pSiS->chtvtextenhance);
1168 xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST,
1169 &pSiS->chtvcontrast);
1170 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE,
1171 &pSiS->sistvedgeenhance);
1172 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION,
1173 &pSiS->sistvsaturation);
1174 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVLUMAFILTER,
1175 &pSiS->sistvyfilter);
1176 if((pSiS->sistvyfilter < 0) || (pSiS->sistvyfilter > 8)) {
1177 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1178 "Illegal Y Filter number; valid is 0 (off), 1 (default), 2-8 (filter number 1-7)\n");
1179 pSiS->sistvyfilter = 1;
1181 xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER,
1182 &pSiS->sistvcfilter);
1183 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBCOARSE,
1184 &pSiS->sistvcolcalibc);
1185 xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE,
1186 &pSiS->sistvcolcalibf);
1187 if((pSiS->sistvcolcalibf > 127) || (pSiS->sistvcolcalibf < -128) ||
1188 (pSiS->sistvcolcalibc > 120) || (pSiS->sistvcolcalibc < -120)) {
1189 pSiS->sistvcolcalibf = pSiS->sistvcolcalibc = 0;
1190 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1191 "Illegal Color Calibration. Range is -128 to 127 (fine), -120 to 120 (coarse)\n");
1193 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1194 &pSiS->tvxpos);
1195 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1196 &pSiS->tvypos);
1197 if(pSiS->tvxpos > 32) { pSiS->tvxpos = 32; tmp = 1; }
1198 if(pSiS->tvxpos < -32) { pSiS->tvxpos = -32; tmp = 1; }
1199 if(pSiS->tvypos > 32) { pSiS->tvypos = 32; tmp = 1; }
1200 if(pSiS->tvypos < -32) { pSiS->tvypos = -32; tmp = 1; }
1201 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1202 "Illegal TV x or y offset. Range is from -32 to 32\n");
1203 tmp = 0;
1204 xf86GetOptValInteger(pSiS->Options, OPTION_TVXSCALE,
1205 &pSiS->tvxscale);
1206 xf86GetOptValInteger(pSiS->Options, OPTION_TVYSCALE,
1207 &pSiS->tvyscale);
1208 if(pSiS->tvxscale > 16) { pSiS->tvxscale = 16; tmp = 1; }
1209 if(pSiS->tvxscale < -16) { pSiS->tvxscale = -16; tmp = 1; }
1210 if(pSiS->tvyscale > 3) { pSiS->tvyscale = 3; tmp = 1; }
1211 if(pSiS->tvyscale < -4) { pSiS->tvyscale = -4; tmp = 1; }
1212 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1213 "Illegal TV x or y scaling parameter. Range is from -16 to 16 (X), -4 to 3 (Y)\n");
1216 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
1217 int tmp = 0;
1218 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326FORCETVPPLUG);
1219 if(strptr) {
1220 if(!xf86NameCmp(strptr,"COMPOSITE"))
1221 pSiS->sis6326tvplug = 1;
1222 else if(!xf86NameCmp(strptr,"SVIDEO"))
1223 pSiS->sis6326tvplug = 0;
1224 else {
1225 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "SIS6326TVForcePlug");
1226 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1227 "Valid parameters are \"COMPOSITE\" or \"SVIDEO\"\n");
1230 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326ENABLEYFILTER,
1231 &pSiS->sis6326enableyfilter);
1232 xf86GetOptValBool(pSiS->Options, OPTION_SIS6326YFILTERSTRONG,
1233 &pSiS->sis6326yfilterstrong);
1234 xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
1235 &pSiS->tvxpos);
1236 xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
1237 &pSiS->tvypos);
1238 if(pSiS->tvxpos > 16) { pSiS->tvxpos = 16; tmp = 1; }
1239 if(pSiS->tvxpos < -16) { pSiS->tvxpos = -16; tmp = 1; }
1240 if(pSiS->tvypos > 16) { pSiS->tvypos = 16; tmp = 1; }
1241 if(pSiS->tvypos < -16) { pSiS->tvypos = -16; tmp = 1; }
1242 if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1243 "Illegal TV x or y offset. Range is from -16 to 16\n");
1244 xf86GetOptValInteger(pSiS->Options, OPTION_SIS6326FSCADJUST,
1245 &pSiS->sis6326fscadjust);
1246 if(pSiS->sis6326fscadjust) {
1247 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1248 "Adjusting the default FSC by %d\n",
1249 pSiS->sis6326fscadjust);
1253 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA) ||
1254 ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
1255 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER);
1256 if(!strptr) {
1257 strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER);
1259 if(strptr) {
1260 if(!xf86NameCmp(strptr,"OFF"))
1261 pSiS->sistvantiflicker = 0;
1262 else if(!xf86NameCmp(strptr,"LOW"))
1263 pSiS->sistvantiflicker = 1;
1264 else if(!xf86NameCmp(strptr,"MED"))
1265 pSiS->sistvantiflicker = 2;
1266 else if(!xf86NameCmp(strptr,"HIGH"))
1267 pSiS->sistvantiflicker = 3;
1268 else if(!xf86NameCmp(strptr,"ADAPTIVE"))
1269 pSiS->sistvantiflicker = 4;
1270 else {
1271 pSiS->sistvantiflicker = -1;
1272 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "SISTVAntiFlicker");
1273 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1274 "Valid parameters are \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n");
1279 /* CRT1Gamma - disable gamma correction for CRT1
1282 Bool val;
1283 from = X_DEFAULT;
1284 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT1GAMMA, &val)) {
1285 from = X_CONFIG;
1286 pSiS->CRT1gamma = val;
1288 xf86DrvMsg(pScrn->scrnIndex, from, "CRT1 gamma correction is %s\n",
1289 pSiS->CRT1gamma ? enabledstr : disabledstr);
1292 /* CRT2Gamma - disable gamma correction for CRT2
1294 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1295 Bool val;
1296 if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2GAMMA, &val)) {
1297 pSiS->CRT2gamma = val;
1301 #ifdef SIS_CP
1302 SIS_CP_OPT_DOOPT
1303 #endif
1305 } /* DualHead */
1307 /* VESA - DEPRECATED
1308 * This option is for forcing the driver to use
1309 * the VESA BIOS extension for mode switching.
1312 Bool val;
1314 if(xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) {
1315 pSiS->VESA = val ? 1 : 0;
1316 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1317 "VESA: VESA usage shall be %s\n",
1318 val ? enabledstr : disabledstr);
1319 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1320 "*** Option \"VESA\" is deprecated. *** \n");
1324 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1326 /* NoInternalModes (300/315/330 series only)
1327 * Since the mode switching code for these chipsets is a
1328 * Asm-to-C translation of BIOS code, we only have timings
1329 * for a pre-defined number of modes. The default behavior
1330 * is to replace XFree's default modes with a mode list
1331 * generated out of the known and supported modes. Use
1332 * this option to disable this. NOT RECOMMENDED.
1334 from = X_DEFAULT;
1335 if(xf86GetOptValBool(pSiS->Options, OPTION_NOINTERNALMODES, &pSiS->noInternalModes))
1336 from = X_CONFIG;
1337 xf86DrvMsg(pScrn->scrnIndex, from, "Usage of built-in modes is %s\n",
1338 pSiS->noInternalModes ? disabledstr : enabledstr);
1341 /* ShadowFB */
1342 from = X_DEFAULT;
1343 if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) {
1344 #ifdef SISMERGED
1345 if(pSiS->MergedFB) {
1346 pSiS->ShadowFB = FALSE;
1347 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1348 "Shadow Frame Buffer not supported in MergedFB mode\n");
1349 } else
1350 #endif
1351 from = X_CONFIG;
1353 if(pSiS->ShadowFB) {
1354 pSiS->NoAccel = TRUE;
1355 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
1356 pSiS->NoXvideo = TRUE;
1357 xf86DrvMsg(pScrn->scrnIndex, from,
1358 "Using \"Shadow Frame Buffer\" - 2D acceleration and Xv disabled\n");
1359 #else
1360 xf86DrvMsg(pScrn->scrnIndex, from,
1361 "Using \"Shadow Frame Buffer\" - 2D acceleration disabled\n");
1362 #endif
1365 /* Rotate */
1366 if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) {
1367 #ifdef SISMERGED
1368 if(pSiS->MergedFB) {
1369 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
1370 "Screen rotation not supported in MergedFB mode\n");
1371 } else
1372 #endif
1373 if(!xf86NameCmp(strptr, "CW")) {
1374 pSiS->Rotate = 1;
1375 } else if(!xf86NameCmp(strptr, "CCW")) {
1376 pSiS->Rotate = -1;
1377 } else {
1378 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "Rotate");
1379 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1380 "Valid parameters are \"CW\" or \"CCW\"\n");
1383 if(pSiS->Rotate) {
1384 pSiS->ShadowFB = TRUE;
1385 pSiS->NoAccel = TRUE;
1386 pSiS->HWCursor = FALSE;
1387 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
1388 pSiS->NoXvideo = TRUE;
1389 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1390 "Rotating screen %sclockwise; (2D acceleration and Xv disabled)\n",
1391 (pSiS->Rotate == -1) ? "counter " : "");
1392 #else
1393 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1394 "Rotating screen %sclockwise (2D acceleration %sdisabled)\n",
1395 (pSiS->Rotate == -1) ? "counter " : "",
1396 #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
1397 "and RandR extension "
1398 #else
1400 #endif
1403 #endif
1408 /* NoXVideo
1409 * Set this to TRUE to disable Xv hardware video acceleration
1411 #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
1412 if((!pSiS->NoAccel) && (!pSiS->NoXvideo)) {
1413 #else
1414 if(!pSiS->NoXvideo) {
1415 #endif
1416 if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOXVIDEO, FALSE)) {
1417 pSiS->NoXvideo = TRUE;
1418 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension disabled\n");
1421 if(!pSiS->NoXvideo) {
1422 Bool val;
1423 int tmp;
1425 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1426 /* XvOnCRT2
1427 * On chipsets with only one overlay (315, 650, 740, 330), the user can
1428 * choose to display the overlay on CRT1 or CRT2. By setting this
1429 * option to TRUE, the overlay will be displayed on CRT2. The
1430 * default is: CRT1 if only CRT1 available, CRT2 if only CRT2
1431 * available, and CRT1 if both is available and detected.
1432 * Since implementation of the XV_SWITCHCRT Xv property this only
1433 * selects the default CRT.
1435 if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
1436 pSiS->XvOnCRT2 = val ? TRUE : FALSE;
1440 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
1441 /* NoYV12 (for 5597/5598, 6326 and 530/620 only)
1442 * YV12 has problems with videos larger than 384x288. So
1443 * allow the user to disable YV12 support to force the
1444 * application to use YUV2 instead.
1446 if(xf86GetOptValBool(pSiS->Options, OPTION_NOYV12, &val)) {
1447 pSiS->NoYV12 = val ? 1 : 0;
1448 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1449 "Xv YV12/I420 support is %s\n",
1450 pSiS->NoYV12 ? disabledstr : enabledstr);
1454 /* Some Xv properties' defaults can be set by options */
1455 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFCONTRAST, &tmp)) {
1456 if((tmp >= 0) && (tmp <= 7)) pSiS->XvDefCon = tmp;
1457 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1458 "XvDefaultContrast" ,0, 7);
1460 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFBRIGHTNESS, &tmp)) {
1461 if((tmp >= -128) && (tmp <= 127)) pSiS->XvDefBri = tmp;
1462 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1463 "XvDefaultBrightness", -128, 127);
1465 if(pSiS->VGAEngine == SIS_315_VGA) {
1466 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFHUE, &tmp)) {
1467 if((tmp >= -8) && (tmp <= 7)) pSiS->XvDefHue = tmp;
1468 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1469 "XvDefaultHue", -8, 7);
1471 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFSATURATION, &tmp)) {
1472 if((tmp >= -7) && (tmp <= 7)) pSiS->XvDefSat = tmp;
1473 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1474 "XvDefaultSaturation", -7, 7);
1477 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFX, &val)) {
1478 if(val) pSiS->XvDefDisableGfx = TRUE;
1479 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1480 "Graphics display will be %s during Xv usage\n",
1481 val ? disabledstr : enabledstr);
1483 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1484 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFXLR, &val)) {
1485 if(val) pSiS->XvDefDisableGfxLR = TRUE;
1486 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1487 "Graphics display left/right of overlay will be %s during Xv usage\n",
1488 val ? disabledstr : enabledstr);
1490 if(xf86GetOptValBool(pSiS->Options, OPTION_XVDISABLECOLORKEY, &val)) {
1491 if(val) pSiS->XvDisableColorKey = TRUE;
1492 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1493 "Xv Color key is %s\n",
1494 val ? disabledstr : enabledstr);
1496 if(xf86GetOptValBool(pSiS->Options, OPTION_XVUSECHROMAKEY, &val)) {
1497 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1498 "Xv Chroma-keying is %s\n",
1499 val ? enabledstr : disabledstr);
1500 if(val) pSiS->XvUseChromaKey = TRUE;
1502 if(xf86GetOptValBool(pSiS->Options, OPTION_XVINSIDECHROMAKEY, &val)) {
1503 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1504 "Xv: Video is transparent if %s chroma key range\n",
1505 val ? "inside" : "outside");
1506 if(val) pSiS->XvInsideChromaKey = TRUE;
1508 if(pSiS->VGAEngine == SIS_300_VGA) {
1509 if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
1510 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
1511 "Xv: Chroma key is in %s format\n",
1512 val ? "YUV" : "RGB");
1513 if(val) pSiS->XvYUVChromaKey = TRUE;
1515 } else {
1516 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1517 "Xv: Chroma key is of same format as video source\n");
1519 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMIN, &tmp)) {
1520 if((tmp >= 0) && (tmp <= 0xffffff)) pSiS->XvChromaMin = tmp;
1521 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1522 "XvChromaMin", 0, 0xffffff);
1524 if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMAX, &tmp)) {
1525 if((tmp >= 0) && (tmp <= 0xffffff)) pSiS->XvChromaMax = tmp;
1526 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1527 "XvChromaMax", 0, 0xffffff);
1530 if(xf86GetOptValBool(pSiS->Options, OPTION_XVMEMCPY, &val)) {
1531 pSiS->XvUseMemcpy = val ? TRUE : FALSE;
1532 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv will %suse memcpy()\n",
1533 val ? "" : "not ");
1538 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
1539 int tmp;
1540 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDBRIR, &tmp)) {
1541 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaBriR = tmp;
1542 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1543 "StoredGammaBrightnessRed", 100, 10000);
1545 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDBRIG, &tmp)) {
1546 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaBriG = tmp;
1547 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1548 "StoredGammaBrightnessGreen", 100, 10000);
1550 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDBRIB, &tmp)) {
1551 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaBriB = tmp;
1552 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1553 "StoredGammaBrightnessBlue", 100, 10000);
1555 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDPBRIR, &tmp)) {
1556 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaPBriR = tmp;
1557 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1558 "StoredGammaPreBrightnessRed", 100, 10000);
1560 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDPBRIG, &tmp)) {
1561 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaPBriG = tmp;
1562 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1563 "StoredGammaPreBrightnessGreen", 100, 10000);
1565 if(xf86GetOptValInteger(pSiS->Options, OPTION_STOREDPBRIB, &tmp)) {
1566 if((tmp >= 100) && (tmp <= 10000)) pSiS->GammaPBriB = tmp;
1567 else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
1568 "StoredGammaPreBrightnessBlue", 100, 10000);
1574 const OptionInfoRec *
1575 SISAvailableOptions(int chipid, int busid)
1577 return SISOptions;