File indexing completed on 2025-04-20 10:57:35

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 #include "core/outputlayer.h"
0011 
0012 #include <QRegion>
0013 #include <memory>
0014 #include <optional>
0015 
0016 namespace KWin
0017 {
0018 
0019 class SurfaceItem;
0020 class DrmFramebuffer;
0021 class GLTexture;
0022 class DrmPipeline;
0023 
0024 class DrmOutputLayer : public OutputLayer
0025 {
0026 public:
0027     virtual ~DrmOutputLayer();
0028 
0029     virtual std::shared_ptr<GLTexture> texture() const;
0030     virtual QRegion currentDamage() const;
0031     virtual void releaseBuffers() = 0;
0032 };
0033 
0034 class DrmPipelineLayer : public DrmOutputLayer
0035 {
0036 public:
0037     DrmPipelineLayer(DrmPipeline *pipeline);
0038 
0039     virtual bool checkTestBuffer() = 0;
0040     virtual std::shared_ptr<DrmFramebuffer> currentBuffer() const = 0;
0041     virtual bool hasDirectScanoutBuffer() const;
0042 
0043 protected:
0044     DrmPipeline *const m_pipeline;
0045 };
0046 
0047 class DrmOverlayLayer : public DrmPipelineLayer
0048 {
0049 public:
0050     DrmOverlayLayer(DrmPipeline *pipeline);
0051 
0052     void setPosition(const QPoint &pos);
0053     void setVisible(bool visible);
0054 
0055     QPoint position() const;
0056     bool isVisible() const;
0057 
0058 protected:
0059     QPoint m_position;
0060     bool m_visible = false;
0061 };
0062 }