User:UNiversal

From Official Kodi Wiki
Jump to navigation Jump to search
uNiversal
uNiversal
Error! Out of Memory
Forumite & Wikifier
System Details: Linux.2.7~Custom
Brain Version: Positronic 2.0
Power Matrix: Hybrid/Biologic
Ctrl+Alt+Del


Resolution configuration xorg.conf

95% Completed


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: Resolution configuration xorg.conf Xorg Modelines Minimal NVidia xorg.conf 


Outline

The xorg.conf is a integral part of running XBMC 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..

Introduction

This guide 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.

1
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.

2
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

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-1):
(II) NVIDIA(0): HorizSync : 15.000-50.000 kHz
(II) NVIDIA(0): VertRefresh : 48.000-62.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(0): Validating Mode "1920x1080":
(II) NVIDIA(0): 1920 x 1080 @ 60 Hz
(II) NVIDIA(0): For use as DFP backend.
(II) NVIDIA(0): Mode Source: EDID
(II) NVIDIA(0): Pixel Clock : 74.25 MHz
(II) NVIDIA(0): HRes, HSyncStart : 1920, 2008
(II) NVIDIA(0): HSyncEnd, HTotal : 2052, 2200
(II) NVIDIA(0): VRes, VSyncStart : 1080, 1084
(II) NVIDIA(0): VSyncEnd, VTotal : 1094, 1124
(II) NVIDIA(0): H/V Polarity : +/+
(II) NVIDIA(0): Extra : Interlace
(II) NVIDIA(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" 74.25 1920 2008 2052 2200 1080 1084 1094 1124 +hsync +vsync Interlace


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 my case 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


Discussion

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

Creating & using EDID.bin

Incomplete.png INCOMPLETE:
This page or section is incomplete. Please add information or correct uncertain data which is marked with a ?

If your machine has a black screen only when you boot it up before TV or AMP, follow this guide.

On some combinations of equipments (Amp/TV/XBMC) in rarer cases you may find that the order you power on your equipment matters. This is obviously inconvenient but can be easily fixed.

The root cause of this issue is the EDID (Extended display identification data) handshake. Xorg may not correctly handshake with AV equipment after boot. Typically this results in a black screen and a full system shut down and restart to rectify.

In this guide we will show you how to trick Xorg into thinking your AV equipment is connected and powered on at all times. This locks your install to one monitor/AMP (port specific) and should stop all handshake issues.

This example is for a nVidia GPU, other GPUs will have a similar approach but are not covered here.

There are many excellent guides on the forum already but most require multiple reboots and the use of other Operating Systems such as windows or Ubuntu.

You'll need:

  • SSH access to your OS
  • Nano installed

OK, let's begin.

First make sure your install is in a working state, powered on in the correct order so that you can see the GUI.

Open an SSH session to your machine.

We gather the tool we need nvidia-xconfig.

Note: nvidia-xconfig is already installed on Ubuntu if you have the nvidia-current drivers installed via the Ubuntu packaging or Xswat ppa. We do not intend to instruct users on full use of this tool.

type:

cd ~/

Now we work out the Assigned Display Device DFP number

type:

cat /var/log/Xorg.0.log | grep "Assigned Display Device: DFP-"

you should see message like the following:

[184756.401] (II) NVIDIA(0): Assigned Display Device: '''DFP-0'''

Take a note of the DFP number in this example "DFP-0". Your number may vary.

In order to gather the information we need to place Xorg into debug mode.

First find out the command used in your current install to start Xorg

type:

ps | grep -i xorg

you should see information like this

1221 root       0:00 Xorg :0.0 vt01 -s 0 -noreset -allowMouseOpenFail -nolisten tcp -config /etc/X11/xorg.conf -ignoreABI

We will use the config file location seen in these results to create a config file duplicate we can modify

type:

sudo nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=/etc/X11/xorg.conf

To place Xorg in debug mode we add the debug command to our new config.

type:

nano /etc/X11/xorg.conf

In the Section "Device" which will include Driver "nvidia" add:

 Option "ModeDebug" "true"

Your config file should now look something like:

 Section "Device"
 	Identifier     "nvidia"
 	Driver         "nvidia"
 	Option         "DynamicTwinView" "False"
 	Option         "NoFlip" "false"
 	Option         "NoLogo" "true"
 	Option         "ModeValidation" "NoVesaModes, NoXServerModes"
 	Option         "ModeDebug" "true"
 EndSection

Now we stop Xorg

type:

killall -9 X

And start it again using a combination of the command discovered earlier and our new config file

type:

Xorg :0.0 vt01 -s 0 -noreset -allowMouseOpenFail -nolisten tcp -config /etc/X11/xorg.conf -ignoreABI '''&'''

You should see something like the following:

X.Org X Server 1.11.4
Release Date: 2012-01-27
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.32-31-generic-pae i686
Current Operating System: Linux LOUNGE 3.2.17 #1 SMP Sat May 19 05:19:29 CEST 2012 i686
Kernel command line: fastboot root=/dev/ram0 rdinit=/init threadirqs boot=LABEL=System disk=LABEL=Storage quiet BOOT_IMAGE=/KERNEL
Build Date: 17 May 2012  03:59:21AM
Current version of pixman: 0.25.2
  Before reporting problems, check http://wiki.x.org
  to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
  (++) from command line, (!!) notice, (II) informational,
  (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.0.log", Time: Wed Jun 20 20:52:05 2012
(++) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Note: You may have to hit return here to see your cursor.

Now that all the precursors are setup we can extract the RAW binary EDID information to a file.

Extracting EDID binary

type for 32bit and 64bit:

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

You should see something like the following:

Found 1 EDID in "/var/log/Xorg.0.log".
Wrote EDID for "ONK TX-NR616 ('''DFP-0''')" to "/etc/X11/edid.bin" (256 bytes).

Configure xorg to read from EDID

Now edit the xorg.conf you created again and replace

 Option "ModeDebug" "true"

with

 Option         "ConnectedMonitor" "DFP-0"
 Option         "CustomEDID" "DFP-0:/etc/X11/edid.bin"
 Option         "IgnoreEDID" "false"
 Option         "UseEDID" "true"
Important: It is VITAL you change the DFP number to match the one we found earlier.


In the end your config will look something like

 Section "Device"
  Identifier     "nvidia"
  Driver         "nvidia"
  Option         "DynamicTwinView" "False"
  Option         "NoFlip" "false"
  Option         "NoLogo" "true"
  Option         "ModeValidation" "NoVesaModes, NoXServerModes"
  Option         "HWCursor" "false"
  Option         "ConnectedMonitor" "DFP-0"
  Option         "CustomEDID" "DFP-0:/etc/X11/edid.bin"
  Option         "IgnoreEDID" "false"
  Option         "UseEDID" "true"
 EndSection
 Section "Screen"
  Identifier     "screen"
  Device         "nvidia"
  DefaultDepth    24
  Option         "ColorRange" "Full"
 #    Option         "ColorRange" "Limited"
 #    Option         "ColorSpace" "RGB"
  SubSection     "Display"
   Depth       24
  EndSubSection
 EndSection
 Section "Extensions"
  Option         "Composite" "false"
 EndSection


Since we have created a new xorg.conf file in a location the OS knows to use as default, further changes need made to make this permanent. If at a later date you need to undo this work simple rename the config file and reboot to revert to default

If all has went to plan when you reboot everything will just work and the order of powering equipment up will not matter anymore.

Note: If your equipment is coupled to a receiver that has broader HDMI capabilities than your TV, you should edit your xorg.conf so that the section "Screen" looks like this:

Section "Screen"
    Identifier     "screen"
    Device         "nvidia"
    DefaultDepth    24
    Option         "ColorRange" "Full"
    Option         "ColorSpace" "RGB"
    SubSection     "Display"
        Depth       24
        Modes       "1280x720"
    EndSubSection
EndSection

Credits

The edid instructions are adapted from the Openelec wiki, credit to original authors[4]

References

templates to be

Template:orangev

{{{1}}} {{{1}}}
[create] Documentation

Template:goldv

{{{1}}} {{{1}}}
[create] Documentation


Template:Quote

{{{1}}}
[create] Documentation


Template:helpn

HELP NOTICE: {{{1}}}
[create] Documentation


Template:Note REMEMBER

[create] Documentation


Template:Tip TIP

[create] Documentation


Template:Help HELP

[create] Documentation