diff --git a/src/backends/drm/drm_egl_cursor_layer.cpp b/src/backends/drm/drm_egl_cursor_layer.cpp index 36fd86957e..6333fd3851 100644 --- a/src/backends/drm/drm_egl_cursor_layer.cpp +++ b/src/backends/drm/drm_egl_cursor_layer.cpp @@ -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 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) diff --git a/src/backends/drm/drm_egl_layer.cpp b/src/backends/drm/drm_egl_layer.cpp index d63ca022e9..2f640bb198 100644 --- a/src/backends/drm/drm_egl_layer.cpp +++ b/src/backends/drm/drm_egl_layer.cpp @@ -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 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 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(); diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index 26168cf6d2..06189e1d8d 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -329,7 +329,6 @@ bool DrmOutput::queueChanges(const std::shared_ptr &props) m_pipeline->setMode(std::static_pointer_cast(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) { diff --git a/src/backends/drm/drm_pipeline.cpp b/src/backends/drm/drm_pipeline.cpp index eb0cab84ad..eb1357b6e3 100644 --- a/src/backends/drm/drm_pipeline.cpp +++ b/src/backends/drm/drm_pipeline.cpp @@ -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 &primaryLaye m_cursorLayer = cursorLayer; } -void DrmPipeline::setRenderOrientation(DrmPlane::Transformations orientation) -{ - m_pending.renderOrientation = orientation; -} - void DrmPipeline::setPresentationMode(PresentationMode mode) { m_pending.presentationMode = mode; diff --git a/src/backends/drm/drm_pipeline.h b/src/backends/drm/drm_pipeline.h index a2bc843156..6806e9ac8d 100644 --- a/src/backends/drm/drm_pipeline.h +++ b/src/backends/drm/drm_pipeline.h @@ -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 &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; 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; diff --git a/src/backends/drm/drm_plane.cpp b/src/backends/drm/drm_plane.cpp index 0532f629c9..4d8754ba89 100644 --- a/src/backends/drm/drm_plane.cpp +++ b/src/backends/drm/drm_plane.cpp @@ -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" diff --git a/src/backends/drm/drm_plane.h b/src/backends/drm/drm_plane.h index 441aa93018..daec5cc82b 100644 --- a/src/backends/drm/drm_plane.h +++ b/src/backends/drm/drm_plane.h @@ -92,8 +92,6 @@ public: DrmProperty vmHotspotY; DrmProperty inFenceFd; - static int32_t transformationToDegrees(Transformations transformation); - private: std::shared_ptr m_current;