From e88f2501bfc0cea9fa1e4cad822e14cce0926879 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 16 Sep 2021 13:17:42 +0200 Subject: [PATCH] platforms/drm: simplify DrmPipeline::checkTestBuffer --- src/plugins/platforms/drm/drm_pipeline.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/drm/drm_pipeline.cpp b/src/plugins/platforms/drm/drm_pipeline.cpp index b6966490ef..a67c5ff844 100644 --- a/src/plugins/platforms/drm/drm_pipeline.cpp +++ b/src/plugins/platforms/drm/drm_pipeline.cpp @@ -275,21 +275,12 @@ bool DrmPipeline::checkTestBuffer() if (!m_active) { return true; } + QSharedPointer buffer; #if HAVE_GBM auto backend = m_gpu->eglBackend(); if (backend && m_output) { - auto buffer = backend->renderTestFrame(m_output); - if (buffer && buffer->bufferId()) { - m_oldTestBuffer = m_primaryBuffer; - m_primaryBuffer = buffer; - return true; - } else { - return false; - } - } - // we either don't have a DrmOutput or we're using QPainter - QSharedPointer buffer; - if (backend && m_gpu->gbmDevice()) { + buffer = backend->renderTestFrame(m_output); + } else if (backend && m_gpu->gbmDevice()) { gbm_bo *bo = gbm_bo_create(m_gpu->gbmDevice(), sourceSize().width(), sourceSize().height(), GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); if (!bo) { return false; @@ -299,7 +290,7 @@ bool DrmPipeline::checkTestBuffer() buffer = QSharedPointer::create(m_gpu, sourceSize()); } #else - auto buffer = QSharedPointer::create(m_gpu, sourceSize()); + buffer = QSharedPointer::create(m_gpu, sourceSize()); #endif if (buffer && buffer->bufferId()) { m_oldTestBuffer = m_primaryBuffer;