/* KWin - the KDE window manager This file is part of the KDE project. SPDX-FileCopyrightText: 2017 Martin Flöser SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef KWIN_DRM_GBM_SURFACE_H #define KWIN_DRM_GBM_SURFACE_H #include #include #include #include "drm_buffer_gbm.h" struct gbm_device; struct gbm_surface; namespace KWin { class GbmSurface { public: explicit GbmSurface(DrmGpu *gpu, const QSize &size, uint32_t format, uint32_t flags); ~GbmSurface(); QSharedPointer swapBuffersForDrm(); QSharedPointer swapBuffers(); void releaseBuffer(GbmBuffer *buffer); QSharedPointer currentBuffer() const; QSharedPointer currentDrmBuffer() const; EGLSurface eglSurface() const { return m_eglSurface; } bool isValid() const { return m_surface != nullptr && m_eglSurface != EGL_NO_SURFACE; } private: gbm_surface *m_surface; DrmGpu *m_gpu; EGLSurface m_eglSurface = EGL_NO_SURFACE; QSharedPointer m_currentBuffer; QSharedPointer m_currentDrmBuffer; QVector m_lockedBuffers; }; } #endif