⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radeon_driver.c

📁 x.org上有关ati系列显卡最新驱动
💻 C
📖 第 1 页 / 共 5 页
字号:
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.117 2004/02/19 22:38:12 tsi Exp $ *//* $XdotOrg: driver/xf86-video-ati/src/radeon_driver.c,v 1.116 2006/04/29 21:30:23 daenzer Exp $ *//* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and *                VA Linux Systems Inc., Fremont, California. * * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation on the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT.  IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */#ifdef HAVE_CONFIG_H#include "config.h"#endif/* * Authors: *   Kevin E. Martin <martin@xfree86.org> *   Rickard E. Faith <faith@valinux.com> *   Alan Hourihane <alanh@fairlite.demon.co.uk> * * Credits: * *   Thanks to Ani Joshi <ajoshi@shell.unixbox.com> for providing source *   code to his Radeon driver.  Portions of this file are based on the *   initialization code for that driver. * * References: * * !!!! FIXME !!!! *   RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical *   Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April *   1999. * *   RAGE 128 Software Development Manual (Technical Reference Manual P/N *   SDK-G04000 Rev. 0.01), ATI Technologies: June 1999. * * This server does not yet support these XFree86 4.0 features: * !!!! FIXME !!!! *   DDC1 & DDC2 *   shadowfb (Note: dri uses shadowfb for another purpose in radeon_dri.c) *   overlay planes * * Modified by Marc Aurele La France (tsi@xfree86.org) for ATI driver merge. * * Mergedfb and pseudo xinerama support added by Alex Deucher (agd5f@yahoo.com) * based on the sis driver by Thomas Winischhofer. * */#include <string.h>#include <stdio.h>				/* Driver data structures */#include "radeon.h"#include "radeon_reg.h"#include "radeon_macros.h"#include "radeon_probe.h"#include "radeon_version.h"#include "radeon_mergedfb.h"#ifdef XF86DRI#define _XF86DRI_SERVER_#include "radeon_dri.h"#include "radeon_sarea.h"#include "sarea.h"#endif#include "fb.h"				/* colormap initialization */#include "micmap.h"#include "dixstruct.h"				/* X and server generic header files */#include "xf86.h"#include "xf86_ansic.h"		/* For xf86getsecs() */#include "xf86_OSproc.h"#include "xf86RAC.h"#include "xf86Resources.h"#include "xf86cmap.h"#include "vbe.h"				/* fbdevhw * vgaHW definitions */#ifdef WITH_VGAHW#include "vgaHW.h"#endif#include "fbdevhw.h"#define DPMS_SERVER#include <X11/extensions/dpms.h>#include "atipciids.h"#include "radeon_chipset.h"#ifndef MAX#define MAX(a,b) ((a)>(b)?(a):(b))#endif#ifndef MIN#define MIN(a,b) ((a)>(b)?(b):(a))#endif				/* Forward definitions for driver functions */static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen);static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);static void RADEONSave(ScrnInfoPtr pScrn);static void RADEONRestore(ScrnInfoPtr pScrn);static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,					    int PowerManagementMode,					    int flags);static void RADEONInitDispBandwidth(ScrnInfoPtr pScrn);static void RADEONGetMergedFBOptions(ScrnInfoPtr pScrn);static int RADEONValidateMergeModes(ScrnInfoPtr pScrn);static void RADEONSetDynamicClock(ScrnInfoPtr pScrn, int mode);static void RADEONForceSomeClocks(ScrnInfoPtr pScrn);static void RADEONUpdatePanelSize(ScrnInfoPtr pScrn);static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);#ifdef XF86DRIstatic void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);#endif/* psuedo xinerama support */extern Bool 		RADEONnoPanoramiXExtension;static const OptionInfoRec RADEONOptions[] = {    { OPTION_NOACCEL,        "NoAccel",          OPTV_BOOLEAN, {0}, FALSE },    { OPTION_SW_CURSOR,      "SWcursor",         OPTV_BOOLEAN, {0}, FALSE },    { OPTION_DAC_6BIT,       "Dac6Bit",          OPTV_BOOLEAN, {0}, FALSE },    { OPTION_DAC_8BIT,       "Dac8Bit",          OPTV_BOOLEAN, {0}, TRUE  },#ifdef XF86DRI    { OPTION_BUS_TYPE,       "BusType",          OPTV_ANYSTR,  {0}, FALSE },    { OPTION_CP_PIO,         "CPPIOMode",        OPTV_BOOLEAN, {0}, FALSE },    { OPTION_USEC_TIMEOUT,   "CPusecTimeout",    OPTV_INTEGER, {0}, FALSE },    { OPTION_AGP_MODE,       "AGPMode",          OPTV_INTEGER, {0}, FALSE },    { OPTION_AGP_FW,         "AGPFastWrite",     OPTV_BOOLEAN, {0}, FALSE },    { OPTION_GART_SIZE_OLD,  "AGPSize",          OPTV_INTEGER, {0}, FALSE },    { OPTION_GART_SIZE,      "GARTSize",         OPTV_INTEGER, {0}, FALSE },    { OPTION_RING_SIZE,      "RingSize",         OPTV_INTEGER, {0}, FALSE },    { OPTION_BUFFER_SIZE,    "BufferSize",       OPTV_INTEGER, {0}, FALSE },    { OPTION_DEPTH_MOVE,     "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE },    { OPTION_PAGE_FLIP,      "EnablePageFlip",   OPTV_BOOLEAN, {0}, FALSE },    { OPTION_NO_BACKBUFFER,  "NoBackBuffer",     OPTV_BOOLEAN, {0}, FALSE },    { OPTION_XV_DMA,         "DMAForXv",         OPTV_BOOLEAN, {0}, FALSE },    { OPTION_FBTEX_PERCENT,  "FBTexPercent",     OPTV_INTEGER, {0}, FALSE },    { OPTION_DEPTH_BITS,     "DepthBits",        OPTV_INTEGER, {0}, FALSE },#ifdef USE_EXA    { OPTION_ACCEL_DFS,      "AccelDFS",         OPTV_BOOLEAN, {0}, FALSE },#endif#endif    { OPTION_PANEL_OFF,      "PanelOff",         OPTV_BOOLEAN, {0}, FALSE },    { OPTION_DDC_MODE,       "DDCMode",          OPTV_BOOLEAN, {0}, FALSE },    { OPTION_MONITOR_LAYOUT, "MonitorLayout",    OPTV_ANYSTR,  {0}, FALSE },    { OPTION_IGNORE_EDID,    "IgnoreEDID",       OPTV_BOOLEAN, {0}, FALSE },    { OPTION_FBDEV,          "UseFBDev",         OPTV_BOOLEAN, {0}, FALSE },    { OPTION_MERGEDFB,	     "MergedFB",      	 OPTV_BOOLEAN, {0}, FALSE },    { OPTION_CRT2HSYNC,	     "CRT2HSync",        OPTV_ANYSTR,  {0}, FALSE },    { OPTION_CRT2VREFRESH,   "CRT2VRefresh",     OPTV_ANYSTR,  {0}, FALSE },    { OPTION_CRT2POS,        "CRT2Position",	 OPTV_ANYSTR,  {0}, FALSE },    { OPTION_METAMODES,      "MetaModes",        OPTV_ANYSTR,  {0}, FALSE },    { OPTION_MERGEDDPI,	     "MergedDPI", 	 OPTV_ANYSTR,  {0}, FALSE },    { OPTION_RADEONXINERAMA, "MergedXinerama", OPTV_BOOLEAN, {0}, FALSE },    { OPTION_CRT2ISSCRN0,    "MergedXineramaCRT2IsScreen0", OPTV_BOOLEAN, {0}, FALSE },    { OPTION_MERGEDFBNONRECT, "MergedNonRectangular", OPTV_BOOLEAN,   {0}, FALSE },    { OPTION_MERGEDFBMOUSER,  "MergedMouseRestriction", OPTV_BOOLEAN,   {0}, FALSE },    { OPTION_DISP_PRIORITY,  "DisplayPriority",  OPTV_ANYSTR,  {0}, FALSE },    { OPTION_PANEL_SIZE,     "PanelSize",        OPTV_ANYSTR,  {0}, FALSE },    { OPTION_MIN_DOTCLOCK,   "ForceMinDotClock", OPTV_FREQ,    {0}, FALSE },    { OPTION_COLOR_TILING,   "ColorTiling",      OPTV_BOOLEAN, {0}, FALSE },#ifdef XvExtension    { OPTION_VIDEO_KEY,                   "VideoKey",                 OPTV_INTEGER, {0}, FALSE },    { OPTION_RAGE_THEATRE_CRYSTAL,        "RageTheatreCrystal",       OPTV_INTEGER, {0}, FALSE },    { OPTION_RAGE_THEATRE_TUNER_PORT,     "RageTheatreTunerPort",     OPTV_INTEGER, {0}, FALSE },    { OPTION_RAGE_THEATRE_COMPOSITE_PORT, "RageTheatreCompositePort", OPTV_INTEGER, {0}, FALSE },    { OPTION_RAGE_THEATRE_SVIDEO_PORT,    "RageTheatreSVideoPort",    OPTV_INTEGER, {0}, FALSE },    { OPTION_TUNER_TYPE,                  "TunerType",                OPTV_INTEGER, {0}, FALSE },	{ OPTION_RAGE_THEATRE_MICROC_PATH,	"RageTheatreMicrocPath",	 OPTV_STRING, {0}, FALSE },	{ OPTION_RAGE_THEATRE_MICROC_TYPE, 	"RageTheatreMicrocType",	 OPTV_STRING, {0}, FALSE },#endif#ifdef RENDER    { OPTION_RENDER_ACCEL,   "RenderAccel",      OPTV_BOOLEAN, {0}, FALSE },    { OPTION_SUBPIXEL_ORDER, "SubPixelOrder",    OPTV_ANYSTR,  {0}, FALSE },#endif    { OPTION_SHOWCACHE,      "ShowCache",        OPTV_BOOLEAN, {0}, FALSE },    { OPTION_DYNAMIC_CLOCKS, "DynamicClocks",    OPTV_BOOLEAN, {0}, FALSE },    { OPTION_BIOS_HOTKEYS,   "BIOSHotkeys",      OPTV_BOOLEAN, {0}, FALSE },    { OPTION_VGA_ACCESS,     "VGAAccess",        OPTV_BOOLEAN, {0}, TRUE  },    { OPTION_REVERSE_DDC,    "ReverseDDC",       OPTV_BOOLEAN, {0}, FALSE },    { OPTION_LVDS_PROBE_PLL, "LVDSProbePLL",     OPTV_BOOLEAN, {0}, FALSE },    { OPTION_ACCELMETHOD,    "AccelMethod",      OPTV_STRING,  {0}, FALSE },    { OPTION_CONSTANTDPI,    "ConstantDPI",	 OPTV_BOOLEAN,	{0}, FALSE },    { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }};_X_EXPORT const OptionInfoRec *RADEONOptionsWeak(void) { return RADEONOptions; }#ifdef WITH_VGAHWstatic const char *vgahwSymbols[] = {    "vgaHWFreeHWRec",    "vgaHWGetHWRec",    "vgaHWGetIndex",    "vgaHWLock",    "vgaHWRestore",    "vgaHWSave",    "vgaHWUnlock",    "vgaHWGetIOBase",    NULL};#endifstatic const char *fbdevHWSymbols[] = {    "fbdevHWInit",    "fbdevHWUseBuildinMode",    "fbdevHWGetVidmem",    "fbdevHWDPMSSet",    /* colormap */    "fbdevHWLoadPalette",    /* ScrnInfo hooks */    "fbdevHWAdjustFrame",    "fbdevHWEnterVT",    "fbdevHWLeaveVT",    "fbdevHWModeInit",    "fbdevHWRestore",    "fbdevHWSave",    "fbdevHWSwitchMode",    "fbdevHWValidModeWeak",    "fbdevHWMapMMIO",    "fbdevHWMapVidmem",    "fbdevHWUnmapMMIO",    "fbdevHWUnmapVidmem",    NULL};static const char *ddcSymbols[] = {    "xf86PrintEDID",    "xf86DoEDID_DDC1",    "xf86DoEDID_DDC2",    NULL};static const char *fbSymbols[] = {    "fbScreenInit",    "fbPictureInit",    NULL};#ifdef USE_EXAstatic const char *exaSymbols[] = {    "exaDriverAlloc",    "exaDriverInit",    "exaDriverFini",    "exaOffscreenAlloc",    "exaOffscreenFree",    "exaGetPixmapOffset",    "exaGetPixmapPitch",    "exaGetPixmapSize",    "exaMarkSync",    "exaWaitSync",    NULL};#endif /* USE_EXA */#ifdef USE_XAAstatic const char *xaaSymbols[] = {    "XAACreateInfoRec",    "XAADestroyInfoRec",    "XAAInit",    NULL};#endif /* USE_XAA */#if 0static const char *xf8_32bppSymbols[] = {    "xf86Overlay8Plus32Init",    NULL};#endifstatic const char *ramdacSymbols[] = {    "xf86CreateCursorInfoRec",    "xf86DestroyCursorInfoRec",    "xf86ForceHWCursor",    "xf86InitCursor",    NULL};#ifdef XF86DRIstatic const char *drmSymbols[] = {    "drmGetInterruptFromBusID",    "drmCtlInstHandler",    "drmCtlUninstHandler",    "drmAddBufs",    "drmAddMap",    "drmAgpAcquire",    "drmAgpAlloc",    "drmAgpBase",    "drmAgpBind",    "drmAgpDeviceId",    "drmAgpEnable",    "drmAgpFree",    "drmAgpGetMode",    "drmAgpRelease",    "drmAgpUnbind",    "drmAgpVendorId",    "drmCommandNone",    "drmCommandRead",    "drmCommandWrite",    "drmCommandWriteRead",    "drmDMA",    "drmFreeVersion",    "drmGetLibVersion",    "drmGetVersion",    "drmMap",    "drmMapBufs",    "drmRadeonCleanupCP",    "drmRadeonClear",    "drmRadeonFlushIndirectBuffer",    "drmRadeonInitCP",    "drmRadeonResetCP",    "drmRadeonStartCP",    "drmRadeonStopCP",    "drmRadeonWaitForIdleCP",    "drmScatterGatherAlloc",    "drmScatterGatherFree",    "drmUnmap",    "drmUnmapBufs",    NULL};static const char *driSymbols[] = {    "DRICloseScreen",    "DRICreateInfoRec",    "DRIDestroyInfoRec",    "DRIFinishScreenInit",    "DRIGetContext",    "DRIGetDeviceInfo",    "DRIGetSAREAPrivate",    "DRILock",    "DRIQueryVersion",    "DRIScreenInit",    "DRIUnlock",    "GlxSetVisualConfigs",    "DRICreatePCIBusID",    NULL};static const char *driShadowFBSymbols[] = {    "ShadowFBInit",    NULL};#endifstatic const char *vbeSymbols[] = {    "VBEInit",    "vbeDoEDID",    NULL};static const char *int10Symbols[] = {    "xf86InitInt10",    "xf86FreeInt10",    "xf86int10Addr",    "xf86ExecX86int10",    NULL};static const char *i2cSymbols[] = {    "xf86CreateI2CBusRec",    "xf86I2CBusInit",    NULL};void RADEONLoaderRefSymLists(void){    /*     * Tell the loader about symbols from other modules that this module might     * refer to.     */    xf86LoaderRefSymLists(#ifdef WITH_VGAHW			  vgahwSymbols,#endif			  fbSymbols,#ifdef USE_EXA			  exaSymbols,#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -