Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 59316 - nvidia-settings uses wrong display name
Summary: nvidia-settings uses wrong display name
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 All
: High normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-03 15:57 UTC by Stefan Sperling
Modified: 2004-08-05 18:17 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
displaytest.c (displaytest.c,998 bytes, text/plain)
2004-08-03 16:01 UTC, Stefan Sperling
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Sperling 2004-08-03 15:57:06 UTC
I recently dumped my g550 for a fx5200, so now I am on binary-only drivers (sniff...)

Today I encountered the nvidia-settings utility.
I frowned very much when I tried 'nvidia-settings --load-config-only' to
restore gamma-correction settings I had applied when running the utility with 
the gui. Instead of restoring my settings, it hung for a while, and then it said:

ERROR: Cannot open display 'dice:0.0'.


ERROR: Unable to assign attribute DigitalVibrance specified on line 17 of
       configuration file '/home/stsp/.nvidia-settings-rc.troublemaker' (no
       Display connection).


ERROR: Unable to assign attribute DigitalVibrance specified on line 18 of
       configuration file '/home/stsp/.nvidia-settings-rc.troublemaker' (no
       Display connection).

and spit out a lot more errors about being unable to assign any attributes in lack of a display connection. My settings were not restored :(

But without --load-config-only, the gui starts as usual, and even restores my settings on startup... weird...

Having time to spare, I dug out ddd and ran it on a freshly compiled nvidia-settings binary.

I found out that when the nvidia-settings utility tries to connect to a display
named "dice:0.0" (dice is my desktop), it fails with the above error.
However, using display ":0.0" seems to work.

The nvidia-settings code has about three sources for the display name to use.
One is gtk, which uses display ":0.0", and that works fine.
Before starting the gui, the code determines the display name using a
function called NvCtrlGetDisplayName(), which I deem to be a hook into the 
nvidia driver. This function returnes the malicious "dice:0.0". (line 155 in query-asign.c). This display name is also used when wrinting the config file on exit. 

My config file (~/.nvidia-settings-rc) has lines such as:
dice:0.0/DigitalVibrance[CRT-0]=0

and when I remove 'dice' changing them to
:0.0/DigitalVibrance[CRT-0]=0
'nvidia-settings --load-config-only' works perfectly, as the display
name is taken directly from the config file when loading the config.
This is source number 3, for those who haven't been counting along ;-)

So I have a workaround... But who's fault is this? 

I wrote a little test-app that tries to open a display. It fails to open 
display "dice:0.0" (hanging forever) but succeeds opening display ":0.0"
With the test-app I can reproduce this problem on all of the three gentoo machines I have on my lan, with both xorg and xfree, with and without nvidia.

But could this be a name resolution issue?
dice is resolved to 192.168.0.1. Could X be configured to not accept connections
from 192.168.0.1 (or anyone) to localhost? But 'xhost + dice' does not change anything...

Or is nvidia doing something wrong here (read: non-standard)? 
Maybe the nvidia-settings utility should solely use the display name returned 
by gtk and not use NvCtrlGetDisplayName? How come these two return different
values? Should NvCtrlGetDisplayName be fixed upstream?

I hope someone can clarify this issue.

thanks
stefan
Comment 1 Stefan Sperling 2004-08-03 16:01:07 UTC
Created attachment 36719 [details]
displaytest.c

This is the test program I used, in case you want to try to reproduce this at
home.

To compile:
gcc displaytest.c -o displaytest -L /usr/X11R6/lib/ -lX11
Comment 2 Stefan Sperling 2004-08-03 16:18:43 UTC
I just realised that the problem only occurs if you check the
"Include X Display Names in the Config File" option on the 
nvidia-settings configuration page.
The tooltip says: "It is normally recommended to leave this option unchecked."
I had better read this before checking the option...
Comment 3 Andrew Bevitt 2004-08-05 18:17:57 UTC
Hmm well if its the result of that checkbox as you say im not going to change anything. Afterall the host:display functionality is going to be useful for remote administration etc.. on remote Xterms.