backends/drm: remove remnants of hardware rotation with compositing

This commit is contained in:
Xaver Hugl 2024-03-06 23:08:03 +01:00
parent acb4945cd3
commit d6ad0bcc20
7 changed files with 3 additions and 76 deletions

View file

@ -19,27 +19,6 @@
namespace KWin
{
static OutputTransform drmToOutputTransform(DrmPipeline *pipeline)
{
auto angle = DrmPlane::transformationToDegrees(pipeline->renderOrientation());
if (angle < 0) {
angle += 360;
}
OutputTransform flip = (pipeline->renderOrientation() & DrmPlane::Transformation::ReflectX) ? OutputTransform::FlipX : OutputTransform();
switch (angle % 360) {
case 0:
return flip;
case 90:
return flip.combine(OutputTransform::Rotate90);
case 180:
return flip.combine(OutputTransform::Rotate180);
case 270:
return flip.combine(OutputTransform::Rotate270);
default:
Q_UNREACHABLE();
}
}
EglGbmCursorLayer::EglGbmCursorLayer(EglGbmBackend *eglBackend, DrmPipeline *pipeline)
: DrmPipelineLayer(pipeline)
, m_surface(pipeline->gpu(), eglBackend, pipeline->gpu()->atomicModeSetting() ? EglGbmLayerSurface::BufferTarget::Linear : EglGbmLayerSurface::BufferTarget::Dumb, EglGbmLayerSurface::FormatOption::RequireAlpha)
@ -54,7 +33,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmCursorLayer::beginFrame()
// note that this allows blending to happen in sRGB or PQ encoding.
// That's technically incorrect, but it looks okay and is intentionally allowed
// as the hardware cursor is more important than an incorrectly blended cursor edge
return m_surface.startRendering(m_pipeline->gpu()->cursorSize(), drmToOutputTransform(m_pipeline).combine(OutputTransform::FlipY), m_pipeline->cursorFormats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->iccProfile(), m_pipeline->output()->needsColormanagement());
return m_surface.startRendering(m_pipeline->gpu()->cursorSize(), m_pipeline->output()->transform().combine(OutputTransform::FlipY), m_pipeline->cursorFormats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->iccProfile(), m_pipeline->output()->needsColormanagement());
}
bool EglGbmCursorLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)

View file

@ -26,27 +26,6 @@
namespace KWin
{
static OutputTransform drmToOutputTransform(DrmPipeline *pipeline)
{
auto angle = DrmPlane::transformationToDegrees(pipeline->renderOrientation());
if (angle < 0) {
angle += 360;
}
OutputTransform flip = (pipeline->renderOrientation() & DrmPlane::Transformation::ReflectX) ? OutputTransform::FlipX : OutputTransform();
switch (angle % 360) {
case 0:
return flip;
case 90:
return flip.combine(OutputTransform::Rotate90);
case 180:
return flip.combine(OutputTransform::Rotate180);
case 270:
return flip.combine(OutputTransform::Rotate270);
default:
Q_UNREACHABLE();
}
}
EglGbmLayer::EglGbmLayer(EglGbmBackend *eglBackend, DrmPipeline *pipeline)
: DrmPipelineLayer(pipeline)
, m_surface(pipeline->gpu(), eglBackend)
@ -59,7 +38,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayer::beginFrame()
m_scanoutBuffer.reset();
m_dmabufFeedback.renderingSurface();
return m_surface.startRendering(m_pipeline->mode()->size(), drmToOutputTransform(m_pipeline).combine(OutputTransform::FlipY), m_pipeline->formats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->iccProfile(), m_pipeline->output()->needsColormanagement());
return m_surface.startRendering(m_pipeline->mode()->size(), m_pipeline->output()->transform().combine(OutputTransform::FlipY), m_pipeline->formats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->iccProfile(), m_pipeline->output()->needsColormanagement());
}
bool EglGbmLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
@ -85,7 +64,7 @@ std::shared_ptr<GLTexture> EglGbmLayer::texture() const
{
if (m_scanoutBuffer) {
const auto ret = m_surface.eglBackend()->importDmaBufAsTexture(*m_scanoutBuffer->buffer()->dmabufAttributes());
ret->setContentTransform(drmToOutputTransform(m_pipeline).combine(OutputTransform::FlipY));
ret->setContentTransform(m_pipeline->output()->transform().combine(OutputTransform::FlipY));
return ret;
} else {
return m_surface.texture();

View file

@ -329,7 +329,6 @@ bool DrmOutput::queueChanges(const std::shared_ptr<OutputChangeSet> &props)
m_pipeline->setMode(std::static_pointer_cast<DrmConnectorMode>(mode));
m_pipeline->setOverscan(props->overscan.value_or(m_pipeline->overscan()));
m_pipeline->setRgbRange(props->rgbRange.value_or(m_pipeline->rgbRange()));
m_pipeline->setRenderOrientation(outputToPlaneTransform(props->transform.value_or(transform())));
m_pipeline->setEnable(props->enabled.value_or(m_pipeline->enabled()));
m_pipeline->setColorDescription(createColorDescription(props));
if (bt2020 || hdr) {

View file

@ -608,11 +608,6 @@ DrmPipelineLayer *DrmPipeline::cursorLayer() const
return m_cursorLayer.get();
}
DrmPlane::Transformations DrmPipeline::renderOrientation() const
{
return m_pending.renderOrientation;
}
PresentationMode DrmPipeline::presentationMode() const
{
return m_pending.presentationMode;
@ -677,11 +672,6 @@ void DrmPipeline::setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLaye
m_cursorLayer = cursorLayer;
}
void DrmPipeline::setRenderOrientation(DrmPlane::Transformations orientation)
{
m_pending.renderOrientation = orientation;
}
void DrmPipeline::setPresentationMode(PresentationMode mode)
{
m_pending.presentationMode = mode;

View file

@ -112,7 +112,6 @@ public:
bool active() const;
bool activePending() const;
bool enabled() const;
DrmPlane::Transformations renderOrientation() const;
PresentationMode presentationMode() const;
uint32_t overscan() const;
Output::RgbRange rgbRange() const;
@ -124,7 +123,6 @@ public:
void setMode(const std::shared_ptr<DrmConnectorMode> &mode);
void setActive(bool active);
void setEnable(bool enable);
void setRenderOrientation(DrmPlane::Transformations orientation);
void setPresentationMode(PresentationMode mode);
void setOverscan(uint32_t overscan);
void setRgbRange(Output::RgbRange range);
@ -195,9 +193,6 @@ private:
std::shared_ptr<IccProfile> iccProfile;
ColorDescription colorDescription = ColorDescription::sRGB;
// the transformation that buffers submitted to the pipeline should have
DrmPlane::Transformations renderOrientation = DrmPlane::Transformation::Rotate0;
};
// the state that is to be tested next
State m_pending;

View file

@ -172,19 +172,6 @@ void DrmPlane::releaseCurrentBuffer()
m_current->releaseBuffer();
}
}
int32_t DrmPlane::transformationToDegrees(DrmPlane::Transformations transformation)
{
if (transformation & DrmPlane::Transformation::Rotate0) {
return 0;
} else if (transformation & DrmPlane::Transformation::Rotate90) {
return 90;
} else if (transformation & DrmPlane::Transformation::Rotate180) {
return 180;
} else {
return 270;
}
}
}
#include "moc_drm_plane.cpp"

View file

@ -92,8 +92,6 @@ public:
DrmProperty vmHotspotY;
DrmProperty inFenceFd;
static int32_t transformationToDegrees(Transformations transformation);
private:
std::shared_ptr<DrmFramebuffer> m_current;