backends/drm: delete egl layers before the egl backend

And ensure a context is current when deleting them
This commit is contained in:
Xaver Hugl 2023-08-16 16:41:04 +02:00
parent 5340d729aa
commit adae140d57
2 changed files with 8 additions and 0 deletions

View file

@ -15,6 +15,7 @@
#include "drm_egl_layer.h"
#include "drm_gpu.h"
#include "drm_logging.h"
#include "drm_output.h"
#include "drm_pipeline.h"
#include "drm_virtual_egl_layer.h"
#include "kwineglutils_p.h"
@ -41,6 +42,12 @@ EglGbmBackend::EglGbmBackend(DrmBackend *drmBackend)
EglGbmBackend::~EglGbmBackend()
{
m_backend->releaseBuffers();
const auto outputs = m_backend->outputs();
for (const auto output : outputs) {
if (auto drmOutput = dynamic_cast<DrmOutput *>(output)) {
drmOutput->pipeline()->setLayers(nullptr, nullptr);
}
}
m_contexts.clear();
cleanup();
m_backend->setRenderBackend(nullptr);

View file

@ -52,6 +52,7 @@ EglGbmLayerSurface::~EglGbmLayerSurface()
void EglGbmLayerSurface::destroyResources()
{
m_eglBackend->makeCurrent();
m_surface = {};
m_oldSurface = {};
}