1dfe64dd3Smacallan/*
2dfe64dd3Smacallan * Video driver option evaluation
3dfe64dd3Smacallan *
4dfe64dd3Smacallan * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
5dfe64dd3Smacallan *
6dfe64dd3Smacallan * Redistribution and use in source and binary forms, with or without
7dfe64dd3Smacallan * modification, are permitted provided that the following conditions
8dfe64dd3Smacallan * are met:
9dfe64dd3Smacallan * 1) Redistributions of source code must retain the above copyright
10dfe64dd3Smacallan *    notice, this list of conditions and the following disclaimer.
11dfe64dd3Smacallan * 2) Redistributions in binary form must reproduce the above copyright
12dfe64dd3Smacallan *    notice, this list of conditions and the following disclaimer in the
13dfe64dd3Smacallan *    documentation and/or other materials provided with the distribution.
14dfe64dd3Smacallan * 3) The name of the author may not be used to endorse or promote products
15dfe64dd3Smacallan *    derived from this software without specific prior written permission.
16dfe64dd3Smacallan *
17dfe64dd3Smacallan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
18dfe64dd3Smacallan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19dfe64dd3Smacallan * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20dfe64dd3Smacallan * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21dfe64dd3Smacallan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22dfe64dd3Smacallan * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23dfe64dd3Smacallan * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24dfe64dd3Smacallan * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25dfe64dd3Smacallan * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26dfe64dd3Smacallan * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27dfe64dd3Smacallan *
28dfe64dd3Smacallan * "NoAccel", "NoXVideo", "SWCursor", "HWCursor" and "Rotate" option portions
29dfe64dd3Smacallan * Copyright (C) 1999-2004 The XFree86 Project, Inc. Licensed under the terms
30dfe64dd3Smacallan * of the XFree86 license (http://www.xfree86.org/current/LICENSE1.html).
31dfe64dd3Smacallan *
32dfe64dd3Smacallan * Authors:  	Thomas Winischhofer <thomas@winischhofer.net>
33dfe64dd3Smacallan *              ?
34dfe64dd3Smacallan */
35dfe64dd3Smacallan
36dfe64dd3Smacallan#ifdef HAVE_CONFIG_H
37dfe64dd3Smacallan#include "config.h"
38dfe64dd3Smacallan#endif
39dfe64dd3Smacallan
40dfe64dd3Smacallan#include "xf86.h"
41dfe64dd3Smacallan#include "xf86PciInfo.h"
42dfe64dd3Smacallan#include "xf86str.h"
43dfe64dd3Smacallan#include "xf86Cursor.h"
44dfe64dd3Smacallan
45dfe64dd3Smacallan#include "xgi.h"
46dfe64dd3Smacallan
47dfe64dd3Smacallantypedef enum {
48dfe64dd3Smacallan    OPTION_SW_CURSOR,
49dfe64dd3Smacallan    OPTION_HW_CURSOR,
50dfe64dd3Smacallan    OPTION_ACCELMETHOD,
51dfe64dd3Smacallan    OPTION_NOACCEL,
52dfe64dd3Smacallan    OPTION_TURBOQUEUE,
53dfe64dd3Smacallan    OPTION_RENDER,
54dfe64dd3Smacallan    OPTION_FORCE_CRT1TYPE,
55dfe64dd3Smacallan    OPTION_FORCE_CRT2TYPE,
56dfe64dd3Smacallan    OPTION_YPBPRAR,
57dfe64dd3Smacallan    OPTION_SHADOW_FB,
58dfe64dd3Smacallan    OPTION_DRI,
59dfe64dd3Smacallan    OPTION_AGP_SIZE,
60dfe64dd3Smacallan    OPTION_AGP_SIZE2,
61dfe64dd3Smacallan    OPTION_ROTATE,
62dfe64dd3Smacallan    OPTION_NOXVIDEO,
63dfe64dd3Smacallan    OPTION_MAXXFBMEM,
64dfe64dd3Smacallan    OPTION_USEROMDATA,
65dfe64dd3Smacallan    OPTION_NOINTERNALMODES,
66dfe64dd3Smacallan    OPTION_RESTOREBYSET,
67dfe64dd3Smacallan    OPTION_NODDCFORCRT2,
68dfe64dd3Smacallan    OPTION_FORCECRT2REDETECTION,
69dfe64dd3Smacallan    OPTION_SENSEYPBPR,
70dfe64dd3Smacallan    OPTION_CRT1GAMMA,
71dfe64dd3Smacallan    OPTION_CRT2GAMMA,
72dfe64dd3Smacallan    OPTION_XVGAMMA,
73dfe64dd3Smacallan    OPTION_XVDEFCONTRAST,
74dfe64dd3Smacallan    OPTION_XVDEFBRIGHTNESS,
75dfe64dd3Smacallan    OPTION_XVDEFHUE,
76dfe64dd3Smacallan    OPTION_XVDEFSATURATION,
77dfe64dd3Smacallan    OPTION_XVDEFDISABLEGFX,
78dfe64dd3Smacallan    OPTION_XVDEFDISABLEGFXLR,
79dfe64dd3Smacallan    OPTION_XVMEMCPY,
80dfe64dd3Smacallan    OPTION_SCALELCD,
81dfe64dd3Smacallan    OPTION_CENTERLCD,
82dfe64dd3Smacallan    OPTION_SPECIALTIMING,
83dfe64dd3Smacallan    OPTION_ENABLEHOTKEY,
84dfe64dd3Smacallan    OPTION_MERGEDFB,
85dfe64dd3Smacallan    OPTION_MERGEDFBAUTO,
86dfe64dd3Smacallan    OPTION_CRT2HSYNC,
87dfe64dd3Smacallan    OPTION_CRT2VREFRESH,
88dfe64dd3Smacallan    OPTION_CRT2POS,
89dfe64dd3Smacallan    OPTION_METAMODES,
90dfe64dd3Smacallan    OPTION_MERGEDFB2,
91dfe64dd3Smacallan    OPTION_CRT2HSYNC2,
92dfe64dd3Smacallan    OPTION_CRT2VREFRESH2,
93dfe64dd3Smacallan    OPTION_CRT2POS2,
94dfe64dd3Smacallan    OPTION_NOXGIXINERAMA,
95dfe64dd3Smacallan    OPTION_NOXGIXINERAMA2,
96dfe64dd3Smacallan    OPTION_CRT2ISSCRN0,
97dfe64dd3Smacallan    OPTION_MERGEDDPI,
98dfe64dd3Smacallan    OPTION_ENABLEXGICTRL,
99dfe64dd3Smacallan    OPTION_STOREDBRI,
100dfe64dd3Smacallan    OPTION_STOREDPBRI,
101dfe64dd3Smacallan    OPTION_RUNTIME_DEBUG,  /* Jong 07/27/2009 */
102dfe64dd3Smacallan	OPTION_TARGET_RATE,    /* Jong@09032009 */
103dfe64dd3Smacallan	OPTION_IGNORE_DDC,     /* Jong@09032009 */
104dfe64dd3Smacallan	OPTION_NONDDC_DEFAULT_MODE, /* Jong@09042009 */
105dfe64dd3Smacallan	OPTION_GAMMA_RGB,			/* Jong@09092009 */
106dfe64dd3Smacallan#ifdef XGI_CP
107dfe64dd3Smacallan    XGI_CP_OPT_OPTIONS
108dfe64dd3Smacallan#endif
109dfe64dd3Smacallan    OPTION_PSEUDO
110dfe64dd3Smacallan} XGIOpts;
111dfe64dd3Smacallan
112dfe64dd3Smacallanstatic const OptionInfoRec XGIOptions[] = {
113dfe64dd3Smacallan    { OPTION_SW_CURSOR,         	"SWcursor",               OPTV_BOOLEAN,   {0}, FALSE },
114dfe64dd3Smacallan    { OPTION_HW_CURSOR,         	"HWcursor",               OPTV_BOOLEAN,   {0}, FALSE },
115dfe64dd3Smacallan    { OPTION_ACCELMETHOD,			"AccelMethod",			OPTV_STRING,	{0}, FALSE },
116dfe64dd3Smacallan    { OPTION_NOACCEL,           	"NoAccel",                OPTV_BOOLEAN,   {0}, FALSE },
117dfe64dd3Smacallan    { OPTION_TURBOQUEUE,        	"TurboQueue",             OPTV_BOOLEAN,   {0}, FALSE },
118dfe64dd3Smacallan    { OPTION_RENDER,        		"RenderAcceleration",     OPTV_BOOLEAN,   {0}, FALSE },
119dfe64dd3Smacallan    { OPTION_FORCE_CRT1TYPE,    	"ForceCRT1Type",          OPTV_STRING,    {0}, FALSE },
120dfe64dd3Smacallan    { OPTION_FORCE_CRT2TYPE,    	"ForceCRT2Type",          OPTV_STRING,    {0}, FALSE },
121dfe64dd3Smacallan    { OPTION_YPBPRAR,  		  		"YPbPrAspectRatio",       OPTV_STRING,    {0}, FALSE },
122dfe64dd3Smacallan    { OPTION_SHADOW_FB,         	"ShadowFB",               OPTV_BOOLEAN,   {0}, FALSE },
123dfe64dd3Smacallan    { OPTION_DRI,         		"DRI",               	  OPTV_BOOLEAN,   {0}, FALSE },
124dfe64dd3Smacallan    { OPTION_AGP_SIZE,			"AGPSize",      	  OPTV_INTEGER,   {0}, FALSE },
125dfe64dd3Smacallan    { OPTION_AGP_SIZE2,			"GARTSize",      	  OPTV_INTEGER,   {0}, FALSE },
126dfe64dd3Smacallan    { OPTION_ROTATE,            	"Rotate",                 OPTV_STRING,    {0}, FALSE },
127dfe64dd3Smacallan    { OPTION_NOXVIDEO,          	"NoXvideo",               OPTV_BOOLEAN,   {0}, FALSE },
128dfe64dd3Smacallan    { OPTION_MAXXFBMEM,         	"MaxXFBMem",              OPTV_INTEGER,   {0}, -1    },
129dfe64dd3Smacallan    { OPTION_SPECIALTIMING,        	"SpecialTiming",          OPTV_STRING,    {0}, -1    },
130dfe64dd3Smacallan    { OPTION_USEROMDATA,		"UseROMData",	          OPTV_BOOLEAN,   {0}, -1    },
131dfe64dd3Smacallan    { OPTION_NOINTERNALMODES,   	"NoInternalModes",        OPTV_BOOLEAN,   {0}, FALSE },
132dfe64dd3Smacallan    { OPTION_RESTOREBYSET,		"RestoreBySetMode", 	  OPTV_BOOLEAN,   {0}, -1    },
133dfe64dd3Smacallan    { OPTION_NODDCFORCRT2,		"NoCRT2Detection", 	  OPTV_BOOLEAN,   {0}, -1    },
134dfe64dd3Smacallan    { OPTION_FORCECRT2REDETECTION,	"ForceCRT2ReDetection",   OPTV_BOOLEAN,   {0}, -1    },
135dfe64dd3Smacallan    { OPTION_SENSEYPBPR,		"SenseYPbPr",   	  OPTV_BOOLEAN,   {0}, -1    },
136dfe64dd3Smacallan    { OPTION_CRT1GAMMA,			"CRT1Gamma", 	  	  OPTV_BOOLEAN,   {0}, -1    },
137dfe64dd3Smacallan    { OPTION_CRT2GAMMA,			"CRT2Gamma", 	  	  OPTV_BOOLEAN,   {0}, -1    },
138dfe64dd3Smacallan    { OPTION_STOREDBRI,			"StoredGammaBrightness",  OPTV_STRING,    {0}, -1    },
139dfe64dd3Smacallan    { OPTION_STOREDPBRI,		"StoredGammaPreBrightness",OPTV_STRING,   {0}, -1    },
140dfe64dd3Smacallan    { OPTION_XVGAMMA,			"XvGamma", 	  	  OPTV_STRING,    {0}, -1    },
141dfe64dd3Smacallan    { OPTION_XVDEFCONTRAST,		"XvDefaultContrast", 	  OPTV_INTEGER,   {0}, -1    },
142dfe64dd3Smacallan    { OPTION_XVDEFBRIGHTNESS,		"XvDefaultBrightness", 	  OPTV_INTEGER,   {0}, -1    },
143dfe64dd3Smacallan    { OPTION_XVDEFHUE,			"XvDefaultHue", 	  OPTV_INTEGER,   {0}, -1    },
144dfe64dd3Smacallan    { OPTION_XVDEFSATURATION,		"XvDefaultSaturation", 	  OPTV_INTEGER,   {0}, -1    },
145dfe64dd3Smacallan    { OPTION_XVDEFDISABLEGFX,		"XvDefaultDisableGfx", 	  OPTV_BOOLEAN,   {0}, -1    },
146dfe64dd3Smacallan    { OPTION_XVDEFDISABLEGFXLR,		"XvDefaultDisableGfxLR",  OPTV_BOOLEAN,   {0}, -1    },
147dfe64dd3Smacallan    { OPTION_XVMEMCPY,			"XvUseMemcpy",  	  OPTV_BOOLEAN,   {0}, -1    },
148dfe64dd3Smacallan    { OPTION_ENABLEHOTKEY,		"EnableHotkey",	   	  OPTV_BOOLEAN,   {0}, -1    },
149dfe64dd3Smacallan    { OPTION_ENABLEXGICTRL,		"EnableXGICtrl",   	  OPTV_BOOLEAN,   {0}, -1    },
150dfe64dd3Smacallan#ifdef XGIMERGED
151dfe64dd3Smacallan    { OPTION_MERGEDFB,			"MergedFB",		  OPTV_BOOLEAN,	  {0}, FALSE },
152dfe64dd3Smacallan    { OPTION_MERGEDFB2,			"TwinView",		  OPTV_BOOLEAN,	  {0}, FALSE },	  /* alias */
153dfe64dd3Smacallan    { OPTION_MERGEDFBAUTO,		"MergedFBAuto",		  OPTV_BOOLEAN,	  {0}, FALSE },
154dfe64dd3Smacallan    { OPTION_CRT2HSYNC,			"CRT2HSync",		  OPTV_STRING,	  {0}, FALSE },
155dfe64dd3Smacallan    { OPTION_CRT2HSYNC2,		"SecondMonitorHorizSync", OPTV_STRING,	  {0}, FALSE },   /* alias */
156dfe64dd3Smacallan    { OPTION_CRT2VREFRESH,		"CRT2VRefresh",		  OPTV_STRING,    {0}, FALSE },
157dfe64dd3Smacallan    { OPTION_CRT2VREFRESH2,		"SecondMonitorVertRefresh", OPTV_STRING,  {0}, FALSE },   /* alias */
158dfe64dd3Smacallan    { OPTION_CRT2POS,   		"CRT2Position",		  OPTV_STRING,	  {0}, FALSE },
159dfe64dd3Smacallan    { OPTION_CRT2POS2,   		"TwinViewOrientation",	  OPTV_STRING,	  {0}, FALSE },   /* alias */
160dfe64dd3Smacallan    { OPTION_METAMODES,   		"MetaModes",  		  OPTV_STRING,	  {0}, FALSE },
161dfe64dd3Smacallan    { OPTION_MERGEDDPI,			"MergedDPI", 		  OPTV_STRING,	  {0}, FALSE },
162dfe64dd3Smacallan    { OPTION_RUNTIME_DEBUG,		"RunTimeDebug",      	  OPTV_BOOLEAN,   {0}, -1 }, /* Jong 07/27/2009 */
163dfe64dd3Smacallan    { OPTION_TARGET_RATE,		"TargetRate",      	  OPTV_INTEGER,   {0}, -1 }, /* Jong@09032009 */
164dfe64dd3Smacallan    { OPTION_IGNORE_DDC,		"IgnoreDDC",      	  OPTV_BOOLEAN,   {0}, -1 }, /* Jong@09032009 */
165dfe64dd3Smacallan    { OPTION_NONDDC_DEFAULT_MODE,		"NonDDCDefaultMode",      	  OPTV_STRING,   {0}, FALSE }, /* Jong@09042009 */
166dfe64dd3Smacallan    { OPTION_GAMMA_RGB,			"GammaRGB",      	  OPTV_STRING,   {0}, FALSE }, /* Jong@09092009 */
167dfe64dd3Smacallan#ifdef XGIXINERAMA
168dfe64dd3Smacallan    { OPTION_NOXGIXINERAMA,		"NoMergedXinerama",	  OPTV_BOOLEAN,	  {0}, FALSE },
169dfe64dd3Smacallan    { OPTION_NOXGIXINERAMA2,		"NoTwinviewXineramaInfo", OPTV_BOOLEAN,   {0}, FALSE },   /* alias */
170dfe64dd3Smacallan    { OPTION_CRT2ISSCRN0,		"MergedXineramaCRT2IsScreen0",OPTV_BOOLEAN,{0},FALSE },
171dfe64dd3Smacallan#endif
172dfe64dd3Smacallan#endif
173dfe64dd3Smacallan#ifdef XGI_CP
174dfe64dd3Smacallan    XGI_CP_OPTION_DETAIL
175dfe64dd3Smacallan#endif
176dfe64dd3Smacallan    { -1,                       	NULL,                     OPTV_NONE,      {0}, FALSE }
177dfe64dd3Smacallan};
178dfe64dd3Smacallan
179dfe64dd3Smacallanunsigned int g_GammaRed;
180dfe64dd3Smacallanunsigned int g_GammaGreen;
181dfe64dd3Smacallanunsigned int g_GammaBlue;
182dfe64dd3Smacallan
183dfe64dd3Smacallanvoid
184dfe64dd3SmacallanxgiOptions(ScrnInfoPtr pScrn)
185dfe64dd3Smacallan{
186dfe64dd3Smacallan    XGIPtr      pXGI = XGIPTR(pScrn);
187dfe64dd3Smacallan    MessageType from;
188dfe64dd3Smacallan    char        *strptr;
189dfe64dd3Smacallan    static const char *mybadparm = "\"%s\" is is not a valid parameter for option \"%s\"\n";
190dfe64dd3Smacallan    static const char *disabledstr = "disabled";
191dfe64dd3Smacallan    static const char *enabledstr = "enabled";
192dfe64dd3Smacallan    static const char *ilrangestr = "Illegal %s parameter. Valid range is %d through %d\n";
193dfe64dd3Smacallan
194dfe64dd3Smacallan    /* Collect all of the relevant option flags (fill in pScrn->options) */
195dfe64dd3Smacallan    xf86CollectOptions(pScrn, NULL);
196dfe64dd3Smacallan
197dfe64dd3Smacallan    /* Process the options */
198dfe64dd3Smacallan    if(!(pXGI->Options = xalloc(sizeof(XGIOptions)))) return;
199dfe64dd3Smacallan
200dfe64dd3Smacallan    memcpy(pXGI->Options, XGIOptions, sizeof(XGIOptions));
201dfe64dd3Smacallan
202dfe64dd3Smacallan    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pXGI->Options);
203dfe64dd3Smacallan
204dfe64dd3Smacallan    /* Set defaults */
205dfe64dd3Smacallan/*
206dfe64dd3Smacallan#ifdef __powerpc__
207dfe64dd3Smacallan    pXGI->NoAccel = TRUE;
208dfe64dd3Smacallan#endif
209dfe64dd3Smacallan*/
210dfe64dd3Smacallan    pXGI->TurboQueue = TRUE;
211dfe64dd3Smacallan#ifdef XGIVRAMQ
212dfe64dd3Smacallan    /* TODO: Option (315 series VRAM command queue) */
213dfe64dd3Smacallan    /* But beware: xgifb does not know about this!!! */
214dfe64dd3Smacallan    pXGI->cmdQueueSize = 512*1024;
215dfe64dd3Smacallan#endif
216dfe64dd3Smacallan    pXGI->doRender = TRUE;
217dfe64dd3Smacallan    pXGI->HWCursor = TRUE;
218dfe64dd3Smacallan    pXGI->Rotate = FALSE;
219dfe64dd3Smacallan    pXGI->ShadowFB = FALSE;
220dfe64dd3Smacallan
221dfe64dd3Smacallan	/* Jong 01/22/2009; only XG40 has 3-d feature */
222dfe64dd3Smacallan	if(pXGI->Chipset == PCI_CHIP_XGIXG40)
223dfe64dd3Smacallan		pXGI->loadDRI = TRUE;
224dfe64dd3Smacallan	else
225dfe64dd3Smacallan		pXGI->loadDRI = FALSE;
226dfe64dd3Smacallan
227dfe64dd3Smacallan    pXGI->agpWantedPages = AGP_PAGES;
228dfe64dd3Smacallan    pXGI->NoXvideo = FALSE;
229dfe64dd3Smacallan    pXGI->maxxfbmem = 0;
230dfe64dd3Smacallan    pXGI->OptROMUsage = -1;
231dfe64dd3Smacallan    pXGI->noInternalModes = FALSE;
232dfe64dd3Smacallan    pXGI->NonDefaultPAL = pXGI->NonDefaultNTSC = -1;
233dfe64dd3Smacallan    pXGI->restorebyset = TRUE;
234dfe64dd3Smacallan    pXGI->nocrt2ddcdetection = FALSE;
235dfe64dd3Smacallan    pXGI->forcecrt2redetection = TRUE;   /* default changed since 13/09/2003 */
236dfe64dd3Smacallan    pXGI->SenseYPbPr = TRUE;
237dfe64dd3Smacallan    pXGI->ForceCRT1Type = CRT1_VGA;
238dfe64dd3Smacallan    pXGI->ForceCRT2Type = CRT2_DEFAULT;
239dfe64dd3Smacallan    pXGI->ForceYPbPrAR = TV_YPBPR169;
240dfe64dd3Smacallan    pXGI->ForceTVType = -1;
241dfe64dd3Smacallan    pXGI->CRT1gamma = TRUE;
242dfe64dd3Smacallan    pXGI->CRT1gammaGiven = FALSE;
243dfe64dd3Smacallan    pXGI->CRT2gamma = TRUE;
244dfe64dd3Smacallan    pXGI->XvGamma = FALSE;
245dfe64dd3Smacallan    pXGI->XvGammaGiven = FALSE;
246dfe64dd3Smacallan    pXGI->enablexgictrl = FALSE;
247dfe64dd3Smacallan
248dfe64dd3Smacallan       pXGI->XvDefBri = 0;
249dfe64dd3Smacallan       pXGI->XvDefCon = 4;
250dfe64dd3Smacallan
251dfe64dd3Smacallan    pXGI->XvDefHue = 0;
252dfe64dd3Smacallan    pXGI->XvDefSat = 0;
253dfe64dd3Smacallan    pXGI->XvDefDisableGfx = FALSE;
254dfe64dd3Smacallan    pXGI->XvDefDisableGfxLR = FALSE;
255dfe64dd3Smacallan    pXGI->XvUseMemcpy = TRUE;
256dfe64dd3Smacallan    pXGI->XvGammaRed = pXGI->XvGammaGreen = pXGI->XvGammaBlue = 1000;
257dfe64dd3Smacallan#ifdef XGIMERGED
258dfe64dd3Smacallan    pXGI->MergedFB = pXGI->MergedFBAuto = FALSE;
259dfe64dd3Smacallan    pXGI->CRT2Position = xgiRightOf;
260dfe64dd3Smacallan    pXGI->CRT2HSync = NULL;
261dfe64dd3Smacallan    pXGI->CRT2VRefresh = NULL;
262dfe64dd3Smacallan    pXGI->MetaModes = NULL;
263dfe64dd3Smacallan    pXGI->MergedFBXDPI = pXGI->MergedFBYDPI = 0;
264dfe64dd3Smacallan#ifdef XGIXINERAMA
265dfe64dd3Smacallan    pXGI->UsexgiXinerama = TRUE;
266dfe64dd3Smacallan    pXGI->CRT2IsScrn0 = FALSE;
267dfe64dd3Smacallan#endif
268dfe64dd3Smacallan#endif
269dfe64dd3Smacallan#ifdef XGI_CP
270dfe64dd3Smacallan    XGI_CP_OPT_DEFAULT
271dfe64dd3Smacallan#endif
272dfe64dd3Smacallan
273dfe64dd3Smacallan
274dfe64dd3Smacallan    /* Collect the options */
275dfe64dd3Smacallan
276dfe64dd3Smacallan	int	TargetRefreshRate = 0;
277dfe64dd3Smacallan    if(xf86GetOptValInteger(pXGI->Options /* pScrn->monitor->options */, OPTION_TARGET_RATE, &TargetRefreshRate))
278dfe64dd3Smacallan	{
279dfe64dd3Smacallan		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Monitor (Option) : Set target refresh rate at %d for all modes...\n", TargetRefreshRate);
280dfe64dd3Smacallan	}
281dfe64dd3Smacallan
282dfe64dd3Smacallan    pXGI->TargetRefreshRate = TargetRefreshRate;
283dfe64dd3Smacallan
284dfe64dd3Smacallan	pXGI->IgnoreDDC = FALSE;
285dfe64dd3Smacallan    if(xf86GetOptValBool(pXGI->Options, OPTION_IGNORE_DDC, &pXGI->IgnoreDDC))
286dfe64dd3Smacallan	{
287dfe64dd3Smacallan		if(pXGI->IgnoreDDC == TRUE)
288dfe64dd3Smacallan			xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Monitor (Option) : IgnoreDDC \n");
289dfe64dd3Smacallan	}
290dfe64dd3Smacallan#if 0 /* can support 1280x768 but not being applied */
291dfe64dd3Smacallan	else
292dfe64dd3Smacallan	{
293dfe64dd3Smacallan		pXGI->IgnoreDDC = TRUE;
294dfe64dd3Smacallan		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Monitor (Option) : set IgnoreDDC as default\n");
295dfe64dd3Smacallan	}
296dfe64dd3Smacallan#endif
297dfe64dd3Smacallan
298dfe64dd3Smacallan	pXGI->Non_DDC_DefaultMode = FALSE;
299dfe64dd3Smacallan	pXGI->Non_DDC_DefaultResolutionX = 1024;
300dfe64dd3Smacallan	pXGI->Non_DDC_DefaultResolutionY = 768;
301dfe64dd3Smacallan	pXGI->Non_DDC_DefaultRefreshRate = 60;
302dfe64dd3Smacallan
303dfe64dd3Smacallan	char	ModeStringFormat[32] = 	"%[^x]x%[^@]@%[^\n]" /* "%[^x]+%[^@]+%[^H^z]" */;
304dfe64dd3Smacallan    char*   Non_DDCDefaultMode = "";
305dfe64dd3Smacallan    char   Non_DDCDefaultResolutionX[8] = "";
306dfe64dd3Smacallan    char   Non_DDCDefaultResolutionY[8] = "";
307dfe64dd3Smacallan    char   Non_DDCDefaultRefreshRate[8] = "";
308dfe64dd3Smacallan
309dfe64dd3Smacallan	/* strcpy(ModeStringFormat, "%[^+]x%[^+]@%[^\n]"); */
310dfe64dd3Smacallan
311dfe64dd3Smacallan	if((Non_DDCDefaultMode = (char *)xf86GetOptValString(pXGI->Options, OPTION_NONDDC_DEFAULT_MODE)))
312dfe64dd3Smacallan	{
313dfe64dd3Smacallan		sscanf(Non_DDCDefaultMode, ModeStringFormat,
314dfe64dd3Smacallan				Non_DDCDefaultResolutionX ,
315dfe64dd3Smacallan				Non_DDCDefaultResolutionY ,
316dfe64dd3Smacallan				Non_DDCDefaultRefreshRate  );
317dfe64dd3Smacallan
318098ad5bdSmacallan		if( (xf86NameCmp(Non_DDCDefaultResolutionX,"") == 0) || (xf86NameCmp(Non_DDCDefaultResolutionY,"") == 0) )
319dfe64dd3Smacallan		{
320dfe64dd3Smacallan			strcpy(Non_DDCDefaultResolutionX, "1024");
321dfe64dd3Smacallan			strcpy(Non_DDCDefaultResolutionY, "768");
322dfe64dd3Smacallan		}
323dfe64dd3Smacallan
324098ad5bdSmacallan		if( (xf86NameCmp(Non_DDCDefaultRefreshRate,"") == 0) || (xf86NameCmp(Non_DDCDefaultRefreshRate,"auto") == 0) )
325dfe64dd3Smacallan				strcpy(Non_DDCDefaultRefreshRate, "60");
326dfe64dd3Smacallan
327dfe64dd3Smacallan		ErrorF("Non-DDC default mode is (%s x %s @ %s Hz)...\n",
328dfe64dd3Smacallan					Non_DDCDefaultResolutionX ,
329dfe64dd3Smacallan					Non_DDCDefaultResolutionY ,
330dfe64dd3Smacallan					Non_DDCDefaultRefreshRate );
331dfe64dd3Smacallan
332dfe64dd3Smacallan		pXGI->Non_DDC_DefaultMode = TRUE;
333dfe64dd3Smacallan
334dfe64dd3Smacallan		pXGI->Non_DDC_DefaultResolutionX = atoi(Non_DDCDefaultResolutionX);
335dfe64dd3Smacallan		pXGI->Non_DDC_DefaultResolutionY = atoi(Non_DDCDefaultResolutionY);
336dfe64dd3Smacallan		pXGI->Non_DDC_DefaultRefreshRate = atoi(Non_DDCDefaultRefreshRate);
337dfe64dd3Smacallan
338dfe64dd3Smacallan		ErrorF("Non-DDC default mode is (%d x %d @ %d Hz)...\n",
339dfe64dd3Smacallan					pXGI->Non_DDC_DefaultResolutionX ,
340dfe64dd3Smacallan					pXGI->Non_DDC_DefaultResolutionY ,
341dfe64dd3Smacallan					pXGI->Non_DDC_DefaultRefreshRate );
342dfe64dd3Smacallan	}
343dfe64dd3Smacallan
344dfe64dd3Smacallan	/* Jong@09092009; gamma value */
345dfe64dd3Smacallan	g_GammaRed = g_GammaGreen = g_GammaBlue = 1000;
346dfe64dd3Smacallan
347dfe64dd3Smacallan	char	GammaStringFormat[32] = "%[^,],%[^,],%[^\n]";
348dfe64dd3Smacallan    char*   GammaRGB = "";
349dfe64dd3Smacallan    char   GammaRed[8] = "";
350dfe64dd3Smacallan    char   GammaGreen[8] = "";
351dfe64dd3Smacallan    char   GammaBlue[8] = "";
352dfe64dd3Smacallan
353dfe64dd3Smacallan	if((GammaRGB = (char *)xf86GetOptValString(pXGI->Options, OPTION_GAMMA_RGB)))
354dfe64dd3Smacallan	{
355dfe64dd3Smacallan		ErrorF("GammaRGB is (%s) from xorg.conf\n", GammaRGB);
356dfe64dd3Smacallan		sscanf(GammaRGB, GammaStringFormat,
357dfe64dd3Smacallan				GammaRed ,
358dfe64dd3Smacallan				GammaGreen ,
359dfe64dd3Smacallan				GammaBlue  );
360dfe64dd3Smacallan		ErrorF("GammaRGB is (%s, %s, %s) after parsing\n", GammaRed, GammaGreen, GammaBlue);
361dfe64dd3Smacallan
362dfe64dd3Smacallan		g_GammaRed = atoi(GammaRed);
363dfe64dd3Smacallan		g_GammaGreen = atoi(GammaGreen);
364dfe64dd3Smacallan		g_GammaBlue = atoi(GammaBlue);
365dfe64dd3Smacallan
366dfe64dd3Smacallan		ErrorF("GammaRGB is (%d, %d, %d) after atoi()\n", g_GammaRed, g_GammaGreen, g_GammaBlue);
367dfe64dd3Smacallan	}
368dfe64dd3Smacallan
369dfe64dd3Smacallan    /* MaxXFBMem
370dfe64dd3Smacallan     * This options limits the amount of video memory X uses for screen
371dfe64dd3Smacallan     * and off-screen buffers. This option should be used if using DRI
372dfe64dd3Smacallan     * is intended. The kernel framebuffer driver required for DRM will
373dfe64dd3Smacallan     * start its memory heap at 12MB if it detects more than 16MB, at 8MB if
374dfe64dd3Smacallan     * between 8 and 16MB are available, otherwise at 4MB. So, if the amount
375dfe64dd3Smacallan     * of memory X uses, a clash between the framebuffer's memory heap
376dfe64dd3Smacallan     * and X is avoided. The amount is to be specified in KB.
377dfe64dd3Smacallan     */
378dfe64dd3Smacallan    if(xf86GetOptValULong(pXGI->Options, OPTION_MAXXFBMEM,
379dfe64dd3Smacallan                                &pXGI->maxxfbmem)) {
380dfe64dd3Smacallan            xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
381dfe64dd3Smacallan                    "MaxXFBMem: Framebuffer memory shall be limited to %ld KB\n",
382dfe64dd3Smacallan		    pXGI->maxxfbmem);
383dfe64dd3Smacallan	    pXGI->maxxfbmem *= 1024;
384dfe64dd3Smacallan    }
385dfe64dd3Smacallan
386dfe64dd3Smacallan    /* NoAccel
387dfe64dd3Smacallan     * Turns off 2D acceleration
388dfe64dd3Smacallan     */
389dfe64dd3Smacallan    if(xf86ReturnOptValBool(pXGI->Options, OPTION_NOACCEL, FALSE)) {
390dfe64dd3Smacallan        pXGI->NoAccel = TRUE;
391dfe64dd3Smacallan	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "2D Acceleration disabled\n");
392dfe64dd3Smacallan    }
393dfe64dd3Smacallan
394dfe64dd3Smacallan	/* Jong@10022009; for xvinfo */
395dfe64dd3Smacallan	if ((pXGI->Chipset== PCI_CHIP_XGIXG20)||(pXGI->Chipset== PCI_CHIP_XGIXG21)||(pXGI->Chipset== PCI_CHIP_XGIXG27))
396dfe64dd3Smacallan		pXGI->NoXvideo = TRUE;
397dfe64dd3Smacallan
398dfe64dd3Smacallan	pXGI->useEXA = FALSE; /* default : XAA */
399dfe64dd3Smacallan    if(!pXGI->NoAccel)
400dfe64dd3Smacallan	{
401dfe64dd3Smacallan		from = X_DEFAULT;
402dfe64dd3Smacallan		if((strptr = (char *)xf86GetOptValString(pXGI->Options, OPTION_ACCELMETHOD))) {
403dfe64dd3Smacallan			if(!xf86NameCmp(strptr,"XAA")) {
404dfe64dd3Smacallan				from = X_CONFIG;
405dfe64dd3Smacallan				pXGI->useEXA = FALSE;
406dfe64dd3Smacallan			} else if(!xf86NameCmp(strptr,"EXA")) {
407dfe64dd3Smacallan				from = X_CONFIG;
408dfe64dd3Smacallan				pXGI->useEXA = TRUE;
409dfe64dd3Smacallan			}
410dfe64dd3Smacallan		}
411dfe64dd3Smacallan
412dfe64dd3Smacallan		xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n",
413dfe64dd3Smacallan			pXGI->useEXA ? "EXA" : "XAA");
414dfe64dd3Smacallan    }
415dfe64dd3Smacallan
416dfe64dd3Smacallan    /* SWCursor
417dfe64dd3Smacallan     * HWCursor
418dfe64dd3Smacallan     * Chooses whether to use the hardware or software cursor
419dfe64dd3Smacallan     */
420dfe64dd3Smacallan    from = X_DEFAULT;
421dfe64dd3Smacallan    if(xf86GetOptValBool(pXGI->Options, OPTION_HW_CURSOR, &pXGI->HWCursor)) {
422dfe64dd3Smacallan        from = X_CONFIG;
423dfe64dd3Smacallan    }
424dfe64dd3Smacallan    if(xf86ReturnOptValBool(pXGI->Options, OPTION_SW_CURSOR, FALSE)) {
425dfe64dd3Smacallan        from = X_CONFIG;
426dfe64dd3Smacallan        pXGI->HWCursor = FALSE;
427dfe64dd3Smacallan    }
428dfe64dd3Smacallan    xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
429dfe64dd3Smacallan                                pXGI->HWCursor ? "HW" : "SW");
430dfe64dd3Smacallan
431dfe64dd3Smacallan    /*
432dfe64dd3Smacallan     * MergedFB
433dfe64dd3Smacallan     *
434dfe64dd3Smacallan     * Enable/disable and configure merged framebuffer mode
435dfe64dd3Smacallan     *
436dfe64dd3Smacallan     */
437dfe64dd3Smacallan#ifdef XGIMERGED
438dfe64dd3Smacallan    if (IS_DUAL_HEAD(pXGI)) {
439dfe64dd3Smacallan       Bool val;
440dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_MERGEDFB, &val)) {
441dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
442dfe64dd3Smacallan	     "Option \"MergedFB\" cannot be used in Dual Head mode\n");
443dfe64dd3Smacallan       }
444dfe64dd3Smacallan    } else
445dfe64dd3Smacallan#endif
446dfe64dd3Smacallan
447dfe64dd3Smacallan    /* Some options can only be specified in the Master Head's Device
448dfe64dd3Smacallan     * section. Here we give the user a hint in the log.
449dfe64dd3Smacallan     */
450dfe64dd3Smacallan    if (IS_DUAL_HEAD(pXGI) && IS_SECOND_HEAD(pXGI)) {
451dfe64dd3Smacallan       static const char *mystring = "Option \"%s\" is only accepted in Master Head's device section\n";
452dfe64dd3Smacallan       Bool val;
453dfe64dd3Smacallan
454dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_TURBOQUEUE, &val)) {
455dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "TurboQueue");
456dfe64dd3Smacallan       }
457dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_RESTOREBYSET, &val)) {
458dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "RestoreBySetMode");
459dfe64dd3Smacallan       }
460dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_ENABLEHOTKEY, &val)) {
461dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EnableHotKey");
462dfe64dd3Smacallan       }
463dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_ENABLEXGICTRL, &val)) {
464dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EnableXGICtrl");
465dfe64dd3Smacallan       }
466dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_USEROMDATA, &val)) {
467dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "UseROMData");
468dfe64dd3Smacallan       }
469dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_NODDCFORCRT2, &val)) {
470dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "NoCRT2Detection");
471dfe64dd3Smacallan       }
472dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_FORCECRT2REDETECTION, &val)) {
473dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2ReDetection");
474dfe64dd3Smacallan       }
475dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_SENSEYPBPR, &val)) {
476dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SenseYPbPr");
477dfe64dd3Smacallan       }
478dfe64dd3Smacallan       if(xf86GetOptValString(pXGI->Options, OPTION_FORCE_CRT1TYPE)) {
479dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT1Type");
480dfe64dd3Smacallan       }
481dfe64dd3Smacallan       if(xf86GetOptValString(pXGI->Options, OPTION_FORCE_CRT2TYPE)) {
482dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2Type");
483dfe64dd3Smacallan       }
484dfe64dd3Smacallan       if(xf86GetOptValString(pXGI->Options, OPTION_YPBPRAR)) {
485dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "YPbPrAspectRatio");
486dfe64dd3Smacallan       }
487dfe64dd3Smacallan       if(xf86GetOptValString(pXGI->Options, OPTION_SPECIALTIMING)) {
488dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SpecialTiming");
489dfe64dd3Smacallan       }
490dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_CRT2GAMMA, &val)) {
491dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CRT2Gamma");
492dfe64dd3Smacallan       }
493dfe64dd3Smacallan#ifdef XGI_CP
494dfe64dd3Smacallan       XGI_CP_OPT_DH_WARN
495dfe64dd3Smacallan#endif
496dfe64dd3Smacallan    }
497dfe64dd3Smacallan    else {
498dfe64dd3Smacallan	  /* TurboQueue */
499dfe64dd3Smacallan
500dfe64dd3Smacallan          from = X_DEFAULT;
501dfe64dd3Smacallan          if(xf86GetOptValBool(pXGI->Options, OPTION_TURBOQUEUE, &pXGI->TurboQueue)) {
502dfe64dd3Smacallan    	     from = X_CONFIG;
503dfe64dd3Smacallan          }
504dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
505dfe64dd3Smacallan                    pXGI->TurboQueue ? enabledstr : disabledstr);
506dfe64dd3Smacallan
507dfe64dd3Smacallan#ifdef XGI_CP
508dfe64dd3Smacallan       XGI_CP_OPT_DOOPT
509dfe64dd3Smacallan#endif
510dfe64dd3Smacallan
511dfe64dd3Smacallan    }  /* DualHead */
512dfe64dd3Smacallan
513dfe64dd3Smacallan    /* CRT1Gamma - enable/disable gamma correction for CRT1
514dfe64dd3Smacallan     */
515dfe64dd3Smacallan    {
516dfe64dd3Smacallan       Bool val;
517dfe64dd3Smacallan       if(xf86GetOptValBool(pXGI->Options, OPTION_CRT1GAMMA, &val)) {
518dfe64dd3Smacallan	  pXGI->CRT1gamma = val;
519dfe64dd3Smacallan	  pXGI->CRT1gammaGiven = TRUE;
520dfe64dd3Smacallan       }
521dfe64dd3Smacallan    }
522dfe64dd3Smacallan
523dfe64dd3Smacallan
524dfe64dd3Smacallan    /* ShadowFB */
525dfe64dd3Smacallan    from = X_DEFAULT;
526dfe64dd3Smacallan    if(xf86GetOptValBool(pXGI->Options, OPTION_SHADOW_FB, &pXGI->ShadowFB)) {
527dfe64dd3Smacallan#ifdef XGIMERGED
528dfe64dd3Smacallan       if(pXGI->MergedFB) {
529dfe64dd3Smacallan          pXGI->ShadowFB = FALSE;
530dfe64dd3Smacallan	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
531dfe64dd3Smacallan	      "Shadow Frame Buffer not supported in MergedFB mode\n");
532dfe64dd3Smacallan       } else
533dfe64dd3Smacallan#endif
534dfe64dd3Smacallan          from = X_CONFIG;
535dfe64dd3Smacallan    }
536dfe64dd3Smacallan    if(pXGI->ShadowFB) {
537dfe64dd3Smacallan	pXGI->NoAccel = TRUE;
538dfe64dd3Smacallan    	xf86DrvMsg(pScrn->scrnIndex, from,
539dfe64dd3Smacallan	   "Using \"Shadow Frame Buffer\" - 2D acceleration disabled\n");
540dfe64dd3Smacallan    }
541dfe64dd3Smacallan
542dfe64dd3Smacallan    /* Rotate */
543dfe64dd3Smacallan    if((strptr = (char *)xf86GetOptValString(pXGI->Options, OPTION_ROTATE))) {
544dfe64dd3Smacallan#ifdef XGIMERGED
545dfe64dd3Smacallan       if(pXGI->MergedFB) {
546dfe64dd3Smacallan	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
547dfe64dd3Smacallan	      "Screen rotation not supported in MergedFB mode\n");
548dfe64dd3Smacallan       } else
549dfe64dd3Smacallan#endif
550dfe64dd3Smacallan       if(!xf86NameCmp(strptr, "CW")) {
551dfe64dd3Smacallan          pXGI->Rotate = 1;
552dfe64dd3Smacallan       } else if(!xf86NameCmp(strptr, "CCW")) {
553dfe64dd3Smacallan          pXGI->Rotate = -1;
554dfe64dd3Smacallan       } else {
555dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "Rotate");
556dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_INFO,
557dfe64dd3Smacallan              "Valid parameters are \"CW\" or \"CCW\"\n");
558dfe64dd3Smacallan       }
559dfe64dd3Smacallan
560dfe64dd3Smacallan       if(pXGI->Rotate) {
561dfe64dd3Smacallan          pXGI->ShadowFB = TRUE;
562dfe64dd3Smacallan          pXGI->NoAccel  = TRUE;
563dfe64dd3Smacallan          pXGI->HWCursor = FALSE;
564dfe64dd3Smacallan	  xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
565dfe64dd3Smacallan              "Rotating screen %sclockwise (2D acceleration %sdisabled)\n",
566dfe64dd3Smacallan	      (pXGI->Rotate == -1) ? "counter " : "",
567dfe64dd3Smacallan              "and RandR extension "
568dfe64dd3Smacallan	      );
569dfe64dd3Smacallan       }
570dfe64dd3Smacallan    }
571dfe64dd3Smacallan
572dfe64dd3Smacallan	/* Jong 07/27/2009; get option of run-time debug */
573dfe64dd3Smacallan    if(!xf86GetOptValBool(pXGI->Options, OPTION_RUNTIME_DEBUG, &g_bRunTimeDebug))
574dfe64dd3Smacallan		g_bRunTimeDebug=0;
575dfe64dd3Smacallan
576dfe64dd3Smacallan#ifdef XF86DRI
577dfe64dd3Smacallan    /* DRI */
578dfe64dd3Smacallan    from = X_DEFAULT;
579dfe64dd3Smacallan    if(xf86GetOptValBool(pXGI->Options, OPTION_DRI, &pXGI->loadDRI)) {
580dfe64dd3Smacallan       from = X_CONFIG;
581dfe64dd3Smacallan    }
582dfe64dd3Smacallan    xf86DrvMsg(pScrn->scrnIndex, from, "DRI %s\n",
583dfe64dd3Smacallan       pXGI->loadDRI ? enabledstr : disabledstr);
584dfe64dd3Smacallan
585dfe64dd3Smacallan    /* AGPSize */
586dfe64dd3Smacallan    {
587dfe64dd3Smacallan       int vali;
588dfe64dd3Smacallan       Bool gotit = FALSE;
589dfe64dd3Smacallan       if(xf86GetOptValInteger(pXGI->Options, OPTION_AGP_SIZE, &vali)) {
590dfe64dd3Smacallan          gotit = TRUE;
591dfe64dd3Smacallan       } else if(xf86GetOptValInteger(pXGI->Options, OPTION_AGP_SIZE2, &vali)) {
592dfe64dd3Smacallan          gotit = TRUE;
593dfe64dd3Smacallan       }
594dfe64dd3Smacallan       if(gotit) {
595dfe64dd3Smacallan	  if((vali >= 8) && (vali <= 512)) {
596dfe64dd3Smacallan	     pXGI->agpWantedPages = (vali * 1024 * 1024) / AGP_PAGE_SIZE;
597dfe64dd3Smacallan	  } else {
598dfe64dd3Smacallan	     xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr, "AGPSize (alias GARTSize)", 8, 512);
599dfe64dd3Smacallan	  }
600dfe64dd3Smacallan       }
601dfe64dd3Smacallan    }
602dfe64dd3Smacallan#endif
603dfe64dd3Smacallan
604dfe64dd3Smacallan    /* NoXVideo
605dfe64dd3Smacallan     * Set this to TRUE to disable Xv hardware video acceleration
606dfe64dd3Smacallan     */
607dfe64dd3Smacallan    if(!pXGI->NoXvideo) {
608dfe64dd3Smacallan       if(xf86ReturnOptValBool(pXGI->Options, OPTION_NOXVIDEO, FALSE)) {
609dfe64dd3Smacallan          pXGI->NoXvideo = TRUE;
610dfe64dd3Smacallan          xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension disabled\n");
611dfe64dd3Smacallan       }
612dfe64dd3Smacallan
613dfe64dd3Smacallan       if(!pXGI->NoXvideo) {
614dfe64dd3Smacallan          Bool val;
615dfe64dd3Smacallan	  int tmp;
616dfe64dd3Smacallan
617dfe64dd3Smacallan	  /* Some Xv properties' defaults can be set by options */
618dfe64dd3Smacallan          if(xf86GetOptValInteger(pXGI->Options, OPTION_XVDEFCONTRAST, &tmp)) {
619dfe64dd3Smacallan             if((tmp >= 0) && (tmp <= 7)) pXGI->XvDefCon = tmp;
620dfe64dd3Smacallan             else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
621dfe64dd3Smacallan       		      "XvDefaultContrast" ,0, 7);
622dfe64dd3Smacallan          }
623dfe64dd3Smacallan          if(xf86GetOptValInteger(pXGI->Options, OPTION_XVDEFBRIGHTNESS, &tmp)) {
624dfe64dd3Smacallan             if((tmp >= -128) && (tmp <= 127)) pXGI->XvDefBri = tmp;
625dfe64dd3Smacallan             else xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ilrangestr,
626dfe64dd3Smacallan       		      "XvDefaultBrightness", -128, 127);
627dfe64dd3Smacallan          }
628dfe64dd3Smacallan
629dfe64dd3Smacallan	  if(xf86GetOptValBool(pXGI->Options, OPTION_XVDEFDISABLEGFX, &val)) {
630dfe64dd3Smacallan	     if(val)  pXGI->XvDefDisableGfx = TRUE;
631dfe64dd3Smacallan	     xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
632dfe64dd3Smacallan	        "Graphics display will be %s during Xv usage\n",
633dfe64dd3Smacallan	     	val ? disabledstr : enabledstr);
634dfe64dd3Smacallan          }
635dfe64dd3Smacallan
636dfe64dd3Smacallan	  if(xf86GetOptValBool(pXGI->Options, OPTION_XVMEMCPY, &val)) {
637dfe64dd3Smacallan	     pXGI->XvUseMemcpy = val ? TRUE : FALSE;
638dfe64dd3Smacallan	     xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv will %suse memcpy()\n",
639dfe64dd3Smacallan	     	val ? "" : "not ");
640dfe64dd3Smacallan          }
641dfe64dd3Smacallan       }
642dfe64dd3Smacallan    }
643dfe64dd3Smacallan}
644dfe64dd3Smacallan
645dfe64dd3Smacallanconst OptionInfoRec *
646dfe64dd3SmacallanXGIAvailableOptions(int chipid, int busid)
647dfe64dd3Smacallan{
648dfe64dd3Smacallan    return XGIOptions;
649dfe64dd3Smacallan}
650