backends/drm: Mark frame failed if presenting null buffer

If eglSwapBuffers() fails, there won't be a buffer and so we need to
mark the frame as failed. Otherwise, the screen can be frozen.

eglSwapBuffers() can fail if some effect calls makeOpenGLContext()
between RenderBackend::beginFrame() and RenderBackend::endFrame(), which
is the case with the zoom effect. It can set wrong draw surface in
ZoomEffect::recreateTexture()

BUG: 445412
This commit is contained in:
Vlad Zahorodnii 2021-11-29 12:48:32 +02:00
parent 84c45b9fd7
commit 2b628ea412
2 changed files with 2 additions and 6 deletions

View file

@ -372,6 +372,7 @@ bool DrmOutput::needsSoftwareTransformation() const
bool DrmOutput::present(const QSharedPointer<DrmBuffer> &buffer, QRegion damagedRegion)
{
if (!buffer || buffer->bufferId() == 0) {
presentFailed();
return false;
}
RenderLoopPrivate *renderLoopPrivate = RenderLoopPrivate::get(m_renderLoop);

View file

@ -47,12 +47,7 @@ DrmPipeline::~DrmPipeline()
bool DrmPipeline::present(const QSharedPointer<DrmBuffer> &buffer)
{
Q_ASSERT(pending.crtc);
if (!buffer) {
if (m_output) {
m_output->presentFailed();
}
return false;
}
Q_ASSERT(buffer);
m_primaryBuffer = buffer;
auto buf = dynamic_cast<DrmGbmBuffer*>(buffer.data());
// with direct scanout disallow modesets, calling presentFailed() and logging warnings