Nvidia & X-server tips

  Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
srv1973 Offline
Member
Posts: 50
Joined: Jan 2008
Reputation: 0
Post: #1
Hi all,

I discovered three useful linux/xorg configuration tips that I want to share with the community, and that I hope will be useful to others.

I have an ASRock ION330HT running Ubuntu Lucid 10.04, hooked up via HDMI to a receiver (although these tips would apply as well if you have it hooked up via HDMI directly to a TV). I had 3 problems with the xserver that bugged me.

The first one was that I was suffering from overscan, eg the screen didn't fit entirely on the TV, and the top/bottom/left/right of the screen was not visible (most specifically, the top and bottom panel were not visible, so I always had to guess where the menus and logout button were). The nvidia-settings program contains a slider in one of its screens that you can use to adjust that, and to make your screen fit your TV.

So I logged on the PC and used the nvidia-settings GUI to correct my overscan (Alt-F2 to get a terminal, then start /usr/bin/nvidia-settings). I saved those settings to /home/xbmc/.nvidia-settings-rc. However, after logging out and in again, my overscan issue was back. So I fired up nvidia-settings again, and presto, overscan issue was immediately corrected: nvidia-settings loads the $HOME/.nvidia-settings-rc file automatically when you start it and applies those settings. But I did not want to have to run nvidia-settings manually everytime I started up this PC, so I needed to find a way to run this automatically.

In order to have these settings automatically applied for all users on the system I did the following:

Code:
sudo vi /etc/xprofile
>>> insert the following lines
CONFIG=/home/xbmc/.nvidia-settings-rc
/usr/bin/nvidia-settings -load-config-only --config=$CONFIG

The second issue I had was that these settings would only be applied after logon, which meant that my GDM login screen still suffered from the overscan problem, which caused me not to be able to see the bar at the bottom of the screen where you select the type of session (eg. GNOME, XBMC, KDE) that you want to start after login. In order to solve that:

Code:
sudo vi /etc/gdm/Init/:0   # colon zero
>>> insert the following lines
CONFIG=/home/xbmc/.nvidia-settings-rc
/usr/bin/nvidia-settings -load-config-only --config=$CONFIG
. /etc/gdm/Init/Default

This /etc/gdm/Init/:0 file will be executed by gdm when starting the X-server on display :0.

The final problem I had was that when I started the PC while the receiver was off, the Nvidia drivers would not detect the HDMI receiver, and therefore X would fall back to a "fail safe" session, which it would presumably run on the VGA connection of the PC. After switching on the receiver (and TV) you would therefore not see anything on the TV. Since this system is supposed to be used by my wife, I needed to come up with either a fix for that, or with an easy to execute procedure to recover from this. For myself, I'd SSH in from my laptop and kill the X failsafe session and restart GDM. For my wife that's not an option. Initially I tried to enable CTRL-ALT-BACKSPACE, which I succeeded in. That would shut down the failsafe X session. However, it would not restart the GDM session automatically. So that was not the solution I was looking for.

Then I had a careful read through the manual of the Nvidia xorg driver, and discovered 2 xorg.conf Options that fixed this issue for me:

First, I used the nvidia-settings GUI to "acquire EDID" for the display that represents my receiver (DFP-0). I told nvidia-settings to save that EDID information to /home/xbmc/.DFP-0.edid.bin. The EDID information is usually retrieved dynamically by the nvidia driver from the connected display, and it described the capabilities of that display. If your receiver/TV is off while starting the X-server, it will not be able to obtain this information, and therefore the X-server will fall back to one of the other available displays in the nvidia xorg driver (eg CRT-0).

I modified the "Screen" section in /etc/X11/xorg.conf to add the following 2 options (in bold):

Code:
Section "Screen"

# Removed Option "metamodes" "nvidia-auto-select +0+0"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinViewXineramaInfoOrder" "CRT-0"
    Option         "TwinView" "0"
    Option         "metamodes" "1360x768 +0+0"
[b]
    Option         "ConnectedMonitor" "DFP-0"
    Option         "CustomEDID" "DFP-0:/home/xbmc/.DFP-0.edid.bin"
[/b]
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

This does two things:
  1. It forces the nvidia driver to use DFP-0 (digital flat panel, eg the HDMI output)
  2. It tells the nvidia xorg driver what the capabilities of the connected display are (eg. the capabilities of my receiver)
    • To test this, switch your receiver/TV off, and reboot your PC. I first logged on via SSH to make sure that everything (eg. /usr/bin/X, gdm) was running, and then switched my receiver+tv on, and presto: I was presented immediately with the XBMC home screen. Wife happy... (and me too).

      Hope this helps somebody,

      Regards
find quote
kubax Offline
Member
Posts: 72
Joined: Sep 2009
Reputation: 0
Location: NRW
Post: #2
Works here, but i had to use DFP-1 instead of DFP-0 (figuring out this took me quite some time ^^)

Check with nvidia-setting if your Display is DFP-0 or DFP-1 or something else...

Thanks for your Tip!!

Kubax

cd /pub/ && cat Beer
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #3
srv1973 Wrote:First, I used the nvidia-settings GUI to "acquire EDID" for the display that represents my receiver (DFP-0). I told nvidia-settings to save that EDID information to /home/xbmc/.DFP-0.edid.bin.
I don't have the GDM install, I boot directly into XBMC - is there any CLI (or equivalent) option available to store the EDID data? Is it a binary file that you end up with or it's a [plain] text file with .bin extension? Can you please provide a sample of the file if it's a text one?

I've the similar sort of problem: If my receiver is OFF, the computer doesn't even start; having said that, it does start but doesn't go past the POST stage I believe (as the receiver is off, hence nothing on the TV too, so not sure what actually happens). But, if the receiver is ON but the TV is OFF, then I end up with the "overscan" issue - top/bottom/left/right go off the screen. Trying to fix that ever since. Many thanks for pointing out. Cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
kubax Offline
Member
Posts: 72
Joined: Sep 2009
Reputation: 0
Location: NRW
Post: #4
just edit your .xsession file of the root user, and insert the folowing "exec xterm"

then run "startx" with root user, and call nvidia-settings from the X Terminal...

cd /pub/ && cat Beer
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #5
kubax Wrote:just edit your .xsession file of the root user, and insert the folowing "exec xterm"
then run "startx" with root user, and call nvidia-settings from the X Terminal...
at work now, shall try at night.
but.... does "startx" work without any desktop manager i.e. Gnome, KDE etc? Or in this case, startx just opens up the "X TerminaI"? I never tried that before that way. Cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
kubax Offline
Member
Posts: 72
Joined: Sep 2009
Reputation: 0
Location: NRW
Post: #6
Startx only runs the X-Server. with the exec command in the .xsession file in your root directory you tell the x-server to execute xterm after start..

cd /pub/ && cat Beer
find quote
kwstump Offline
Junior Member
Posts: 18
Joined: Jan 2010
Reputation: 0
Post: #7
THANK YOU!!!!!! The restart of XBMC with the HDMI MOnitor turned off has been a thorn in my side since the beginning!!!!

Thanks again,
Kevin
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #8
kubax Wrote:Startx only runs the X-Server. with the exec command in the .xsession file in your root directory you tell the x-server to execute xterm after start..
Unfortunately there is no .xsession file - not for root user, neither does the xbmc user have. I created a .xsession file for root with this:
#!/bin/bash
exec xterm
and startx just returns a blank screen. There is absolutely no error in the Xorg.0.log as well.
If I do ssh x-forward and run nvidia-settings from there, I get "no nVidia driver installed message". doesn't look straight forward to run x-apps without a window-manager. Any suggestion[s]? cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
(This post was last modified: 2010-06-07 22:06 by MacUsers.)
find quote
kubax Offline
Member
Posts: 72
Joined: Sep 2009
Reputation: 0
Location: NRW
Post: #9
just the exec command... without #!/bin/bash

check if xterm is installed.. don't know if it's automatically installed by X

.xsession is usualy not there, you have to create it at /root/.xsession (in this case)

cd /pub/ && cat Beer
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #10
kubax Wrote:just the exec command... without #!/bin/bash
I did that too, but the same result. xterm is installed:

[email protected]:~# dpkg --list | grep xterm
ii xterm 256-1ubuntu1 X terminal emulator

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
gsgleason Offline
Donor
Posts: 172
Joined: Oct 2009
Reputation: 5
Post: #11
I thought it should be .xinitrc
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #12
gsgleason Wrote:I thought it should be .xinitrc
I thought that so but I don't have .xinitrc file either. I don't have "/etc/X11/xinitrc" as well. Cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #13
thanks gsgleason, .xinitrc worked - but with "exec nvidia-settings" in it; "exec nvidia-settings" is not working for some reason. cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
kubax Offline
Member
Posts: 72
Joined: Sep 2009
Reputation: 0
Location: NRW
Post: #14
strange, here .xsession works just fine...
but when it works now, great ^^

cd /pub/ && cat Beer
find quote
MacUsers Offline
Fan
Posts: 458
Joined: Jun 2009
Reputation: 0
Location: London, UK
Post: #15
MacUsers Wrote:thanks gsgleason, .xinitrc worked - but with "exec nvidia-settings" in it; "exec nvidia-settings" is not working for some reason. cheers!!!
oops!!! "exec xterm" didn't work, I meant. Cheers!!!

MONEUAL 320B | ASUS P5Q-VM | Core2Duo E6320 | Radeon HD 6450 | Kingston KVR 800Mz HyperX DDR2 4GB (2 x 2GB) | UJ-120 BD-ROM | Pioneer VSX-924-K | KEF KHT3005SE-W | Panasonic TX-P42GT50B | OpenELEC
find quote
Post Reply