File indexing completed on 2025-09-14 05:23:15

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2021 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "core/output.h"
0012 
0013 namespace KWin
0014 {
0015 
0016 class DrmBackend;
0017 class DrmGpu;
0018 class DrmOutputLayer;
0019 class OutputFrame;
0020 
0021 class DrmAbstractOutput : public Output
0022 {
0023     Q_OBJECT
0024 public:
0025     DrmAbstractOutput(DrmGpu *gpu);
0026 
0027     RenderLoop *renderLoop() const override;
0028     void frameFailed() const;
0029     void pageFlipped(std::chrono::nanoseconds timestamp, PresentationMode mode);
0030     DrmGpu *gpu() const;
0031 
0032     virtual bool present(const std::shared_ptr<OutputFrame> &frame) = 0;
0033     virtual DrmOutputLayer *primaryLayer() const = 0;
0034     virtual DrmOutputLayer *cursorLayer() const = 0;
0035 
0036     void updateEnabled(bool enabled);
0037 
0038 protected:
0039     friend class DrmGpu;
0040 
0041     std::unique_ptr<RenderLoop> m_renderLoop;
0042     std::shared_ptr<OutputFrame> m_frame;
0043     DrmGpu *const m_gpu;
0044 };
0045 
0046 }