Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

Nvidia Optimus + screen tearing + sync to vblank

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
Arthanis
Apprentice
Apprentice
Posts: 166
Joined: Fri Mar 21, 2008 5:09 am

Nvidia Optimus + screen tearing + sync to vblank

  • Quote

Post by Arthanis » Fri Oct 17, 2014 10:19 pm

I'm using proprietary nvidia-drivers with optimus support, and I notice severe screen tearing (like there is no vertical sync at all), and when I run nvidia-settings, there is no sync to vblank option (to set vertical sync). Is there any way to enable it? If not, does that work using bumblebee/primus ? Thanks in advance.
Top
Arthanis
Apprentice
Apprentice
Posts: 166
Joined: Fri Mar 21, 2008 5:09 am

  • Quote

Post by Arthanis » Sat Oct 18, 2014 7:37 am

Well, here is what I discovered so far:

Xfce4 compositor doesn't support vsync, so no matter if I use bumblebee, primus, intel or nvidia, even though glxgears tells me that vsync is enabled (fps limited to 60), I get screen tearing. So, to that end, I just installed compton and it solved the problem with the intel driver and with primus/bumblebee.


The problem is that, at least here, primus/bumblebee gives me a serious performance hit, so I would like to use nvidia-only. But when I enable nvidia-only, there is no vsync at all. Does anyone know why?

Code: Select all

claudio@g1310max ~ $ glxgears 
29850 frames in 5.0 seconds = 5969.593 FPS
33478 frames in 5.0 seconds = 6695.498 FPS
I also tried enabling triple buffering by adding these entries in my xorg.conf in each Device:

Code: Select all

Section "Device" 
Identifier	"nvidia" 
Driver	"nvidia" 
BusID	"PCI:1:0:0" 
Option "TripleBuffer" "True"
EndSection 

Section "Device" 
Identifier	"intel" 
Driver	"modesetting" 
BusID	"PCI:0:2:0" 
Option "TripleBuffer" "True"
EndSection 
As well as adding in /etc/environment :

Code: Select all

CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True
And these entries in ~/.nvidia-settings-rc

Code: Select all

0/SyncToVBlank=1
0/AllowFlipping=1
All to no avail. Thanks in advance.
Top
mf2
n00b
n00b
Posts: 51
Joined: Thu Jun 14, 2007 7:22 pm

  • Quote

Post by mf2 » Sun Oct 19, 2014 11:45 am

I have no idea how NVIDIA Optimus work, but if it uses the standard nvidia driver you will need to export the nvidia-specific env variables:

Code: Select all

__GL_SYNC_TO_VBLANK=1
__GL_SYNC_DISPLAY_DEVICE="DVI-D-0"
I am actually not sure if one needs to put something like "DVI-D-0" (display name by xrandr) or "DFP-0" (display name by nvidia driver) into the __GL_SYNC_DISPLAY_DEVICE variable.
Anyway, you can read more about this in the nvidia driver doc, chapter 11 (should have been installed with the driver into /usr/doc).[/code]
Top
Arthanis
Apprentice
Apprentice
Posts: 166
Joined: Fri Mar 21, 2008 5:09 am

  • Quote

Post by Arthanis » Sun Oct 19, 2014 8:07 pm

Thanks for the reply. Well, I tried this at /etc/environment:

Code: Select all

__GL_SYNC_TO_VBLANK=True
__GL_SYNC_DISPLAY_DEVICE="NVIDIA-0" 
As my .xinitrc is the following:

Code: Select all

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec ck-launch-session startxfce4

And:

Code: Select all

xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x1f5 cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
[/code]
But taken from nvidia documentation:
You can use the environment variable __GL_SYNC_DISPLAY_DEVICE to specify to which display device OpenGL should sync. You should set this environment variable to the name of a display device; for example "CRT-1". Look for the line "Connected display device(s):" in your X log file for a list of the display devices present and their names.
But when I do it, I get nothing relevant:

Code: Select all

[    15.693] (II) NVIDIA(0): Creating default Display subsection in Screen section
[    15.693] (**) NVIDIA(0): Option "UseDisplayDevice" "none"
[    15.694] (**) NVIDIA(0): Option "UseDisplayDevice" set to "none"; enabling NoScanout
[    16.044] (--) NVIDIA(0): Valid display device(s) on GeForce GTX 860M at PCI:1:0:0
[    16.044] (WW) NVIDIA(0): Unable to get display device for DPI computation.
[    16.060] (II) modesetting(G0): Output DisplayPort-1-0 has no monitor section
[    16.060] (II) modesetting(G0): Digital Display Input
[    16.060] (II) modesetting(G0): Digital interface is DisplayPort
[    16.076] (II) modesetting(G0): EDID for output DisplayPort-1-0
[    16.079] (WW) modesetting(G0): Option "UseDisplayDevice" is not used

Or:

Code: Select all

grep -ir device /var/log/Xorg.0.log
[    15.564] (**) |   |-->Device "nvidia"
[    15.564] (**) |-->Inactive Device "intel"
[    15.564] (==) Automatically adding devices
[    15.564] (==) Automatically enabling devices
[    15.564] (==) Automatically adding GPU devices
[    15.566] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[    15.566] (II) xfree86: Adding drm device (/dev/dri/card1)
[    15.566] (II) xfree86: Adding drm device (/dev/dri/card0)
[    15.693] (**) NVIDIA(0): Option "UseDisplayDevice" "none"
[    15.694] (**) NVIDIA(0): Option "UseDisplayDevice" set to "none"; enabling NoScanout
[    16.044] (--) NVIDIA(0): Valid display device(s) on GeForce GTX 860M at PCI:1:0:0
[    16.044] (WW) NVIDIA(0): Unable to get display device for DPI computation.
[    16.079] (WW) modesetting(G0): Option "UseDisplayDevice" is not used
[    18.399] (II) config/udev: Adding input device Power Button (/dev/input/event3)
[    18.400] (**) evdev: Power Button: Device: "/dev/input/event3"
[    18.400] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3"
[    18.400] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
[    18.412] (II) config/udev: Adding input device Video Bus (/dev/input/event5)
[    18.412] (**) evdev: Video Bus: Device: "/dev/input/event5"
[    18.412] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:01/input/input5/event5"
[    18.412] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 7)
[    18.412] (II) config/udev: Adding input device Video Bus (/dev/input/event4)
[    18.412] (**) evdev: Video Bus: Device: "/dev/input/event4"
[    18.412] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:4d/LNXVIDEO:00/input/input4/event4"
[    18.412] (II) XINPUT: Adding extended input device "Video Bus" (type: KEYBOARD, id 8)
[    18.413] (II) config/udev: Adding input device Power Button (/dev/input/event0)
[    18.413] (**) evdev: Power Button: Device: "/dev/input/event0"
[    18.413] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input0/event0"
[    18.413] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 9)
[    18.413] (II) config/udev: Adding input device Lid Switch (/dev/input/event2)
[    18.413] (II) No input driver specified, ignoring this device.
[    18.413] (II) This device may have been added with another device file.
[    18.413] (II) config/udev: Adding input device Sleep Button (/dev/input/event1)
[    18.413] (**) evdev: Sleep Button: Device: "/dev/input/event1"
[    18.413] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input1/event1"
[    18.413] (II) XINPUT: Adding extended input device "Sleep Button" (type: KEYBOARD, id 10)
[    18.413] (II) config/udev: Adding drm device (/dev/dri/card1)
[    18.413] (II) config/udev: Adding drm device (/dev/dri/card0)
[    18.413] (II) config/udev: Adding input device HDA Intel HDMI HDMI (/dev/input/event8)
[    18.413] (II) No input driver specified, ignoring this device.
[    18.413] (II) This device may have been added with another device file.
[    18.414] (II) config/udev: Adding input device HDA Intel PCH Mic (/dev/input/event10)
[    18.414] (II) No input driver specified, ignoring this device.
[    18.414] (II) This device may have been added with another device file.
[    18.414] (II) config/udev: Adding input device HDA Intel PCH Front Headphone (/dev/input/event9)
[    18.414] (II) No input driver specified, ignoring this device.
[    18.414] (II) This device may have been added with another device file.
[    18.414] (II) config/udev: Adding input device AT Translated Set 2 keyboard (/dev/input/event6)
[    18.414] (**) evdev: AT Translated Set 2 keyboard: Device: "/dev/input/event6"
[    18.414] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio0/input/input6/event6"
[    18.414] (II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD, id 11)
[    18.414] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/event7)
[    18.415] (**) Option "Device" "/dev/input/event7"
[    18.435] (II) synaptics: SynPS/2 Synaptics TouchPad: ignoring touch events for semi-multitouch device
[    18.445] (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio2/input/input12/event7"
[    18.445] (II) XINPUT: Adding extended input device "SynPS/2 Synaptics TouchPad" (type: TOUCHPAD, id 12)
[    18.446] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/mouse0)
[    18.446] (**) SynPS/2 Synaptics TouchPad: Ignoring device from InputClass "touchpad ignore duplicates"
Any tips on finding the device to sync? Thanks in advance
Top
Roman_Gruber
Advocate
Advocate
Posts: 3854
Joined: Tue Oct 03, 2006 8:43 am
Location: Austro Bavaria

  • Quote

Post by Roman_Gruber » Mon Oct 20, 2014 9:40 am

http://wiki.gentoo.org/wiki/NVIDIA_Driv ... us_Laptops
Top
Arthanis
Apprentice
Apprentice
Posts: 166
Joined: Fri Mar 21, 2008 5:09 am

  • Quote

Post by Arthanis » Mon Oct 20, 2014 6:33 pm

http://wiki.gentoo.org/wiki/NVIDIA_Driv ... us_Laptops
Well, I used that guide to get optimus running in first place, but how does this address my issue?
Top
Xywa
Veteran
Veteran
User avatar
Posts: 1631
Joined: Sat Jul 23, 2005 2:00 pm
Location: /mnt/Gentoo/Europe

Re: Nvidia Optimus + screen tearing + sync to vblank

  • Quote

Post by Xywa » Sun Jan 18, 2015 9:29 am

Arthanis wrote:I'm using proprietary nvidia-drivers with optimus support, and I notice severe screen tearing (like there is no vertical sync at all), and when I run nvidia-settings, there is no sync to vblank option (to set vertical sync). Is there any way to enable it? If not, does that work using bumblebee/primus ? Thanks in advance.
Hi,

I have the same problem. I used to use bumblebee + primusrum, and there was no tearing (especially in games).

Now I have the proper optimus driver, there is more fps in games, but terrible tearing. The guys who made primus were known about fantastic performance with tearing (in comparation to eg. optirun), so maybe we should ask them how to configure nvidia without bumblebee, so we could have no tearing?

I have (works in Mint):

Code: Select all

$ cat /etc/environment 
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True

Code: Select all

$ cat .xinitrc 
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startkde

Code: Select all

$ xrandr --listproviders 
Providers: number : 2
Provider 0: id: 0x2b0 cap: 0x1, Source Output crtcs: 2 outputs: 1 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x45 cap: 0x2, Sink Output crtcs: 2 outputs: 4 associated providers: 1 name:modesetting
UPDATE

I have found this:
When prime is enabled, there is currently no synchronization between the source device producing the pixels and the sink device reading them. I.e., in a typical NVIDIA + Intel configuration, the Intel chip just scans out the shared buffer constantly, without regard to when the pixels are copied into it.
The README mentions this in Chapter 32, "Offloading Graphics Display with RandR 1.4":
Caveats

There is no synchronization between the images rendered by the NVIDIA GPU and the output device. This means that the output device can start reading the next frame of video while it is still being updated, producing a graphical artifact known as “tearing”. Tearing is currently expected due to limitations in the design of the X.Org X server.
Aaron Plattner
NVIDIA Linux Graphics
#2
Posted 09/17/2014 03:25 PM
https://devtalk.nvidia.com/default/topi ... -gt620-m-/
Top
arosboro
n00b
n00b
User avatar
Posts: 73
Joined: Tue Aug 19, 2003 3:49 am
Location: Pennsylvania, USA
Contact:
Contact arosboro
Website

Nvidia-Prime

  • Quote

Post by arosboro » Wed Jun 10, 2015 4:03 pm

Hi,

I see ubuntu users have an nvidia-prime package https://github.com/tseliot/nvidia-prime that allows them to switch graphics between intel and nvidia (saving battery) and configure monitors with nvidia-settings.

Is it possible to use something like these binaries in gentoo?

It adds a prime section to nvidia-settings that you can turn on. My friend uses ubuntu, and it seems he does not have any tearing issues. He can use hdmi as well, and has 3 monitors working without issue.
Andrew Rosborough
I run on a Dell Latitude with a Core i5 and 8GB Ram
Top
Xywa
Veteran
Veteran
User avatar
Posts: 1631
Joined: Sat Jul 23, 2005 2:00 pm
Location: /mnt/Gentoo/Europe

  • Quote

Post by Xywa » Thu Jul 09, 2015 7:07 am

Hi,

Any news how to fix tearing on nvidia optimus cards? Any new driver or other solution?
Top
Xywa
Veteran
Veteran
User avatar
Posts: 1631
Joined: Sat Jul 23, 2005 2:00 pm
Location: /mnt/Gentoo/Europe

Re: Nvidia Optimus + screen tearing + sync to vblank

  • Quote

Post by Xywa » Thu Feb 04, 2016 7:15 am

Arthanis wrote:I'm using proprietary nvidia-drivers with optimus support, and I notice severe screen tearing (like there is no vertical sync at all), and when I run nvidia-settings, there is no sync to vblank option (to set vertical sync). Is there any way to enable it? If not, does that work using bumblebee/primus ? Thanks in advance.
Looks like tearing with Nvidia Optimus will be fixed in 4.5 kernel:
https://devtalk.nvidia.com/default/topi ... gt620-m-/4
Top
Post Reply

10 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic