kwin/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.h
Vlad Zahorodnii 964c487d4f wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code
and allow adding new features easier, for example referencing the shm
pool when a shm buffer is destroyed, or monitoring for readable linux
dmabuf file descriptors, etc.

Also, a referenced ClientBuffer cannot be destroyed, unlike the old
BufferInterface.
2021-07-23 15:33:38 +00:00

57 lines
1.5 KiB
C++

/*
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "platformopenglsurfacetexture_wayland.h"
#include <epoxy/egl.h>
namespace KWaylandServer
{
class DrmClientBuffer;
class ShmClientBuffer;
class LinuxDmaBufV1ClientBuffer;
}
namespace KWin
{
class AbstractEglBackend;
class KWIN_EXPORT BasicEGLSurfaceTextureWayland : public PlatformOpenGLSurfaceTextureWayland
{
public:
BasicEGLSurfaceTextureWayland(OpenGLBackend *backend, SurfacePixmapWayland *pixmap);
~BasicEGLSurfaceTextureWayland() override;
AbstractEglBackend *backend() const;
bool create() override;
void update(const QRegion &region) override;
private:
bool loadShmTexture(KWaylandServer::ShmClientBuffer *buffer);
void updateShmTexture(KWaylandServer::ShmClientBuffer *buffer, const QRegion &region);
bool loadEglTexture(KWaylandServer::DrmClientBuffer *buffer);
void updateEglTexture(KWaylandServer::DrmClientBuffer *buffer);
bool loadDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer);
void updateDmabufTexture(KWaylandServer::LinuxDmaBufV1ClientBuffer *buffer);
EGLImageKHR attach(KWaylandServer::DrmClientBuffer *buffer);
void destroy();
enum class BufferType {
None,
Shm,
DmaBuf,
Egl,
};
EGLImageKHR m_image = EGL_NO_IMAGE_KHR;
BufferType m_bufferType = BufferType::None;
};
} // namespace KWin