Commit 33fad70c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

platforms/drm: Fix initialization of EGL displays

Currently, every time compositing is restarted, both the gbm and the egl
streams backend will re-obtain the EGLDisplay object.

This is wrong because the core assumption is that the EGL display doesn't
change once it has been obtained.
parent a195223a
......@@ -13,6 +13,9 @@
#include <qobject.h>
#include <QVector>
#include <epoxy/egl.h>
#include <fixx11h.h>
#include "drm_buffer.h"
struct gbm_device;
......@@ -58,6 +61,10 @@ public:
gbm_device *gbmDevice() const {
return m_gbmDevice;
}
EGLDisplay eglDisplay() const {
return m_eglDisplay;
}
QVector<DrmPlane*> planes() const {
return m_planes;
......@@ -66,6 +73,10 @@ public:
void setGbmDevice(gbm_device *d) {
m_gbmDevice = d;
}
void setEglDisplay(EGLDisplay display) {
m_eglDisplay = display;
}
DrmDumbBuffer *createBuffer(const QSize &size) const {
return new DrmDumbBuffer(m_fd, size);
......@@ -95,6 +106,7 @@ private:
bool m_atomicModeSetting;
bool m_useEglStreams;
gbm_device* m_gbmDevice;
EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
// all available planes: primarys, cursors and overlays
QVector<DrmPlane*> m_planes;
......
......@@ -74,7 +74,7 @@ void EglGbmBackend::cleanupOutput(Output &output)
bool EglGbmBackend::initializeEgl()
{
initClientExtensions();
EGLDisplay display = eglDisplay();
EGLDisplay display = m_gpu->eglDisplay();
// Use eglGetPlatformDisplayEXT() to get the display pointer
// if the implementation supports it.
......@@ -98,6 +98,7 @@ bool EglGbmBackend::initializeEgl()
m_gpu->setGbmDevice(device);
display = eglGetPlatformDisplayEXT(platform, device, nullptr);
m_gpu->setEglDisplay(display);
}
if (display == EGL_NO_DISPLAY) {
......
......@@ -121,7 +121,7 @@ void EglStreamBackend::cleanupOutput(const Output &o)
bool EglStreamBackend::initializeEgl()
{
initClientExtensions();
EGLDisplay display = eglDisplay();
EGLDisplay display = m_gpu->eglDisplay();
if (display == EGL_NO_DISPLAY) {
if (!hasClientExtension(QByteArrayLiteral("EGL_EXT_device_base")) &&
!(hasClientExtension(QByteArrayLiteral("EGL_EXT_device_query")) &&
......@@ -157,6 +157,7 @@ bool EglStreamBackend::initializeEgl()
display = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, device, platformAttribs);
break;
}
m_gpu->setEglDisplay(display);
}
if (display == EGL_NO_DISPLAY) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment