Destroy dmabuf implementation on EGL backend going down

Summary:
We leak memory if we do not destroy the dmabuf implementation on EGL backend
going down.

Also this makes sure everything is cleaned up on shutdown.

FIXED-IN: 5.17.4

BUG: 413637

Test Plan: Compiles, settings change and shutdown ok.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25577
icc-effect-5.17.5
Roman Gilg 2019-11-27 20:45:04 +01:00
parent fd69924e51
commit e2d5ec606a
4 changed files with 11 additions and 4 deletions

View File

@ -60,7 +60,7 @@ public:
using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags;
explicit LinuxDmabuf();
~LinuxDmabuf();
~LinuxDmabuf() override;
KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
uint32_t format,

View File

@ -66,7 +66,10 @@ AbstractEglBackend::AbstractEglBackend()
connect(Compositor::self(), &Compositor::aboutToDestroy, this, &AbstractEglBackend::unbindWaylandDisplay);
}
AbstractEglBackend::~AbstractEglBackend() = default;
AbstractEglBackend::~AbstractEglBackend()
{
delete m_dmaBuf;
}
void AbstractEglBackend::unbindWaylandDisplay()
{
@ -171,7 +174,8 @@ void AbstractEglBackend::initWayland()
}
}
EglDmabuf::factory(this);
Q_ASSERT(!m_dmaBuf);
m_dmaBuf = EglDmabuf::factory(this);
}
void AbstractEglBackend::initClientExtensions()

View File

@ -39,6 +39,8 @@ class BufferInterface;
namespace KWin
{
class EglDmabuf;
class KWIN_EXPORT AbstractEglBackend : public QObject, public OpenGLBackend
{
Q_OBJECT
@ -85,6 +87,7 @@ private:
EGLContext m_context = EGL_NO_CONTEXT;
EGLConfig m_config = nullptr;
QList<QByteArray> m_clientExtensions;
EglDmabuf *m_dmaBuf = nullptr;
};
class KWIN_EXPORT AbstractEglTexture : public SceneOpenGLTexturePrivate

View File

@ -77,7 +77,7 @@ public:
static EglDmabuf* factory(AbstractEglBackend *backend);
explicit EglDmabuf(AbstractEglBackend *backend);
~EglDmabuf();
~EglDmabuf() override;
KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
uint32_t format,