File indexing completed on 2024-11-10 04:56:56

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "openglsurfacetexture_wayland.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 class AbstractEglBackend;
0015 class GraphicsBuffer;
0016 
0017 class KWIN_EXPORT BasicEGLSurfaceTextureWayland : public OpenGLSurfaceTextureWayland
0018 {
0019 public:
0020     BasicEGLSurfaceTextureWayland(OpenGLBackend *backend, SurfacePixmap *pixmap);
0021     ~BasicEGLSurfaceTextureWayland() override;
0022 
0023     AbstractEglBackend *backend() const;
0024 
0025     bool create() override;
0026     void update(const QRegion &region) override;
0027 
0028 private:
0029     bool loadShmTexture(GraphicsBuffer *buffer);
0030     void updateShmTexture(GraphicsBuffer *buffer, const QRegion &region);
0031     bool loadDmabufTexture(GraphicsBuffer *buffer);
0032     void updateDmabufTexture(GraphicsBuffer *buffer);
0033     void destroy();
0034 
0035     enum class BufferType {
0036         None,
0037         Shm,
0038         DmaBuf,
0039     };
0040 
0041     BufferType m_bufferType = BufferType::None;
0042 };
0043 
0044 } // namespace KWin