Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Nvidia Optimus + screen tearing + sync to vblank
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 166

PostPosted: Fri Oct 17, 2014 10:19 pm    Post subject: Nvidia Optimus + screen tearing + sync to vblank Reply with quote

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.
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 166

PostPosted: Sat Oct 18, 2014 7:37 am    Post subject: Reply with quote

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:

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:

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:

CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True


And these entries in ~/.nvidia-settings-rc
Code:

0/SyncToVBlank=1
0/AllowFlipping=1


All to no avail. Thanks in advance.
Back to top
View user's profile Send private message
mf2
n00b
n00b


Joined: 14 Jun 2007
Posts: 43

PostPosted: Sun Oct 19, 2014 11:45 am    Post subject: Reply with quote

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:

__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]
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 166

PostPosted: Sun Oct 19, 2014 8:07 pm    Post subject: Reply with quote

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

Code:

__GL_SYNC_TO_VBLANK=True
__GL_SYNC_DISPLAY_DEVICE="NVIDIA-0"


As my .xinitrc is the following:

Code:

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


And:
Code:

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:
Quote:

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:

[    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:

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
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon Oct 20, 2014 9:40 am    Post subject: Reply with quote

http://wiki.gentoo.org/wiki/NVIDIA_Driver_with_Optimus_Laptops
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 166

PostPosted: Mon Oct 20, 2014 6:33 pm    Post subject: Reply with quote

Quote:

http://wiki.gentoo.org/wiki/NVIDIA_Driver_with_Optimus_Laptops


Well, I used that guide to get optimus running in first place, but how does this address my issue?
Back to top
View user's profile Send private message
Xywa
Veteran
Veteran


Joined: 23 Jul 2005
Posts: 1631
Location: /mnt/Gentoo/Europe

PostPosted: Sun Jan 18, 2015 9:29 am    Post subject: Re: Nvidia Optimus + screen tearing + sync to vblank Reply with quote

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:
$ 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:
$ cat .xinitrc
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec startkde


Code:
$ 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:
Quote:
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.

Quote:
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/topic/775691/vsync-issue-nvidia-prime-ux32vd-with-gt620-m-/
Back to top
View user's profile Send private message
arosboro
n00b
n00b


Joined: 19 Aug 2003
Posts: 73
Location: Pennsylvania, USA

PostPosted: Wed Jun 10, 2015 4:03 pm    Post subject: Nvidia-Prime Reply with quote

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
Back to top
View user's profile Send private message
Xywa
Veteran
Veteran


Joined: 23 Jul 2005
Posts: 1631
Location: /mnt/Gentoo/Europe

PostPosted: Thu Jul 09, 2015 7:07 am    Post subject: Reply with quote

Hi,

Any news how to fix tearing on nvidia optimus cards? Any new driver or other solution?
Back to top
View user's profile Send private message
Xywa
Veteran
Veteran


Joined: 23 Jul 2005
Posts: 1631
Location: /mnt/Gentoo/Europe

PostPosted: Thu Feb 04, 2016 7:15 am    Post subject: Re: Nvidia Optimus + screen tearing + sync to vblank Reply with quote

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/topic/775691/linux/vsync-issue-nvidia-prime-ux32vd-with-gt620-m-/4
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum