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
This commit is contained in:
Xaver Hugl 2023-04-21 00:04:27 +02:00
parent 3ff7a527e3
commit 8ca38fb328

View file

@ -93,35 +93,6 @@ std::shared_ptr<GLTexture> 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<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(surface->buffer());