kwin/src/backends/drm/virtual_egl_gbm_layer.h
Vlad Zahorodnii bfb60e3610 Add RenderTarget type
The main motivation behind this change is to unify render target
representation across opengl and software renderers and avoid accessing
the render backend directory in order to get the render target.
2022-04-13 10:16:16 +00:00

61 lines
1.4 KiB
C++

/*
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>
#include <QPointer>
#include <QRegion>
#include <QSharedPointer>
#include <epoxy/egl.h>
#include <optional>
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;
OutputLayerBeginFrameInfo beginFrame() override;
void endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
bool scanout(SurfaceItem *surfaceItem) override;
QRegion currentDamage() const override;
QSharedPointer<GLTexture> texture() const override;
private:
bool createGbmSurface();
bool doesGbmSurfaceFit(GbmSurface *surf) const;
void destroyResources();
QPointer<KWaylandServer::SurfaceInterface> m_scanoutSurface;
QSharedPointer<GbmBuffer> m_currentBuffer;
QRegion m_currentDamage;
QSharedPointer<GbmSurface> m_gbmSurface;
QSharedPointer<GbmSurface> m_oldGbmSurface;
DrmVirtualOutput *const m_output;
EglGbmBackend *const m_eglBackend;
};
}