Archive:Configuring resolution via xorg.conf

From Official Kodi Wiki
Jump to navigation Jump to search
Information: This page contains explanation about modelines in xorg.conf
Advanced: The information contained in this page is considered advanced.
Warning: The informations contained in this page can cause issues with your X if any errors or incorrect information is entered.

xorg table of contents:
Configuration guides: Modeline references:


The xorg.conf is a integral part of running Kodi in X via for e.g. xinit in some controllable manner. While in recent Linux the device drivers have improved considerably and deem xorg.conf unneeded, it still has its niche.

If you ever had problems getting the correct resolution or correct modelines on your HTPC this is an easy guide. You can also use this guide to tweak 23.976p and 24p modelines for smoother playback..


This instructions and methods outlined here should be quite "generic", use this guide on your own risk. if you end up without a picture on your screen restore the backup xorg.conf or rename existing if no backup exists. References[1][2][3]

Preparing xorg.conf for tweaking

Backing up any existing xorg.conf is a integral step in assuring your can revert any errors.

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

Then generate a new clean xorg.conf to have a base which to build on later,

Note: You probably can use this for other non-NVidia systems, this is something you need to research how-to generate a xorg.conf for ATI or Intel and if you need one to begin with. feel free to update this guide.

sudo nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=/etc/X11/xorg.conf
3 Now we need to edit the new xorg.conf to add some options.
sudo nano /etc/X11/xorg.conf

then add the following lines in the correct section of that file:

Section "monitor"
	Option			"ExactModeTimingsDVI"		 "true"
	Option			"DPI" "96 x 96"
	Option			"DPMS"				 "false"
4 The validation lines vary from setup to setup and depend very much on how well your TV handles EDID,

Telling xorg to ignore EDID may result in low resolution being shown in xbmc, if you dont offer correct and valid modelines for xbmc-xandrc to pick from. In this example we are not disabling EDID data. We definitely dont want vesa modes or xserver modes

Section "Device"
Option				"ModeValidation"		 "NoVesaModes, NoXServerModes"

Note: Some difficult TV/AVR Edid can be turned off by appending "NoEdidModes" to the Modevalidation line parameters. However notice this may affect some modelines being validated and used.
Now close and save the file by hitting Ctrl+X on your keyboard. Then press Y followed by  Enter

Refresh rate & Modelines values

These are very important values to get right.

1 Now we need to figure out what kind of HorizSync/VertRefresh and resolution your TV/AVR supports by its EDID info:

Kill xbmc if it's running by

sudo stop xbmc

Then we need to setup a logfile which logs your TV/AVR EDID modes:

cd ~

sudo X -verbose 6 > ~/xlog.txt 2>&1

This process needs interrupting via Ctrl+C after a few seconds.

In the root of your home directory you will find a xlog.txt /home/xbmc/xlog.txt

2 Open the (/home/xbmc/xlog.txt) file and browse until you see something like this section:
(II) NVIDIA(0): Frequency information for SAMSUNG (DFP-0):
(II) NVIDIA(0):   HorizSync   : 26.000-76.000 kHz
(II) NVIDIA(0):   VertRefresh : 23.000-61.000 Hz
(II) NVIDIA(0):     (HorizSync from EDID)
(II) NVIDIA(0):     (VertRefresh from EDID)

Write Down or make a note of the HorizSync and VertRefresh values.

3 Browse further on (/home/xbmc/xlog.txt) and find all the validated modes. Like the example below:
(II) NVIDIA(GPU-0):   Validating Mode "1920x1080":
(II) NVIDIA(GPU-0):     1920 x 1080 @ 24 Hz
(II) NVIDIA(GPU-0):     Mode Source: EDID
(II) NVIDIA(GPU-0):       Pixel Clock      : 74.16 MHz
(II) NVIDIA(GPU-0):       HRes, HSyncStart : 1920, 2558
(II) NVIDIA(GPU-0):       HSyncEnd, HTotal : 2602, 2750
(II) NVIDIA(GPU-0):       VRes, VSyncStart : 1080, 1084
(II) NVIDIA(GPU-0):       VSyncEnd, VTotal : 1089, 1125
(II) NVIDIA(GPU-0):       H/V Polarity     : +/+
(II) NVIDIA(GPU-0):     Viewport                 1920x1080+415+22
(II) NVIDIA(GPU-0):       Horizontal Taps        0
(II) NVIDIA(GPU-0):       Vertical Taps          0
(II) NVIDIA(GPU-0):       Base SuperSample       x1
(II) NVIDIA(GPU-0):       Base Depth             32
(II) NVIDIA(GPU-0):       Distributed Rendering  1
(II) NVIDIA(GPU-0):       Overlay Depth          32
(II) NVIDIA(GPU-0):     Mode is valid.

Note: Make sure that the "(II)NVIDIA(0): Mode is valid." line exists on the one you pick.

4 To create a modeline from this is easy. From my example above the first line would be "1920x1080" and then 74.25 and then 1920 2008 and 2052 2200 and so on. you just read the values from top to bottom.

So in this example the modeline that section gives me would be:

ModeLine "1920x1080_24" 74.16 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync

Assembling your xorg.conf

Now that we got both HorizSync and VertRefresh and a working modeline lets put it in our xorg.conf.

1 Issue from terminal:
sudo nano /etc/X11/xorg.conf
2 Then add from what you wrote down earlier.
Section "Monitor"
HorizSync      15 - 50
VertRefresh    48 - 62
ModeLine "1920x1080" 74.25 1920 2008 2052 2200 1080 1084 1094 1124 +hsync +vsync Interlace

(or edit the ones there already if your xorg.conf already contains some modelines)

SubSection "Display"
Modes "1920x1080"
IMPORTANT: This line must match the modeline you created ! In this example it was "1920x1080", However "1280x720" Modelines are also ok if your TV is only HD Ready
3 Now close and save the file by hitting Ctrl+X on your keyboard. Then press Y followed by  Enter
4 Start xbmc by running it:
sudo xbmc start

You should get a nice correct screen, make sure to go into settings - screen and calibrate/adjust your new resolution.

If not try another modeline using same methods and see if that works.

Note: Almost ready to use xorg.conf to get you started see Minimal NVidia xorg.conf


Attention talk.png See the HOW-TO setup Kodi and Linux with correct resolution for discussion and more information.