/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2016 Roman Gilg SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef KWIN_DRM_OBJECT_CRTC_H #define KWIN_DRM_OBJECT_CRTC_H #include "drm_object.h" #include #include "drm_pointer.h" namespace KWin { class DrmBackend; class DrmBuffer; class DrmDumbBuffer; class GammaRamp; class DrmGpu; class DrmCrtc : public DrmObject { public: DrmCrtc(DrmGpu *gpu, uint32_t crtcId, int pipeIndex); bool init() override; enum class PropertyIndex : uint32_t { ModeId = 0, Active = 1, Gamma_LUT = 2, Gamma_LUT_size = 3, Count }; int pipeIndex() const { return m_pipeIndex; } QSharedPointer current() { return m_currentBuffer; } QSharedPointer next() { return m_nextBuffer; } void setCurrent(const QSharedPointer &buffer) { m_currentBuffer = buffer; } void setNext(const QSharedPointer &buffer) { m_nextBuffer = buffer; } void flipBuffer(); int gammaRampSize() const { if (const auto &prop = m_props.at(static_cast(PropertyIndex::Gamma_LUT_size))) { return prop->value(); } return m_crtc->gamma_size; } bool hasGammaProp() const { return m_props.at(static_cast(PropertyIndex::Gamma_LUT)); } drmModeModeInfo queryCurrentMode(); private: DrmScopedPointer m_crtc; int m_pipeIndex; QSharedPointer m_currentBuffer; QSharedPointer m_nextBuffer; }; } #endif