File indexing completed on 2024-11-10 04:56:27

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 "drm_layer.h"
0011 
0012 #include "drm_dmabuf_feedback.h"
0013 #include "drm_egl_layer_surface.h"
0014 
0015 #include <QMap>
0016 #include <QPointer>
0017 #include <QRegion>
0018 #include <epoxy/egl.h>
0019 #include <optional>
0020 
0021 namespace KWin
0022 {
0023 
0024 class EglGbmBackend;
0025 
0026 class EglGbmLayer : public DrmPipelineLayer
0027 {
0028 public:
0029     EglGbmLayer(EglGbmBackend *eglBackend, DrmPipeline *pipeline);
0030 
0031     std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
0032     bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
0033     bool scanout(SurfaceItem *surfaceItem) override;
0034     bool checkTestBuffer() override;
0035     std::shared_ptr<DrmFramebuffer> currentBuffer() const override;
0036     bool hasDirectScanoutBuffer() const override;
0037     QRegion currentDamage() const override;
0038     std::shared_ptr<GLTexture> texture() const override;
0039     ColorDescription colorDescription() const;
0040     void releaseBuffers() override;
0041     std::chrono::nanoseconds queryRenderTime() const override;
0042 
0043 private:
0044     std::shared_ptr<DrmFramebuffer> m_scanoutBuffer;
0045     QRegion m_currentDamage;
0046 
0047     EglGbmLayerSurface m_surface;
0048     DmabufFeedback m_dmabufFeedback;
0049 };
0050 
0051 }