#include "ati.h"
#include "atiadapter.h"
#include "atichip.h"
#include "aticonfig.h"
#include "aticursor.h"
#include "atioption.h"
#include "atistruct.h"
typedef enum
{
ATI_OPTION_BIOS_DISPLAY,
ATI_OPTION_CRT_SCREEN,
ATI_OPTION_DEVEL,
ATI_OPTION_BLEND,
ATI_OPTION_LCDSYNC
} ATIPrivateOptionType;
void
ATIProcessOptions
(
ScrnInfoPtr pScreenInfo,
ATIPtr pATI
)
{
OptionInfoPtr PublicOption = xnfalloc(ATIPublicOptionSize);
OptionInfoRec PrivateOption[] =
{
{
ATI_OPTION_BIOS_DISPLAY,
"biosdisplay",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
ATI_OPTION_CRT_SCREEN,
"crtscreen",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
ATI_OPTION_DEVEL,
"tsi",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
ATI_OPTION_BLEND,
"lcdblend",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
ATI_OPTION_LCDSYNC,
"lcdsync",
OPTV_BOOLEAN,
{0, },
FALSE
},
{
-1,
NULL,
OPTV_NONE,
{0, },
FALSE
}
};
(void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize);
# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool
# define BIOSDisplay PrivateOption[ATI_OPTION_BIOS_DISPLAY].value.bool
# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool
# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.bool
# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.bool
# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool
# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool
# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool
#ifndef AVOID_CPIO
# define Linear PublicOption[ATI_OPTION_LINEAR].value.bool
#endif
# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool
# define TestCacheMMIO PublicOption[ATI_OPTION_TEST_MMIO_CACHE].value.bool
# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.bool
# define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool
# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool
# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool
# define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.bool
# define ReferenceClock \
PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq
xf86CollectOptions(pScreenInfo, NULL);
#ifndef AVOID_CPIO
if (pATI->Adapter >= ATI_ADAPTER_MACH64)
#endif
{
Accel = CacheMMIO = HWCursor = TRUE;
#ifndef AVOID_CPIO
Linear = TRUE;
#endif
}
ReferenceClock = ((double)157500000.0) / ((double)11.0);
#ifndef AVOID_CPIO
if (pATI->PCIInfo)
#endif
{
ShadowFB = TRUE;
}
Blend = PanelDisplay = TRUE;
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
PublicOption);
xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options,
PrivateOption);
#ifndef AVOID_CPIO
if (!xf86LinearVidMem() && Linear)
{
if (PublicOption[ATI_OPTION_LINEAR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"OS does not support linear apertures.\n");
Linear = FALSE;
}
#endif
pATI->OptionAccel = Accel;
pATI->OptionBIOSDisplay = BIOSDisplay;
pATI->OptionBlend = Blend;
pATI->OptionCRTDisplay = CRTDisplay;
pATI->OptionCSync = CSync;
pATI->OptionDevel = Devel;
#ifndef AVOID_CPIO
pATI->OptionLinear = Linear;
#endif
pATI->OptionMMIOCache = CacheMMIO;
pATI->OptionTestMMIOCache = TestCacheMMIO;
pATI->OptionProbeClocks = ProbeClocks;
pATI->OptionShadowFB = ShadowFB;
pATI->OptionLCDSync = LCDSync;
if ((PanelDisplay != CRTScreen) ||
PublicOption[ATI_OPTION_PANEL_DISPLAY].found)
pATI->OptionPanelDisplay = PanelDisplay;
else
pATI->OptionPanelDisplay = !CRTScreen;
pATI->Cursor = ATI_CURSOR_SOFTWARE;
if (SWCursor || !HWCursor)
{
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"Option \"sw_cursor\" overrides Option \"hw_cursor\".\n");
}
else if (pATI->Chip < ATI_CHIP_264CT)
{
if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found)
xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
"Option \"hw_cursor\" not supported in this configuration.\n");
}
else
{
pATI->Cursor = ATI_CURSOR_HARDWARE;
}
if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator)
{
switch ((int)(ReferenceClock / ((double)100000.0)))
{
case 143:
pATI->ReferenceNumerator = 157500;
pATI->ReferenceDenominator = 11;
break;
case 286:
pATI->ReferenceNumerator = 315000;
pATI->ReferenceDenominator = 11;
break;
default:
pATI->ReferenceNumerator =
(int)(ReferenceClock / ((double)1000.0));
pATI->ReferenceDenominator = 1;
break;
}
}
xfree(PublicOption);
}