File indexing completed on 2024-06-09 05:25:20

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2016 Roman Gilg <subdiff@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "drm_object.h"
0012 
0013 #include <QPoint>
0014 #include <memory>
0015 
0016 namespace KWin
0017 {
0018 
0019 class DrmBackend;
0020 class DrmFramebuffer;
0021 class GammaRamp;
0022 class DrmGpu;
0023 class DrmPlane;
0024 
0025 class DrmCrtc : public DrmObject
0026 {
0027 public:
0028     DrmCrtc(DrmGpu *gpu, uint32_t crtcId, int pipeIndex, DrmPlane *primaryPlane, DrmPlane *cursorPlane);
0029 
0030     void disable(DrmAtomicCommit *commit) override;
0031     bool updateProperties() override;
0032 
0033     int pipeIndex() const;
0034     int gammaRampSize() const;
0035     DrmPlane *primaryPlane() const;
0036     DrmPlane *cursorPlane() const;
0037     drmModeModeInfo queryCurrentMode();
0038 
0039     std::shared_ptr<DrmFramebuffer> current() const;
0040     void setCurrent(const std::shared_ptr<DrmFramebuffer> &buffer);
0041     void releaseCurrentBuffer();
0042 
0043     DrmProperty modeId;
0044     DrmProperty active;
0045     DrmProperty vrrEnabled;
0046     DrmProperty gammaLut;
0047     DrmProperty gammaLutSize;
0048     DrmProperty ctm;
0049     DrmProperty degammaLut;
0050     DrmProperty degammaLutSize;
0051 
0052 private:
0053     DrmUniquePtr<drmModeCrtc> m_crtc;
0054     std::shared_ptr<DrmFramebuffer> m_currentBuffer;
0055     int m_pipeIndex;
0056     DrmPlane *m_primaryPlane;
0057     DrmPlane *m_cursorPlane;
0058 };
0059 
0060 }