backends/drm: don't test hardware rotation if not supported by the driver

This commit is contained in:
Xaver Hugl 2022-05-14 23:35:27 +02:00
parent d7b710a9a1
commit 420358709a
2 changed files with 14 additions and 0 deletions

View file

@ -110,6 +110,7 @@ DrmPipeline::Error DrmPipeline::commitPipelinesAtomic(const QVector<DrmPipeline
return Error::OutofMemory;
}
for (const auto &pipeline : pipelines) {
pipeline->checkHardwareRotation();
if (pipeline->activePending()) {
if (!pipeline->m_pending.layer->checkTestBuffer()) {
qCWarning(KWIN_DRM) << "Checking test buffer failed for" << mode;
@ -290,6 +291,18 @@ bool DrmPipeline::populateAtomicValues(drmModeAtomicReq *req)
return true;
}
void DrmPipeline::checkHardwareRotation()
{
if (m_pending.crtc && m_pending.crtc->primaryPlane()) {
const bool supported = (m_pending.bufferOrientation & m_pending.crtc->primaryPlane()->supportedTransformations());
if (!supported) {
m_pending.bufferOrientation = DrmPlane::Transformations(DrmPlane::Transformation::Rotate0);
}
} else {
m_pending.bufferOrientation = DrmPlane::Transformation::Rotate0;
}
}
uint32_t DrmPipeline::calculateUnderscan()
{
const auto size = m_pending.mode->size();

View file

@ -141,6 +141,7 @@ private:
bool isBufferForDirectScanout() const;
uint32_t calculateUnderscan();
static Error errnoToError();
void checkHardwareRotation();
// legacy only
Error presentLegacy();