Bug 373268 - Application dependent tearing with OpenGL
Summary: Application dependent tearing with OpenGL
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: scene-opengl (show other bugs)
Version: 5.8.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-04 23:05 UTC by Curtis Seizert
Modified: 2016-12-06 17:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:
mgraesslin: NVIDIA+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Seizert 2016-12-04 23:05:54 UTC
Platform: Arch Linux x86-64, nvidia 375.20 driver, everything up to date.

Bug: Tearing that can become very severe with some applications (most noticeably vbox, which makes the entire rest of the screen rapidly flash.

Reproducibile: Always.

Steps to reproduce: Open most any application, but the worst are vbox and nvidia visual profiler.

More info: Previously this was completely fixed by using full screen repaints, but this no longer seems to work.  The problem is gone when using xrender, but so are a number of desktop effects.  As far as I can tell, the issue is the same whether using OpenGL 2.0 or 3.1, and none of the vsync options are helpful.  Unfortunately I cannot get a screenshot of this.
Comment 1 Martin Flöser 2016-12-05 17:47:11 UTC
Please provide the output of
qdbus org.kde.KWin /KWin supportInformation

Did you change any settings of the NVIDIA driver?
Comment 2 Curtis Seizert 2016-12-05 18:20:54 UTC
I have overclocked the graphics card, but the problem still occurs when it is not overclocked.

Here is the output:
KWin Support Information:
The following information should be used when requesting support on e.g. http://forum.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like http://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 5.8.4
Qt Version: 5.7.0
Qt compile version: 5.7.0
XCB compile version: 1.12

Operation Mode: X11 only

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_INPUT: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 11804000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.oxygen
Theme: 
Blur: 0
onAllDesktopsAvailable: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 16
font: Gadugi,12,-1,5,50,0,0,0,0,0
smallSpacing: 4
largeSpacing: 16

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 20
windowSnapZone: 20
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 2
glSmoothScale: 2
colorCorrected: false
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 0
glPlatformInterface: 1
windowsBlockCompositing: false

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  yes
Number of Screens: 2

Screen 0:
---------
Name: DP-0
Geometry: 3840,0,3840x2160
Refresh Rate: 60

Screen 1:
---------
Name: DP-2
Geometry: 0,0,3840x2160
Refresh Rate: 60


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1070/PCIe/SSE2
OpenGL version string: 3.1.0 NVIDIA 375.20
OpenGL platform interface: GLX
OpenGL shading language version string: 1.40 NVIDIA via Cg compiler
Driver: NVIDIA
Driver version: 375.20
GPU class: Unknown
OpenGL version: 3.1
GLSL version: 1.40
X server version: 1.18.4
Linux kernel version: 4.8.10
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
zoom
slidingpopups
kwin4_effect_login
wobblywindows
slideback
screenshot
magiclamp
kwin4_effect_windowaperture
glide
kwin4_effect_translucency
flipswitch
desktopgrid
cubeslide
cube
coverswitch
kwin4_effect_morphingpopups
kwin4_effect_fade
kwin4_effect_zoomdesktop
kwin4_effect_cooleffect
slidingtooltips
presentwindows
kwin4_effect_dialogparent
highlightwindow
blur
contrast
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
enableFocusTracking: false
followFocus: true
focusDelay: 350
moveFactor: 20
targetZoom: 1

slidingpopups:
fadeInTime: 150
fadeOutTime: 250

kwin4_effect_login:

wobblywindows:
stiffness: 0.15
drag: 0.8
moveFactor: 0.1
xTesselation: 20
yTesselation: 20
minVelocity: 0
maxVelocity: 1000
stopVelocity: 0.5
minAcceleration: 0
maxAcceleration: 1000
stopAcceleration: 0.5
moveEffectEnabled: true
openEffectEnabled: false
closeEffectEnabled: false
moveWobble: true
resizeWobble: true

slideback:

screenshot:

magiclamp:
animationDuration: 250

kwin4_effect_windowaperture:

glide:
duration: 350
effect: 0
angle: -90

kwin4_effect_translucency:

flipswitch:
tabBox: false
tabBoxAlternative: false
duration: 200
angle: 30
xPosition: 0.33000001311302185
yPosition: 1
windowTitle: true

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

cubeslide:
rotationDuration: 500
dontSlidePanels: false
dontSlideStickyWindows: false
usePagerLayout: true
useWindowMoving: false

cube:
cubeOpacity: 0.800000011920929
opacityDesktopOnly: false
displayDesktopName: true
reflection: true
rotationDuration: 500
backgroundColor: #000000
capColor: #d4d7d0
paintCaps: true
closeOnMouseRelease: false
zPosition: 100
useForTabBox: false
invertKeys: false
invertMouse: false
capDeformationFactor: 0
useZOrdering: false
texturedCaps: true

coverswitch:
animationDuration: 200
animateSwitch: true
animateStart: true
animateStop: true
reflection: true
windowTitle: true
zPosition: 900
primaryTabBox: true
secondaryTabBox: false

kwin4_effect_morphingpopups:

kwin4_effect_fade:

kwin4_effect_zoomdesktop:

kwin4_effect_cooleffect:

slidingtooltips:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

kwin4_effect_dialogparent:

highlightwindow:

blur:
blurRadius: 12
cacheTexture: true

contrast:

startupfeedback:
type: 3

screenedge:

kscreen:
Comment 3 Martin Flöser 2016-12-05 19:11:54 UTC
You have two screens. Due to the way how X works we can only vsync to one screen. This could (!) explain the problem.

It might be worth a try to disconnect one and check whether it still tears.
Comment 4 Curtis Seizert 2016-12-05 21:37:40 UTC
What I have set up at the moment is one screen that is actually connected to two displays and one screen that is just a dummy.  This is so that I can overclock my graphics card that is not driving a display.

When I disconnect one of my monitors, this does not resolve the problem, but if I comment out the relevant sections of my xorg.conf file (see below), this does solve the problem.  Unfortunately, it also makes me unable to overclock my second GPU, which I would really like to be able to do.

Is there a way to specify which screen gets vsynced?  That would presumably solve my problem and allow me to overclock my second GPU as well.

Below is the xorg.conf file that results in no tearing.  If I remove the comments, there is tearing.

xorg.conf:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
#    Screen         "Screen1"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG Ultra HD"
    HorizSync       30.0 - 135.0
    VertRefresh     56.0 - 61.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG Ultra HD"
    HorizSync       30.0 - 135.0
    VertRefresh     56.0 - 61.0
    Option         "DPMS"
EndSection

#Section "Monitor"
#    Identifier     "Monitor2"
#EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1070"
    BusID          "PCI:3:0:0"
    Option         "UseEdidDpi" "FALSE"
    Option         "DPI" "144x144"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1080"
    BusID          "PCI:4:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Coolbits" "12"
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-4"
    Option         "metamodes" "DP-0: nvidia-auto-select +3840+0, DP-2: nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

#Section "Screen"
#    Identifier     "Screen1"
#    Device         "Device1"
#    Monitor        "Monitor2"
#    Option         "Coolbits" "12"
#EndSection
Comment 5 Martin Flöser 2016-12-06 17:58:43 UTC
I'm sorry, but such a setup is outside the scope of what we can support. The tearing is related to this setup with fake/dummy screens. This obviously breaks Vsync.

Whether or not it's possible to specify to which screen to vsync is something I do not know and also not of relevance for KWin. That's something you need to check in the nvidia driver options.