Skip to content

WIP: Cache QML textures instead of QImages

Basically all the time spent rendering the timeline is spent uploading QImages to textures (attach the QML profiler while kdenlive is running with a medium sized project to see), so I think it makes sense to switch to caching QSGTextures instead of QImages.

One problem is that the Qt scenegraph does cache, both images and textures (so today it is already cached thrice), but there is no way to tune the tiny cache size (that I could find), so we more or less need to do the entire caching thing ourselves. And it is further complicated by the scenegraph wanting to have full ownership over everything, so we can't just cache the QSGTextures we hand to the scenegraph directly as they will be deleted.

An alternative would be to create our own QQuickItem class, which can then just render a QSGTexture from the cache in its updatePaintNode() function.

Also, I think it might make more sense to use a plain QCache, instead of modifying Cache_t like I did here? And I should've used a shared pointer...

This patch doesn't really work that well, it fails to fetch the thumbnail textures sometimes (and I think I missed some checking that we fetched texture for the correct window from the cache). But its mostly to illustrate my idea, so feel free to close it).

Merge request reports