Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/egl_stream_backend.h
Show All 14 Lines | |||||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_EGL_STREAM_BACKEND_H | 20 | #ifndef KWIN_EGL_STREAM_BACKEND_H | ||
21 | #define KWIN_EGL_STREAM_BACKEND_H | 21 | #define KWIN_EGL_STREAM_BACKEND_H | ||
22 | #include "abstract_egl_backend.h" | 22 | #include "abstract_egl_backend.h" | ||
23 | #include <KWayland/Server/surface_interface.h> | 23 | #include <KWaylandServer/surface_interface.h> | ||
24 | #include <KWayland/Server/eglstream_controller_interface.h> | 24 | #include <KWaylandServer/eglstream_controller_interface.h> | ||
25 | #include <wayland-server-core.h> | 25 | #include <wayland-server-core.h> | ||
26 | 26 | | |||
27 | namespace KWin | 27 | namespace KWin | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | class DrmBackend; | 30 | class DrmBackend; | ||
31 | class DrmOutput; | 31 | class DrmOutput; | ||
32 | class DrmBuffer; | 32 | class DrmBuffer; | ||
Show All 25 Lines | 57 | private: | |||
58 | bool initializeEgl(); | 58 | bool initializeEgl(); | ||
59 | bool initBufferConfigs(); | 59 | bool initBufferConfigs(); | ||
60 | bool initRenderingContext(); | 60 | bool initRenderingContext(); | ||
61 | struct StreamTexture | 61 | struct StreamTexture | ||
62 | { | 62 | { | ||
63 | EGLStreamKHR stream; | 63 | EGLStreamKHR stream; | ||
64 | GLuint texture; | 64 | GLuint texture; | ||
65 | }; | 65 | }; | ||
66 | StreamTexture *lookupStreamTexture(KWayland::Server::SurfaceInterface *surface); | 66 | StreamTexture *lookupStreamTexture(KWaylandServer::SurfaceInterface *surface); | ||
67 | void attachStreamConsumer(KWayland::Server::SurfaceInterface *surface, | 67 | void attachStreamConsumer(KWaylandServer::SurfaceInterface *surface, | ||
68 | void *eglStream, | 68 | void *eglStream, | ||
69 | wl_array *attribs); | 69 | wl_array *attribs); | ||
70 | struct Output | 70 | struct Output | ||
71 | { | 71 | { | ||
72 | DrmOutput *output = nullptr; | 72 | DrmOutput *output = nullptr; | ||
73 | DrmBuffer *buffer = nullptr; | 73 | DrmBuffer *buffer = nullptr; | ||
74 | EGLSurface eglSurface = EGL_NO_SURFACE; | 74 | EGLSurface eglSurface = EGL_NO_SURFACE; | ||
75 | EGLStreamKHR eglStream = EGL_NO_STREAM_KHR; | 75 | EGLStreamKHR eglStream = EGL_NO_STREAM_KHR; | ||
76 | }; | 76 | }; | ||
77 | bool resetOutput(Output &output, DrmOutput *drmOutput); | 77 | bool resetOutput(Output &output, DrmOutput *drmOutput); | ||
78 | bool makeContextCurrent(const Output &output); | 78 | bool makeContextCurrent(const Output &output); | ||
79 | void presentOnOutput(Output &output); | 79 | void presentOnOutput(Output &output); | ||
80 | void cleanupOutput(const Output &output); | 80 | void cleanupOutput(const Output &output); | ||
81 | void createOutput(DrmOutput *output); | 81 | void createOutput(DrmOutput *output); | ||
82 | 82 | | |||
83 | DrmBackend *m_backend; | 83 | DrmBackend *m_backend; | ||
84 | QVector<Output> m_outputs; | 84 | QVector<Output> m_outputs; | ||
85 | KWayland::Server::EglStreamControllerInterface *m_eglStreamControllerInterface; | 85 | KWaylandServer::EglStreamControllerInterface *m_eglStreamControllerInterface; | ||
86 | QHash<KWayland::Server::SurfaceInterface *, StreamTexture> m_streamTextures; | 86 | QHash<KWaylandServer::SurfaceInterface *, StreamTexture> m_streamTextures; | ||
87 | 87 | | |||
88 | friend class EglStreamTexture; | 88 | friend class EglStreamTexture; | ||
89 | }; | 89 | }; | ||
90 | 90 | | |||
91 | /** | 91 | /** | ||
92 | * @brief External texture bound to an EGLStreamKHR. | 92 | * @brief External texture bound to an EGLStreamKHR. | ||
93 | */ | 93 | */ | ||
94 | class EglStreamTexture : public AbstractEglTexture | 94 | class EglStreamTexture : public AbstractEglTexture | ||
95 | { | 95 | { | ||
96 | public: | 96 | public: | ||
97 | ~EglStreamTexture() override; | 97 | ~EglStreamTexture() override; | ||
98 | bool loadTexture(WindowPixmap *pixmap) override; | 98 | bool loadTexture(WindowPixmap *pixmap) override; | ||
99 | void updateTexture(WindowPixmap *pixmap) override; | 99 | void updateTexture(WindowPixmap *pixmap) override; | ||
100 | 100 | | |||
101 | private: | 101 | private: | ||
102 | EglStreamTexture(SceneOpenGLTexture *texture, EglStreamBackend *backend); | 102 | EglStreamTexture(SceneOpenGLTexture *texture, EglStreamBackend *backend); | ||
103 | bool acquireStreamFrame(EGLStreamKHR stream); | 103 | bool acquireStreamFrame(EGLStreamKHR stream); | ||
104 | void createFbo(); | 104 | void createFbo(); | ||
105 | void copyExternalTexture(GLuint tex); | 105 | void copyExternalTexture(GLuint tex); | ||
106 | bool attachBuffer(KWayland::Server::BufferInterface *buffer); | 106 | bool attachBuffer(KWaylandServer::BufferInterface *buffer); | ||
107 | EglStreamBackend *m_backend; | 107 | EglStreamBackend *m_backend; | ||
108 | GLuint m_fbo, m_rbo; | 108 | GLuint m_fbo, m_rbo; | ||
109 | GLenum m_format; | 109 | GLenum m_format; | ||
110 | friend class EglStreamBackend; | 110 | friend class EglStreamBackend; | ||
111 | }; | 111 | }; | ||
112 | 112 | | |||
113 | } // namespace | 113 | } // namespace | ||
114 | 114 | | |||
115 | #endif | 115 | #endif |