Fix DRM EGL crash regression
Summary:
In 47343fb
we made GBM buffer shared.
What we wanted to do was:
Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
Call the gbm_surface*() on that operator
Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT
What we did:
Cast the std::shared_ptr<GBMSurface> to a gbm_surface* then cast that
to void*.
This is just a garbage value and it crashes in Mesa when we do our first
paint.
I've replaced that with an explicit method then we can use shared_ptr's
-> operator rather than get() which does the right thing in a readable
way.
Test Plan:
It crashed after rebasing to master (for Aleix too)
No longer crashes
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8251
This commit is contained in:
parent
d6a906da92
commit
5bca058826
3 changed files with 4 additions and 4 deletions
|
@ -78,7 +78,7 @@ private Q_SLOTS:
|
||||||
void GbmSurfaceTest::testCreate()
|
void GbmSurfaceTest::testCreate()
|
||||||
{
|
{
|
||||||
GbmSurface surface(nullptr, 2, 3, 4, 5);
|
GbmSurface surface(nullptr, 2, 3, 4, 5);
|
||||||
gbm_surface *native = surface;
|
gbm_surface *native = surface.surface();
|
||||||
QVERIFY(surface);
|
QVERIFY(surface);
|
||||||
QCOMPARE(native->width, 2u);
|
QCOMPARE(native->width, 2u);
|
||||||
QCOMPARE(native->height, 3u);
|
QCOMPARE(native->height, 3u);
|
||||||
|
@ -91,7 +91,7 @@ void GbmSurfaceTest::testCreateFailure()
|
||||||
gbm_device dev{true};
|
gbm_device dev{true};
|
||||||
GbmSurface surface(&dev, 2, 3, 4, 5);
|
GbmSurface surface(&dev, 2, 3, 4, 5);
|
||||||
QVERIFY(!surface);
|
QVERIFY(!surface);
|
||||||
gbm_surface *native = surface;
|
gbm_surface *native = surface.surface();
|
||||||
QVERIFY(!native);
|
QVERIFY(!native);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ void EglGbmBackend::createOutput(DrmOutput *drmOutput)
|
||||||
qCCritical(KWIN_DRM) << "Create gbm surface failed";
|
qCCritical(KWIN_DRM) << "Create gbm surface failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
o.eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *)((gbm_surface*)o.gbmSurface.get()), nullptr);
|
o.eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *)(o.gbmSurface->surface()), nullptr);
|
||||||
if (o.eglSurface == EGL_NO_SURFACE) {
|
if (o.eglSurface == EGL_NO_SURFACE) {
|
||||||
qCCritical(KWIN_DRM) << "Create Window Surface failed";
|
qCCritical(KWIN_DRM) << "Create Window Surface failed";
|
||||||
o.gbmSurface.reset();
|
o.gbmSurface.reset();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
return m_surface != nullptr;
|
return m_surface != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator gbm_surface*() const {
|
gbm_surface* surface() const {
|
||||||
return m_surface;
|
return m_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue