Make nvidia-screen settings permanent with jetson-nano

Hi,

I need to make the below settings permanent with jetson-nano device which i’m currently using.

export DISPLAY=:0 nvidia-settings --assign 0/CurrentMetaMode="DFP-0: 1920x1080 { ViewPortIn=1920x1080, ViewPortOut=1395x1060+0+0 }"

I can put this code in the script and execute the script, then it sets the screen properly.
but the problem is i need to do this each time when the system starts.

These are things which i tried but they failed.
approaches tried and which failed: to run the set_screen.sh script

  1. placing in the bashrc. causes login issues, won’t be able to login through ssh.
  2. trying to run with @reboot option the script did not make any changes to the screen at all.
  3. trying to run as start_up_application by making it as a startup script with gnome-session-properties. this approach do works but it stops another app which i run with supervisor during the system startup.

Can someone point me in the right direction where i can place the above settings, so that it runs properly and does not rise any issues with other startup applications.

Maybe you could put the command in /etc/systemd/nv.sh and it would be executed in every boot.

BTW, why do you have nvidia-settings on nano? Do you install it manually?

Tried, but didn’t work, it did not do any changes

No did not install it manually, we have currently connected a screen to the jetson-nano device for mirroring the content over the HDMI cable.

If i do not run the screen_setting command which i have placed above, then the content on the screen won’t appear full.

On a scale 0-1, it does not show 1/4 part on the screen.

How about writing some setting in xorg.conf?

Section "Screen"
Identifier "Screen0"
Monitor    "Monitor0"
    SubSection "Display"
    Viewport   0 0
    Modes "1280x1024"
    Depth   24 
    Virtual 1280 1024
EndSubSection
EndSection

tried, but didn’t work, that makes even worst, i mean it cuts more than 1/4th of the screen

could you tell me what is the right way of making use of viewportin and viewportout variables in xorg file so that the screen sets properly.

this particular link talks about it
https://download.nvidia.com/XFree86/Linux-x86_64/304.137/README/configtwinview.html

i tried to put it in this way but it did not make any changes.

SubSection     "Display"
        Depth     24
        Option    "ViewPortIn" "DFP-0: 1920x1080 { ViewPortIn=1920x1080 }"
        Option    "ViewPortOut" "DFP-0: 1920x1080 { viewPortOut=1395x1060+0+0 }"
    EndSubSection

referred this link

https://www.pclinuxos.com/forum/index.php/topic,106650.msg916221.html?PHPSESSID=94852fcj0cdfj70bvdge92lr64#msg916221
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option          "BaseMosaic" "off"
    SubSection     "Display"
        Depth     24
        Modes     "1920x1080"
    EndSubSection
    Option         "metamodes" "DFP-0: 1920x1080 { ViewPortIn=1920x1080, ViewPortOut=1395x1060+0+0 }"
EndSection

But still it did not do any changes…

It sounds like the random sample I shared to you have some effect but just not what you want, right?

Yes thats right, it does have an effect over the display screen. but the setting values need to be proper.

Please check your xorg.0.log. It should tell why your viewport setting does not work.

Also, you could try to change the virtual to different size.
What I shared is just a sample. You could change it to whatever you want.

This is the output of /var/log/Xorg.0.log

[    10.993] (--) Log file renamed from "/var/log/Xorg.pid-5333.log" to "/var/log/Xorg.0.log"
[    11.022] 
X.Org X Server 1.19.6
Release Date: 2017-12-20
[    11.022] X Protocol Version 11, Revision 0
[    11.022] Build Operating System: Linux 4.4.0-148-generic aarch64 Ubuntu
[    11.022] Current Operating System: Linux is-desktop 4.9.140-tegra #1 SMP PREEMPT Wed Mar 13 00:32:22 PDT 2019 aarch64
[    11.022] Kernel command line: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92cb6000 is_hdmi_initialised=1  root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0    root=/dev/mmcblk0p1 rw rootwait console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait
[    11.022] Build Date: 03 June 2019  08:11:53AM
[    11.022] xorg-server 2:1.19.6-1ubuntu4.3 (For technical support please see http://www.ubuntu.com/support) 
[    11.022] Current version of pixman: 0.34.0
[    11.022] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[    11.022] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    11.022] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Aug 17 12:20:33 2019
[    11.056] (==) Using config file: "/etc/X11/xorg.conf"
[    11.056] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    11.062] (==) ServerLayout "Default Layout"
[    11.062] (**) |-->Screen "Screen0" (0)
[    11.062] (**) |   |-->Monitor "Monitor0"
[    11.063] (**) |   |-->Device "Device0"
[    11.063] (**) |   |-->GPUDevice "Device0"
[    11.063] (**) |-->Input Device "Keyboard0"
[    11.063] (**) |-->Input Device "Mouse0"
[    11.063] (**) Option "Xinerama" "0"
[    11.063] (==) Automatically adding devices
[    11.063] (==) Automatically enabling devices
[    11.063] (==) Automatically adding GPU devices
[    11.063] (==) Automatically binding GPU devices
[    11.063] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    11.069] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[    11.069] 	Entry deleted from font path.
[    11.069] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[    11.070] 	Entry deleted from font path.
[    11.070] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[    11.070] 	Entry deleted from font path.
[    11.074] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[    11.074] 	Entry deleted from font path.
[    11.074] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[    11.074] 	Entry deleted from font path.
[    11.074] (==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/Type1,
	built-ins
[    11.074] (==) ModulePath set to "/usr/lib/xorg/modules"
[    11.074] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[    11.074] (WW) Disabling Keyboard0
[    11.074] (WW) Disabling Mouse0
[    11.074] (II) Loader magic: 0x55605e2010
[    11.074] (II) Module ABI versions:
[    11.074] 	X.Org ANSI C Emulation: 0.4
[    11.074] 	X.Org Video Driver: 23.0
[    11.074] 	X.Org XInput driver : 24.1
[    11.074] 	X.Org Server Extension : 10.0
[    11.076] (++) using VT number 1

[    11.081] (II) systemd-logind: took control of session /org/freedesktop/login1/session/_31
[    11.083] (II) no primary bus or device found
[    11.083] (WW) "dri" will not be loaded unless you've specified it to be loaded elsewhere.
[    11.083] (II) "glx" will be loaded by default.
[    11.083] (II) LoadModule: "extmod"
[    11.083] (II) Module "extmod" already built-in
[    11.083] (II) LoadModule: "glx"
[    11.086] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    11.123] (II) Module glx: vendor="X.Org Foundation"
[    11.123] 	compiled for 1.19.6, module version = 1.0.0
[    11.123] 	ABI class: X.Org Server Extension, version 10.0
[    11.123] (II) LoadModule: "nvidia"
[    11.123] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[    11.180] (II) Module nvidia: vendor="NVIDIA Corporation"
[    11.180] 	compiled for 4.0.2, module version = 1.0.0
[    11.180] 	Module class: X.Org Video Driver
[    11.188] (II) NVIDIA dlloader X Driver  32.1.0  Release Build  (integ_stage_rel)  (buildbrain@mobile-u64-3531)  Wed Mar 13 00:27:48 PDT 2019
[    11.188] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[    11.188] (WW) Falling back to old probe method for NVIDIA
[    11.188] (II) Loading sub module "fb"
[    11.188] (II) LoadModule: "fb"
[    11.189] (II) Loading /usr/lib/xorg/modules/libfb.so
[    11.193] (II) Module fb: vendor="X.Org Foundation"
[    11.193] 	compiled for 1.19.6, module version = 1.0.0
[    11.193] 	ABI class: X.Org ANSI C Emulation, version 0.4
[    11.193] (II) Loading sub module "wfb"
[    11.193] (II) LoadModule: "wfb"
[    11.193] (II) Loading /usr/lib/xorg/modules/libwfb.so
[    11.196] (II) Module wfb: vendor="X.Org Foundation"
[    11.196] 	compiled for 1.19.6, module version = 1.0.0
[    11.196] 	ABI class: X.Org ANSI C Emulation, version 0.4
[    11.196] (II) Loading sub module "ramdac"
[    11.196] (II) LoadModule: "ramdac"
[    11.196] (II) Module "ramdac" already built-in
[    11.198] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[    11.198] (EE) Screen 1 deleted because of no matching config section.
[    11.198] (II) UnloadModule: "nvidia"
[    11.199] (II) UnloadSubModule: "wfb"
[    11.199] (II) UnloadSubModule: "fb"
[    11.199] (**) NVIDIA(0): Depth 24, (--) framebuffer bpp 32
[    11.199] (==) NVIDIA(0): RGB weight 888
[    11.199] (==) NVIDIA(0): Default visual is TrueColor
[    11.199] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[    11.199] (DB) xf86MergeOutputClassOptions unsupported bus type 0
[    11.199] (**) NVIDIA(0): Option "Stereo" "0"
[    11.199] (**) NVIDIA(0): Option "nvidiaXineramaInfoOrder" "DFP-0"
[    11.199] (**) NVIDIA(0): Option "SLI" "Off"
[    11.199] (**) NVIDIA(0): Option "MultiGPU" "Off"
[    11.199] (**) NVIDIA(0): Option "BaseMosaic" "off"
[    11.199] (**) NVIDIA(0): Stereo disabled by request
[    11.199] (**) NVIDIA(0): NVIDIA SLI disabled.
[    11.199] (**) NVIDIA(0): NVIDIA Multi-GPU disabled.
[    11.200] (**) NVIDIA(0): Option "MetaModes" "DFP-0: 1920x1080 { ViewPortIn=1920x1080, ViewPortOut=1395x1060+0+0 }"
[    11.200] (**) NVIDIA(0): Enabling 2D acceleration
[    11.200] (II) Loading sub module "glxserver_nvidia"
[    11.200] (II) LoadModule: "glxserver_nvidia"
[    11.200] (II) Loading /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so
[    11.471] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[    11.471] 	compiled for 4.0.2, module version = 1.0.0
[    11.471] 	Module class: X.Org Server Extension
[    11.471] (II) NVIDIA GLX Module  32.1.0  Release Build  (integ_stage_rel)  (buildbrain@mobile-u64-3531)  Wed Mar 13 00:26:03 PDT 2019
[    11.508] (--) NVIDIA(0): Valid display device(s) on GPU-0 at SoC
[    11.508] (--) NVIDIA(0):     DFP-0
[    11.508] (--) NVIDIA(0):     DFP-1
[    11.508] (II) NVIDIA(0): NVIDIA GPU NVIDIA Tegra X1 (nvgpu) (GM20B) at SoC (GPU-0)
[    11.508] (--) NVIDIA(0): Memory: 4051520 kBytes
[    11.508] (--) NVIDIA(0): VideoBIOS: 
[    11.509] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    11.509] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    11.510] (II) NVIDIA(0): Validated MetaModes:
[    11.510] (II) NVIDIA(0):    
[    11.510] (II) NVIDIA(0):     "DFP-0:1920x1080{ViewPortIn=1920x1080,ViewPortOut=1395x1060+0+0}"
[    11.510] (II) NVIDIA(0): Virtual screen size determined to be 1920 x 1080
[    11.513] (--) NVIDIA(0): DPI set to (162, 119); computed from "UseEdidDpi" X config
[    11.513] (--) NVIDIA(0):     option
[    11.513] (--) Depth 24 pixmap format is 32 bpp
[    11.513] (II) NVIDIA: Reserving 6144.00 MB of virtual memory for indirect memory
[    11.513] (II) NVIDIA:     access.
[    11.516] (EE) NVIDIA(0): Failed to allocate NVIDIA Error Handler
[    11.516] (II) NVIDIA(0): ACPI: failed to connect to the ACPI event daemon; the daemon
[    11.516] (II) NVIDIA(0):     may not be running or the "AcpidSocketPath" X
[    11.516] (II) NVIDIA(0):     configuration option may not be set correctly.  When the
[    11.516] (II) NVIDIA(0):     ACPI event daemon is available, the NVIDIA X driver will
[    11.516] (II) NVIDIA(0):     try to use it to receive ACPI event notifications.  For
[    11.516] (II) NVIDIA(0):     details, please see the "ConnectToAcpid" and
[    11.516] (II) NVIDIA(0):     "AcpidSocketPath" X configuration options in Appendix B: X
[    11.516] (II) NVIDIA(0):     Config Options in the README.
[    11.579] (II) NVIDIA(0): Setting mode "DFP-0:1920x1080{ViewPortIn=1920x1080,ViewPortOut=1395x1060+0+0}"
[    11.717] (==) NVIDIA(0): Disabling shared memory pixmaps
[    11.717] (==) NVIDIA(0): Backing store enabled
[    11.718] (==) NVIDIA(0): Silken mouse enabled
[    11.720] (==) NVIDIA(0): DPMS enabled
[    11.720] (II) Loading sub module "dri2"
[    11.720] (II) LoadModule: "dri2"
[    11.720] (II) Module "dri2" already built-in
[    11.720] (II) NVIDIA(0): [DRI2] Setup complete
[    11.720] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[    11.754] (--) RandR disabled
[    11.761] (II) SELinux: Disabled on system
[    11.762] (II) Initializing extension GLX
[    11.762] (II) Indirect GLX disabled.
[    11.916] (II) config/udev: Adding input device tegra-hda HDMI/DP,pcm=3 (/dev/input/event0)
[    11.916] (II) No input driver specified, ignoring this device.
[    11.916] (II) This device may have been added with another device file.
[    11.917] (II) config/udev: Adding input device gpio-keys (/dev/input/event1)
[    11.917] (**) gpio-keys: Applying InputClass "libinput keyboard catchall"
[    11.917] (II) LoadModule: "libinput"
[    11.920] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[    11.933] (II) Module libinput: vendor="X.Org Foundation"
[    11.933] 	compiled for 1.19.6, module version = 0.27.1
[    11.933] 	Module class: X.Org XInput Driver
[    11.933] 	ABI class: X.Org XInput driver, version 24.1
[    11.933] (II) Using input driver 'libinput' for 'gpio-keys'
[    11.935] (II) systemd-logind: got fd for /dev/input/event1 13:65 fd 33 paused 0
[    11.935] (**) gpio-keys: always reports core events
[    11.935] (**) Option "Device" "/dev/input/event1"
[    11.936] (**) Option "_source" "server/udev"
[    11.937] (II) event1  - gpio-keys: is tagged by udev as: Keyboard
[    11.937] (II) event1  - gpio-keys: device is a keyboard
[    11.937] (II) event1  - gpio-keys: device removed
[    11.937] (**) Option "config_info" "udev:/sys/devices/gpio-keys/input/input1/event1"
[    11.937] (II) XINPUT: Adding extended input device "gpio-keys" (type: KEYBOARD, id 6)
[    11.937] (**) Option "xkb_model" "pc105"
[    11.937] (**) Option "xkb_layout" "us"
[    11.939] (II) event1  - gpio-keys: is tagged by udev as: Keyboard
[    11.939] (II) event1  - gpio-keys: device is a keyboard
[    16.637] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    16.637] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    16.638] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    16.638] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    16.848] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    16.848] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    17.246] (II) NVIDIA(0): Setting mode "HDMI-0: nvidia-auto-select @1395x1060 +0+0 {ViewPortIn=1395x1060, ViewPortOut=1395x1060+0+0}"
[    17.973] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    18.028] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    18.822] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    18.822] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS

In the above there are two commands at different places

[    11.579]...
 (II) NVIDIA(0): Setting mode "DFP-0:1920x1080{ViewPortIn=1920x1080,ViewPortOut=1395x1060+0+0}"
...
....
[    17.246] (II) NVIDIA(0): Setting mode "HDMI-0: nvidia-auto-select @1395x1060 +0+0 {ViewPortIn=1395x1060, ViewPortOut=1395x1060+0+0}"
...

It showing that it has applied the “metamodes” settings but it is not.
The screen resolution remains same without any changes…
not able to figure out what is going wrong here…

I tried to change the Virtual to different size, i changed it to 1920x1080, when i restarted, system was kind of hanged, and it resulted in some sort of error.

And i removed the virtual size and restarted the system then my startup app got crashed system_error pop_up message.

So playing with the virtual size, seems to be kind of dangerous move.

Once the system is started, if i run my set_screen.sh script, it sets the screen resolution, and the respective changes does appear on the Xorg.0.log file.

[    16.848] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    16.848] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    17.246] (II) NVIDIA(0): Setting mode "HDMI-0: nvidia-auto-select @1395x1060 +0+0 {ViewPortIn=1395x1060, ViewPortOut=1395x1060+0+0}"
[    17.973] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    18.028] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    18.822] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    18.822] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    19.706] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    19.712] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS
[    20.061] (II) NVIDIA(0): Setting mode "DFP-0:1920x1080{ViewPortIn=1920x1080,ViewPortOut=1395x1060+0+0}"
[    20.103] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): connected
[    20.104] (--) NVIDIA(GPU-0): NOVA HD CARD (DFP-0): External TMDS

What i guess is that, it first sets the screen then the respective settings might be overriding again in some other way.

For now i have only one option, running the script manually after starting the system.

I’m using NoMachine and the screen was 640x480 on jetson Nano.
But this worked for me!

Thank you so much.

**tip:

sudo gedit /etc/X11/xorg.conf

and add the following code at the end of the file:

1 Like

This guy knows what’s up. Thank you good sir.
Worked perfect. My res was too high. 800x600 is all I wanted and this did the trick with VNC even.
Thanks