First is first. I am not to be liable for direct, indirect or consequential damages or for any loss of revenue.
If you have just installed Linux on your htpc and your resolution is way off, you may suspect from many things. In my case, it was the EDID information coming from the TV. The resolution was there as 1920x1080 but the dimensions of the 47" tv was recognized as 1".
So how do we fix it. Get ready for a multi platform journey.
Check the recognized dimensions and resolution with
xrandr -q
or
xdpyinfo
First we need to get the edid file from the TV. I may suggest two routes at this point.
1) Use your Xorg log to find the EDID information. It would be similar to the hex strings given below. Clean the info in the beginning of each line, make it a single line hex info and convert it to a binary string. I had problems doing this thus I followed the second route.
[ 14.784] (II) fglrx(0): 00ffffffffffff0058b3003700000000
[ 14.784] (II) fglrx(0): 0117010380683c780a6837a454489a25
[ 14.784] (II) fglrx(0): 0f4a4c3fef8001010101010101010101
[ 14.784] (II) fglrx(0): 010101010101011d8018711c1620582c
[ 14.784] (II) fglrx(0): 250010584200009e011d007251d01e20
[ 14.784] (II) fglrx(0): 6e28550010584200001e000000fc0034
[ 14.784] (II) fglrx(0): 37575f4c43445f54560a2020000000fd
[ 14.784] (II) fglrx(0): 00313d0f2e08000a2020202020200137
2) Nvidia can download EDID file in binary format. Just connect a laptop with an Nvidia graphics card to the TV, open up the Nvidia driver menu that you make adjustments and download the EDID binary file. No hassle.
Now you have the EDID binary file. Next you need to make some fixes on the file. There are two great Windoz programs dedicated to this work. I wish there were Linux alternatives but all you can get is read-edid and hex editor for this job which requires too much time to waste. The windows programs for this job is;
EDID_Converter.exe
and
Phoenix.exe
Change the binary EDID file to Phoenix format with EDID_converter as Phoenix cannot read binary.
Then open the converted EDID file on Phoenix. You can see all the information from EDID, make the changes as you wish.
For my case, 47"(~120 cm) inch tv with 16:9 aspect ratio should have dimensions in cm similar to this.
sqrt((16*x)**2 + (9*x)**2)=120
x = 120/ sqrt((16)**2 + (9)**2) = 6.5368
Height = 9*x = 58.83 cm
Width = 16*x = 104.590 cm
You can round off them as you wish or adjust for your TV size and here is the calculation to do that.
Next thing, using Phoenix and this values, edit your EDID file and save (You can change anything about your TV so just be careful, you have been warned). Save the file in Phoenix format and again use the EDID_converter to convert the file back to binary. Almost there.
Now we have a new, modified EDID file. You can just send it(re-program) to TV if you can and make everything permanent but this is not what we are going to do as I do not want to deal with it.
For ati catalyst drivers in linux, you can use this EDID file instead of the one sent by TV. So where are we gonna put this file and what should be the name.
First open TTY1 screen (CTRL+ALT+1) and kill X (systemctl stop gdm). Then trace catalyst.
systemctl stop gdm
equo install strace
strace -e "trace=open" X -retro 2> xtrace.log
after the strace command return back to TTY1 (CTRL+ALT+1) and kill the X (CTRL+C). Look at the xtrace.log file that you have just created. You should see something like
open("/proc/ati/major", O_RDONLY) = 15
open("/dev/ati/card0", O_RDWR) = 15
open("/sys/bus/pci/devices/0000:01:00.0/config", O_RDONLY|O_CLOEXEC) = 16
open("/sys/bus/pci/devices/0000:01:00.0/config", O_WRONLY|O_CLOEXEC) = 16
open("/sys/bus/pci/devices/0000:01:00.0/resource2", O_RDWR|O_CLOEXEC) = 16
open("/usr/lib/xorg/modules/libfb.so", O_RDONLY|O_CLOEXEC) = 16
open("/etc/ati/amdpcsdb", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 16
open("/etc/ati/DFP3.edid", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ati/dfp3.edid", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ati/DFP3.edid", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ati/dfp3.edid", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/proc/mtrr", O_RDWR) = 16
Loading extension ATIFGLRXDRI
open("/proc/ati/major", O_RDONLY) = 16
in my case it was DFP2 (the paste above is taken from reference 1).
So put the modified EDID file to /etc/ati/DFP2.edid. To be on the safe side
cp modifiedEDID.bin /etc/ati/DFP1.edid
cp modifiedEDID.bin /etc/ati/DFP2.edid
cp modifiedEDID.bin /etc/ati/DFP3.edid
cp modifiedEDID.bin /etc/ati/DFP4.edid
That is it, reboot or restart X to see a nice resolution.
Edit: HDMI sound issues
I recognized that the conversion and phoenix just deal with the video section of the .edid files. If you use the route described above you will probably miss the sound through HDMI.
The solution for that I found was Monitor Asset Manager (4). I used the original (binary) version of edid file that I dumped from the TV with this program and generated the monitor.inf file. Then, through the program, I used the modded (from Phoenix) dat file and combined with the monitor.inf through the program.
Open up Monitor Asset Program
File>Open>Modded_Edid.dat
File>Edit>Append CEA extension Block>Select the inf file you generated
Append save a new binary file and you are done.
I suspect you can do everything described here with just the Monitor Asset Manager without the need of other Phoenix and edid file converter but I am not going to dig into that right now.
I tried and got back my HDMI output, it is your turn now :)
References
1)http://hotcashew.com/2013/08/fixing-invalid-edid-in-linux-wit-fglrx/
2)http://sathyasays.com/2008/10/26/how-to-tackle-screen-resolution-problems-in-linux/
3)http://linuxtidbits.wordpress.com/2011/12/22/display-size-dpi-and-text-size-an-interesting-diy/
4)http://www.entechtaiwan.com/util/moninfo.shtm