platforms/drm: simplify DrmPipeline::checkTestBuffer

This commit is contained in:
Xaver Hugl 2021-09-16 13:17:42 +02:00
parent 3fc74f103a
commit e88f2501bf

View file

@ -275,21 +275,12 @@ bool DrmPipeline::checkTestBuffer()
if (!m_active) {
return true;
}
QSharedPointer<DrmBuffer> 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<DrmBuffer> 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<DrmDumbBuffer>::create(m_gpu, sourceSize());
}
#else
auto buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize());
buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize());
#endif
if (buffer && buffer->bufferId()) {
m_oldTestBuffer = m_primaryBuffer;