2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2017-10-05 16:58:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
2017-10-05 16:58:57 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-10-05 16:58:57 +00:00
|
|
|
#ifndef KWIN_DRM_GBM_SURFACE_H
|
|
|
|
#define KWIN_DRM_GBM_SURFACE_H
|
|
|
|
|
2019-07-09 19:19:26 +00:00
|
|
|
#include <cstdint>
|
2021-05-25 17:25:55 +00:00
|
|
|
#include <epoxy/egl.h>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include "drm_buffer_gbm.h"
|
2017-10-05 16:58:57 +00:00
|
|
|
|
|
|
|
struct gbm_device;
|
|
|
|
struct gbm_surface;
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class GbmSurface
|
|
|
|
{
|
|
|
|
public:
|
2021-05-25 17:25:55 +00:00
|
|
|
explicit GbmSurface(DrmGpu *gpu, const QSize &size, uint32_t format, uint32_t flags);
|
2021-07-31 13:32:50 +00:00
|
|
|
explicit GbmSurface(DrmGpu *gpu, const QSize &size, uint32_t format, QVector<uint64_t> modifiers);
|
2017-10-05 16:58:57 +00:00
|
|
|
~GbmSurface();
|
|
|
|
|
2021-05-25 17:25:55 +00:00
|
|
|
QSharedPointer<DrmGbmBuffer> swapBuffersForDrm();
|
|
|
|
QSharedPointer<GbmBuffer> swapBuffers();
|
|
|
|
|
|
|
|
void releaseBuffer(GbmBuffer *buffer);
|
2017-10-05 16:58:57 +00:00
|
|
|
|
2021-05-25 17:25:55 +00:00
|
|
|
QSharedPointer<GbmBuffer> currentBuffer() const;
|
|
|
|
QSharedPointer<DrmGbmBuffer> currentDrmBuffer() const;
|
|
|
|
|
|
|
|
EGLSurface eglSurface() const {
|
|
|
|
return m_eglSurface;
|
2017-10-05 16:58:57 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 22:05:17 +00:00
|
|
|
QSize size() const {
|
|
|
|
return m_size;
|
|
|
|
}
|
|
|
|
|
2021-05-25 17:25:55 +00:00
|
|
|
bool isValid() const {
|
|
|
|
return m_surface != nullptr && m_eglSurface != EGL_NO_SURFACE;
|
2017-10-05 16:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
gbm_surface *m_surface;
|
2021-05-25 17:25:55 +00:00
|
|
|
DrmGpu *m_gpu;
|
|
|
|
EGLSurface m_eglSurface = EGL_NO_SURFACE;
|
2021-05-25 22:05:17 +00:00
|
|
|
QSize m_size;
|
2021-05-25 17:25:55 +00:00
|
|
|
|
|
|
|
QSharedPointer<GbmBuffer> m_currentBuffer;
|
|
|
|
QSharedPointer<DrmGbmBuffer> m_currentDrmBuffer;
|
|
|
|
QVector<GbmBuffer*> m_lockedBuffers;
|
2017-10-05 16:58:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|