132b578d3Smrg/*
232b578d3Smrg * Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
332b578d3Smrg *
432b578d3Smrg * Permission to use, copy, modify, distribute, and sell this software and its
532b578d3Smrg * documentation for any purpose is hereby granted without fee, provided that
632b578d3Smrg * the above copyright notice appear in all copies and that both that copyright
732b578d3Smrg * notice and this permission notice appear in supporting documentation, and
832b578d3Smrg * that the name of Marc Aurele La France not be used in advertising or
932b578d3Smrg * publicity pertaining to distribution of the software without specific,
1032b578d3Smrg * written prior permission.  Marc Aurele La France makes no representations
1132b578d3Smrg * about the suitability of this software for any purpose.  It is provided
1232b578d3Smrg * "as-is" without express or implied warranty.
1332b578d3Smrg *
1432b578d3Smrg * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1532b578d3Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO
1632b578d3Smrg * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1732b578d3Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1832b578d3Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1932b578d3Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2032b578d3Smrg * PERFORMANCE OF THIS SOFTWARE.
2132b578d3Smrg *
2232b578d3Smrg * DRI support by:
2332b578d3Smrg *    Leif Delgass <ldelgass@retinalburn.net>
2432b578d3Smrg */
2532b578d3Smrg
2632b578d3Smrg#ifdef HAVE_CONFIG_H
2732b578d3Smrg#include "config.h"
2832b578d3Smrg#endif
2932b578d3Smrg
3032b578d3Smrg#include <string.h>
3132b578d3Smrg
3232b578d3Smrg#include "ati.h"
3332b578d3Smrg#include "atichip.h"
3432b578d3Smrg#include "aticursor.h"
3532b578d3Smrg#include "atioption.h"
3632b578d3Smrg#include "atistruct.h"
3732b578d3Smrg
3832b578d3Smrg#include "mach64_common.h"
3932b578d3Smrg
4032b578d3Smrg#ifdef TV_OUT
4132b578d3Smrg
4232b578d3Smrg/*
4332b578d3Smrg * List of supported TV standard names
4432b578d3Smrg */
4532b578d3Smrgconst char *ATITVStandardNames[ATI_TV_STDS_MAX_VALID+1] = {
4632b578d3Smrg    "NTSC",
4732b578d3Smrg    "PAL",
4832b578d3Smrg    "PAL-M",
4932b578d3Smrg    "PAL-60",
5032b578d3Smrg    "NTSC-J",
5132b578d3Smrg    "PAL-CN",
5232b578d3Smrg    "PAL-N",
5332b578d3Smrg    "Reserved1",
5432b578d3Smrg    "Reserved2",
5532b578d3Smrg    "SCART-PAL",
5632b578d3Smrg    "None",
5732b578d3Smrg    "Invalid"
5832b578d3Smrg};
5932b578d3Smrg
6032b578d3Smrg#endif /* TV_OUT */
6132b578d3Smrg
6232b578d3Smrg/*
6332b578d3Smrg * Recognised XF86Config options.
6432b578d3Smrg */
6532b578d3Smrgstatic const OptionInfoRec ATIPublicOptions[] =
6632b578d3Smrg{
6732b578d3Smrg    {
6832b578d3Smrg        ATI_OPTION_PROBE_SPARSE,
6932b578d3Smrg        "probe_sparse",
7032b578d3Smrg        OPTV_BOOLEAN,
7132b578d3Smrg        {0, },
7232b578d3Smrg        FALSE
7332b578d3Smrg    },
7432b578d3Smrg    {
7532b578d3Smrg        ATI_OPTION_ACCEL,
7632b578d3Smrg        "accel",
7732b578d3Smrg        OPTV_BOOLEAN,
7832b578d3Smrg        {0, },
7932b578d3Smrg        FALSE
8032b578d3Smrg    },
8132b578d3Smrg    {
8232b578d3Smrg        ATI_OPTION_CRT_DISPLAY,
8332b578d3Smrg        "crt_display",
8432b578d3Smrg        OPTV_BOOLEAN,
8532b578d3Smrg        {0, },
8632b578d3Smrg        FALSE
8732b578d3Smrg    },
8832b578d3Smrg    {
8932b578d3Smrg        ATI_OPTION_CSYNC,
9032b578d3Smrg        "composite_sync",
9132b578d3Smrg        OPTV_BOOLEAN,
9232b578d3Smrg        {0, },
9332b578d3Smrg        FALSE
9432b578d3Smrg    },
9532b578d3Smrg    {
9632b578d3Smrg        ATI_OPTION_HWCURSOR,
9732b578d3Smrg        "hw_cursor",
9832b578d3Smrg        OPTV_BOOLEAN,
9932b578d3Smrg        {0, },
10032b578d3Smrg        FALSE,
10132b578d3Smrg    },
10232b578d3Smrg
10332b578d3Smrg#ifdef XF86DRI_DEVEL
10432b578d3Smrg
10532b578d3Smrg    {
10632b578d3Smrg        ATI_OPTION_IS_PCI,
10732b578d3Smrg        "force_pci_mode",
10832b578d3Smrg        OPTV_BOOLEAN,
10932b578d3Smrg        {0, },
11032b578d3Smrg        FALSE,
11132b578d3Smrg    },
11232b578d3Smrg    {
11332b578d3Smrg        ATI_OPTION_DMA_MODE,
11432b578d3Smrg        "dma_mode",
11532b578d3Smrg        OPTV_STRING,
11632b578d3Smrg        {0, },
11732b578d3Smrg        FALSE,
11832b578d3Smrg    },
11932b578d3Smrg    {
12032b578d3Smrg        ATI_OPTION_AGP_MODE,
12132b578d3Smrg        "agp_mode",
12232b578d3Smrg        OPTV_INTEGER,
12332b578d3Smrg        {0, },
12432b578d3Smrg        FALSE,
12532b578d3Smrg    },
12632b578d3Smrg    {
12732b578d3Smrg        ATI_OPTION_AGP_SIZE,
12832b578d3Smrg        "agp_size",
12932b578d3Smrg        OPTV_INTEGER,
13032b578d3Smrg        {0, },
13132b578d3Smrg        FALSE,
13232b578d3Smrg    },
13332b578d3Smrg    {
13432b578d3Smrg        ATI_OPTION_LOCAL_TEXTURES,
13532b578d3Smrg        "local_textures",
13632b578d3Smrg        OPTV_BOOLEAN,
13732b578d3Smrg        {0, },
13832b578d3Smrg        FALSE,
13932b578d3Smrg    },
14032b578d3Smrg    {
14132b578d3Smrg        ATI_OPTION_BUFFER_SIZE,
14232b578d3Smrg        "buffer_size",
14332b578d3Smrg        OPTV_INTEGER,
14432b578d3Smrg        {0, },
14532b578d3Smrg        FALSE,
14632b578d3Smrg    },
14732b578d3Smrg
14832b578d3Smrg#endif /* XF86DRI_DEVEL */
14932b578d3Smrg
15032b578d3Smrg#ifdef TV_OUT
15132b578d3Smrg    {
15232b578d3Smrg        ATI_OPTION_TV_OUT,
15332b578d3Smrg        "tv_out",
15432b578d3Smrg        OPTV_BOOLEAN,
15532b578d3Smrg        {0, },
15632b578d3Smrg        FALSE
15732b578d3Smrg    },
15832b578d3Smrg    {
15932b578d3Smrg        ATI_OPTION_TV_STD,
16032b578d3Smrg        "tv_standard",
16132b578d3Smrg        OPTV_STRING,
16232b578d3Smrg        {0, },
16332b578d3Smrg        FALSE
16432b578d3Smrg    },
16532b578d3Smrg
16632b578d3Smrg#endif /* TV_OUT */
16732b578d3Smrg
16832b578d3Smrg    {
16932b578d3Smrg        ATI_OPTION_MMIO_CACHE,
17032b578d3Smrg        "mmio_cache",
17132b578d3Smrg        OPTV_BOOLEAN,
17232b578d3Smrg        {0, },
17332b578d3Smrg        FALSE
17432b578d3Smrg    },
17532b578d3Smrg
17632b578d3Smrg
17732b578d3Smrg    {
17832b578d3Smrg        ATI_OPTION_TEST_MMIO_CACHE,
17932b578d3Smrg        "test_mmio_cache",
18032b578d3Smrg        OPTV_BOOLEAN,
18132b578d3Smrg        {0, },
18232b578d3Smrg        FALSE
18332b578d3Smrg    },
18432b578d3Smrg    {
18532b578d3Smrg        ATI_OPTION_PANEL_DISPLAY,
18632b578d3Smrg        "panel_display",
18732b578d3Smrg        OPTV_BOOLEAN,
18832b578d3Smrg        {0, },
18932b578d3Smrg        FALSE
19032b578d3Smrg    },
19132b578d3Smrg    {
19232b578d3Smrg        ATI_OPTION_REFERENCE_CLOCK,
19332b578d3Smrg        "reference_clock",
19432b578d3Smrg        OPTV_FREQ,
19532b578d3Smrg        {0, },
19632b578d3Smrg        FALSE
19732b578d3Smrg    },
19832b578d3Smrg    {
19932b578d3Smrg        ATI_OPTION_SHADOW_FB,
20032b578d3Smrg        "shadow_fb",
20132b578d3Smrg        OPTV_BOOLEAN,
20232b578d3Smrg        {0, },
20332b578d3Smrg        FALSE
20432b578d3Smrg    },
20532b578d3Smrg    {
20632b578d3Smrg        ATI_OPTION_SWCURSOR,
20732b578d3Smrg        "sw_cursor",
20832b578d3Smrg        OPTV_BOOLEAN,
20932b578d3Smrg        {0, },
21032b578d3Smrg        FALSE,
21132b578d3Smrg    },
21232b578d3Smrg    {
21332b578d3Smrg        ATI_OPTION_ACCELMETHOD,
21432b578d3Smrg        "AccelMethod",
21532b578d3Smrg        OPTV_STRING,
21632b578d3Smrg        {0, },
21732b578d3Smrg        FALSE
21832b578d3Smrg    },
21932b578d3Smrg    {
22032b578d3Smrg        ATI_OPTION_RENDER_ACCEL,
22132b578d3Smrg        "RenderAccel",
22232b578d3Smrg        OPTV_BOOLEAN,
22332b578d3Smrg        {0, },
22432b578d3Smrg        FALSE
22532b578d3Smrg    },
22632b578d3Smrg    {
22732b578d3Smrg        -1,
22832b578d3Smrg        NULL,
22932b578d3Smrg        OPTV_NONE,
23032b578d3Smrg        {0, },
23132b578d3Smrg        FALSE
23232b578d3Smrg    }
23332b578d3Smrg};
23432b578d3Smrg
23532b578d3Smrgstatic const unsigned long ATIPublicOptionSize = SizeOf(ATIPublicOptions);
23632b578d3Smrg
23732b578d3Smrgconst OptionInfoRec *
23832b578d3SmrgATIOptionsWeak(void) { return ATIPublicOptions; }
23932b578d3Smrg
24032b578d3Smrg/*
24132b578d3Smrg * Non-publicised XF86Config options.
24232b578d3Smrg */
24332b578d3Smrgtypedef enum
24432b578d3Smrg{
24532b578d3Smrg    ATI_OPTION_BIOS_DISPLAY,    /* Allow BIOS interference */
24632b578d3Smrg    ATI_OPTION_CRT_SCREEN,      /* Legacy negation of "PanelDisplay" */
24732b578d3Smrg    ATI_OPTION_DEVEL,           /* Intentionally undocumented */
24832b578d3Smrg    ATI_OPTION_BLEND,           /* Force horizontal blending of small modes */
24932b578d3Smrg    ATI_OPTION_LCDSYNC          /* Use XF86Config panel mode porches */
25032b578d3Smrg} ATIPrivateOptionType;
25132b578d3Smrg
25232b578d3Smrg/*
25332b578d3Smrg * ATIProcessOptions --
25432b578d3Smrg *
25532b578d3Smrg * This function extracts options from what was parsed out of the XF86Config
25632b578d3Smrg * file.
25732b578d3Smrg */
25832b578d3Smrgvoid
25932b578d3SmrgATIProcessOptions
26032b578d3Smrg(
26132b578d3Smrg    ScrnInfoPtr pScreenInfo,
26232b578d3Smrg    ATIPtr      pATI
26332b578d3Smrg)
26432b578d3Smrg{
26532b578d3Smrg    OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize);
26632b578d3Smrg    OptionInfoRec PrivateOption[] =
26732b578d3Smrg    {
26832b578d3Smrg        {                       /* ON:  Let BIOS change display(s) */
26932b578d3Smrg            ATI_OPTION_BIOS_DISPLAY,    /* OFF:  Don't */
27032b578d3Smrg            "biosdisplay",
27132b578d3Smrg            OPTV_BOOLEAN,
27232b578d3Smrg            {0, },
27332b578d3Smrg            FALSE
27432b578d3Smrg        },
27532b578d3Smrg        {                       /* Negation of "PanelDisplay" public option */
27632b578d3Smrg            ATI_OPTION_CRT_SCREEN,
27732b578d3Smrg            "crtscreen",
27832b578d3Smrg            OPTV_BOOLEAN,
27932b578d3Smrg            {0, },
28032b578d3Smrg            FALSE
28132b578d3Smrg        },
28232b578d3Smrg        {                       /* ON:   Ease exploration of loose ends */
28332b578d3Smrg            ATI_OPTION_DEVEL,   /* OFF:  Fit for public consumption */
28432b578d3Smrg            "tsi",
28532b578d3Smrg            OPTV_BOOLEAN,
28632b578d3Smrg            {0, },
28732b578d3Smrg            FALSE
28832b578d3Smrg        },
28932b578d3Smrg        {                       /* ON:   Horizontally blend most modes */
29032b578d3Smrg            ATI_OPTION_BLEND,   /* OFF:  Use pixel replication more often */
29132b578d3Smrg            "lcdblend",
29232b578d3Smrg            OPTV_BOOLEAN,
29332b578d3Smrg            {0, },
29432b578d3Smrg            FALSE
29532b578d3Smrg        },
29632b578d3Smrg        {                       /* ON:   Use XF86Config porch timings */
29732b578d3Smrg            ATI_OPTION_LCDSYNC, /* OFF:  Use porches from mode on entry */
29832b578d3Smrg            "lcdsync",
29932b578d3Smrg            OPTV_BOOLEAN,
30032b578d3Smrg            {0, },
30132b578d3Smrg            FALSE
30232b578d3Smrg        },
30332b578d3Smrg        {
30432b578d3Smrg            -1,
30532b578d3Smrg            NULL,
30632b578d3Smrg            OPTV_NONE,
30732b578d3Smrg            {0, },
30832b578d3Smrg            FALSE
30932b578d3Smrg        }
31032b578d3Smrg    };
31132b578d3Smrg
31232b578d3Smrg    (void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize);
31332b578d3Smrg
3140b0ce0bfSmrg#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 25
3150b0ce0bfSmrg# define boolean bool
3160b0ce0bfSmrg#endif
3170b0ce0bfSmrg
3180b0ce0bfSmrg#   define ProbeSparse   PublicOption[ATI_OPTION_PROBE_SPARSE].value.boolean
3190b0ce0bfSmrg#   define Accel         PublicOption[ATI_OPTION_ACCEL].value.boolean
3200b0ce0bfSmrg#   define BIOSDisplay   PrivateOption[ATI_OPTION_BIOS_DISPLAY].value.boolean
3210b0ce0bfSmrg#   define Blend         PrivateOption[ATI_OPTION_BLEND].value.boolean
3220b0ce0bfSmrg#   define CRTDisplay    PublicOption[ATI_OPTION_CRT_DISPLAY].value.boolean
3230b0ce0bfSmrg#   define CRTScreen     PrivateOption[ATI_OPTION_CRT_SCREEN].value.boolean
3240b0ce0bfSmrg#   define CSync         PublicOption[ATI_OPTION_CSYNC].value.boolean
3250b0ce0bfSmrg#   define Devel         PrivateOption[ATI_OPTION_DEVEL].value.boolean
3260b0ce0bfSmrg#   define HWCursor      PublicOption[ATI_OPTION_HWCURSOR].value.boolean
32732b578d3Smrg
32832b578d3Smrg#ifdef XF86DRI_DEVEL
32932b578d3Smrg
3300b0ce0bfSmrg#   define IsPCI       PublicOption[ATI_OPTION_IS_PCI].value.boolean
33132b578d3Smrg#   define DMAMode     PublicOption[ATI_OPTION_DMA_MODE].value.str
33232b578d3Smrg#   define AGPMode     PublicOption[ATI_OPTION_AGP_MODE].value.num
33332b578d3Smrg#   define AGPSize     PublicOption[ATI_OPTION_AGP_SIZE].value.num
3340b0ce0bfSmrg#   define LocalTex    PublicOption[ATI_OPTION_LOCAL_TEXTURES].value.boolean
33532b578d3Smrg#   define BufferSize  PublicOption[ATI_OPTION_BUFFER_SIZE].value.num
33632b578d3Smrg
33732b578d3Smrg#endif /* XF86DRI_DEVEL */
33832b578d3Smrg
33932b578d3Smrg#ifdef TV_OUT
34032b578d3Smrg
3410b0ce0bfSmrg#   define TvOut        PublicOption[ATI_OPTION_TV_OUT].value.boolean
34232b578d3Smrg#   define TvStd        PublicOption[ATI_OPTION_TV_STD].value.str
34332b578d3Smrg
34432b578d3Smrg#endif /* TV_OUT */
34532b578d3Smrg
3460b0ce0bfSmrg#   define CacheMMIO     PublicOption[ATI_OPTION_MMIO_CACHE].value.boolean
3470b0ce0bfSmrg#   define TestCacheMMIO PublicOption[ATI_OPTION_TEST_MMIO_CACHE].value.boolean
3480b0ce0bfSmrg#   define PanelDisplay  PublicOption[ATI_OPTION_PANEL_DISPLAY].value.boolean
3490b0ce0bfSmrg#   define ShadowFB      PublicOption[ATI_OPTION_SHADOW_FB].value.boolean
3500b0ce0bfSmrg#   define SWCursor      PublicOption[ATI_OPTION_SWCURSOR].value.boolean
35132b578d3Smrg#   define AccelMethod   PublicOption[ATI_OPTION_ACCELMETHOD].value.str
3520b0ce0bfSmrg#   define RenderAccel   PublicOption[ATI_OPTION_RENDER_ACCEL].value.boolean
3530b0ce0bfSmrg#   define LCDSync       PrivateOption[ATI_OPTION_LCDSYNC].value.boolean
35432b578d3Smrg
35532b578d3Smrg#   define ReferenceClock \
35632b578d3Smrg        PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq
35732b578d3Smrg
35832b578d3Smrg    /* Pick up XF86Config options */
35932b578d3Smrg    xf86CollectOptions(pScreenInfo, NULL);
36032b578d3Smrg
36132b578d3Smrg    /* Set non-zero defaults */
36232b578d3Smrg    Accel = CacheMMIO = HWCursor = TRUE;
36332b578d3Smrg
36432b578d3Smrg    ReferenceClock = ((double)157500000.0) / ((double)11.0);
36532b578d3Smrg
36632b578d3Smrg    ShadowFB = TRUE;
36732b578d3Smrg
36832b578d3Smrg    Blend = PanelDisplay = TRUE;
36932b578d3Smrg
37032b578d3Smrg#ifdef USE_EXA
37132b578d3Smrg    RenderAccel = TRUE;
37232b578d3Smrg#endif
37332b578d3Smrg
37432b578d3Smrg#ifdef XF86DRI_DEVEL
37532b578d3Smrg    DMAMode = "async";
37632b578d3Smrg#endif
37732b578d3Smrg
37832b578d3Smrg#ifdef TV_OUT
37932b578d3Smrg    TvStd = "None";  /* No tv standard change requested */
38032b578d3Smrg#endif
38132b578d3Smrg
38232b578d3Smrg    xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
38332b578d3Smrg        PublicOption);
38432b578d3Smrg    xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
38532b578d3Smrg        PrivateOption);
38632b578d3Smrg
38732b578d3Smrg    /* Move option values into driver private structure */
38832b578d3Smrg    pATI->OptionProbeSparse = ProbeSparse;
38932b578d3Smrg    pATI->OptionAccel = Accel;
39032b578d3Smrg    pATI->OptionBIOSDisplay = BIOSDisplay;
39132b578d3Smrg    pATI->OptionBlend = Blend;
39232b578d3Smrg    pATI->OptionCRTDisplay = CRTDisplay;
39332b578d3Smrg    pATI->OptionCSync = CSync;
39432b578d3Smrg    pATI->OptionDevel = Devel;
39532b578d3Smrg
39632b578d3Smrg#ifdef TV_OUT
39732b578d3Smrg
39832b578d3Smrg    if (TvOut && pATI->Chip < ATI_CHIP_264GT) {
39932b578d3Smrg       /* Only allow this for 3D Rage (I) or greater chip ID
40032b578d3Smrg	* AFAIK, no chips before this supported TV-Out
40132b578d3Smrg	* mach64VT has support for TV tuner, but no TV-Out
40232b578d3Smrg	*/
40332b578d3Smrg	xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
40432b578d3Smrg                "TV Out not supported for this chip.\n");
40532b578d3Smrg    } else {
40632b578d3Smrg	ATITVStandard std;
40732b578d3Smrg	pATI->OptionTvOut = TvOut;
40832b578d3Smrg	pATI->OptionTvStd = ATI_TV_STD_INVALID;
40932b578d3Smrg	for (std = 0; std < ATI_TV_STDS_MAX_VALID; std++) {
41032b578d3Smrg	    if (std != ATI_TV_STD_RESERVED1 && std != ATI_TV_STD_RESERVED2) {
41132b578d3Smrg		if (strncasecmp(TvStd, ATITVStandardNames[std], ATI_TV_STDS_NAME_MAXLEN)==0) {
41232b578d3Smrg		    pATI->OptionTvStd = std;
41332b578d3Smrg		    break;
41432b578d3Smrg		}
41532b578d3Smrg	    }
41632b578d3Smrg	}
41732b578d3Smrg    }
41832b578d3Smrg
41932b578d3Smrg#endif /* TV_OUT */
42032b578d3Smrg
42132b578d3Smrg    pATI->OptionMMIOCache = CacheMMIO;
42232b578d3Smrg    pATI->OptionTestMMIOCache = TestCacheMMIO;
42332b578d3Smrg    pATI->OptionShadowFB = ShadowFB;
42432b578d3Smrg    pATI->OptionLCDSync = LCDSync;
42532b578d3Smrg
42632b578d3Smrg    /* "CRTScreen" is now "NoPanelDisplay" */
42732b578d3Smrg    if ((PanelDisplay != CRTScreen) ||
42832b578d3Smrg        PublicOption[ATI_OPTION_PANEL_DISPLAY].found)
42932b578d3Smrg        pATI->OptionPanelDisplay = PanelDisplay;
43032b578d3Smrg    else
43132b578d3Smrg        pATI->OptionPanelDisplay = !CRTScreen;
43232b578d3Smrg
43332b578d3Smrg#ifdef XF86DRI_DEVEL
43432b578d3Smrg
43532b578d3Smrg    pATI->OptionIsPCI = IsPCI;
43632b578d3Smrg    pATI->OptionAGPMode = AGPMode;
43732b578d3Smrg    pATI->OptionAGPSize = AGPSize;
43832b578d3Smrg    pATI->OptionLocalTextures = LocalTex;
43932b578d3Smrg    pATI->OptionBufferSize = BufferSize;
44032b578d3Smrg
44132b578d3Smrg    if (strcasecmp(DMAMode, "async")==0)
44232b578d3Smrg        pATI->OptionDMAMode = MACH64_MODE_DMA_ASYNC;
44332b578d3Smrg    else if (strcasecmp(DMAMode, "sync")==0)
44432b578d3Smrg        pATI->OptionDMAMode = MACH64_MODE_DMA_SYNC;
44532b578d3Smrg    else if (strcasecmp(DMAMode, "mmio")==0 )
44632b578d3Smrg        pATI->OptionDMAMode = MACH64_MODE_MMIO;
44732b578d3Smrg    else {
44832b578d3Smrg        xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
4490b0ce0bfSmrg		   "Unknown dma_mode: '%s'\n", DMAMode);
45032b578d3Smrg	xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
45132b578d3Smrg		   "Valid dma_mode options are: 'async','sync','mmio'\n");
45232b578d3Smrg        xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
45332b578d3Smrg		   "Defaulting to async DMA mode\n");
45432b578d3Smrg	pATI->OptionDMAMode = MACH64_MODE_DMA_ASYNC;
45532b578d3Smrg    }
45632b578d3Smrg
45732b578d3Smrg#endif /* XF86DRI_DEVEL */
45832b578d3Smrg
45932b578d3Smrg    /* Validate and set cursor options */
46032b578d3Smrg    pATI->Cursor = ATI_CURSOR_SOFTWARE;
46132b578d3Smrg    if (SWCursor || !HWCursor)
46232b578d3Smrg    {
46332b578d3Smrg        if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
46432b578d3Smrg            xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
46532b578d3Smrg                "Option \"sw_cursor\" overrides Option \"hw_cursor\".\n");
46632b578d3Smrg    }
46732b578d3Smrg    else if (pATI->Chip < ATI_CHIP_264CT)
46832b578d3Smrg    {
46932b578d3Smrg        if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
47032b578d3Smrg            xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
47132b578d3Smrg                "Option \"hw_cursor\" not supported in this configuration.\n");
47232b578d3Smrg    }
47332b578d3Smrg    else
47432b578d3Smrg    {
47532b578d3Smrg        pATI->Cursor = ATI_CURSOR_HARDWARE;
47632b578d3Smrg    }
47732b578d3Smrg
47832b578d3Smrg    pATI->refclk = (int)ReferenceClock;
47932b578d3Smrg
48032b578d3Smrg    pATI->useEXA = FALSE;
48132b578d3Smrg    if (pATI->OptionAccel)
48232b578d3Smrg    {
48332b578d3Smrg        MessageType from = X_DEFAULT;
48432b578d3Smrg#if defined(USE_EXA)
48532b578d3Smrg#if defined(USE_XAA)
48632b578d3Smrg        if (AccelMethod != NULL)
48732b578d3Smrg        {
48832b578d3Smrg            from = X_CONFIG;
48932b578d3Smrg            if (xf86NameCmp(AccelMethod, "EXA") == 0)
49032b578d3Smrg                pATI->useEXA = TRUE;
49132b578d3Smrg        }
49232b578d3Smrg#else /* USE_XAA */
49332b578d3Smrg        pATI->useEXA = TRUE;
49432b578d3Smrg#endif /* !USE_XAA */
49532b578d3Smrg#endif /* USE_EXA */
49632b578d3Smrg        xf86DrvMsg(pScreenInfo->scrnIndex, from,
49732b578d3Smrg            "Using %s acceleration architecture\n",
49832b578d3Smrg            pATI->useEXA ? "EXA" : "XAA");
49932b578d3Smrg
50032b578d3Smrg#if defined(USE_EXA)
50132b578d3Smrg        if (pATI->useEXA && pATI->Chip >= ATI_CHIP_264GTPRO)
50232b578d3Smrg            pATI->RenderAccelEnabled = TRUE;
50332b578d3Smrg
50432b578d3Smrg        if (pATI->useEXA && !RenderAccel)
50532b578d3Smrg            pATI->RenderAccelEnabled = FALSE;
50632b578d3Smrg#endif
50732b578d3Smrg    }
50832b578d3Smrg
5091b12faf6Smrg    free(PublicOption);
51032b578d3Smrg}
511