# nVidia driver refreshes display too quickly with a manual Modeline



## gdwatson (Jun 3, 2017)

I just installed a shiny new nVidia GTX 1060.  I have the nVidia driver up and running with X; neither it nor its MS Windows counterpart does well with my monitor's EDID information, so it defaults to 1024x768 instead of 1280x1024.

I've been trying to configure resolution manually.  It worked in Windows, but a modeline with comparable settings produced by `gtf 1280 1024 60` seems to be stripped out by the X driver for safety reasons.  If I put in the option to disable safety checks, my monitor displays, "Out of Range, H. Frequency: 91kHz, V. Frequency: 85Hz."

`uname -a`: "FreeBSD dweorh 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64".  I am running the quarterly package set, with nvidia-driver at version 375.26_1.

/usr/local/etc/X11/xorg.conf.d/display.conf:


```
Section "Device"
   Identifier "Device0"
   VendorName "NVIDIA Corporation"
   Driver "nvidia"
   BusID "PCI:1:0:0"
   #Option "ModeValidation" "AllowNon60HzDFPModes,NoMaxPClkCheck,NoEdidMaxPClkCheck,NoHorizSyncCheck,NoVertRefreshCheck,NoVirtualSizeCheck,AllowNonEdidModes"
   Option "ModeDebug" "True"
   Option "ModeValidation" "AllowNonEdidModes"
   Option "UseEDID" "False"
   Option "NoLogo" "True"
EndSection

Section "Screen"
   Identifier "Screen0"
   Device "Device0"
   Monitor "Monitor0"
   SubSection "Display"
          Modes "1280x1024"
   EndSubSection
EndSection

Section "Monitor"
   Identifier "Monitor0"
   Option "DPI" "96 x 96"
   HorizSync 30 - 82
   VertRefresh 50 - 85
   # 1280x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 108.88 MHz
   Modeline "1280x1024"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync
EndSection
```

From /var/log/Xorg.0.log:


```
X.Org X Server 1.18.4
Release Date: 2016-07-19
[     5.623] X Protocol Version 11, Revision 0
[     5.623] Build Operating System: FreeBSD 11.0-RELEASE-p8 amd64
[     5.623] Current Operating System: FreeBSD dweorh 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
[     5.623] Build Date: 04 April 2017  08:24:10AM
[     5.623]  
[     5.623] Current version of pixman: 0.34.0
[     5.623]    Before reporting problems, check http://wiki.x.org
   to make sure that you have the latest version.
[     5.623] Markers: (--) probed, (**) from config file, (==) default setting,
   (++) from command line, (!!) notice, (II) informational,
   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[     5.623] (==) Log file: "/var/log/Xorg.0.log", Time: Sat Jun  3 15:27:38 2017
[     5.625] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[     5.625] (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
[     5.626] (==) No Layout section.  Using the first Screen section.
[     5.626] (**) |-->Screen "Screen0" (0)
[     5.626] (**) |   |-->Monitor "Monitor0"
[     5.626] (**) |   |-->Device "Device0"
[     5.626] (==) Automatically adding devices
[     5.626] (==) Automatically enabling devices
[     5.626] (==) Not automatically adding GPU devices
[     5.626] (==) Max clients allowed: 256, resource mask: 0x1fffff
[     5.633] (==) FontPath set to:
   /usr/local/share/fonts/misc/,
   /usr/local/share/fonts/TTF/,
   /usr/local/share/fonts/OTF/,
   /usr/local/share/fonts/Type1/,
   /usr/local/share/fonts/100dpi/,
   /usr/local/share/fonts/75dpi/
[     5.633] (==) ModulePath set to "/usr/local/lib/xorg/modules"
[     5.633] (II) The server relies on devd to provide the list of input devices.
   If no devices become available, reconfigure devd or disable AutoAddDevices.
[     5.633] (II) Loader magic: 0x813b70
[     5.633] (II) Module ABI versions:
[     5.633]    X.Org ANSI C Emulation: 0.4
[     5.633]    X.Org Video Driver: 20.0
[     5.633]    X.Org XInput driver : 22.1
[     5.633]    X.Org Server Extension : 9.0
[     5.633] (--) PCI:*(0:1:0:0) 10de:1c03:3842:6163 rev 161, Mem @ 0xf6000000/16777216, 0xe0000000/268435456, 0xf0000000/33554432, I/O @ 0x0000e000/128, BIOS @ 0x????????/65536
[     5.633] (II) LoadModule: "glx"
[     5.634] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so
[     5.727] (II) Module glx: vendor="NVIDIA Corporation"
[     5.727]    compiled for 4.0.2, module version = 1.0.0
[     5.727]    Module class: X.Org Server Extension
[     5.727] (II) NVIDIA GLX Module  375.26  Thu Dec  8 18:20:58 PST 2016
[     5.727] (II) LoadModule: "nvidia"
[     5.729] (II) Loading /usr/local/lib/xorg/modules/drivers/nvidia_drv.so
[     5.735] (II) Module nvidia: vendor="NVIDIA Corporation"
[     5.735]    compiled for 4.0.2, module version = 1.0.0
[     5.735]    Module class: X.Org Video Driver
[     5.736] (II) NVIDIA dlloader X Driver  375.26  Thu Dec  8 17:59:41 PST 2016
[     5.736] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[     5.736] (--) Using syscons driver with X support (version 549739036674.0)
[     5.736] (++) using VT number 9

[     5.770] (II) Loading sub module "fb"
[     5.770] (II) LoadModule: "fb"
[     5.770] (II) Loading /usr/local/lib/xorg/modules/libfb.so
[     5.771] (II) Module fb: vendor="X.Org Foundation"
[     5.771]    compiled for 1.18.4, module version = 1.0.0
[     5.771]    ABI class: X.Org ANSI C Emulation, version 0.4
[     5.771] (II) Loading sub module "wfb"
[     5.771] (II) LoadModule: "wfb"
[     5.771] (II) Loading /usr/local/lib/xorg/modules/libwfb.so
[     5.773] (II) Module wfb: vendor="X.Org Foundation"
[     5.773]    compiled for 1.18.4, module version = 1.0.0
[     5.773]    ABI class: X.Org ANSI C Emulation, version 0.4
[     5.773] (II) Loading sub module "ramdac"
[     5.773] (II) LoadModule: "ramdac"
[     5.773] (II) Module "ramdac" already built-in
[     5.775] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[     5.775] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[     5.775] (==) NVIDIA(0): RGB weight 888
[     5.775] (==) NVIDIA(0): Default visual is TrueColor
[     5.775] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[     5.776] (**) NVIDIA(0): Option "NoLogo" "True"
[     5.776] (**) NVIDIA(0): Option "DPI" "96 x 96"
[     5.776] (**) NVIDIA(0): Option "ModeValidation" "NoMaxPClkCheck,NoEdidMaxPClkCheck,NoVirtualSizeCheck,AllowNonEdidModes"
[     5.776] (**) NVIDIA(0): Option "UseEDID" "False"
[     5.776] (**) NVIDIA(0): Enabling 2D acceleration
[     5.776] (**) NVIDIA(0): Ignoring EDIDs
[     6.542] (--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:1:0:0
[     6.542] (--) NVIDIA(0):     DFP-0 (boot)
[     6.542] (--) NVIDIA(0):     DFP-1
[     6.542] (--) NVIDIA(0):     DFP-2
[     6.542] (--) NVIDIA(0):     DFP-3
[     6.542] (--) NVIDIA(0):     DFP-4
[     6.542] (--) NVIDIA(0):     DFP-5
[     6.542] (--) NVIDIA(0):     DFP-6
[     6.542] (--) NVIDIA(0):     DFP-7
[     6.542] (II) NVIDIA(0): NVIDIA GPU GeForce GTX 1060 6GB (GP106-A) at PCI:1:0:0
[     6.542] (II) NVIDIA(0):     (GPU-0)
[     6.542] (--) NVIDIA(0): Memory: 6291456 kBytes
[     6.542] (--) NVIDIA(0): VideoBIOS: 86.06.39.00.62
[     6.542] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[     6.543] (--) NVIDIA(GPU-0): DFP-0: connected
[     6.543] (--) NVIDIA(GPU-0): DFP-0: Internal TMDS
[     6.543] (--) NVIDIA(GPU-0): DFP-0: 330.0 MHz maximum pixel clock
[     6.543] (--) NVIDIA(GPU-0):
[     6.546] (--) NVIDIA(GPU-0): DFP-1: disconnected
[     6.546] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[     6.546] (--) NVIDIA(GPU-0): DFP-1: 330.0 MHz maximum pixel clock
[     6.546] (--) NVIDIA(GPU-0):
[     6.546] (--) NVIDIA(GPU-0): DFP-2: disconnected
[     6.546] (--) NVIDIA(GPU-0): DFP-2: Internal DisplayPort
[     6.546] (--) NVIDIA(GPU-0): DFP-2: 1440.0 MHz maximum pixel clock
[     6.546] (--) NVIDIA(GPU-0):
[     6.547] (--) NVIDIA(GPU-0): DFP-3: disconnected
[     6.547] (--) NVIDIA(GPU-0): DFP-3: Internal TMDS
[     6.547] (--) NVIDIA(GPU-0): DFP-3: 330.0 MHz maximum pixel clock
[     6.547] (--) NVIDIA(GPU-0):
[     6.547] (--) NVIDIA(GPU-0): DFP-4: disconnected
[     6.547] (--) NVIDIA(GPU-0): DFP-4: Internal DisplayPort
[     6.547] (--) NVIDIA(GPU-0): DFP-4: 1440.0 MHz maximum pixel clock
[     6.547] (--) NVIDIA(GPU-0):
[     6.548] (--) NVIDIA(GPU-0): DFP-5: disconnected
[     6.548] (--) NVIDIA(GPU-0): DFP-5: Internal TMDS
[     6.548] (--) NVIDIA(GPU-0): DFP-5: 330.0 MHz maximum pixel clock
[     6.548] (--) NVIDIA(GPU-0):
[     6.548] (--) NVIDIA(GPU-0): DFP-6: disconnected
[     6.548] (--) NVIDIA(GPU-0): DFP-6: Internal DisplayPort
[     6.548] (--) NVIDIA(GPU-0): DFP-6: 1440.0 MHz maximum pixel clock
[     6.548] (--) NVIDIA(GPU-0):
[     6.549] (--) NVIDIA(GPU-0): DFP-7: disconnected
[     6.549] (--) NVIDIA(GPU-0): DFP-7: Internal TMDS
[     6.549] (--) NVIDIA(GPU-0): DFP-7: 330.0 MHz maximum pixel clock
[     6.549] (--) NVIDIA(GPU-0):
[     6.549] (**) NVIDIA(GPU-0): Mode Validation Overrides for DFP-0:
[     6.549] (**) NVIDIA(GPU-0):     NoVirtualSizeCheck
[     6.549] (**) NVIDIA(GPU-0):     NoMaxPClkCheck
[     6.549] (**) NVIDIA(GPU-0):     NoEdidMaxPClkCheck
[     6.549] (**) NVIDIA(GPU-0):     AllowNonEdidModes
[     6.552] (WW) NVIDIA(0): No valid modes for "DFP-0:1280x1024"; removing.
[     6.552] (WW) NVIDIA(0):
[     6.552] (WW) NVIDIA(0): Unable to validate any modes; falling back to the default mode
[     6.552] (WW) NVIDIA(0):     "nvidia-auto-select".
[     6.552] (WW) NVIDIA(0):
[     6.552] (II) NVIDIA(0): Validated MetaModes:
[     6.552] (II) NVIDIA(0):     "DFP-0:nvidia-auto-select"
[     6.552] (II) NVIDIA(0): Virtual screen size determined to be 1024 x 768
[     6.555] (**) NVIDIA(0): DPI set to (96, 96); computed from "DPI" X config option
[     6.555] (--) Depth 24 pixmap format is 32 bpp
[     6.556] (II) NVIDIA: Reserving 49152.00 MB of virtual memory for indirect memory
[     6.556] (II) NVIDIA:     access.
[     6.575] (II) NVIDIA(0): Setting mode "DFP-0:nvidia-auto-select"
[     6.631] (==) NVIDIA(0): Disabling shared memory pixmaps
[     6.631] (==) NVIDIA(0): Backing store enabled
[     6.631] (==) NVIDIA(0): Silken mouse enabled
[     6.632] (==) NVIDIA(0): DPMS enabled
[     6.632] (II) Loading sub module "dri2"
[     6.632] (II) LoadModule: "dri2"
[     6.632] (II) Module "dri2" already built-in
[     6.632] (II) NVIDIA(0): [DRI2] Setup complete
[     6.632] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[     6.633] (--) RandR disabled
[     6.634] (II) Initializing extension GLX
[     6.634] (II) Indirect GLX disabled.
[     6.712] (II) config/devd: probing input devices...
[     6.712] (II) config/devd: adding input device (null) (/dev/kbdmux)
[     6.712] (II) LoadModule: "kbd"
[     6.712] (II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
[     6.713] (II) Module kbd: vendor="X.Org Foundation"
[     6.713]    compiled for 1.18.4, module version = 1.9.0
[     6.713]    Module class: X.Org XInput Driver
[     6.713]    ABI class: X.Org XInput driver, version 22.1
[     6.713] (II) Using input driver 'kbd' for 'kbdmux'
[     6.713] (**) kbdmux: always reports core events
[     6.713] (**) kbdmux: always reports core events
[     6.713] (**) Option "Protocol" "standard"
[     6.713] (**) Option "XkbRules" "base"
[     6.713] (**) Option "XkbModel" "pc105"
[     6.713] (**) Option "XkbLayout" "us"
[     6.713] (**) Option "config_info" "devd:kbdmux"
[     6.713] (II) XINPUT: Adding extended input device "kbdmux" (type: KEYBOARD, id 6)
[     6.736] (II) config/devd: kbdmux is enabled, ignoring device ukbd0
[     6.736] (II) config/devd: kbdmux is enabled, ignoring device atkbd0
[     6.736] (II) config/devd: adding input device (null) (/dev/sysmouse)
[     6.736] (II) LoadModule: "mouse"
[     6.736] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[     6.738] (II) Module mouse: vendor="X.Org Foundation"
[     6.738]    compiled for 1.18.4, module version = 1.9.2
[     6.738]    Module class: X.Org XInput Driver
[     6.738]    ABI class: X.Org XInput driver, version 22.1
[     6.738] (II) Using input driver 'mouse' for 'sysmouse'
[     6.738] (**) sysmouse: always reports core events
[     6.738] (**) Option "Device" "/dev/sysmouse"
[     6.738] (==) sysmouse: Protocol: "Auto"
[     6.738] (**) sysmouse: always reports core events
[     6.738] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[     6.738] (**) sysmouse: ZAxisMapping: buttons 4 and 5
[     6.738] (**) sysmouse: Buttons: 5
[     6.738] (**) Option "config_info" "devd:sysmouse"
[     6.738] (II) XINPUT: Adding extended input device "sysmouse" (type: MOUSE, id 7)
[     6.738] (**) sysmouse: (accel) keeping acceleration scheme 1
[     6.738] (**) sysmouse: (accel) acceleration profile 0
[     6.738] (**) sysmouse: (accel) acceleration factor: 2.000
[     6.738] (**) sysmouse: (accel) acceleration threshold: 4
[     6.738] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[     6.738] (II) sysmouse: SetupAuto: protocol is SysMouse
[     9.096] (II) config/devd: kbdmux is enabled, ignoring device ukbd0
[     9.128] (II) config/devd: device /dev/ums0 already opened
[     9.128] (II) config/devd: ignoring device uhid0
```


----------



## Beeblebrox (Jun 3, 2017)

IDK how to debug this, but you can work around it by running an xrandr post-Xorg start shell script. Excellent how-to: https://wiki.archlinux.org/index.php/Xrandr


----------



## gdwatson (Jun 4, 2017)

xrandr seems to be using the modes already defined on the monitor, and since the mode gets stripped out by the driver xrandr can't find it.


```
gdwatson@dweorh:~$ xrandr --output DVI-D-0 --mode 1280x1024 --rate 60
xrandr: cannot find mode 1280x1024
gdwatson@dweorh:~$
```


----------



## Beeblebrox (Jun 4, 2017)

Did you read the sction "Troubleshooting: Adding undetected resolutions"?

`$ cvt 1280 1024` will give something like:

```
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
```

Using the output from above, define new mode by ~/bin/xset.sh

```
#!/bin/sh
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA-0 1280x1024_60.00
xrandr --output VGA-0 --mode 1280x1024_60.00
```


----------



## gdwatson (Jun 6, 2017)

I clearly didn't look through it long enough.    Thanks for the reminder; that page has a lot of nVidia-specific stuff that's helpful, too.

Notes for future searchers:  Those HorizSync and VertRefresh lines in the monitor configuration are essential; it won't work without them.  The EDID configuration lines were mostly a distraction and I was able to remove them in the end.


----------

