2020-11-28 17:53:41 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: 2020 Xaver Hugl <xaver.hugl@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef EGLMULTIBACKEND_H
|
|
|
|
#define EGLMULTIBACKEND_H
|
|
|
|
|
2021-11-10 12:26:34 +00:00
|
|
|
#include "openglbackend.h"
|
2020-11-28 17:53:41 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2021-11-10 12:26:34 +00:00
|
|
|
class DrmBackend;
|
|
|
|
class DrmGpu;
|
|
|
|
class EglGbmBackend;
|
|
|
|
|
2021-07-24 08:25:23 +00:00
|
|
|
class EglMultiBackend : public OpenGLBackend
|
2020-11-28 17:53:41 +00:00
|
|
|
{
|
2021-04-27 11:49:53 +00:00
|
|
|
Q_OBJECT
|
2020-11-28 17:53:41 +00:00
|
|
|
public:
|
2021-11-10 12:26:34 +00:00
|
|
|
EglMultiBackend(DrmBackend *backend, EglGbmBackend *primaryEglBackend);
|
2020-11-28 17:53:41 +00:00
|
|
|
~EglMultiBackend();
|
|
|
|
|
|
|
|
void init() override;
|
|
|
|
|
2021-08-24 20:55:42 +00:00
|
|
|
QRegion beginFrame(AbstractOutput *output) override;
|
|
|
|
void endFrame(AbstractOutput *output, const QRegion &damage, const QRegion &damagedRegion) override;
|
|
|
|
bool scanout(AbstractOutput *output, SurfaceItem *surfaceItem) override;
|
2020-11-28 17:53:41 +00:00
|
|
|
|
|
|
|
bool makeCurrent() override;
|
|
|
|
void doneCurrent() override;
|
|
|
|
|
2021-10-20 14:58:58 +00:00
|
|
|
SurfaceTexture *createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
|
|
|
SurfaceTexture *createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
2020-11-28 17:53:41 +00:00
|
|
|
QSharedPointer<GLTexture> textureForOutput(AbstractOutput *requestedOutput) const override;
|
|
|
|
|
2021-08-24 20:55:42 +00:00
|
|
|
bool directScanoutAllowed(AbstractOutput *output) const override;
|
2021-02-02 13:26:43 +00:00
|
|
|
|
2021-04-27 11:49:53 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void addGpu(DrmGpu *gpu);
|
|
|
|
void removeGpu(DrmGpu *gpu);
|
|
|
|
|
2020-11-28 17:53:41 +00:00
|
|
|
private:
|
2021-04-27 11:49:53 +00:00
|
|
|
DrmBackend *m_platform;
|
2021-11-10 12:26:34 +00:00
|
|
|
QVector<EglGbmBackend*> m_backends;
|
2021-05-23 17:45:05 +00:00
|
|
|
bool m_initialized = false;
|
2020-11-28 17:53:41 +00:00
|
|
|
|
2021-11-10 12:26:34 +00:00
|
|
|
EglGbmBackend *findBackend(AbstractOutput *output) const;
|
2020-11-28 17:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // EGLMULTIBACKEND_H
|