New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sudden tearing in videos (youtube etc) as if a "vsync issue" was afoot when trying to get two monitors with different refresh rates work in dual-head config (esp if another, unrelated VM is highly active) #3194

Open
tonsimple opened this Issue Oct 19, 2017 · 15 comments

Comments

Projects
None yet
7 participants
@tonsimple

tonsimple commented Oct 19, 2017

Qubes OS version:

R 3.2

Affected TemplateVMs:

dom0 ?


Steps to reproduce the behavior:

Just play a video on youtube using intel embedded driver on Skylake while having two screens (144 hz one and a 60 hz one)

The window with movie (youtube in a browser) is on 144hz screen.

Expected behavior:

No VSYNC issue, no tearing, movie plays smooth.

Actual behavior:

Spontaneous bursts of tearing as consistent with "vsync not working right"

General notes:

Two 60hz screens and 144 Hz + 144 Hz screen have so far not produced this issue.

P.S.: adding the following to xorg.conf alleviated issue MASSIVELY in firefox and "moderately" in chrome.

Option "TearFree" "true"
Option "TrippleBuffer" "true"
Option "Vsync" "true"

More interestingly, according to https://www.vsynctester.com/ the issue becomes more pronounced if some "heavy lifting" is done in another (unrelated) VM.
Is a VM being able to affect VSYNC (and, seemingly, only VSYNC since no dropped frames) in another VM... normal?


Related issues:

@tonsimple tonsimple changed the title from Sudden tearing in videos (youtube etc) as if a "vsync issue" was afoot when trying to get two monitors with different refresh rates work in dual-head config to Sudden tearing in videos (youtube etc) as if a "vsync issue" was afoot when trying to get two monitors with different refresh rates work in dual-head config (esp if another, unrelated VM is highly active) Oct 19, 2017

@andrewdavidwong andrewdavidwong added this to the Release 3.2 updates milestone Oct 19, 2017

@Yethal

This comment has been minimized.

Show comment
Hide comment
@Yethal

Yethal Oct 21, 2017

Where exactly did you modify the file? In dom0? In templates? And in which directory?

Yethal commented Oct 21, 2017

Where exactly did you modify the file? In dom0? In templates? And in which directory?

@tonsimple

This comment has been minimized.

Show comment
Hide comment
@tonsimple

tonsimple Oct 21, 2017

in dom0
/etc/X11/xorg.conf

in dom0
/etc/X11/xorg.conf

@Yethal

This comment has been minimized.

Show comment
Hide comment
@Yethal

Yethal Oct 22, 2017

I don't have that file there.

Yethal commented Oct 22, 2017

I don't have that file there.

@tonsimple

This comment has been minimized.

Show comment
Hide comment
@tonsimple

tonsimple Oct 22, 2017

Weird, I do, and its settings are working (easily tested by trying to delete all screen entries, which prevents xfce start (I did try it just to make sure my file actually works)

Weird, I do, and its settings are working (easily tested by trying to delete all screen entries, which prevents xfce start (I did try it just to make sure my file actually works)

@Yethal

This comment has been minimized.

Show comment
Hide comment
@Yethal

Yethal Oct 22, 2017

[Yethal@dom0 ~]$ ls /etc/X11
applnk fontpath.d xinit Xmodmap xorg.conf.d Xresources
Is this file supposed to be autocreated at some point during the installation process?

Yethal commented Oct 22, 2017

[Yethal@dom0 ~]$ ls /etc/X11
applnk fontpath.d xinit Xmodmap xorg.conf.d Xresources
Is this file supposed to be autocreated at some point during the installation process?

@tonsimple

This comment has been minimized.

Show comment
Hide comment
@tonsimple

tonsimple Oct 22, 2017

I don't know, but I think it "was there for me" when I recently re-installed qubes due to one of ASUS's dumb weird BIOS bugs.
I think there's an x command to autocreate it if it is absent....

Edit: PS: I'll post a question about this to qubes-devel

tonsimple commented Oct 22, 2017

I don't know, but I think it "was there for me" when I recently re-installed qubes due to one of ASUS's dumb weird BIOS bugs.
I think there's an x command to autocreate it if it is absent....

Edit: PS: I'll post a question about this to qubes-devel

@samcv

This comment has been minimized.

Show comment
Hide comment
@samcv

samcv Feb 3, 2018

I am using 4.0-rc3, and by default XFCE is setup with vertical sync (vsync) disabled. May not be totally related to this issue, maybe I should open another issue to see if the default for that preference can be changed?

P.S. @tonsimple are you using KDE of XFCE?

samcv commented Feb 3, 2018

I am using 4.0-rc3, and by default XFCE is setup with vertical sync (vsync) disabled. May not be totally related to this issue, maybe I should open another issue to see if the default for that preference can be changed?

P.S. @tonsimple are you using KDE of XFCE?

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Feb 3, 2018

Member

I am using 4.0-rc3, and by default XFCE is setup with vertical sync (vsync) disabled. May not be totally related to this issue, maybe I should open another issue to see if the default for that preference can be changed?

Generally speaking, we try to respect upstream distro's default choices unless there's a specific reason not to. If having vsync disabled by default is best for most people, then it's not unreasonable to ask the minority to take a minute to change that setting, whereas it would be unreasonable to make the default worse for most people just so that a minority doesn't have to bother changing a setting. On the other hand, if the default is wrong in general (e.g., if having vsync enabled by default would actually be better for most XFCE users, regardless of whether they're also Qubes users), then it might be worth filing an issue with XFCE.

Member

andrewdavidwong commented Feb 3, 2018

I am using 4.0-rc3, and by default XFCE is setup with vertical sync (vsync) disabled. May not be totally related to this issue, maybe I should open another issue to see if the default for that preference can be changed?

Generally speaking, we try to respect upstream distro's default choices unless there's a specific reason not to. If having vsync disabled by default is best for most people, then it's not unreasonable to ask the minority to take a minute to change that setting, whereas it would be unreasonable to make the default worse for most people just so that a minority doesn't have to bother changing a setting. On the other hand, if the default is wrong in general (e.g., if having vsync enabled by default would actually be better for most XFCE users, regardless of whether they're also Qubes users), then it might be worth filing an issue with XFCE.

@brendanhoar

This comment has been minimized.

Show comment
Hide comment
@brendanhoar

brendanhoar Mar 4, 2018

FWIW, the following substantially improved youtube HD video viewing in my personal VM (using firefox) on a Thinkpad W520 with integrated (intel) graphics. The options may be specific to the intel driver.

  • Open Terminal in dom0
  • cd /etc/X11/xorg.conf.d/
  • sudo vi 10-display.conf
  • Put the following content in it (assumption you know vi basics)

Section "Device"
Identifier "Intel Graphics Card0"
Driver "intel"
Option "TearFree" "true"
Option "TripleBuffer" true"
Option "Vsync" "true"
EndSection

-- Save the file

If you make a typo (or if I did) and Xorg can't parse it, X11 won't load. You'll need to hit alt-f2, login as qubes-user and remove or rename the file without the conf extension and reboot to fix it. Ask me how I know... :)

I also enabled Qubes/System Tools/Windows Manager Tweaks/Compositor/"Synchronize drawing to the vertical blank" before the above, but that did not seem to make a difference. I haven't turned it off since making the above change, though.

FWIW, the following substantially improved youtube HD video viewing in my personal VM (using firefox) on a Thinkpad W520 with integrated (intel) graphics. The options may be specific to the intel driver.

  • Open Terminal in dom0
  • cd /etc/X11/xorg.conf.d/
  • sudo vi 10-display.conf
  • Put the following content in it (assumption you know vi basics)

Section "Device"
Identifier "Intel Graphics Card0"
Driver "intel"
Option "TearFree" "true"
Option "TripleBuffer" true"
Option "Vsync" "true"
EndSection

-- Save the file

If you make a typo (or if I did) and Xorg can't parse it, X11 won't load. You'll need to hit alt-f2, login as qubes-user and remove or rename the file without the conf extension and reboot to fix it. Ask me how I know... :)

I also enabled Qubes/System Tools/Windows Manager Tweaks/Compositor/"Synchronize drawing to the vertical blank" before the above, but that did not seem to make a difference. I haven't turned it off since making the above change, though.

@brendanhoar

This comment has been minimized.

Show comment
Hide comment
@brendanhoar

brendanhoar Mar 4, 2018

Clarification: this was under Qubes V4.0RC4

Clarification: this was under Qubes V4.0RC4

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 4, 2018

Member

Thanks for researching this @brendanhoar !
While considering something we could put in default installation, the above will break non-intel hardware. But I think using OutputClass should work:

Section "OutputClass"
    Identifier "Intel Graphics Card0"
    # not sure if should be "intel" or "i915"
    MatchDriver "i915"
    Option "TearFree" "true"
    Option "TripleBuffer" true"
    Option "Vsync" "true"
EndSection
Member

marmarek commented Mar 4, 2018

Thanks for researching this @brendanhoar !
While considering something we could put in default installation, the above will break non-intel hardware. But I think using OutputClass should work:

Section "OutputClass"
    Identifier "Intel Graphics Card0"
    # not sure if should be "intel" or "i915"
    MatchDriver "i915"
    Option "TearFree" "true"
    Option "TripleBuffer" true"
    Option "Vsync" "true"
EndSection
@samcv

This comment has been minimized.

Show comment
Hide comment
@samcv

samcv Mar 5, 2018

Personally it doesn't make sense to me to force the GPU driver settings into a less efficient and non-driver portable setting instead of changing the settings for the DE to use vsync. Changing the setting for XFCE would affect all video cards and not have to mess with any of the Xorg or driver settings. Forcing the drivers to use "TearFree" reduces performance and battery life needlessly. The simple solution is to have the DE use vsync instead of trying to get the GPU to correct for the DE's lack of using vsync itself.

On the Intel driver: TripleBuffer and VSync are already enabled by default. @brendanhoar referred to the setting as "Vsync" but it is actually "VSync" for the Intel GPU driver. It could possibly be case insensitive or the setting may be being ignored (since this setting defaults to being enabled).

samcv commented Mar 5, 2018

Personally it doesn't make sense to me to force the GPU driver settings into a less efficient and non-driver portable setting instead of changing the settings for the DE to use vsync. Changing the setting for XFCE would affect all video cards and not have to mess with any of the Xorg or driver settings. Forcing the drivers to use "TearFree" reduces performance and battery life needlessly. The simple solution is to have the DE use vsync instead of trying to get the GPU to correct for the DE's lack of using vsync itself.

On the Intel driver: TripleBuffer and VSync are already enabled by default. @brendanhoar referred to the setting as "Vsync" but it is actually "VSync" for the Intel GPU driver. It could possibly be case insensitive or the setting may be being ignored (since this setting defaults to being enabled).

@Yethal

This comment has been minimized.

Show comment
Hide comment
@Yethal

Yethal Mar 5, 2018

What about non-Intel GPUs? If it's as simple as single configuration file per vendor it would only be a matter of detecting the gpu via lspci/modprobe and choosing appropriate file.

Yethal commented Mar 5, 2018

What about non-Intel GPUs? If it's as simple as single configuration file per vendor it would only be a matter of detecting the gpu via lspci/modprobe and choosing appropriate file.

@brendanhoar

This comment has been minimized.

Show comment
Hide comment
@brendanhoar

brendanhoar Mar 5, 2018

Hi Sam,

Thanks for the information on the default settings for the Intel driver making some of my changes redundant (or ignored). I will do more testing with the settings later this week.

Also, I agree with your premise, if by DE you mean Desktop Environment: if a DE setting can handle it, we shouldn't need to modify the display driver settings.

So...

I thought I had already tried that by checking the Qubes/System Tools/Windows Manager Tweaks/Compositor/"Synchronize drawing to the vertical blank" setting, but that did not seem to reduce the tearing.

Can you think of another place in the DE that I should be adjusting this? Am I interpreting your "DE" correctly?

Thanks,
Brendan

Hi Sam,

Thanks for the information on the default settings for the Intel driver making some of my changes redundant (or ignored). I will do more testing with the settings later this week.

Also, I agree with your premise, if by DE you mean Desktop Environment: if a DE setting can handle it, we shouldn't need to modify the display driver settings.

So...

I thought I had already tried that by checking the Qubes/System Tools/Windows Manager Tweaks/Compositor/"Synchronize drawing to the vertical blank" setting, but that did not seem to reduce the tearing.

Can you think of another place in the DE that I should be adjusting this? Am I interpreting your "DE" correctly?

Thanks,
Brendan

@SurinameClubcard

This comment has been minimized.

Show comment
Hide comment
@SurinameClubcard

SurinameClubcard Jul 19, 2018

I'm running Qubes R4.0 on two systems. Both have only one, Intel based, video card. The first system has an rather old Intel HD 4600 chip (PCI-id 8086:0412), the second system has a pretty new Intel HD Graphics 630 (PCI-id 8086:591b). On the first system, setting "Synchronize drawing on the vertical blank" immediately fixed the tearing, on the second one nothing changed. It is (a bit annoyingly) visible when playing movies. I will experiment with above suggestions.

SurinameClubcard commented Jul 19, 2018

I'm running Qubes R4.0 on two systems. Both have only one, Intel based, video card. The first system has an rather old Intel HD 4600 chip (PCI-id 8086:0412), the second system has a pretty new Intel HD Graphics 630 (PCI-id 8086:591b). On the first system, setting "Synchronize drawing on the vertical blank" immediately fixed the tearing, on the second one nothing changed. It is (a bit annoyingly) visible when playing movies. I will experiment with above suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment