# Nvidia Wrong Resolution Solution

## Graymi

Way back when i started using Gentoo on my laptop, i soon discovered that using the "proper" nvidia-drivers from portage caused me the hassle of not detecting my display properly, and giving me a resolution of 800x600 and not the full 1024x768.

I soon discovered ignoring my EDID solved this.

However a not-so-recent rebuild meant that nvidia-legacy drivers had gone, and unfortunately ignoring the edid with non legacy drivers lead to what i shall call the rainbow effect, where my xserver simply drew pretty colours on the screen (pretty useless colours at that)

after hours of tweeking, with various tips not working,i eventually discovered that through mode-lines and ignoring some of my edid, i could get my display running at 968x768 resolution (i think that's what it was) obviously not ideal, owing partly to the annoying fact of a black bar running down the right side of my screen.

well those pixels are once again active! I finally did some reading up on the subject.

and here's how to get your laptop running at full resolution. (definately works on my toshiba sp6100... and if i undestand what i've done correctly don't see why shouldn't work on others)

/----------------------------------\

\----------------------------------/

Firstly, we know our EDID is wrong. but it's actually a very simple change to make to correct it. Step one is to use the nivdia-settings application to create a copy of the incorrect edid somewhere on your computer. I chose /etc/X11 simply to keep everything together.

once you've done this, you need to load the file into your favourite hex editor.

Now look for the following Bytes: 56 and 58 take the upper part of 58 (the first of the two hex-digits) and put it infront of the whole of 56 to create a 3 digit hex number. in my case 3C9. Convert this to a decimal number, and what do you get? well, the wrong horizontal resolution, that's what (969... such a daft number)

Well, time to correct that. Using your favourite decimal-hex converted program (calc on my windows box in this case I'm afraid folks... I'm stuck in console on the laptop) tap in the correct horizontal resolution, and convert it to hex (in my case 1024, becomes 400)

Now the tricky part. take the first digit, and replace the first digit of byte 58 with that (4) and the remaining two digits, and replace byte 56 with those (00)

save the edid file

now pop open xorg.cfg

Remove any ignoreEdid or useEdid false config options. and put the following in

```

Option "CustomEDID" "DFP-0:<PATHTOEDIDFILE>"

```

in my xorg, this:

```

Option "CustomEDID" "DFP-0:/etx/X11/edid.bin"

```

and restart your xserver

and providing all has gone swimmingly, you should now have a flat panel monitor that actually works at the correct resolution, with no rainbow lights or crud like that.

This is a problem that had been bugging me for months, hoep somebody finds this information useful.

----------

## spindle

Sweet. Nice trick. Thanks for sharing this (from here). I'll probably try this in a few days myself and get up to date on my nvidia-drivers.

In the console you could have used vim for your binary edit (vim -b file.bin). But that may require a lot more beer if you're not used to vim, but it's so worth it in the end, trust me.   :Very Happy: 

----------

## Graymi

I'm a big vim fan. Haven't got a clue how to use it properly in the console (still haven't figured out copy nd paste   :Embarassed: )

but it replaced notepad at work ages ago

----------

## spindle

This doesn't seem to quite work for me I don't have those 56 and 58 values in my edid.bin.

```
mike@dedeX ~ $ xxd edid.bin 

0000000: 00ff ffff ffff ff00 0472 74ad 6105 5064  .........rt.a.Pd

0000010: 2d10 0103 e82f 1e78 2ec5 85a4 5949 9a24  -..../.x....YI.$

0000020: 1250 54bf ef00 8180 8140 714f 9500 950f  .PT......@qO....

0000030: b300 81c0 8bc0 2139 9030 621a 2740 68b0  ......!9.0b.'@h.

0000040: 3600 d928 1100 001c 0000 00fd 0038 4c1e  6..(.........8L.

0000050: 5210 000a 2020 2020 2020 0000 0090 0041  R...      .....A

0000060: 6365 7220 414c 3232 3136 570a 0000 00ff  cer AL2216W.....

0000070: 004c 3734 3039 3033 3833 3832 3020 0052  .L74090383820 .R

```

----------

## Graymi

ah, a slight overview on my behalf... 56 and 58 are bytes 38 and 3a (dec->hex... whoops lol)

so, the two values you'd be interested in are underlined here...

0000030: b300 81c0 8bc0 2139 9030 621a 2740 68b0  ......!9.0b.'@h. 

seems your monitor thinks its horizontal value is 690 (1680 in normal numbers)

----------

## spindle

 *Graymi wrote:*   

> seems your monitor thinks its horizontal value is 690 (1680 in normal numbers)

 

Hmm, that's correct for my monitor (1680x1050). So I guess that's not it. It looks like 1050 (0x41a) is in there too right after. Is there a spec for this file somewhere that I could look at?

----------

## spindle

Nevermind, I got this working. Mine had a checksum mismatch problem I'm pretty sure.

----------

## Graymi

glad ot hear you fixed that. checksum error, nasty.

as for a file spec, i vaugly remeber something lurking around wikipedia, but really cba to go looking for the link right now as its past my bed-time  :Razz: 

just try searching for EDID  :Razz:  :Razz: 

----------

## spindle

Searching for EDID found that wikipedia article you mention I assume. Looks like there's a link to the spec there in the external links section at the bottom. Here's a direct link to the pdf.

Thanks for the info. I might not need the spec for now as this seems to be working great for me now. I'll note it as it might make some interesting reading sometime and if anyone else needs it.

----------

## rockdw

I actually came across a less "low-level" way to fix this on my Dell Inspiron 8200 (GeForce2 Go)

I had the same problem with the 800x600 and ended up using xorgcfg to create a new xorg.conf (it's referenced in the X config HOWTO) That in itself wasn't all that exciting, except for the fact that everything was now working!  Upon closer inspection, I discovered a very small difference in the file from what I had before.  In my Monitor section, I now had the following:

```

Section "Monitor"

        Identifier   "Monitor0"

        VendorName   "Monitor Vendor"

        ModelName    "Monitor Model"

 ### Comment all HorizSync and VertRefresh values to use DDC:

        HorizSync    31.5 - 64.3

        VertRefresh  50.0 - 60.0

EndSection

```

where the HorizSync and VertRefresh had been added (part of what I selected for the monitor during the xorgcfg).  As soon as I commented out these two values, it went right back to the dreaded 800x600 bad micro font problems I have been dealing with.  

I don't yet understand exactly _why_ this makes a difference, but it does (for me, anyway).  It even found the 1400x1050 native of my laptop.  If you pick the wrong values, I also saw that the X server manages to find the correct ones anyway (you'll see it in the Xorg.0.log file) so you can go back and put in the correct ones.  Just try to put the correct stuff in if at all possible, just to be safe  :Smile: 

----------

## Graymi

i'm speaking more from what little experiance i gleamed, but it seems when X starts it tries to validate things such as refresh against edid and other such fanciness. therefore putting in invalid refresh and sync values tends to lead to stuff not working, or simply invalidating modes.

i just installed a big ol' nasty 1080p telly ( :Razz: ) and use edid modes only on that - no refresh rates specified in xorg.conf - works every time

so try sticking with edid is my advice. unless its corrupt. like my laptop.

----------

