/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2015 Martin Gräßlin SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "drm_abstract_output.h" #include "drm_object.h" #include "drm_plane.h" #include #include #include #include #include #include #include #include namespace KWin { class DrmConnector; class DrmGpu; class DrmPipeline; class DumbSwapchain; class DrmLease; class OutputChangeSet; class KWIN_EXPORT DrmOutput : public DrmAbstractOutput { Q_OBJECT public: explicit DrmOutput(const std::shared_ptr &connector); ~DrmOutput() override; DrmConnector *connector() const; DrmPipeline *pipeline() const; bool present(const std::shared_ptr &frame) override; DrmOutputLayer *primaryLayer() const override; DrmOutputLayer *cursorLayer() const override; bool queueChanges(const std::shared_ptr &properties); void applyQueuedChanges(const std::shared_ptr &properties); void revertQueuedChanges(); void updateDpmsMode(DpmsMode dpmsMode); bool updateCursorLayer() override; DrmLease *lease() const; bool addLeaseObjects(QList &objectList); void leased(DrmLease *lease); void leaseEnded(); bool setChannelFactors(const QVector3D &rgb) override; /** * channel factors adapted to the target color space + brightness setting multiplied in */ QVector3D adaptedChannelFactors() const; void updateConnectorProperties(); /** * @returns the color description / encoding that the buffers passed to the CRTC need to have, without a color pipeline to change it */ const ColorDescription &scanoutColorDescription() const; /** * @returns whether or not the renderer should apply channel factors */ bool needsChannelFactorFallback() const; private: bool setDrmDpmsMode(DpmsMode mode); void setDpmsMode(DpmsMode mode) override; void tryKmsColorOffloading(); ColorDescription createColorDescription(const std::shared_ptr &props, double brightness) const; Capabilities computeCapabilities() const; void updateInformation(); void setBrightnessDevice(BrightnessDevice *device) override; void updateBrightness(double newBrightness, double newArtificialHdrHeadroom); void setScanoutColorDescription(const ColorDescription &description); QList> getModes() const; DrmGpu *const m_gpu; DrmPipeline *m_pipeline; const std::shared_ptr m_connector; QTimer m_turnOffTimer; DrmLease *m_lease = nullptr; QVector3D m_channelFactors = {1, 1, 1}; bool m_channelFactorsNeedShaderFallback = false; ColorDescription m_scanoutColorDescription = ColorDescription::sRGB; PresentationMode m_desiredPresentationMode = PresentationMode::VSync; }; } Q_DECLARE_METATYPE(KWin::DrmOutput *)