2022-02-18 00:26:29 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "drm_layer.h"
|
|
|
|
|
|
|
|
#include <QMap>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <QPointer>
|
2022-02-18 00:26:29 +00:00
|
|
|
#include <QRegion>
|
|
|
|
#include <epoxy/egl.h>
|
2022-03-23 10:13:38 +00:00
|
|
|
#include <optional>
|
2022-02-18 00:26:29 +00:00
|
|
|
|
|
|
|
namespace KWaylandServer
|
|
|
|
{
|
|
|
|
class SurfaceInterface;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class GbmSurface;
|
|
|
|
class GLTexture;
|
|
|
|
class EglGbmBackend;
|
|
|
|
class GbmBuffer;
|
|
|
|
class DrmVirtualOutput;
|
|
|
|
|
|
|
|
class VirtualEglGbmLayer : public DrmOutputLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VirtualEglGbmLayer(EglGbmBackend *eglBackend, DrmVirtualOutput *output);
|
|
|
|
|
|
|
|
void aboutToStartPainting(const QRegion &damagedRegion) override;
|
2022-08-04 16:14:37 +00:00
|
|
|
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
|
2022-05-27 01:17:43 +00:00
|
|
|
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
|
2022-02-18 00:26:29 +00:00
|
|
|
bool scanout(SurfaceItem *surfaceItem) override;
|
|
|
|
|
|
|
|
QRegion currentDamage() const override;
|
2022-05-17 10:36:34 +00:00
|
|
|
std::shared_ptr<GLTexture> texture() const override;
|
2022-05-06 01:57:28 +00:00
|
|
|
void releaseBuffers() override;
|
2022-02-18 00:26:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool createGbmSurface();
|
|
|
|
bool doesGbmSurfaceFit(GbmSurface *surf) const;
|
|
|
|
|
|
|
|
QPointer<KWaylandServer::SurfaceInterface> m_scanoutSurface;
|
2022-05-05 21:23:10 +00:00
|
|
|
std::shared_ptr<GbmBuffer> m_currentBuffer;
|
2022-02-18 00:26:29 +00:00
|
|
|
QRegion m_currentDamage;
|
2022-05-05 21:23:10 +00:00
|
|
|
std::shared_ptr<GbmSurface> m_gbmSurface;
|
|
|
|
std::shared_ptr<GbmSurface> m_oldGbmSurface;
|
2022-02-18 00:26:29 +00:00
|
|
|
|
|
|
|
DrmVirtualOutput *const m_output;
|
|
|
|
EglGbmBackend *const m_eglBackend;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|