Linux Howto: Best Video Playback - Using your TV's Specific EDID / what can my tv do
#1
Extended display identification data (EDID) is a data structure provided by a digital display to describe its capabilities to a video source.

A little background: This started looking into this when I installed Frodo with the MythTV PVR plugin, and the playback of my recordings had some really bad tearing issues.

Luckily I eventually found this post by Universal (awesome post thanks!!), which helpped out with the Playback issues I was having with Myth Recordings: http://forum.xbmc.org/showthread.php?tid...pid1220215 (if your having playback issues be sure to visit this post, I think I had just about everything set the same except in step 3, once I changed that, it was like night and day.

But before I found Universal's post I was looking at logs, and googling things, and I ran across some interesting stuff, so after I had fixed my issues I started to cleanup, and map things specifically based on my devices and their specs.

That being said this post is highly customized to my particual hardware (as such some of the options in xorg.conf I've added are specific to Nvidia's Driver, and may not apply to you). That being said, I tried to capture everything I did, so that If anyone else decides to go down this rabbit hole, hopefully they can do it a bit quicker than i did...

Lets get stared....

Since im doing this over an ssh session you may see DISPLAY=:0 in front of some commands (but you can log in to lightdm or openbox and do the same, or use a Alt+shift-F2 to get a console)

First we need to figure out what we are connected to, and what we have available

1) cat /var/log/Xorg.0.log |grep -i nvidia

Now look for lines similar to this:
[ 7.301] (--) NVIDIA(0): Valid display device(s) on ION at PCI:1:0:0
[ 7.301] (--) NVIDIA(0): CRT-0
[ 7.301] (--) NVIDIA(0): DFP-0
[ 7.301] (--) NVIDIA(0): TOSHIBA-TV (DFP-1) (connected)

This will give you your valid devices

as you can see i am connected to DFP-1 (via HDMI) and I am not using the other available devices

on to xorg.conf
"configuration in xorg.conf is based on per monitor. So you need write a 'Monitor' section for each output you are using and specify these monitors in 'Device' section."

So Im going to disable them in /etc/X11/xorg.conf (just so it doesnt probe for them, it saves a little bit of time)

2) sudo vim /etc/X11/xorg.conf
and make the following changes based on your output from number 1

2a) so First I add to the device section:
Option "ProbeAllGpus" "False" # only probe GPUs that have a monitor section (if you have more than one, onboard etc)
Option "UseDisplayDevice" "DFP-1" # lets tell xorg which device we are using
Option "IgnoreDisplayDevices" "CRT, DFP-0" #tell xorg to ignore the other devices (this way it wont probe for clock speeds etc)
Option "ModeDebug" "true" #more on this in step 3 Wink

My original Device section looked like this:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection

Now it looks like this:
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "ProbeAllGpus" "False"
Option "UseDisplayDevice" "DFP-1"
Option "IgnoreDisplayDevices" "CRT, DFP-0"
Option "ModeDebug" "true"
EndSection


2b) Now i change my current monitor section so that its identified by DFP-1
my original Monitor section looked like this:
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection

and now it looks like this:
Section "Monitor
Identifier "DFP-1"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection

2d) One last thing to do since we renamed the identifier from Monitor-0 to DFP-1 we need to change this in the Sceen Section also:

Change the line that looks like:
Monitor "Monitor0"

to:
Monitor "DFP-1"

2e) exit and save

3) Now for our Monitor's exact informaiton edid you'll need to run the following commands:

3a) install some nesicary programs:
sudo apt-get install edid-decode
sudo apt-get install read-edid
sudo reboot

3b) Next we create a bin file with our TVs edid info:

nvidia-xconfig --extract-edids-from-file=/var/log/Xorg.0.log --extract-edids-output-file=edid.bin

**NOTE: if your not getting your edid.bin file, make sure you are directly connected from your video card to your monitor/tv**


3c) Lets see what alls in this thing:
edid-decode edid.bin

(lots of info comes out specific to you TV)

3d) Disable the Debug Mode by removing the line we added earilier:
sudo vim /etc/X11/xorg.conf
delete the folowing line:
Option "ModeDebug" "true"
:wq
sudo reboot

4) lets see what our current resoltion is (this is handled by xrandr):
DISPLAY=:0 xrandr --verbose

look for the line with the word current

1920x1080 (0x24c) 148.5MHz +HSync +VSync *current +preferred
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.5KHz
v: height 1080 start 1084 end 1089 total 1125 clock 60.0Hz

Mine looks good...
You can also see this information in the xbmc.log file if you turn on debug (it uses xbmc-randr)
cat .xbmc/temp/xbmc.log |grep -i mode
10:21:30 T:3007022912 INFO: Output 'HDMI-0' has 27 modes
10:21:30 T:3007022912 INFO: XRANDR: /usr/lib/xbmc/xbmc-xrandr --output HDMI-0 --mode 0x24c

Ok now i know that xbmc is outputting mode 0x24c

But if for some reason its not(say you have it passing through some other device) well you now have your edid info and can tell X to use your custom edid.bin for your specific display add the following to your screen section:
Option "CustomEDID" "DFP-1:/home/user1/edid.bin"


5) now lets check our Horz / Vert rates:

5a) What rates can my monitor handle:
edid-decode edid.bin |grep hor

Monitor ranges: 23-76HZ vertical, 15-80kHz horizontal, max dotclock 150MHz

5b) what is xorg.conf configured for:
cat /etc/X11/xorg.conf|grep -i 'hor\|vert'
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0

5c) Whats actually being output:
cat /var/log/Xorg.0.log |grep -i hor
[ 6.519] (**) NVIDIA(0): Using HorizSync/VertRefresh ranges from the EDID for display

Looks like I'm set to use my EDID data ok good..

5d) I'm going to change things in my xorg.conf file anyway, it may not matter, but if i want to look somewhere for a quick reference i can cat xorg.conf and know thats what my monitors rates are:
sudo vim /etc/X11/xorg.conf

and change these lines:
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0

to:
HorizSync 15.0 - 80.0
VertRefresh 23.0 - 76.0

5e) While im in the monitor section I went ahead and changed the VendorName and ModelName from "Unknown" to the values reported by in my edid also

Side note: XBMC / Xorg / xrandr seem to be doing an excellent job of handling switching video modes, and pulling resolutions and syncs from xrandr - you can see all your modes by issuing 'DISPLAY=:0 xrandr --verbose' If you like this info can be used to generate modelines for your xorg.conf, but watching the logs while playing videos, xbmc does a great job of switching modes depending on content.

6) Color Depth
I know my nvidia card will support 30bit color depth and while i was looking at my edid info i saw the following:
DC_36bit
DC_30bit
DC_Y444

DC is Deep color, and these are some of the better modes my TV supports, So i tried to change the Color Depth from 24 to 30, but XBMC appears to have a bug and crashes.

So I opened a ticket: http://trac.xbmc.org/ticket/14108

If you want to try it out, all you need to do is change items like:
Depth 24
DefaultDepth 24

to:
Depth 30
DefaultDepth 30


7) What else can we clean up... well lets see:
cat /var/log/Xorg.0.log |grep WW

will return warnings, that are pretty easy to fix:
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 5.321] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 5.321] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[ 5.321] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[ 5.322] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[ 5.321] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.

hmm font issues... looks like it wastes time looking for those 100 and 75 dpi fonts in differnt places...

Pasting "The directory "/usr/share/fonts/X11/cyrillic" does not exist" in google let me know:
I needed to install cyrillic xfonts... So:
sudo apt-get install xfonts-cyrillic
and so i took a guess at the other two and they worked:
sudo apt-get install xfonts-100dpi
sudo apt-get install xfonts-75dpi
sudo apt-get install x-ttcidfont-conf

Then i checked again and saw a new warning say what? ok
sudo mkfontdir /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/

Conclusion: EDID has a lot of info in it, specific to your TV, not only modes & syncs but color depths supported, and audio information. You can also grab the edid 3 or 4 different ways but this seemed the simplest way that actually worked without too much manual input. I really hope that the 30bit issue gets patched so I can check that out, if it happens to work for anyone please drop me a message... Since this is all very specific to your specific, I may not be able to provide much input. But on the flip side if someone runs across something that they think is a general enough setting / config / option feel free to share.

....What my xorg.conf looks like now....

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "DFP-1"
VendorName "TOSHIBA"
ModelName "1011"
HorizSync 15.0 - 80.0
VertRefresh 23.0 - 76.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "ProbeAllGpus" "False"
Option "UseDisplayDevice" "DFP-1"
Option "IgnoreDisplayDevices" "CRT, DFP-0"
Option "AddARGBGLXVisuals" "True"
Option "ModeValidation" "NoVesaModes, NoXServerModes"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "DFP-1"
DefaultDepth 24
Option "CustomEDID" "DFP-1:/home/user1/edid.bin"
Option "HWCursor" "Off"
Option "NoLogo" "True"
Option "DynamicTwinView" "False"
SubSection "Display"
Depth 24
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection


...some links...
https://wiki.ubuntu.com/X/Config/Resolution
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2
http://en.wikipedia.org/wiki/HDMI (tmds stuff)
http://us.download.nvidia.com/XFree86/Li...index.html
http://www.mcamafia.de/mcapage0/timecalc.htm
http://ehdmi.co.uk/tag/maximum-pixel-clock-rate/
http://us.download.nvidia.com/XFree86/Li...index.html
sudo DISPLAY=:0 nvidia-xconfig --query-gpu-info
/usr/share/X11/rgb.txt
Reply

Logout Mark Read Team Forum Stats Members Help
Howto: Best Video Playback - Using your TV's Specific EDID / what can my tv do1