From 8ca38fb328606f8a0bababea2e07b36fd775768f Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 21 Apr 2023 00:04:27 +0200 Subject: [PATCH] backends/drm: fix buffer orientation check for direct scanout Without hardware rotation, the buffer transform with always be "normal", so all "normal" client buffers would be accepted for direct scanout, which is not correct. CCBUG: 467138 --- src/backends/drm/drm_egl_layer.cpp | 31 +----------------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/backends/drm/drm_egl_layer.cpp b/src/backends/drm/drm_egl_layer.cpp index ae75e18cb6..4a0b159548 100644 --- a/src/backends/drm/drm_egl_layer.cpp +++ b/src/backends/drm/drm_egl_layer.cpp @@ -93,35 +93,6 @@ std::shared_ptr EglGbmLayer::texture() const } } -static DrmPlane::Transformations invertAndConvertTransform(Output::Transform transform) -{ - DrmPlane::Transformations ret; - switch (transform) { - case Output::Transform::Normal: - case Output::Transform::Flipped: - ret = DrmPlane::Transformation::Rotate0; - break; - case Output::Transform::Rotated90: - case Output::Transform::Flipped90: - ret = DrmPlane::Transformation::Rotate270; - break; - case Output::Transform::Rotated180: - case Output::Transform::Flipped180: - ret = DrmPlane::Transformation::Rotate180; - break; - case Output::Transform::Rotated270: - case Output::Transform::Flipped270: - ret = DrmPlane::Transformation::Rotate90; - break; - } - if (transform == Output::Transform::Flipped || transform == Output::Transform::Flipped180) { - ret |= DrmPlane::Transformation::ReflectX; - } else if (transform == Output::Transform::Flipped90 || transform == Output::Transform::Flipped270) { - ret |= DrmPlane::Transformation::ReflectY; - } - return ret; -} - bool EglGbmLayer::scanout(SurfaceItem *surfaceItem) { static bool valid; @@ -135,7 +106,7 @@ bool EglGbmLayer::scanout(SurfaceItem *surfaceItem) return false; } const auto surface = item->surface(); - if (invertAndConvertTransform(surface->bufferTransform()) != m_pipeline->bufferOrientation()) { + if (m_pipeline->bufferOrientation() != DrmPlane::Transformation::Rotate0 || surface->bufferTransform() != m_pipeline->output()->transform()) { return false; } const auto buffer = qobject_cast(surface->buffer());