--- programs/Xserver/hw/xfree86/drivers/nv/Imakefile.orig Tue Mar 8 03:27:23 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/Imakefile Mon Apr 2 00:32:18 2007 @@ -6,6 +6,12 @@ #define IHaveModules #include +EXTRA_DEFINES = -DUSE_LIBC_WRAPPER=1 \ + -DPACKAGE_VERSION_MAJOR=1 \ + -DPACKAGE_VERSION_MINOR=0 \ + -DPACKAGE_VERSION_PATCHLEVEL=1 \ + -DHAVE_XV_DRAWABLE=0 + N_SRCS = nv_driver.c nv_dac.c nv_setup.c nv_cursor.c nv_xaa.c nv_dga.c \ nv_shadow.c nv_hw.c nv_video.c R_SRCS = riva_driver.c riva_dac.c riva_setup.c riva_cursor.c riva_xaa.c \ --- programs/Xserver/hw/xfree86/drivers/nv/nv_const.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_const.h Tue Jan 9 07:46:08 2007 @@ -6,9 +6,6 @@ #define NV_VERSION 4000 #define NV_NAME "NV" #define NV_DRIVER_NAME "nv" -#define NV_MAJOR_VERSION 1 -#define NV_MINOR_VERSION 0 -#define NV_PATCHLEVEL 1 #endif /* __NV_CONST_H__ */ --- programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c.orig Fri Sep 30 05:47:29 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c Tue Jan 9 07:46:08 2007 @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.18 2005/09/29 21:47:29 aplattner Exp $ */ +/* $XdotOrg: driver/xf86-video-nv/src/nv_driver.c,v 1.21 2006/01/24 16:45:29 aplattner Exp $ */ /* $XConsortium: nv_driver.c /main/3 1996/10/28 05:13:37 kaleb $ */ /* * Copyright 1996-1997 David J. McKay @@ -29,7 +29,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.137 2005/09/14 02:28:03 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.144 2006/06/16 00:19:32 mvojkovi Exp $ */ #include "nv_include.h" @@ -58,6 +58,10 @@ static void NVFreeScreen(int scrnIndex, int flags); static ModeStatus NVValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); +#ifdef RANDR +static Bool NVDriverFunc(ScrnInfoPtr pScrnInfo, xorgDriverFuncOp op, + pointer data); +#endif /* Internally used functions */ @@ -87,7 +91,7 @@ 0 }; -/* Known cards as of 2005/09/21 */ +/* Known cards as of 2006/06/16 */ static SymTabRec NVKnownChipsets[] = { @@ -133,7 +137,7 @@ #else { 0x10DE0179, "GeForce4 440 Go 64M" }, #endif - { 0x10DE017A, "Quadro4 NVS" }, + { 0x10DE017A, "Quadro NVS" }, { 0x10DE017C, "Quadro4 500 GoGL" }, { 0x10DE017D, "GeForce4 410 Go 16M" }, @@ -147,7 +151,7 @@ #if defined(__powerpc__) { 0x10DE0189, "GeForce4 MX with AGP8X (Mac)" }, #endif - { 0x10DE018A, "Quadro4 280 NVS" }, + { 0x10DE018A, "Quadro4 NVS 280 SD" }, { 0x10DE018B, "Quadro4 380 XGL" }, { 0x10DE018C, "Quadro NVS 50 PCI" }, { 0x10DE018D, "GeForce4 448 Go" }, @@ -161,7 +165,6 @@ { 0x10DE0250, "GeForce4 Ti 4600" }, { 0x10DE0251, "GeForce4 Ti 4400" }, - { 0x10DE0252, "0x0252" }, { 0x10DE0253, "GeForce4 Ti 4200" }, { 0x10DE0258, "Quadro4 900 XGL" }, { 0x10DE0259, "Quadro4 750 XGL" }, @@ -182,21 +185,15 @@ { 0x10DE0311, "GeForce FX 5600 Ultra" }, { 0x10DE0312, "GeForce FX 5600" }, - { 0x10DE0313, "0x0313"}, - { 0x10DE0314, "GeForce FX 5600SE" }, - { 0x10DE0316, "0x0316" }, - { 0x10DE0317, "0x0317" }, + { 0x10DE0314, "GeForce FX 5600XT" }, { 0x10DE031A, "GeForce FX Go5600" }, { 0x10DE031B, "GeForce FX Go5650" }, { 0x10DE031C, "Quadro FX Go700" }, - { 0x10DE031D, "0x031D" }, - { 0x10DE031E, "0x031E" }, - { 0x10DE031F, "0x031F" }, { 0x10DE0320, "GeForce FX 5200" }, { 0x10DE0321, "GeForce FX 5200 Ultra" }, { 0x10DE0322, "GeForce FX 5200" }, - { 0x10DE0323, "GeForce FX 5200SE" }, + { 0x10DE0323, "GeForce FX 5200LE" }, { 0x10DE0324, "GeForce FX Go5200" }, { 0x10DE0325, "GeForce FX Go5250" }, { 0x10DE0326, "GeForce FX 5500" }, @@ -204,47 +201,41 @@ { 0x10DE0328, "GeForce FX Go5200 32M/64M" }, #if defined(__powerpc__) { 0x10DE0329, "GeForce FX 5200 (Mac)" }, -#else - { 0x10DE0329, "0x0329" }, #endif { 0x10DE032A, "Quadro NVS 55/280 PCI" }, { 0x10DE032B, "Quadro FX 500/600 PCI" }, { 0x10DE032C, "GeForce FX Go53xx Series" }, { 0x10DE032D, "GeForce FX Go5100" }, - { 0x10DE032F, "0x032F" }, { 0x10DE0330, "GeForce FX 5900 Ultra" }, { 0x10DE0331, "GeForce FX 5900" }, { 0x10DE0332, "GeForce FX 5900XT" }, { 0x10DE0333, "GeForce FX 5950 Ultra" }, - { 0x10DE033F, "Quadro FX 700" }, { 0x10DE0334, "GeForce FX 5900ZT" }, { 0x10DE0338, "Quadro FX 3000" }, + { 0x10DE033F, "Quadro FX 700" }, { 0x10DE0341, "GeForce FX 5700 Ultra" }, { 0x10DE0342, "GeForce FX 5700" }, { 0x10DE0343, "GeForce FX 5700LE" }, { 0x10DE0344, "GeForce FX 5700VE" }, - { 0x10DE0345, "0x0345" }, { 0x10DE0347, "GeForce FX Go5700" }, { 0x10DE0348, "GeForce FX Go5700" }, - { 0x10DE0349, "0x0349" }, - { 0x10DE034B, "0x034B" }, { 0x10DE034C, "Quadro FX Go1000" }, { 0x10DE034E, "Quadro FX 1100" }, - { 0x10DE034F, "0x034F" }, { 0x10DE0040, "GeForce 6800 Ultra" }, { 0x10DE0041, "GeForce 6800" }, { 0x10DE0042, "GeForce 6800 LE" }, - { 0x10DE0043, "0x0043" }, + { 0x10DE0043, "GeForce 6800 XE" }, + { 0x10DE0044, "GeForce 6800 XT" }, { 0x10DE0045, "GeForce 6800 GT" }, { 0x10DE0046, "GeForce 6800 GT" }, + { 0x10DE0047, "GeForce 6800 GS" }, { 0x10DE0048, "GeForce 6800 XT" }, - { 0x10DE0049, "0x0049" }, { 0x10DE004E, "Quadro FX 4000" }, - { 0x10DE00C0, "0x00C0" }, + { 0x10DE00C0, "GeForce 6800 GS" }, { 0x10DE00C1, "GeForce 6800" }, { 0x10DE00C2, "GeForce 6800 LE" }, { 0x10DE00C3, "GeForce 6800 XT" }, @@ -257,16 +248,15 @@ { 0x10DE0140, "GeForce 6600 GT" }, { 0x10DE0141, "GeForce 6600" }, { 0x10DE0142, "GeForce 6600 LE" }, - { 0x10DE0143, "0x0143" }, + { 0x10DE0143, "GeForce 6600 VE" }, { 0x10DE0144, "GeForce Go 6600" }, { 0x10DE0145, "GeForce 6610 XL" }, { 0x10DE0146, "GeForce Go 6600 TE/6200 TE" }, { 0x10DE0147, "GeForce 6700 XL" }, { 0x10DE0148, "GeForce Go 6600" }, { 0x10DE0149, "GeForce Go 6600 GT" }, - { 0x10DE014B, "0x014B" }, - { 0x10DE014C, "0x014C" }, - { 0x10DE014D, "0x014D" }, + { 0x10DE014C, "Quadro FX 550" }, + { 0x10DE014D, "Quadro FX 550" }, { 0x10DE014E, "Quadro FX 540" }, { 0x10DE014F, "GeForce 6200" }, @@ -280,32 +270,68 @@ { 0x10DE0167, "GeForce Go 6200" }, { 0x10DE0168, "GeForce Go 6400" }, { 0x10DE0169, "GeForce 6250" }, - { 0x10DE016B, "0x016B" }, - { 0x10DE016C, "0x016C" }, - { 0x10DE016D, "0x016D" }, - { 0x10DE016E, "0x016E" }, - { 0x10DE0210, "0x0210" }, { 0x10DE0211, "GeForce 6800" }, { 0x10DE0212, "GeForce 6800 LE" }, { 0x10DE0215, "GeForce 6800 GT" }, + { 0x10DE0218, "GeForce 6800 XT" }, - { 0x10DE0220, "0x0220" }, { 0x10DE0221, "GeForce 6200" }, - { 0x10DE0222, "0x0222" }, - { 0x10DE0228, "0x0228" }, + { 0x10DE0222, "GeForce 6200 A-LE" }, - { 0x10DE0090, "0x0090" }, + { 0x10DE0090, "GeForce 7800 GTX" }, { 0x10DE0091, "GeForce 7800 GTX" }, { 0x10DE0092, "GeForce 7800 GT" }, - { 0x10DE0093, "0x0093" }, - { 0x10DE0094, "0x0094" }, + { 0x10DE0093, "GeForce 7800 GS" }, + { 0x10DE0095, "GeForce 7800 SLI" }, { 0x10DE0098, "GeForce Go 7800" }, { 0x10DE0099, "GeForce Go 7800 GTX" }, - { 0x10DE009C, "0x009C" }, { 0x10DE009D, "Quadro FX 4500" }, - { 0x10DE009E, "0x009E" }, - + + { 0x10DE01D1, "GeForce 7300 LE" }, + { 0x10DE01D3, "GeForce 7300 SE" }, + { 0x10DE01D6, "GeForce Go 7200" }, + { 0x10DE01D7, "GeForce Go 7300" }, + { 0x10DE01D8, "GeForce Go 7400" }, + { 0x10DE01D9, "GeForce Go 7400 GS" }, + { 0x10DE01DA, "Quadro NVS 110M" }, + { 0x10DE01DB, "Quadro NVS 120M" }, + { 0x10DE01DC, "Quadro FX 350M" }, + { 0x10DE01DD, "GeForce 7500 LE" }, + { 0x10DE01DE, "Quadro FX 350" }, + { 0x10DE01DF, "GeForce 7300 GS" }, + + { 0x10DE0391, "GeForce 7600 GT" }, + { 0x10DE0392, "GeForce 7600 GS" }, + { 0x10DE0393, "GeForce 7300 GT" }, + { 0x10DE0394, "GeForce 7600 LE" }, + { 0x10DE0395, "GeForce 7300 GT" }, + { 0x10DE0397, "GeForce Go 7700" }, + { 0x10DE0398, "GeForce Go 7600" }, + { 0x10DE0399, "GeForce Go 7600 GT"}, + { 0x10DE039A, "Quadro NVS 300M" }, + { 0x10DE039B, "GeForce Go 7900 SE" }, + { 0x10DE039C, "Quadro FX 550M" }, + { 0x10DE039E, "Quadro FX 560" }, + + { 0x10DE0290, "GeForce 7900 GTX" }, + { 0x10DE0291, "GeForce 7900 GT" }, + { 0x10DE0292, "GeForce 7900 GS" }, + { 0x10DE0298, "GeForce Go 7900 GS" }, + { 0x10DE0299, "GeForce Go 7900 GTX" }, + { 0x10DE029A, "Quadro FX 2500M" }, + { 0x10DE029B, "Quadro FX 1500M" }, + { 0x10DE029C, "Quadro FX 5500" }, + { 0x10DE029D, "Quadro FX 3500" }, + { 0x10DE029E, "Quadro FX 1500" }, + { 0x10DE029F, "Quadro FX 4500 X2" }, + + { 0x10DE0240, "GeForce 6150" }, + { 0x10DE0241, "GeForce 6150 LE" }, + { 0x10DE0242, "GeForce 6100" }, + { 0x10DE0244, "GeForce Go 6150" }, + { 0x10DE0247, "GeForce Go 6100" }, + {-1, NULL} }; @@ -432,7 +458,7 @@ MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, - NV_MAJOR_VERSION, NV_MINOR_VERSION, NV_PATCHLEVEL, + PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, MOD_CLASS_VIDEODRV, @@ -663,8 +689,11 @@ int pciid = ((*ppPci)->vendor << 16) | (*ppPci)->chipType; int token = pciid; - if((token & 0xfff0) == 0x00F0) + if(((token & 0xfff0) == 0x00F0) || + ((token & 0xfff0) == 0x02E0)) + { token = NVGetPCIXpressChip(*ppPci); + } while(nvchips->name) { if(token == nvchips->token) @@ -697,14 +726,14 @@ case 0x0120: case 0x0140: case 0x0160: - case 0x0130: case 0x01D0: case 0x0090: case 0x0210: case 0x0220: - case 0x0230: + case 0x0240: case 0x0290: case 0x0390: + case 0x03D0: NVChipsets[numUsed].token = pciid; NVChipsets[numUsed].name = "Unknown NVIDIA chip"; NVPciChipsets[numUsed].numChipset = pciid; @@ -924,14 +953,9 @@ { NVPtr pNv = NVPTR(xf86Screens[scrnIndex]); - if(pNv->fpWidth && pNv->fpHeight) { - if((pNv->fpWidth < mode->HDisplay) || (pNv->fpHeight < mode->VDisplay)) { - xf86DrvMsg(scrnIndex, X_INFO, "Mode \"%s\" is larger than " - "BIOS programmed panel size of %d x %d. Removing.\n", - mode->name, pNv->fpWidth, pNv->fpHeight); - return (MODE_BAD); - } - } + if(pNv->fpWidth && pNv->fpHeight) + if((pNv->fpWidth < mode->HDisplay) || (pNv->fpHeight < mode->VDisplay)) + return (MODE_PANEL); return (MODE_OK); } @@ -980,8 +1004,16 @@ const char *s; if (flags & PROBE_DETECT) { - nvProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); - return TRUE; + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + + if (!pEnt) + return FALSE; + + i = pEnt->index; + xfree(pEnt); + + nvProbeDDC(pScrn, i); + return TRUE; } /* @@ -1053,8 +1085,11 @@ from = X_PROBED; pNv->Chipset = (pNv->PciInfo->vendor << 16) | pNv->PciInfo->chipType; - if((pNv->Chipset & 0xfff0) == 0x00F0) + if(((pNv->Chipset & 0xfff0) == 0x00F0) || + ((pNv->Chipset & 0xfff0) == 0x02E0)) + { pNv->Chipset = NVGetPCIXpressChip(pNv->PciInfo); + } pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets, pNv->Chipset); @@ -1236,6 +1271,7 @@ pScrn->ValidMode = fbdevHWValidModeWeak(); } pNv->Rotate = 0; + pNv->RandRRotation = FALSE; if ((s = xf86GetOptValString(pNv->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { pNv->ShadowFB = TRUE; @@ -1252,13 +1288,29 @@ pNv->Rotate = -1; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter clockwise - acceleration disabled\n"); + } else + if(!xf86NameCmp(s, "RandR")) { +#ifdef RANDR + pNv->ShadowFB = TRUE; + pNv->NoAccel = TRUE; + pNv->HWCursor = FALSE; + pNv->RandRRotation = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using RandR rotation - acceleration disabled\n"); +#else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "This driver was not compiled with support for the Resize and " + "Rotate extension. Cannot honor 'Option \"Rotate\" " + "\"RandR\"'.\n"); +#endif } else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Rotate\"\n", s); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Valid options are \"CW\" or \"CCW\"\n"); + "Valid options are \"CW\", \"CCW\", and \"RandR\"\n"); } } + if(xf86GetOptValInteger(pNv->Options, OPTION_VIDEO_KEY, &(pNv->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pNv->videoKey); @@ -1377,26 +1429,26 @@ case 0x0280: /* GeForce4 Ti (8x AGP) */ pNv->Architecture = NV_ARCH_20; break; - case 0x0300: /* GeForceFX 5800 */ - case 0x0310: /* GeForceFX 5600 */ - case 0x0320: /* GeForceFX 5200 */ - case 0x0330: /* GeForceFX 5900 */ - case 0x0340: /* GeForceFX 5700 */ + case 0x0300: /* GeForce FX 5800 */ + case 0x0310: /* GeForce FX 5600 */ + case 0x0320: /* GeForce FX 5200 */ + case 0x0330: /* GeForce FX 5900 */ + case 0x0340: /* GeForce FX 5700 */ pNv->Architecture = NV_ARCH_30; break; - case 0x0040: - case 0x00C0: - case 0x0120: - case 0x0130: - case 0x0140: - case 0x0160: - case 0x01D0: - case 0x0090: - case 0x0210: - case 0x0220: - case 0x0230: - case 0x0290: - case 0x0390: + case 0x0040: /* GeForce 6800 */ + case 0x00C0: /* GeForce 6800 */ + case 0x0120: /* GeForce 6800 */ + case 0x0140: /* GeForce 6600 */ + case 0x0160: /* GeForce 6200 */ + case 0x01D0: /* GeForce 7200, 7300, 7400 */ + case 0x0090: /* GeForce 7800 */ + case 0x0210: /* GeForce 6800 */ + case 0x0220: /* GeForce 6200 */ + case 0x0290: /* GeForce 7900 */ + case 0x0390: /* GeForce 7600 */ + case 0x0240: /* GeForce 6100 */ + case 0x03D0: pNv->Architecture = NV_ARCH_40; break; default: @@ -1840,7 +1892,7 @@ int ret; VisualPtr visual; unsigned char *FBStart; - int width, height, displayWidth, offscreenHeight; + int width, height, displayWidth, offscreenHeight, shadowHeight; BoxRec AvailFBArea; /* @@ -1925,9 +1977,18 @@ width = pScrn->virtualY; } + /* If RandR rotation is enabled, leave enough space in the + * framebuffer for us to rotate the screen dimensions without + * changing the pitch. + */ + if(pNv->RandRRotation) + shadowHeight = max(width, height); + else + shadowHeight = height; + if(pNv->ShadowFB) { pNv->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); - pNv->ShadowPtr = xalloc(pNv->ShadowPitch * height); + pNv->ShadowPtr = xalloc(pNv->ShadowPitch * shadowHeight); displayWidth = pNv->ShadowPitch / (pScrn->bitsPerPixel >> 3); FBStart = pNv->ShadowPtr; } else { @@ -2019,18 +2080,21 @@ if(pNv->ShadowFB) { RefreshAreaFuncPtr refreshArea = NVRefreshArea; - if(pNv->Rotate) { - pNv->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = NVPointerMoved; + if(pNv->Rotate || pNv->RandRRotation) { + pNv->PointerMoved = pScrn->PointerMoved; + if(pNv->Rotate) + pScrn->PointerMoved = NVPointerMoved; switch(pScrn->bitsPerPixel) { case 8: refreshArea = NVRefreshArea8; break; case 16: refreshArea = NVRefreshArea16; break; case 32: refreshArea = NVRefreshArea32; break; } - xf86DisableRandR(); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Driver rotation enabled, RandR disabled\n"); + if(!pNv->RandRRotation) { + xf86DisableRandR(); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Driver rotation enabled, RandR disabled\n"); + } } ShadowFBInit(pScreen, refreshArea); @@ -2044,7 +2108,7 @@ pScrn->memPhysBase = pNv->FbAddress; pScrn->fbOffset = 0; - if(pNv->Rotate == 0) + if(pNv->Rotate == 0 && !pNv->RandRRotation) NVInitVideo(pScreen); pScreen->SaveScreen = NVSaveScreen; @@ -2056,6 +2120,13 @@ pNv->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = NVBlockHandler; +#ifdef RANDR + /* Install our DriverFunc. We have to do it this way instead of using the + * HaveDriverFuncs argument to xf86AddDriver, because InitOutput clobbers + * pScrn->DriverFunc */ + pScrn->DriverFunc = NVDriverFunc; +#endif + /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -2087,3 +2158,64 @@ NVDACSave(pScrn, vgaReg, nvReg, pNv->Primary); } +#ifdef RANDR +static Bool +NVRandRGetInfo(ScrnInfoPtr pScrn, Rotation *rotations) +{ + NVPtr pNv = NVPTR(pScrn); + + if(pNv->RandRRotation) + *rotations = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_270; + else + *rotations = RR_Rotate_0; + + return TRUE; +} + +static Bool +NVRandRSetConfig(ScrnInfoPtr pScrn, xorgRRConfig *config) +{ + NVPtr pNv = NVPTR(pScrn); + + switch(config->rotation) { + case RR_Rotate_0: + pNv->Rotate = 0; + pScrn->PointerMoved = pNv->PointerMoved; + break; + + case RR_Rotate_90: + pNv->Rotate = -1; + pScrn->PointerMoved = NVPointerMoved; + break; + + case RR_Rotate_270: + pNv->Rotate = 1; + pScrn->PointerMoved = NVPointerMoved; + break; + + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unexpected rotation in NVRandRSetConfig!\n"); + pNv->Rotate = 0; + pScrn->PointerMoved = pNv->PointerMoved; + return FALSE; + } + + return TRUE; +} + +static Bool +NVDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer data) +{ + switch(op) { + case RR_GET_INFO: + return NVRandRGetInfo(pScrn, (Rotation*)data); + case RR_SET_CONFIG: + return NVRandRSetConfig(pScrn, (xorgRRConfig*)data); + default: + return FALSE; + } + + return FALSE; +} +#endif --- programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c.orig Fri Sep 30 05:47:29 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c Tue Jan 9 07:46:08 2007 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c,v 1.17 2005/09/22 20:34:42 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c,v 1.21 2006/06/16 00:19:33 mvojkovi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -144,16 +144,23 @@ if(pNv->Architecture >= NV_ARCH_40) { pll = pNv->PMC[0x4020/4]; - P = (pll >> 16) & 0x03; + P = (pll >> 16) & 0x07; pll = pNv->PMC[0x4024/4]; M = pll & 0xFF; N = (pll >> 8) & 0xFF; - MB = (pll >> 16) & 0xFF; - NB = (pll >> 24) & 0xFF; + if(((pNv->Chipset & 0xfff0) == 0x0290) || + ((pNv->Chipset & 0xfff0) == 0x0390)) + { + MB = 1; + NB = 1; + } else { + MB = (pll >> 16) & 0xFF; + NB = (pll >> 24) & 0xFF; + } *MClk = ((N * NB * pNv->CrystalFreqKHz) / (M * MB)) >> P; pll = pNv->PMC[0x4000/4]; - P = (pll >> 16) & 0x03; + P = (pll >> 16) & 0x07; pll = pNv->PMC[0x4004/4]; M = pll & 0xFF; N = (pll >> 8) & 0xFF; @@ -875,6 +882,12 @@ case NV_ARCH_20: case NV_ARCH_30: default: + if(((pNv->Chipset & 0xfff0) == 0x0240) || + ((pNv->Chipset & 0xfff0) == 0x03D0)) + { + state->arbitration0 = 128; + state->arbitration1 = 0x0480; + } else if(((pNv->Chipset & 0xffff) == 0x01A0) || ((pNv->Chipset & 0xffff) == 0x01f0)) { @@ -945,7 +958,9 @@ if(((pNv->Chipset & 0xfff0) == 0x0090) || ((pNv->Chipset & 0xfff0) == 0x01D0) || - ((pNv->Chipset & 0xfff0) == 0x0290)) + ((pNv->Chipset & 0xfff0) == 0x0290) || + ((pNv->Chipset & 0xfff0) == 0x0390) || + ((pNv->Chipset & 0xfff0) == 0x03D0)) { regions = 15; } @@ -1200,6 +1215,8 @@ break; case 0x0160: case 0x01D0: + case 0x0240: + case 0x03D0: pNv->PMC[0x1700/4] = pNv->PFB[0x020C/4]; pNv->PMC[0x1704/4] = 0; pNv->PMC[0x1708/4] = 0; @@ -1213,13 +1230,13 @@ pNv->PGRAPH[0x082C/4] = 0x00000108; break; case 0x0220: - case 0x0230: pNv->PGRAPH[0x0860/4] = 0; pNv->PGRAPH[0x0864/4] = 0; pNv->PRAMDAC[0x0608/4] |= 0x00100000; break; case 0x0090: case 0x0290: + case 0x0390: pNv->PRAMDAC[0x0608/4] |= 0x00100000; pNv->PGRAPH[0x0828/4] = 0x07830610; pNv->PGRAPH[0x082C/4] = 0x0000016A; @@ -1277,7 +1294,9 @@ } else { if(((pNv->Chipset & 0xfff0) == 0x0090) || ((pNv->Chipset & 0xfff0) == 0x01D0) || - ((pNv->Chipset & 0xfff0) == 0x0290)) + ((pNv->Chipset & 0xfff0) == 0x0290) || + ((pNv->Chipset & 0xfff0) == 0x0390) || + ((pNv->Chipset & 0xfff0) == 0x03D0)) { for(i = 0; i < 60; i++) { pNv->PGRAPH[(0x0D00/4) + i] = pNv->PFB[(0x0600/4) + i]; @@ -1287,7 +1306,8 @@ for(i = 0; i < 48; i++) { pNv->PGRAPH[(0x0900/4) + i] = pNv->PFB[(0x0600/4) + i]; if(((pNv->Chipset & 0xfff0) != 0x0160) && - ((pNv->Chipset & 0xfff0) != 0x0220)) + ((pNv->Chipset & 0xfff0) != 0x0220) && + ((pNv->Chipset & 0xfff0) != 0x0240)) { pNv->PGRAPH[(0x6900/4) + i] = pNv->PFB[(0x0600/4) + i]; } @@ -1309,7 +1329,8 @@ } else { if(((pNv->Chipset & 0xfff0) == 0x0090) || ((pNv->Chipset & 0xfff0) == 0x01D0) || - ((pNv->Chipset & 0xfff0) == 0x0290)) + ((pNv->Chipset & 0xfff0) == 0x0290) || + ((pNv->Chipset & 0xfff0) == 0x0390)) { pNv->PGRAPH[0x0DF0/4] = pNv->PFB[0x0200/4]; pNv->PGRAPH[0x0DF4/4] = pNv->PFB[0x0204/4]; --- programs/Xserver/hw/xfree86/drivers/nv/nv_include.h.orig Wed Apr 20 20:25:29 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_include.h Mon Apr 2 00:19:24 2007 @@ -3,11 +3,18 @@ #ifndef __NV_INCLUDE_H__ #define __NV_INCLUDE_H__ +#if !USE_LIBC_WRAPPER +#include +#include +#endif + /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" +#if USE_LIBC_WRAPPER #include "xf86_ansic.h" +#endif #include "compiler.h" /* Drivers for PCI hardware need this */ @@ -51,6 +58,10 @@ #include "xf86DDC.h" #include "region.h" + +#ifdef RANDR +#include +#endif #include "nv_local.h" #include "nv_type.h" --- programs/Xserver/hw/xfree86/drivers/nv/nv_local.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_local.h Mon Apr 2 00:19:31 2007 @@ -46,7 +46,9 @@ * HW. Put all affected includes, typdefs, etc. here so the riva_hw.* files * can stay generic in nature. */ +#if USE_LIBC_WRAPPER #include "xf86_ansic.h" +#endif #include "compiler.h" #include "xf86_OSproc.h" --- programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c.orig Fri Sep 30 05:47:29 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c Mon Apr 2 00:38:09 2007 @@ -174,14 +174,17 @@ { NVPtr pNv = NVPTR(pScrn); volatile U032 *PRAMDAC = pNv->PRAMDAC0; - CARD32 reg52C, reg608; + CARD32 reg52C, reg608, dac0_reg608 = 0; Bool present; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Probing for analog device on output %s...\n", output ? "B" : "A"); - if(output) PRAMDAC += 0x800; + if(output) { + dac0_reg608 = PRAMDAC[0x0608/4]; + PRAMDAC += 0x800; + } reg52C = PRAMDAC[0x052C/4]; reg608 = PRAMDAC[0x0608/4]; @@ -204,7 +207,8 @@ else xf86DrvMsg(pScrn->scrnIndex, X_PROBED, " ...can't find one\n"); - pNv->PRAMDAC0[0x0608/4] &= 0x0000EFFF; + if(output) + pNv->PRAMDAC0[0x0608/4] = dac0_reg608; PRAMDAC[0x052C/4] = reg52C; PRAMDAC[0x0608/4] = reg608; --- programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c.orig Mon Jul 11 10:29:58 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c Tue Jan 9 07:46:08 2007 @@ -68,6 +68,11 @@ CARD8 *dstPtr, *srcPtr, *src; CARD32 *dst; + if(!pNv->Rotate) { + NVRefreshArea(pScrn, num, pbox); + return; + } + dstPitch = pScrn->displayWidth; srcPitch = -pNv->Rotate * pNv->ShadowPitch; @@ -114,6 +119,11 @@ CARD16 *dstPtr, *srcPtr, *src; CARD32 *dst; + if(!pNv->Rotate) { + NVRefreshArea(pScrn, num, pbox); + return; + } + dstPitch = pScrn->displayWidth; srcPitch = -pNv->Rotate * pNv->ShadowPitch >> 1; @@ -158,6 +168,11 @@ NVPtr pNv = NVPTR(pScrn); int count, width, height, dstPitch, srcPitch; CARD32 *dstPtr, *srcPtr, *src, *dst; + + if(!pNv->Rotate) { + NVRefreshArea(pScrn, num, pbox); + return; + } dstPitch = pScrn->displayWidth; srcPitch = -pNv->Rotate * pNv->ShadowPitch >> 2; --- programs/Xserver/hw/xfree86/drivers/nv/nv_type.h.orig Fri Apr 22 06:25:47 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_type.h Tue Jan 9 07:46:08 2007 @@ -172,6 +172,7 @@ CARD32 currentRop; Bool WaitVSyncPossible; Bool BlendingPossible; + Bool RandRRotation; } NVRec, *NVPtr; #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) --- programs/Xserver/hw/xfree86/drivers/nv/nv_video.c.orig Mon Jul 11 10:29:58 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/nv_video.c Tue Jan 9 07:46:08 2007 @@ -7,7 +7,9 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" +#if USE_LIBC_WRAPPER #include "xf86_ansic.h" +#endif #include "compiler.h" #include "xf86PciInfo.h" #include "xf86Pci.h" @@ -81,7 +83,12 @@ static void NVStopOverlayVideo(ScrnInfoPtr, pointer, Bool); static void NVStopBlitVideo(ScrnInfoPtr, pointer, Bool); +#if HAVE_XV_DRAWABLE +static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer, DrawablePtr); +#else static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +#endif + static void NVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); static int NVQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); @@ -1006,6 +1013,9 @@ Bool Sync, RegionPtr clipBoxes, pointer data +#if HAVE_XV_DRAWABLE + , DrawablePtr pDraw +#endif ) { NVPortPrivPtr pPriv = (NVPortPrivPtr)data; --- programs/Xserver/hw/xfree86/drivers/nv/riva_const.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_const.h Tue Jan 9 07:46:08 2007 @@ -6,9 +6,6 @@ #define RIVA_VERSION 4000 #define RIVA_NAME "RIVA128" #define RIVA_DRIVER_NAME "riva128" -#define RIVA_MAJOR_VERSION 1 -#define RIVA_MINOR_VERSION 0 -#define RIVA_PATCHLEVEL 1 #endif /* __RIVA_CONST_H__ */ --- programs/Xserver/hw/xfree86/drivers/nv/riva_driver.c.orig Mon Jul 11 10:29:58 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_driver.c Tue Jan 9 07:46:08 2007 @@ -177,7 +177,7 @@ MODINFOSTRING1, MODINFOSTRING2, XORG_VERSION_CURRENT, - RIVA_MAJOR_VERSION, RIVA_MINOR_VERSION, RIVA_PATCHLEVEL, + PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, PACKAGE_VERSION_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, MOD_CLASS_VIDEODRV, @@ -493,8 +493,16 @@ const char *s; if (flags & PROBE_DETECT) { - rivaProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); - return TRUE; + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + + if (!pEnt) + return FALSE; + + i = pEnt->index; + xfree(pEnt); + + rivaProbeDDC(pScrn, i); + return TRUE; } /* --- programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h Tue Jan 9 07:46:08 2007 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.25 2003/05/04 01:20:52 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.26 2003/07/31 20:24:31 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ --- programs/Xserver/hw/xfree86/drivers/nv/riva_include.h.orig Wed Apr 20 20:25:29 2005 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_include.h Mon Apr 2 00:19:22 2007 @@ -3,11 +3,17 @@ #ifndef __RIVA_INCLUDE_H__ #define __RIVA_INCLUDE_H__ +#if !USE_LIBC_WRAPPER +#include +#endif + /* All drivers should typically include these */ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" +#if USE_LIBC_WRAPPER #include "xf86_ansic.h" +#endif #include "compiler.h" /* Drivers for PCI hardware need this */ --- programs/Xserver/hw/xfree86/drivers/nv/riva_local.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_local.h Tue Jan 9 07:46:08 2007 @@ -46,7 +46,9 @@ * HW. Put all affected includes, typdefs, etc. here so the riva_hw.* files * can stay generic in nature. */ +#if USE_LIBC_WRAPPER #include "xf86_ansic.h" +#endif #include "compiler.h" #include "xf86_OSproc.h" --- programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h.orig Sat Apr 24 03:42:10 2004 +++ programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h Tue Jan 9 07:46:08 2007 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.9 2002/01/30 01:35:03 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.10 2003/07/31 20:24:31 mvojkovi Exp $ */ /*