summaryrefslogtreecommitdiff
path: root/driver/xf86-video-nv/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-05-03 16:42:24 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-05-03 16:42:24 +0000
commitf28ebb124cd8286ec4b90fb357af9c5e2b1cfca2 (patch)
treeb8a76c1621500408ef70c59ce0cc70907a66f3a1 /driver/xf86-video-nv/src
parentdeb713453d2ae91b63221fc0c30696cc5a7828f9 (diff)
update to xf86-video-nv 2.1.13.
Diffstat (limited to 'driver/xf86-video-nv/src')
-rw-r--r--driver/xf86-video-nv/src/Makefile.in14
-rw-r--r--driver/xf86-video-nv/src/g80_output.c4
-rw-r--r--driver/xf86-video-nv/src/nv_dac.c95
-rw-r--r--driver/xf86-video-nv/src/nv_driver.c1
-rw-r--r--driver/xf86-video-nv/src/nv_setup.c7
-rw-r--r--driver/xf86-video-nv/src/nv_type.h32
-rw-r--r--driver/xf86-video-nv/src/riva_dac.c81
-rw-r--r--driver/xf86-video-nv/src/riva_setup.c65
-rw-r--r--driver/xf86-video-nv/src/riva_type.h20
9 files changed, 179 insertions, 140 deletions
diff --git a/driver/xf86-video-nv/src/Makefile.in b/driver/xf86-video-nv/src/Makefile.in
index cb951b6ea..50cc1d157 100644
--- a/driver/xf86-video-nv/src/Makefile.in
+++ b/driver/xf86-video-nv/src/Makefile.in
@@ -149,6 +149,7 @@ F77 = @F77@
FFLAGS = @FFLAGS@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -188,15 +189,9 @@ VERSION = @VERSION@
XMODES_CFLAGS = @XMODES_CFLAGS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_LIBS = @XORG_LIBS@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
ac_ct_F77 = @ac_ct_F77@
-ac_ct_NMEDIT = @ac_ct_NMEDIT@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@@ -213,17 +208,22 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
@@ -231,8 +231,10 @@ modes_dir = @modes_dir@
moduledir = @moduledir@
oldincludedir = @oldincludedir@
parser_dir = @parser_dir@
+pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
diff --git a/driver/xf86-video-nv/src/g80_output.c b/driver/xf86-video-nv/src/g80_output.c
index e906fbba7..420a73ed8 100644
--- a/driver/xf86-video-nv/src/g80_output.c
+++ b/driver/xf86-video-nv/src/g80_output.c
@@ -307,7 +307,11 @@ ProbeDDC(I2CBusPtr i2c)
"Probing for EDID on I2C bus %i...\n", bus);
pNv->reg[addr/4] = 7;
/* Should probably use xf86OutputGetEDID here */
+#ifdef EDID_COMPLETE_RAWDATA
+ monInfo = xf86DoEEDID(pScrn->scrnIndex, i2c, TRUE);
+#else
monInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, i2c);
+#endif
pNv->reg[addr/4] = 3;
if(monInfo) {
diff --git a/driver/xf86-video-nv/src/nv_dac.c b/driver/xf86-video-nv/src/nv_dac.c
index b1049cce1..b6df1074d 100644
--- a/driver/xf86-video-nv/src/nv_dac.c
+++ b/driver/xf86-video-nv/src/nv_dac.c
@@ -42,8 +42,21 @@ NVDACPanelTweaks(NVPtr pNv, NVRegPtr state)
we can do is experiment and apply hacks. */
if(((pNv->Chipset & 0xffff) == 0x0328) && (state->bpp == 32)) {
- /* At least one NV34 laptop needs this workaround. */
- tweak = -1;
+#if XSERVER_LIBPCIACCESS
+ if (((pNv->PciInfo->subvendor_id & 0xffff) == 0x1179) &&
+ ((pNv->PciInfo->subdevice_id & 0xffff) == 0x0020))
+#else
+ if (((pNv->PciInfo->subsysVendor & 0xffff) == 0x1179) &&
+ ((pNv->PciInfo->subsysCard & 0xffff) == 0x0020))
+#endif
+ {
+
+ /* Toshiba Tecra M2 */
+ tweak = 1;
+ } else {
+ /* At least one NV34 laptop needs this workaround. */
+ tweak = -1;
+ }
}
if((pNv->Chipset & 0xfff0) == 0x0310) {
@@ -105,58 +118,58 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
horizTotal += 2;
}
- pVga->CRTC[0x0] = Set8Bits(horizTotal);
- pVga->CRTC[0x1] = Set8Bits(horizDisplay);
- pVga->CRTC[0x2] = Set8Bits(horizBlankStart);
- pVga->CRTC[0x3] = SetBitField(horizBlankEnd,4:0,4:0)
- | SetBit(7);
- pVga->CRTC[0x4] = Set8Bits(horizStart);
- pVga->CRTC[0x5] = SetBitField(horizBlankEnd,5:5,7:7)
- | SetBitField(horizEnd,4:0,4:0);
- pVga->CRTC[0x6] = SetBitField(vertTotal,7:0,7:0);
- pVga->CRTC[0x7] = SetBitField(vertTotal,8:8,0:0)
- | SetBitField(vertDisplay,8:8,1:1)
- | SetBitField(vertStart,8:8,2:2)
- | SetBitField(vertBlankStart,8:8,3:3)
- | SetBit(4)
- | SetBitField(vertTotal,9:9,5:5)
- | SetBitField(vertDisplay,9:9,6:6)
- | SetBitField(vertStart,9:9,7:7);
- pVga->CRTC[0x9] = SetBitField(vertBlankStart,9:9,5:5)
- | SetBit(6)
+ pVga->CRTC[0x0] = NV_Set8Bits(horizTotal);
+ pVga->CRTC[0x1] = NV_Set8Bits(horizDisplay);
+ pVga->CRTC[0x2] = NV_Set8Bits(horizBlankStart);
+ pVga->CRTC[0x3] = NV_SetBitField(horizBlankEnd,4:0,4:0)
+ | NV_SetBit(7);
+ pVga->CRTC[0x4] = NV_Set8Bits(horizStart);
+ pVga->CRTC[0x5] = NV_SetBitField(horizBlankEnd,5:5,7:7)
+ | NV_SetBitField(horizEnd,4:0,4:0);
+ pVga->CRTC[0x6] = NV_SetBitField(vertTotal,7:0,7:0);
+ pVga->CRTC[0x7] = NV_SetBitField(vertTotal,8:8,0:0)
+ | NV_SetBitField(vertDisplay,8:8,1:1)
+ | NV_SetBitField(vertStart,8:8,2:2)
+ | NV_SetBitField(vertBlankStart,8:8,3:3)
+ | NV_SetBit(4)
+ | NV_SetBitField(vertTotal,9:9,5:5)
+ | NV_SetBitField(vertDisplay,9:9,6:6)
+ | NV_SetBitField(vertStart,9:9,7:7);
+ pVga->CRTC[0x9] = NV_SetBitField(vertBlankStart,9:9,5:5)
+ | NV_SetBit(6)
| ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00);
- pVga->CRTC[0x10] = Set8Bits(vertStart);
- pVga->CRTC[0x11] = SetBitField(vertEnd,3:0,3:0) | SetBit(5);
- pVga->CRTC[0x12] = Set8Bits(vertDisplay);
+ pVga->CRTC[0x10] = NV_Set8Bits(vertStart);
+ pVga->CRTC[0x11] = NV_SetBitField(vertEnd,3:0,3:0) | NV_SetBit(5);
+ pVga->CRTC[0x12] = NV_Set8Bits(vertDisplay);
pVga->CRTC[0x13] = ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8));
- pVga->CRTC[0x15] = Set8Bits(vertBlankStart);
- pVga->CRTC[0x16] = Set8Bits(vertBlankEnd);
+ pVga->CRTC[0x15] = NV_Set8Bits(vertBlankStart);
+ pVga->CRTC[0x16] = NV_Set8Bits(vertBlankEnd);
pVga->Attribute[0x10] = 0x01;
if(pNv->Television)
pVga->Attribute[0x11] = 0x00;
- nvReg->screen = SetBitField(horizBlankEnd,6:6,4:4)
- | SetBitField(vertBlankStart,10:10,3:3)
- | SetBitField(vertStart,10:10,2:2)
- | SetBitField(vertDisplay,10:10,1:1)
- | SetBitField(vertTotal,10:10,0:0);
+ nvReg->screen = NV_SetBitField(horizBlankEnd,6:6,4:4)
+ | NV_SetBitField(vertBlankStart,10:10,3:3)
+ | NV_SetBitField(vertStart,10:10,2:2)
+ | NV_SetBitField(vertDisplay,10:10,1:1)
+ | NV_SetBitField(vertTotal,10:10,0:0);
- nvReg->horiz = SetBitField(horizTotal,8:8,0:0)
- | SetBitField(horizDisplay,8:8,1:1)
- | SetBitField(horizBlankStart,8:8,2:2)
- | SetBitField(horizStart,8:8,3:3);
+ nvReg->horiz = NV_SetBitField(horizTotal,8:8,0:0)
+ | NV_SetBitField(horizDisplay,8:8,1:1)
+ | NV_SetBitField(horizBlankStart,8:8,2:2)
+ | NV_SetBitField(horizStart,8:8,3:3);
- nvReg->extra = SetBitField(vertTotal,11:11,0:0)
- | SetBitField(vertDisplay,11:11,2:2)
- | SetBitField(vertStart,11:11,4:4)
- | SetBitField(vertBlankStart,11:11,6:6);
+ nvReg->extra = NV_SetBitField(vertTotal,11:11,0:0)
+ | NV_SetBitField(vertDisplay,11:11,2:2)
+ | NV_SetBitField(vertStart,11:11,4:4)
+ | NV_SetBitField(vertBlankStart,11:11,6:6);
if(mode->Flags & V_INTERLACE) {
horizTotal = (horizTotal >> 1) & ~1;
- nvReg->interlace = Set8Bits(horizTotal);
- nvReg->horiz |= SetBitField(horizTotal,8:8,4:4);
+ nvReg->interlace = NV_Set8Bits(horizTotal);
+ nvReg->horiz |= NV_SetBitField(horizTotal,8:8,4:4);
} else {
nvReg->interlace = 0xff; /* interlace off */
}
diff --git a/driver/xf86-video-nv/src/nv_driver.c b/driver/xf86-video-nv/src/nv_driver.c
index e235afb2a..2e1003dad 100644
--- a/driver/xf86-video-nv/src/nv_driver.c
+++ b/driver/xf86-video-nv/src/nv_driver.c
@@ -303,6 +303,7 @@ static SymTabRec NVKnownChipsets[] =
{ 0x10DE0167, "GeForce Go 6200" },
{ 0x10DE0168, "GeForce Go 6400" },
{ 0x10DE0169, "GeForce 6250" },
+ { 0x10DE016A, "GeForce 7100 GS" },
{ 0x10DE0211, "GeForce 6800" },
{ 0x10DE0212, "GeForce 6800 LE" },
diff --git a/driver/xf86-video-nv/src/nv_setup.c b/driver/xf86-video-nv/src/nv_setup.c
index bea00503f..132a96bf0 100644
--- a/driver/xf86-video-nv/src/nv_setup.c
+++ b/driver/xf86-video-nv/src/nv_setup.c
@@ -229,7 +229,12 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Probing for EDID on I2C bus %s...\n", bus ? "B" : "A");
- if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pNv->I2C))) {
+#ifdef EDID_COMPLETE_RAWDATA
+ MonInfo = xf86DoEEDID(pScrn->scrnIndex, pNv->I2C, TRUE);
+#else
+ MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pNv->I2C);
+#endif
+ if (MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"DDC detected a %s:\n", MonInfo->features.input_type ?
"DFP" : "CRT");
diff --git a/driver/xf86-video-nv/src/nv_type.h b/driver/xf86-video-nv/src/nv_type.h
index d704e2e2d..8ebb9a8a8 100644
--- a/driver/xf86-video-nv/src/nv_type.h
+++ b/driver/xf86-video-nv/src/nv_type.h
@@ -1,5 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.51 2005/04/16 23:57:26 mvojkovi Exp $ */
-
#ifndef __NV_STRUCT_H__
#define __NV_STRUCT_H__
@@ -16,13 +14,13 @@
#define NV_ARCH_40 0x40
-#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
-#define MASKEXPAND(mask) BITMASK(1?mask,0?mask)
-#define SetBF(mask,value) ((value) << (0?mask))
-#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) )
-#define SetBitField(value,from,to) SetBF(to, GetBF(value,from))
-#define SetBit(n) (1<<(n))
-#define Set8Bits(value) ((value)&0xff)
+#define NV_BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
+#define NV_MASKEXPAND(mask) NV_BITMASK(1?mask,0?mask)
+#define NV_SetBF(mask,value) ((value) << (0?mask))
+#define NV_GetBF(var,mask) (((unsigned)((var) & NV_MASKEXPAND(mask))) >> (0?mask) )
+#define NV_SetBitField(value,from,to) NV_SetBF(to, NV_GetBF(value,from))
+#define NV_SetBit(n) (1<<(n))
+#define NV_Set8Bits(value) ((value)&0xff)
typedef struct {
int bitsPerPixel;
@@ -56,6 +54,7 @@ typedef struct _riva_hw_state
U032 vpllB;
U032 vpll2B;
U032 pllsel;
+ U032 control;
U032 general;
U032 crtcOwner;
U032 head;
@@ -69,6 +68,7 @@ typedef struct _riva_hw_state
U032 timingV;
U032 displayV;
U032 crtcSync;
+ U032 crtcVSync;
} RIVA_HW_STATE, *NVRegPtr;
@@ -79,8 +79,12 @@ typedef struct {
CARD32 Architecture;
CARD32 CursorStart;
EntityInfoPtr pEnt;
+#if XSERVER_LIBPCIACCESS
+ struct pci_device *PciInfo;
+#else
pciVideoPtr PciInfo;
PCITAG PciTag;
+#endif
int Chipset;
int ChipRev;
Bool Primary;
@@ -132,6 +136,8 @@ typedef struct {
void (*PointerMoved)(int index, int x, int y);
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
+ xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
+ Bool accessEnabled;
Bool FBDev;
int Rotate;
NVFBLayout CurrentLayout;
@@ -158,6 +164,7 @@ typedef struct {
Bool fpScaler;
int fpWidth;
int fpHeight;
+ CARD32 fpVTotal;
CARD32 fpSyncs;
Bool usePanelTweak;
int PanelTweak;
@@ -173,6 +180,13 @@ typedef struct {
Bool WaitVSyncPossible;
Bool BlendingPossible;
Bool RandRRotation;
+
+ /* VBE dual-head */
+ Bool VBEDualhead;
+ vbeInfoPtr pVbe;
+ VbeInfoBlock *pVbeInfo;
+ int vbeMode;
+ CARD32 vbeCRTC1Offset;
} NVRec, *NVPtr;
#define NVPTR(p) ((NVPtr)((p)->driverPrivate))
diff --git a/driver/xf86-video-nv/src/riva_dac.c b/driver/xf86-video-nv/src/riva_dac.c
index d371a05af..9b7b51873 100644
--- a/driver/xf86-video-nv/src/riva_dac.c
+++ b/driver/xf86-video-nv/src/riva_dac.c
@@ -23,8 +23,6 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_dac.c,v 1.1 2003/07/31 20:24:29 mvojkovi Exp $ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -69,55 +67,55 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if(mode->Flags & V_INTERLACE)
vertTotal |= 1;
- pVga->CRTC[0x0] = Set8Bits(horizTotal);
- pVga->CRTC[0x1] = Set8Bits(horizDisplay);
- pVga->CRTC[0x2] = Set8Bits(horizBlankStart);
- pVga->CRTC[0x3] = SetBitField(horizBlankEnd,4:0,4:0)
- | SetBit(7);
- pVga->CRTC[0x4] = Set8Bits(horizStart);
- pVga->CRTC[0x5] = SetBitField(horizBlankEnd,5:5,7:7)
- | SetBitField(horizEnd,4:0,4:0);
- pVga->CRTC[0x6] = SetBitField(vertTotal,7:0,7:0);
- pVga->CRTC[0x7] = SetBitField(vertTotal,8:8,0:0)
- | SetBitField(vertDisplay,8:8,1:1)
- | SetBitField(vertStart,8:8,2:2)
- | SetBitField(vertBlankStart,8:8,3:3)
- | SetBit(4)
- | SetBitField(vertTotal,9:9,5:5)
- | SetBitField(vertDisplay,9:9,6:6)
- | SetBitField(vertStart,9:9,7:7);
- pVga->CRTC[0x9] = SetBitField(vertBlankStart,9:9,5:5)
- | SetBit(6)
+ pVga->CRTC[0x0] = RIVA_Set8Bits(horizTotal);
+ pVga->CRTC[0x1] = RIVA_Set8Bits(horizDisplay);
+ pVga->CRTC[0x2] = RIVA_Set8Bits(horizBlankStart);
+ pVga->CRTC[0x3] = RIVA_SetBitField(horizBlankEnd,4:0,4:0)
+ | RIVA_SetBit(7);
+ pVga->CRTC[0x4] = RIVA_Set8Bits(horizStart);
+ pVga->CRTC[0x5] = RIVA_SetBitField(horizBlankEnd,5:5,7:7)
+ | RIVA_SetBitField(horizEnd,4:0,4:0);
+ pVga->CRTC[0x6] = RIVA_SetBitField(vertTotal,7:0,7:0);
+ pVga->CRTC[0x7] = RIVA_SetBitField(vertTotal,8:8,0:0)
+ | RIVA_SetBitField(vertDisplay,8:8,1:1)
+ | RIVA_SetBitField(vertStart,8:8,2:2)
+ | RIVA_SetBitField(vertBlankStart,8:8,3:3)
+ | RIVA_SetBit(4)
+ | RIVA_SetBitField(vertTotal,9:9,5:5)
+ | RIVA_SetBitField(vertDisplay,9:9,6:6)
+ | RIVA_SetBitField(vertStart,9:9,7:7);
+ pVga->CRTC[0x9] = RIVA_SetBitField(vertBlankStart,9:9,5:5)
+ | RIVA_SetBit(6)
| ((mode->Flags & V_DBLSCAN) ? 0x80 : 0x00);
- pVga->CRTC[0x10] = Set8Bits(vertStart);
- pVga->CRTC[0x11] = SetBitField(vertEnd,3:0,3:0) | SetBit(5);
- pVga->CRTC[0x12] = Set8Bits(vertDisplay);
+ pVga->CRTC[0x10] = RIVA_Set8Bits(vertStart);
+ pVga->CRTC[0x11] = RIVA_SetBitField(vertEnd,3:0,3:0) | RIVA_SetBit(5);
+ pVga->CRTC[0x12] = RIVA_Set8Bits(vertDisplay);
pVga->CRTC[0x13] = ((pLayout->displayWidth/8)*(pLayout->bitsPerPixel/8));
- pVga->CRTC[0x15] = Set8Bits(vertBlankStart);
- pVga->CRTC[0x16] = Set8Bits(vertBlankEnd);
+ pVga->CRTC[0x15] = RIVA_Set8Bits(vertBlankStart);
+ pVga->CRTC[0x16] = RIVA_Set8Bits(vertBlankEnd);
pVga->Attribute[0x10] = 0x01;
- rivaReg->screen = SetBitField(horizBlankEnd,6:6,4:4)
- | SetBitField(vertBlankStart,10:10,3:3)
- | SetBitField(vertStart,10:10,2:2)
- | SetBitField(vertDisplay,10:10,1:1)
- | SetBitField(vertTotal,10:10,0:0);
+ rivaReg->screen = RIVA_SetBitField(horizBlankEnd,6:6,4:4)
+ | RIVA_SetBitField(vertBlankStart,10:10,3:3)
+ | RIVA_SetBitField(vertStart,10:10,2:2)
+ | RIVA_SetBitField(vertDisplay,10:10,1:1)
+ | RIVA_SetBitField(vertTotal,10:10,0:0);
- rivaReg->horiz = SetBitField(horizTotal,8:8,0:0)
- | SetBitField(horizDisplay,8:8,1:1)
- | SetBitField(horizBlankStart,8:8,2:2)
- | SetBitField(horizStart,8:8,3:3);
+ rivaReg->horiz = RIVA_SetBitField(horizTotal,8:8,0:0)
+ | RIVA_SetBitField(horizDisplay,8:8,1:1)
+ | RIVA_SetBitField(horizBlankStart,8:8,2:2)
+ | RIVA_SetBitField(horizStart,8:8,3:3);
- rivaReg->extra = SetBitField(vertTotal,11:11,0:0)
- | SetBitField(vertDisplay,11:11,2:2)
- | SetBitField(vertStart,11:11,4:4)
- | SetBitField(vertBlankStart,11:11,6:6);
+ rivaReg->extra = RIVA_SetBitField(vertTotal,11:11,0:0)
+ | RIVA_SetBitField(vertDisplay,11:11,2:2)
+ | RIVA_SetBitField(vertStart,11:11,4:4)
+ | RIVA_SetBitField(vertBlankStart,11:11,6:6);
if(mode->Flags & V_INTERLACE) {
horizTotal = (horizTotal >> 1) & ~1;
- rivaReg->interlace = Set8Bits(horizTotal);
- rivaReg->horiz |= SetBitField(horizTotal,8:8,4:4);
+ rivaReg->interlace = RIVA_Set8Bits(horizTotal);
+ rivaReg->horiz |= RIVA_SetBitField(horizTotal,8:8,4:4);
} else {
rivaReg->interlace = 0xff; /* interlace off */
}
@@ -281,4 +279,3 @@ RivaDACi2cInit(ScrnInfoPtr pScrn)
}
return TRUE;
}
-
diff --git a/driver/xf86-video-nv/src/riva_setup.c b/driver/xf86-video-nv/src/riva_setup.c
index faedf9a94..64726f734 100644
--- a/driver/xf86-video-nv/src/riva_setup.c
+++ b/driver/xf86-video-nv/src/riva_setup.c
@@ -23,8 +23,6 @@
/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen
<jpaana@s2.org> */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_setup.c $ */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -169,7 +167,12 @@ RivaProbeDDC (ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Probing for EDID...\n");
- if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pRiva->I2C))) {
+#ifdef EDID_COMPLETE_RAWDATA
+ MonInfo = xf86DoEEDID(pScrn->scrnIndex, pRiva->I2C, TRUE);
+#else
+ MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pRiva->I2C);
+#endif
+ if (MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
" ... found one\n");
xf86PrintEDID( MonInfo );
@@ -189,7 +192,6 @@ Riva3Setup(ScrnInfoPtr pScrn)
CARD32 regBase = pRiva->IOAddress;
CARD32 frameBase = pRiva->FbAddress;
xf86MonPtr monitor;
- int mmioFlags;
pRiva->Save = RivaDACSave;
pRiva->Restore = RivaDACRestore;
@@ -231,40 +233,39 @@ Riva3Setup(ScrnInfoPtr pScrn)
pRiva->riva.EnableIRQ = 0;
pRiva->riva.IO = VGA_IOBASE_COLOR;
- mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
+#if XSERVER_LIBPCIACCESS
+#define MAP(ptr, offset, size) { \
+ void *tmp; \
+ pci_device_map_range(pRiva->PciInfo, (offset), (size), \
+ PCI_DEV_MAP_FLAG_WRITABLE, &tmp); \
+ pRiva->riva.ptr = tmp; \
+ }
+#else
+#define MAP(ptr, offset, size) \
+ pRiva->riva.ptr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO | \
+ VIDMEM_READSIDEEFFECT, pRiva->PciTag, \
+ (offset), (size));
+#endif
- pRiva->riva.PRAMDAC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00680000, 0x00003000);
- pRiva->riva.PFB = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00100000, 0x00001000);
- pRiva->riva.PFIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00002000, 0x00002000);
- pRiva->riva.PGRAPH = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00400000, 0x00002000);
- pRiva->riva.PEXTDEV = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00101000, 0x00001000);
- pRiva->riva.PTIMER = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00009000, 0x00001000);
- pRiva->riva.PMC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00000000, 0x00009000);
- pRiva->riva.FIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- regBase+0x00800000, 0x00010000);
- pRiva->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag,
- frameBase+0x00C00000, 0x00008000);
+ MAP(PRAMDAC, regBase + 0x00680000, 0x00003000);
+ MAP(PFB, regBase + 0x00100000, 0x00001000);
+ MAP(PFIFO, regBase + 0x00002000, 0x00002000);
+ MAP(PGRAPH, regBase + 0x00400000, 0x00002000);
+ MAP(PEXTDEV, regBase + 0x00101000, 0x00001000);
+ MAP(PTIMER, regBase + 0x00009000, 0x00001000);
+ MAP(PMC, regBase + 0x00000000, 0x00009000);
+ MAP(FIFO, regBase + 0x00800000, 0x00010000);
+ MAP(PRAMIN, frameBase+0x00C00000, 0x00008000);
/*
* These registers are read/write as 8 bit values. Probably have to map
* sparse on alpha.
*/
- pRiva->riva.PCIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
- pRiva->PciTag, regBase+0x00601000,
- 0x00003000);
- pRiva->riva.PDIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
- pRiva->PciTag, regBase+0x00681000,
- 0x00003000);
- pRiva->riva.PVIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
- pRiva->PciTag, regBase+0x000C0000,
- 0x00001000);
+ MAP(PCIO, regBase + 0x00601000, 0x00003000);
+ MAP(PDIO, regBase + 0x00681000, 0x00003000);
+ MAP(PVIO, regBase + 0x000C0000, 0x00001000);
+
+#undef MAP
pRiva->riva.PCRTC = pRiva->riva.PGRAPH;
diff --git a/driver/xf86-video-nv/src/riva_type.h b/driver/xf86-video-nv/src/riva_type.h
index 204c75842..5a1317f34 100644
--- a/driver/xf86-video-nv/src/riva_type.h
+++ b/driver/xf86-video-nv/src/riva_type.h
@@ -1,5 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_type.h $ */
-
#ifndef __Riva_STRUCT_H__
#define __Riva_STRUCT_H__
@@ -11,13 +9,13 @@
#include "xf86int10.h"
-#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
-#define MASKEXPAND(mask) BITMASK(1?mask,0?mask)
-#define SetBF(mask,value) ((value) << (0?mask))
-#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) )
-#define SetBitField(value,from,to) SetBF(to, GetBF(value,from))
-#define SetBit(n) (1<<(n))
-#define Set8Bits(value) ((value)&0xff)
+#define RIVA_BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b))
+#define RIVA_MASKEXPAND(mask) RIVA_BITMASK(1?mask,0?mask)
+#define RIVA_SetBF(mask,value) ((value) << (0?mask))
+#define RIVA_GetBF(var,mask) (((unsigned)((var) & RIVA_MASKEXPAND(mask))) >> (0?mask) )
+#define RIVA_SetBitField(value,from,to) RIVA_SetBF(to, RIVA_GetBF(value,from))
+#define RIVA_SetBit(n) (1<<(n))
+#define RIVA_Set8Bits(value) ((value)&0xff)
typedef RIVA_HW_STATE* RivaRegPtr;
@@ -53,8 +51,12 @@ typedef struct {
RIVA_HW_STATE SavedReg;
RIVA_HW_STATE ModeReg;
EntityInfoPtr pEnt;
+#if XSERVER_LIBPCIACCESS
+ struct pci_device *PciInfo;
+#else
pciVideoPtr PciInfo;
PCITAG PciTag;
+#endif
xf86AccessRec Access;
int ChipRev;
Bool Primary;