Commit e7365bf4 authored by Xaver Hugl's avatar Xaver Hugl Committed by Merge Service
Browse files

backends/drm: don't do direct scanout if transformations don't match

Part-of: <!2128>
parent 0a7ae31e
Pipeline #183500 failed with stage
in 17 minutes and 44 seconds
......@@ -88,6 +88,35 @@ QSharedPointer<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;
......@@ -101,6 +130,9 @@ bool EglGbmLayer::scanout(SurfaceItem *surfaceItem)
return false;
}
const auto surface = item->surface();
if (invertAndConvertTransform(surface->bufferTransform()) != m_pipeline->bufferOrientation()) {
return false;
}
const auto buffer = qobject_cast<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(surface->buffer());
if (!buffer || buffer->planes().isEmpty() || buffer->size() != m_pipeline->bufferSize()) {
return false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment