LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   changing screen resolution and frequency with nvidia-settings from the CLI (https://www.linuxquestions.org/questions/linux-software-2/changing-screen-resolution-and-frequency-with-nvidia-settings-from-the-cli-545963/)

Valkyrie_of_valhalla 04-14-2007 03:36 AM

changing screen resolution and frequency with nvidia-settings from the CLI
 
What I actually want to do is create a startup script on Slackware, that runs this utility and changes my resolution and frequency. The man pages aren't quite detailed. I should be able to do something with the -a flag, but I don't understand the exact parameters that I have to put in.

Problem: I can't get a frequency higher than 60 with either kde's or xfce's settings pannel. With the nvidia-settings utility, I can, but it gets resetted after a reboot, or logout. (yes, I have tried disabling "apply settings at kde startup" from the control center on kde)

Temporary solution: I have to run nvidia-settings every time I reboot or log out.

Long-term solution: The script I'm talking about, something to automate this process.

So, does anyone know the CLI option I have to put in? Can I even do this?
Thanks for reading. Any info/suggestion is welcomed. If anyone has another solution, I'm open to that as well.

berbae 04-14-2007 08:41 AM

Hi
The 'man nvidia-settings' explains how to load the settings :
it's in the USER GUIDE
Quote:

3. Loading Settings Automatically
The NVIDIA X driver does not preserve values set with nvidia-settings
between runs of the X server (or even between logging in and logging out
of X, with xdm(1), gdm, or kdm ). This is intentional, because different
users may have different preferences, thus these settings are stored on a
per-user basis in a configuration file stored in the user's home direc-
tory.

The configuration file is named ~/.nvidia-settings-rc. You can specify a
different configuration file name with the --config commandline option.

After you have run nvidia-settings once and have generated a configuration
file, you can then run:

nvidia-settings --load-config-only

at any time in the future to upload these settings to the X server again.
For example, you might place the above command in your ~/.xinitrc file so
that your settings are applied automatically when you log in to X.

Your .xinitrc file, which controls what X applications should be started
when you log into X (or startx), might look something like this:

nvidia-settings --load-config-only &
xterm &
evilwm
I think this is what you are looking for. I hope so.

Valkyrie_of_valhalla 04-14-2007 09:06 AM

thanks for the reply.
It seems like what I wanted,but...
Tried typing in a terminal
nvidia-settings --load-config-only
But it doesn't modify anything. Maybe the file is resetted each time? I have to check this.
By the way, I don't seem to have .xinitrc in my home dir. I can't place it in /etc/rc.d either, as those scripts run before x starts... Where does KDE store it's list with programs running at startup? I noticed it has a folder ~/.kde/Autostart, is that it?

berbae 04-14-2007 05:00 PM

Quote:

If you do not already have an ~/.xinitrc file, then chances are that
xinit(1) is using a system-wide xinitrc file. This system wide file is
typically here:

/etc/X11/xinit/xinitrc

To use it, but also have nvidia-settings upload your settings, you could
create an ~/.xinitrc with the contents:

nvidia-settings --load-config-only &
. /etc/X11/xinit/xinitrc

System administrators may choose to place the nvidia-settings load command
directly in the system xinitrc script.

Please see the xinit(1) man page for further details of configuring your
~/.xinitrc file.
You can also put the line 'nvidia-settings --load-config-only &' in your ~/.bashrc file if you always login with kdm into KDE. But I think it's not so good as using xinitrc or ~/.xinitrc which run only in graphical mode. Using the ~/.kde/Autostart folder would be a good choice too.

Of course before being able to use the '~/.nvidia-settings-rc' file, you have to run nvidia-settings once under user login, not root, and configure your settings there.
To be sure check the presence of the '~/.nvidia-settings-rc' file after you have configured your settings.
If it works when you run the nvidia-settings utility, it should work also when you reboot and/or you log in as the user who made the settings. But be sure to put the command 'nvidia-settings --load-config-only &' in a user's file which runs at login time and graphical mode.
It should not be too difficult to find or to create one (see above for suggestions). I hope so for you.

dive 04-14-2007 06:05 PM

You may also want to look at xrandr

Valkyrie_of_valhalla 04-15-2007 02:48 AM

Thank you all for the replies.
berbae, I'll follow your advice, and put it in /etc/X11/xinit/xinitrc
But first I need to get it to work.
Typing nvidia-settings --load-config-only in a console seems not to do anything.
Taking a look in the .nvidia-settings-rc file, I noticed there isn't any line about the resolution and refresh rate.
Here's the file:
Code:

# ConfigProperties:

RcFileLocale = en_US
ToolTips = Yes
DisplayStatusBar = Yes
SliderTextEntries = Yes
IncludeDisplayNameInConfigFile = No
ShowQuitDialog = No

# Attributes:

0/DigitalVibrance[CRT-0]=0
0/ImageSharpening[CRT-0]=0
0/SyncToVBlank=0
0/AllowFlipping=1
0/LogAniso=0
0/FSAA=0
0/TextureSharpen=0
0/ForceGenericCpu=0
0/CursorShadow=0
0/CursorShadowXOffset=4
0/CursorShadowYOffset=2
0/CursorShadowAlpha=64
0/CursorShadowRed=0
0/CursorShadowGreen=0
0/CursorShadowBlue=0
0/FSAAAppControlled=1
0/LogAnisoAppControlled=1
0/RedBrightness=0.000000
0/GreenBrightness=0.000000
0/BlueBrightness=0.000000
0/RedContrast=-0.021277
0/GreenContrast=-0.021277
0/BlueContrast=-0.021277
0/RedGamma=1.000000
0/GreenGamma=1.000000
0/BlueGamma=1.000000
0/OpenGLImageSettings=1
0/XVideoOverlaySaturation=4096
0/XVideoOverlayContrast=4096
0/XVideoOverlayBrightness=0
0/XVideoOverlayHue=0
0/XVideoTextureSyncToVBlank=1
0/XVideoBlitterSyncToVBlank=0
0/XVideoSyncToDisplay=1

So then, it won't work changing resolution and refresh rate this way?
Any ideas?

BTW, from the xrandr manual: "Xrandr is used to set the screen size, orientation and/or reflection." Can I use it for this too? If so, how?

berbae 04-15-2007 04:57 AM

Because you said in your OP :
Quote:

I can't get a frequency higher than 60 with either kde's or xfce's settings pannel. With the nvidia-settings utility, I can
I thought that the command works and the problem was not there.
Can you give precisions on how you can change the frequency higher than 60 with nvidia-settings.

You spoke of a -a flag in your OP, I can't see that option in the nvidia-settings manual.

Another way to cope with this question would be to edit the /etc/X11/xorg.conf file ;
add in the Section "Device" the line :
Option "UseEdidFreqs" "false"
and put the right values in the Section "Monitor" :
HorizSync 30-80
VertRefresh 56-76
these values are mine but you should write yours to comprise the values from the monitor manual.
Then choose the right resolution for the mode option in the Section "Screen".

Valkyrie_of_valhalla 04-15-2007 05:42 AM

I change the frequency rate from the nvidia-settings GUI. Here's a snapshot:
http://img267.imageshack.us/img267/9...pshot11co2.png
I set it to 75 and it seems to work. The Quit button shows a tooltip saying it will save the configuration to ./nvidia-settings-rc when it exits.
From KDE's menu, it appears to be at 57, and I can only get 50-60. Here's a snapshot of that too, just in case:
http://img442.imageshack.us/img442/3829/snapshot13vy6.png

I think I misread what the -a does, in the manual it says:
Code:

-a, --assign=assign
              The assign argument to the --assign commandline option is of the
              form:

                      {DISPLAY}/{attribute name}[{display devices}]={value}

              This assigns the attribute {attribute name} to the value {value}
              on  the  X  Display  {DISPLAY}.  {DISPLAY}  follows  the  usual
              {host}:{display}.{screen}  syntax  of  the  DISPLAY  environment
              variable  and  is optional; when it is not specified, then it is
              implied following the same rule as  the  --ctrl-display  option.
              If the X screen is not specified, then the assignment is made to
              all X screens.  Note that the '/' is only  required  when  {DIS-
              PLAY} is present.

              {DISPLAY}  can  additionally  include  a target specification to
              direct an assignment to something other than  an  X  screen.  A
              target  specification  is contained within brackets and consists
              of a target type name, a colon, and the target id.  The  target
              type name can be one of screen, gpu, or framelock; the target id
              is the index into the list of targets (for  that  target  type).
              The  target specification can be used in {DISPLAY} wherever an X
              screen can be used, following the syntax  {host}:{display}[{tar-
              get_type}:{target_id}].  See the output of

                      nvidia-settings --query all

              for  information  on  which  target types can be used with which
              attributes.  See the output of

                      nvidia-settings -q screens -q gpus -q framelocks
 for lists of targets for each target type.

              The [{display devices}] portion is also optional; if it  is  not
              specified,  then  the  attribute  is  assigned  to  all  display
              devices.

              Some examples:

                      -a FSAA=5
                      -a localhost:0.0/DigitalVibrance[CRT-0]=0
                      --assign="SyncToVBlank=1"
                      -a [gpu:0]/DigitalVibrance[DFP-1]=63

As for xorg.conf, here are the parts of it referring to the monitor, video card and screen:
Code:

Section "Monitor"
DisplaySize  345 259
    Identifier    "My monitor"
    HorizSync      31.5 - 82.0
    VertRefresh    50.0 - 160.0
EndSection

Section "Device"
    #VideoRam    131072
    # Insert Clocks lines here if appropriate
    Identifier    "GeForce FX"
    Driver        "nvidia"
EndSection

Section "Screen"
    Identifier    "Screen 1"
    Device        "GeForce FX"
    Monitor        "My monitor"
    DefaultDepth    24
    SubSection    "Display"
        Viewport    0 0
        Depth      8
        Modes      "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection    "Display"
        Viewport    0 0
        Depth      16
        Modes      "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection    "Display"
        Viewport    0 0
        Depth      24
        Modes      "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
EndSection

Tried a while ago changing the HorizSync and VertRefresh with various valules, but it doesn't seem to work. The nvidia-settings program also has a button "save to x configuration file", tried that too and it didn't work...

berbae 04-15-2007 07:56 AM

I think your nvidia/xorg configuration is good.
Your problem is to get the right refresh rate when you boot/log in as a user.
To do that it's preferable not to use the KDE control center as it doesn't give right values for the refresh rate.
The command to get the real refresh rate is :
nvidia-settings --query RefreshRate

For example on my machine this command gives :
Attribute 'RefreshRate' (arch:0.0; display device: CRT-0): 75,02 Hz.

although in KDE control center only 50hz and 53hz are shown, and I know these are wrong values.

So in your case to know what is your refresh rate after a boot/log in, run in a console just after you logged in :
nvidia-settings --query RefreshRate

You will get the real refresh rate used by the nvidia driver.

If this is not the one you want, try to change it with :
nvidia-settings --assign="RefreshRate=75"
then verify it with :
nvidia-settings --query RefreshRate

Can you tell me if this works for you.

berbae 04-15-2007 08:02 AM

Message deleted because of accidental double post.

Valkyrie_of_valhalla 04-15-2007 08:26 AM

Hmm,thanks for the suggestions, there's a little problem here, it says the refresh rate attribute is read only.
Tried both as user and with sudo nvidia-settings --assign="RefreshRate=75" and got:
Code:

ERROR: The attribute 'RefreshRate' specified in assignment
      'RefreshRate=75' cannot be assigned (it is a read-only
      attribute).

So it doesn't work...
As for nvidia-settings --query RefreshRate, this is what I get at KDE startup:
Code:

  Attribute 'RefreshRate' (host:0.0; display device: CRT-0): 43.48
  Hz.
    'RefreshRate' is an integer attribute.
    'RefreshRate' is a read-only attribute.
    'RefreshRate' is display device specific.
    'RefreshRate' can use the following target types: X Screen, GPU.

And after running the nvidia-settings GUI:
Code:

  Attribute 'RefreshRate' (host:0.0; display device: CRT-0): 75.03
  Hz.
    'RefreshRate' is an integer attribute.
    'RefreshRate' is a read-only attribute.
    'RefreshRate' is display device specific.
    'RefreshRate' can use the following target types: X Screen, GPU.


berbae 04-15-2007 11:09 AM

Yes it was my fault to suggest to you the nvidia-settings --assign="RefreshRate=75" command, I had not realized it was a read-only attribute as the output of the '--query RefreshRate' command shows.

The nvidia driver knows the ModeLine parameters for the 75Hz refresh rate, because you can set it with the nvidia-settings GUI.
A solution now is to force this ModeLine at X startup in the /etc/X11/xorg.conf file. It should be named "1280x1024_75" as this is the way valid modes are given a unique name by the nvidia driver.

So in the Section "Screen" add the ModeLine you want as default like that :
Quote:

SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x1024_75" "1024x768" "800x600" "640x480"
EndSubSection
I think this should work. Tell me if it is not the case.

Valkyrie_of_valhalla 04-15-2007 11:58 AM

Yup, that did it :D
Thank you!



All times are GMT -5. The time now is 03:39 PM.