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) { if (!m_active) {
return true; return true;
} }
QSharedPointer<DrmBuffer> buffer;
#if HAVE_GBM #if HAVE_GBM
auto backend = m_gpu->eglBackend(); auto backend = m_gpu->eglBackend();
if (backend && m_output) { if (backend && m_output) {
auto buffer = backend->renderTestFrame(m_output); buffer = backend->renderTestFrame(m_output);
if (buffer && buffer->bufferId()) { } else if (backend && m_gpu->gbmDevice()) {
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()) {
gbm_bo *bo = gbm_bo_create(m_gpu->gbmDevice(), sourceSize().width(), sourceSize().height(), GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); 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) { if (!bo) {
return false; return false;
@ -299,7 +290,7 @@ bool DrmPipeline::checkTestBuffer()
buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize()); buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize());
} }
#else #else
auto buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize()); buffer = QSharedPointer<DrmDumbBuffer>::create(m_gpu, sourceSize());
#endif #endif
if (buffer && buffer->bufferId()) { if (buffer && buffer->bufferId()) {
m_oldTestBuffer = m_primaryBuffer; m_oldTestBuffer = m_primaryBuffer;