Tuesday, June 1, 2010

Correct Modelines for Panasonic TC-P42G10

Getting the picture from my Linux media box to be centered and clocked properly on my Panasonic plasma display has been quite challenging. This is because the TC-P42G10 furnishes incorrect EDID data to my computer through the DVI interface (shame on you, Panasonic!) that resulted in an off-center display and a vertical refresh rate ever so close to 60.01 Hz.

Centering the image in the display was not terribly challenging. The big mystery occurred when the television would cleanly display my Linux desktop; however, once a full-screen video started playing, the screen would go blank. It took me many hours to figure out that rounding errors in the calculated pixel clock caused the video refresh rate to be greater than 60 Hz. This, in turn, would cause the television's firmware to treat the video as invalid input -- resulting in a blank screen and no sound.

Furthermore, the latest Linux kernel drivers for ATI cards employ a new interface called kernel modesetting, or KMS. This means that, instead of the X server, the Linux kernel handles the probing of EDID information and configuration of all video timings. Because KMS is a new interface, there is no way for the user to easily specify his or her own timing information to the Linux kernel. Therefore, booting with the kernel option nomodeset is required to disable KMS and allow Xorg to handle mode changes.

Here is the modeline for Xorg:
Mode "1920x1080p"
DotClock 145
HTimings 1920 2016 2060 2200
# (67.5 kHz)
VTimings 1080 1084 1096 1125 # 60 Hz.
Flags "-hsync" "+vsync"
EndMode
Using this in the /etc/x11/xorg.conf had changed a little bit since the last time I had to do x11 hacking. Here's how we do it in 2010:
Section "Device"
Identifier "Configured Video Device"
Driver "radeon"
Option "NoDDC"
Option "IgnoreEDID" "on"
EndSection

Section "ServerFlags"
Option "AIGLX" "off" # Enabling this option seems to screw up firefox
EndSection

Section "Monitor"
Identifier "Configured Monitor"
HorizSync 15-68
VertRefresh 32-61
Mode "Original"
DotClock 148.50
HTimings 1920 2008 2052 2200
VTimings 1080 1084 1089 1125
Flags "-hsync" "+vsync"
EndMode
Mode "1920x1080p" # <60 Hz.
DotClock 145
HTimings 1920 2016 2060 2200
VTimings 1080 1084 1096 1125
Flags "-hsync" "+vsync"
# <(67.5 kHz)
EndMode
Mode "1920x1080i"
DotClock 72.5
HTimings 1920 2016 2060 2200
VTimings 1080 1084 1096 1125
Flags "-HSync" "-VSync" "Interlace"
EndMode
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080p"
EndSubSection
EndSection
And there you have it.

Update: I found another test video that caused screen blanking, and had to back off the pixel clock even further to a value of "145."