Bug 365946 - Use of same Open GL Texture by two windows
Summary: Use of same Open GL Texture by two windows
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-21 13:21 UTC by David Edmundson
Modified: 2016-08-09 08:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edmundson 2016-07-21 13:21:45 UTC
Some user on Reddit complained of black squares/missing text.
I think we've seen other reports, particularly the missing text.

Download http://static.davidedmundson.co.uk/plasmashell.trace

and open qapitrace

Follow texture 97 - It ends up being used by two windows at once for different things

Chronological history:

====
frame 90 (THUMBNAIL 1)
creates texture 97


*EVENT*
(user mouse overs the firefox tab in the taskbar.
so we're replace the thumbnails AND start to animate the firefox icon in the taskbar) in two windows
*EVENT*

====

frame 109 (TASKBAR:) deletes texture 97 (probably destruction of window Thumbnail1?)
frame 109 creates new texture 97 - a slightly highlighted firefox icon

====

frame 110 (THUMBNAIL 2)
deletes textures 97 (because reasons?)
uploads new texture 97

uses glXCreatePixmap so it *must* be the WindowThumbnail item

apitrace reports bug uploading - but that makes sense if the source is some other window which we don't have replaying

====

frame 112 (TASKBAR)
uses texture 97

API trace doesn't show that texture. (we should see two. Program 22 is fading node and we clearly try to use two textures)
implies texture 97 is broken - which is what I see on my read-through. It should be the highlighted firefox, yet it's clearly been deleted and replaced by that other window

====

Interesting that the relevant parts (a FadingNode and WindowThumbnail) are both KDE code (i.e more likely to be b0rked than Qt code)
Though this could also be coincidence because these by definition will be doing more dynamic things than static images.

Possible bugs:

 - Window thumbnail is deleting someone elses texture.
        I did make an RR about WindowThumbnail doing a double delete once. Maybe this user doesn't have that patch?

        EDIT: OBVIOUSLY NOT BECAUSE I NEVER MERGED IT!!!
 OR
    - FadingNode isn't holding on to the texture like it should
        Though it's a QScopedPointer round the QSGTexure though(?)
 OR
 -Threads
        It is two windows are both meddling with the same texture ID..possible?
        and discardPixmap() is called in multiple places in the main thread which is wrong (?)
 OR
 - Something else :)
Comment 1 David Edmundson 2016-08-09 08:37:05 UTC
Git commit 45a2f5a8286d9884fdf1161c09da5807c0528481 by David Edmundson.
Committed on 09/08/2016 at 08:37.
Pushed by davidedmundson into branch 'master'.

Don't delete gl texture twice in thumbnail

The QSGTextures are created with

window()->createTextureFromId(m_texture, QSize(w,h),
QuickWindow::TextureOwnsGLTexture));

this means we don't want to be deleting textures ourselves too, it will
be deleted when we delete the QSGTexture, which is a scoped pointer
inside our QSGNode.
Related: bug 355644
REVIEW: 126131

M  +2    -2    src/declarativeimports/core/windowthumbnail.cpp

http://commits.kde.org/plasma-framework/45a2f5a8286d9884fdf1161c09da5807c0528481