File indexing completed on 2024-05-26 05:32:41

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
0006     SPDX-FileCopyrightText: 2021 Xaver Hugl <xaver.hugl@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #pragma once
0011 
0012 #include "drm_abstract_output.h"
0013 
0014 #include <QObject>
0015 #include <QRect>
0016 
0017 namespace KWin
0018 {
0019 
0020 class SoftwareVsyncMonitor;
0021 class VirtualBackend;
0022 class DrmPipelineLayer;
0023 
0024 class DrmVirtualOutput : public DrmAbstractOutput
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     DrmVirtualOutput(const QString &name, DrmGpu *gpu, const QSize &size, qreal scale);
0030     ~DrmVirtualOutput() override;
0031 
0032     bool present(const std::shared_ptr<OutputFrame> &frame) override;
0033     DrmOutputLayer *primaryLayer() const override;
0034     DrmOutputLayer *cursorLayer() const override;
0035     void recreateSurface();
0036 
0037 private:
0038     void vblank(std::chrono::nanoseconds timestamp);
0039     void setDpmsMode(DpmsMode mode) override;
0040 
0041     std::shared_ptr<DrmOutputLayer> m_layer;
0042     bool m_pageFlipPending = true;
0043 
0044     std::unique_ptr<SoftwareVsyncMonitor> m_vsyncMonitor;
0045 };
0046 
0047 }