mirror of
https://github.com/X11Libre/xf86-video-nv.git
synced 2026-03-24 01:24:21 +00:00
Fix more load detection false positives.
This commit is contained in:
@@ -136,23 +136,22 @@ G80DacLoadDetect(xf86OutputPtr output)
|
||||
const int scrnIndex = pScrn->scrnIndex;
|
||||
const int dacOff = 2048 * pPriv->or;
|
||||
int sigstate;
|
||||
CARD32 load, tmp, tmp2;
|
||||
CARD32 load, tmp;
|
||||
|
||||
xf86DrvMsg(scrnIndex, X_PROBED, "Trying load detection on VGA%i ... ",
|
||||
pPriv->or);
|
||||
|
||||
pNv->reg[(0x0061A010+dacOff)/4] = 0x00000001;
|
||||
tmp2 = pNv->reg[(0x0061A004+dacOff)/4];
|
||||
tmp = pNv->reg[(0x0061A004+dacOff)/4];
|
||||
pNv->reg[(0x0061A004+dacOff)/4] = 0x80150000;
|
||||
while(pNv->reg[(0x0061A004+dacOff)/4] & 0x80000000);
|
||||
tmp = pNv->architecture == 0x50 ? 420 : 340;
|
||||
pNv->reg[(0x0061A00C+dacOff)/4] = tmp | 0x100000;
|
||||
pNv->reg[(0x0061A00C+dacOff)/4] = pNv->loadVal | 0x100000;
|
||||
sigstate = xf86BlockSIGIO();
|
||||
usleep(45000);
|
||||
xf86UnblockSIGIO(sigstate);
|
||||
load = pNv->reg[(0x0061A00C+dacOff)/4];
|
||||
pNv->reg[(0x0061A00C+dacOff)/4] = 0;
|
||||
pNv->reg[(0x0061A004+dacOff)/4] = 0x80000000 | tmp2;
|
||||
pNv->reg[(0x0061A004+dacOff)/4] = 0x80000000 | tmp;
|
||||
|
||||
// Use this DAC if all three channels show load.
|
||||
if((load & 0x38000000) == 0x38000000) {
|
||||
|
||||
@@ -32,6 +32,41 @@
|
||||
#include "g80_display.h"
|
||||
#include "g80_output.h"
|
||||
|
||||
static CARD32 G80FindLoadVal(const unsigned char *table1)
|
||||
{
|
||||
const unsigned char *p = table1;
|
||||
int count;
|
||||
const CARD32 def = 340;
|
||||
|
||||
for(p = table1; *(CARD16*)p != 0xb8ff && p < table1 + 64000; p += 2);
|
||||
if(p == table1 + 64000)
|
||||
return def;
|
||||
p += 2;
|
||||
if(*(CARD32*)p != 0x544942)
|
||||
return def;
|
||||
p += 4;
|
||||
if(*(CARD16*)p != 0x100)
|
||||
return def;
|
||||
p += 2;
|
||||
if(*p != 12)
|
||||
return def;
|
||||
p++;
|
||||
if(*p != 6)
|
||||
return def;
|
||||
p++;
|
||||
count = *p;
|
||||
p += 2;
|
||||
for(; *p != 'A' && count >= 0; count--, p += 6);
|
||||
if(count == -1)
|
||||
return def;
|
||||
p += 4;
|
||||
p = table1 + *(CARD16*)p;
|
||||
p = table1 + *(CARD16*)p;
|
||||
if(p[0] != 0x10 || p[1] != 4 || p[2] != 4 || p[3] != 2)
|
||||
return def;
|
||||
return *(CARD32*)(p + 4) & 0x3ff;
|
||||
}
|
||||
|
||||
static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
|
||||
{
|
||||
unsigned char *table2;
|
||||
@@ -110,6 +145,9 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
|
||||
xf86DrvMsg(scrnIndex, X_PROBED, " Bus %i -> SOR%i\n", i, pNv->i2cMap[i].sor);
|
||||
}
|
||||
|
||||
pNv->loadVal = G80FindLoadVal(pNv->table1);
|
||||
xf86DrvMsg(scrnIndex, X_PROBED, "Load detection: %d\n", pNv->loadVal);
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
|
||||
@@ -56,6 +56,7 @@ typedef struct G80Rec {
|
||||
Bool present;
|
||||
ORNum or;
|
||||
} lvds;
|
||||
CARD32 loadVal;
|
||||
|
||||
xf86Int10InfoPtr int10;
|
||||
int int10Mode; /* Console mode to restore */
|
||||
|
||||
Reference in New Issue
Block a user