/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2022 Xaver Hugl SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "core/renderbackend.h" #include "drm_layer.h" #include "utils/damagejournal.h" #include namespace KWin { class QPainterSwapchain; class QPainterSwapchainSlot; class DrmPipeline; class DrmVirtualOutput; class DrmQPainterBackend; class DrmFramebuffer; class DrmQPainterLayer : public DrmPipelineLayer { public: explicit DrmQPainterLayer(DrmPipeline *pipeline, DrmPlane::TypeIndex type); std::optional doBeginFrame() override; bool doEndFrame(const QRegion &renderedRegion, const QRegion &damagedRegion, OutputFrame *frame) override; bool checkTestBuffer() override; std::shared_ptr currentBuffer() const override; void releaseBuffers() override; DrmDevice *scanoutDevice() const override; QHash> supportedDrmFormats() const override; private: bool doesSwapchainFit() const; std::shared_ptr m_swapchain; std::shared_ptr m_currentBuffer; std::shared_ptr m_currentFramebuffer; DamageJournal m_damageJournal; std::unique_ptr m_renderTime; }; class DrmVirtualQPainterLayer : public DrmOutputLayer { public: explicit DrmVirtualQPainterLayer(DrmVirtualOutput *output); std::optional doBeginFrame() override; bool doEndFrame(const QRegion &renderedRegion, const QRegion &damagedRegion, OutputFrame *frame) override; void releaseBuffers() override; DrmDevice *scanoutDevice() const override; QHash> supportedDrmFormats() const override; private: QImage m_image; std::unique_ptr m_renderTime; }; }