Index ¦ Archives ¦ Atom

1366x768 is not allowed in the EDID block. Here's how to write your XOrg modeline.

Looks like there are many LCD panels/TVs out there with a native resolution of 1366x768. That is indeed a very close approximation to the expected 16:9 rectangle, except XOrg keeps showing you a resolution of 1360x768 (or 1368x768) instead of the native 1366x768. Why? Because 1366 is not divisible by 8 and that's not valid in an EDID block. Learn more on wikipedia.

You need a custom modeline in your xorg.conf file for that. The NVIDIA drivers also have some ModeValidation setting which needs some attention. Let's start with the last one, you need to add the following (in the Screen section):

Option "ModeValidation" "AllowNonEdidModes, NoWidthAlignmentCheck"

To make XOrg log files more verbose, you may also want to add the following:

Option "ModeDebug" "True"

And what about the modeline? So this guy wrote a lot about it but for our purposes, let's just start with xvidtune to check for the current settings:

$ xvidtune -show
"1360x768" 84.75 1360 1432 1568 1776 768 771 776 798 -hsync +vsync

After the modeline 'description' (whis is 1360x768), the first number you see represents the pixel clock speed. The remaining eight numbers are two groups of four numbers intended to set the horizontal and vertical resolution. The interesting thing is that you can get your hrefresh and vrefresh value with a simple formula: hrefresh = 84.75/1776 and vrefresh = 84.75/(1776*798)

Now, on my LCD manual I had the following valuable informations:

1360*768
47.72 59.8 84.75
1366*768
47.56 59.6 84.75

Those are hrefresh, vrefresh and pixel clock. Let's put those in the modeline adding some more small changes:

"1366x768" 84.75 1366 1438 1574 1782 768 771 776 798 -hsync +vsync

Now here is how the new numbers were found:

84.75
is the pixel clock and remains the same as per service manual
1360 became 1366
that's the hresolution we want
1776 became 1782
that is what we need to get the 47.56 hrefresh and 59.6 vrefresh values indicated in the service manual, check yourself with the formula 84.75/1782 ~= 47.56 and 84.75/(1782\*798) ~= 59.6

Also, from the initial xvidtune output, the numbers 1432 and 1568 represent some delay, measured in pixels pictured past the viewable area, at the defined pixel clock speed. They are used to set front porch, sync pulse and back porch; by using 1360 as the number of horizontal pixels you get the following:

(1432-1360)/84.75 = 0.84us black on right side
(1568-1432)/84.75 = 1.60us sync pulse width
(1776-1568)/84.75 = 2.54us black on left side

Now use 1366 as the number of horizontal pixels and keep the delay unchanged:

(1438-1366)/84.75 = 0.84us black on right side
(1574-1438)/84.75 = 1.60us sync pulse width
(1782-1574)/84.75 = 2.54us black on left side

Finally, for this blog post all the values I'm using refer to the LG 37LG3000. Enjoy!

© Giulio Fidente. Built using Pelican. Theme by Giulio Fidente on github. Member of the Internet Defense League.