Art Boulatov wrote:
> David Findlay wrote:
> P.S. I was wondering if anybody have written yet a simple prog
> to overclock engine/memory on TNT2 (like PowerStrip does),
> since NVIDIA driver does not support that feature (WHY NOT? XF86Config
> is a good place to enter those values into).
> My card is just going forward into it, so I get
> a remarkable fps increase under windows.
> Would be great to be able to do the same under X.
> > David Findlay
Hi,
here is a program from the linux-nvidia mailinglist.
It works fine for me.
I take NO - repeat NO - responsability for it.
Edit it and adjust the frequencies ( don't exagerate ! ) in the file.
Compile it.
HTH
[
nvoverclock.c 6K ]
/* ----------------------------------------------------------------------
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TNT clock
----------------------------------------------------------------------
* To: linux-nvi...@lists.surfsouth.com
* Subject: Re: TNT clock
* From: Matan Ziv-Av <ma...@svgalib.org>
* Date: Tue, 29 Feb 2000 13:41:50 +0200 (IST)
* Delivered-At-Relayer-To: <linux-nvi...@lists.surfsouth.com>
* In-Reply-To: <Pine.LNX.4.10.10002261252520.859-100...@matan.home>
* Reply-To: Matan Ziv-Av <ma...@svgalib.org>
* Sender: owner-linux-nvi...@mail-overflow.surfsouth.com
----------------------------------------------------------------------
OK, Thanks to all who replied.
If anyone still wants to run the program, it needs to be run as root
(which I forgot to say).
First, the problem I had is related to an undocumented bit in one
register. In order to read (or write) the NVPLL, bit 10 of the COEFF
SELECT register needs to be set. It is done by X, so everyone who runs
the program from X gets the right values.
I added a line to the program to set this bit, and the program now reads
125/150MHz, as it should. There seem to be also 125/143 and 150/183
standards (the later is called ultra). The TNT seems to be run at
90/110, and a GeForce DDR, chipset at 120MHz and memory at 300MHz.
Daniel Koukola reports that overclocking the memory clock (MPLL) helps
for using higher character clocks with SVGATextMode.
In my test, I changed the memory clock from 150MHz to 163MHz, and the 3D
performance increased by the same amount (I only tested the mesa demo
gears).
If you want to try the attached program to overclock, I suggest the
following:
Run it in a text console (not xterm).
Make sure you have vga_reset (from a recent svgalib) installed, and that
you know how to run it blindly. It will save a reboot if the program
messes up too much.
The program needs to be run as root. Change the clock values in the
program before compiling. If you use kernel 2.0, or proc fs is not
mounted, or the program does not find the card for any reason, change
the if(pci... and base=... lines to base=0xab000000, where the ab value
is the first pci aperture of the nvidia card.
--
Matan Ziv-Av. ma...@svgalib.org*/
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
static int ClockSelect(int clockIn,int *clockOut,int *mOut,
int *nOut,int *pOut);
static int base_freq;
static int pci_read_config(unsigned char bus, unsigned char device,
unsigned char fn, unsigned long *buf, int size)
{
int f,i;
char filename[256];
sprintf(filename,"/proc/bus/pci/%02i/%02x.%i",bus,device,fn);
f=open(filename,O_RDONLY);
if(read(f,buf,4*size)<1)for(i=0;i<63;i++)buf[i]=-1;
close(f);
return 0;
};
int pci_find_vendor_vga(unsigned int vendor, unsigned long *conf)
{ unsigned long buf[64];
int bus,device=0;
for(bus=0;bus<16;bus++)
for(device=0;device<32;device++){
pci_read_config(bus,device,0,buf,3);
if(((buf[0]&0xffff)==vendor)&&
(((buf[2]>>16)&0xffff)==0x0300)) { /* VGA Class */
pci_read_config(bus,device,0,buf,64);
memcpy(conf,buf,256);
return 0;
};
}
return -1;
}
int main(int argc, char *argv[])
{
int i;
int f;
void *c, *d, *e;
unsigned char *p, *q;
unsigned long *l;
unsigned long base;
unsigned long buf[64];
int mm,nn,pp;
int newNVPLL, newMPLL, newNVclock, newMEMclock;
if(pci_find_vendor_vga(0x10de,buf))exit(1);
base=buf[4]&0xffffff00;
/* eerst kijken of de commandolijn options goed zijn */
if (argc < 2)
{
printf ("Usage %s : Verify Set\n",argv[0] );
exit (1);
}
f=open("/dev/mem",O_RDWR);
/* c is fro the clocks, d for PEXTDEV, and e for the crtc */
c=mmap(0,4096,PROT_READ|PROT_WRITE,MAP_SHARED,f,base + 0x680000);
p=(unsigned char *)c;
d=mmap(0,4096,PROT_READ,MAP_SHARED,f,base + 0x101000);
l=(unsigned long *)d;
e=mmap(0,4096,PROT_READ|PROT_WRITE,MAP_SHARED,f,base + 0x601000);
q=(unsigned char *)c;
/* enable the programable NVPLL and MPLL */
*(unsigned long *)(p+0x50c)|=0x0000500;
/* Unlock the extended vga features (I'm not sure if it is necessary) */
*(q+0x3d4)=0x1f;
*(q+0x3d5)=0x57;
/* find out the reference frequency */
base_freq= (*l&0x40) ? 14318 : 13500;
printf("old Memory clock= %i \n",
((unsigned int)base_freq * *(p+0x505) / *(p+0x504))>>*(p+0x506));
printf("old Core clock= %i \n",
((unsigned int)base_freq * *(p+0x501) / *(p+0x500))>>*(p+0x502));
/* HERE the new clocks are selected (in KHz). */
if (strstr(argv[1],"S"))
{
/* adjust here don't exagerate and have vga_reset at hand*/
ClockSelect(166000,&newMEMclock,&mm,&nn,&pp);
newMPLL=(pp<<16)+(nn<<8)+mm;
/*adjust here don't exagerate and have vga_reset at hand */
ClockSelect(176000,&newNVclock,&mm,&nn,&pp);
newNVPLL=(pp<<16)+(nn<<8)+mm;
/*printf("newMPLL=%08x newMEMclock=%i\n",newMPLL,newMEMclock);
printf("newNVPLL=%08x newNVclock=%i\n\n",newNVPLL,newNVclock);*/
*(long *)(p+0x500)=newNVPLL;
*(long *)(p+0x504)=newMPLL;
printf("new Memory clock= %i \n",
((unsigned int)base_freq * *(p+0x505) / *(p+0x504))>>*(p+0x506));
printf("new Core clock= %i \n",
((unsigned int)base_freq * *(p+0x501) / *(p+0x500))>>*(p+0x502));
}
};
static int ClockSelect(int clockIn,int *clockOut,int *mOut,
int *nOut,int *pOut)
{
int m,n,p;
int c,t,d;
int bestn,bestm,bestdiff;
bestn=0;
bestdiff=clockIn;
p=0;
while(clockIn<128000) {
p++;
clockIn*=2;
}
for(m=8;m<=13;m++) {
c=clockIn*m;
t=(c+(base_freq>>1))/base_freq;
d=c-(t*base_freq);
if(d<0)d=-d;
d=d/m;
if(d<bestdiff) {
bestn=t;
bestm=m;
bestdiff=d;
}
}
*mOut=bestm;*nOut=bestn;*pOut=p;
*clockOut=(base_freq*bestn/bestm)>>p;
if (bestdiff<1000) return 1; else return 0;
}