Bug 368066 - Plasma causes X to leak video memory
Summary: Plasma causes X to leak video memory
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.7.3
Platform: Arch Linux Linux
: NOR major
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
: 368869 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-08-31 18:03 UTC by Ahmed Waheed
Modified: 2016-09-16 05:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Waheed 2016-08-31 18:03:18 UTC
Using kwin 5.7.4, but applies to 5.7.3, after few hours of usage (chrome, wine and hipchat) the system becomes unresponsive and after some tracking I noticed that running nvidia-smi prints that Xorg is using 7.5g of GPU memory.

Restarting kwin doesn't free that memory, only restarting X.

Reproducible: Always

Steps to Reproduce:
1. Use KF5.
2. Use the computer for few hours (Chrome, VSCode, HipChat4 and wine)


Actual Results:  
Random windows turns completely black and the system becomes mostly unresponsive until I kill X.

Expected Results:  
Well, not make X use up all my GPU memory.

This only happens with kwin, using Gnome 3 and LXDE with openbox does not trigger this bug.

nvidia-* 370.23, xorg-server 1.18.4, the card is Gigabyte G1 1080.
Comment 1 David Edmundson 2016-09-01 12:35:07 UTC
Confirmed, issue with previews and threaded render loops.  See my patch on Rb
Comment 2 Ahmed Waheed 2016-09-02 18:33:57 UTC
@David Edmundson  any chance I can workaround this bug until it is fixed?
Comment 3 David Edmundson 2016-09-03 08:31:55 UTC
Turn off window thumbnails in the task manager
Comment 4 David Edmundson 2016-09-03 08:33:52 UTC
Git commit 8e517b1578ad1e5988f440790f5048416a7dd68c by David Edmundson.
Committed on 03/09/2016 at 08:33.
Pushed by davidedmundson into branch 'master'.

WindowThumbnail: Do GL calls in the correct thread

WindowThumbnail did some open GL operations, discarding old textures, in
the GUI thread. Whislt it's not going to cause a threading issue (as
updatePaintNode always ran when the main thread was blocked) we're not
meant to mix threads with openGL contexts.

It also seems to have a GL leak on nvidia, which was previously masked
by the double delete fixed in
https://git.reviewboard.kde.org/r/126131/diff/2/
It seems only one worked, and in the applied version we went with the
wrong one.

This patch makes use of QQuickItem::releaseResources to delete the GL
textures on window change and destructor; it's then removed from
stopRedirecting so that start/stop redirecting handles xcb on the GUI
thread and updatePaintNode/discardPixmap is the GL stuff on the render
thread.

See http://doc.qt.io/qt-5/qquickitem.html#graphics-resource-handling

REVIEW: 128763

M  +114  -44   src/declarativeimports/core/windowthumbnail.cpp
M  +5    -1    src/declarativeimports/core/windowthumbnail.h

http://commits.kde.org/plasma-framework/8e517b1578ad1e5988f440790f5048416a7dd68c
Comment 5 Martin Flöser 2016-09-16 05:31:32 UTC
*** Bug 368869 has been marked as a duplicate of this bug. ***