5#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
6#define DRMEGLSERVERBUFFERINTEGRATION_H
8#include <QtCore/QVariant>
9#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
11#include "qwayland-server-drm-egl-server-buffer.h"
13#include <QtGui/QWindow>
14#include <QtGui/qpa/qplatformnativeinterface.h>
15#include <QtGui/QGuiApplication>
17#include <QtWaylandCompositor/qwaylandcompositor.h>
18#include <QtWaylandCompositor/private/qwayland-server-server-buffer-extension.h>
20#include <QtCore/QDebug>
22#include <EGL/eglext.h>
25typedef void *EGLImageKHR;
26typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const EGLint *attrib_list);
27typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
30#ifndef GL_OES_EGL_image
33#ifndef EGL_MESA_drm_image
34typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy,
const EGLint *attrib_list);
35typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
40class DrmEglServerBufferIntegration;
59 QOpenGLTexture *m_texture =
nullptr;
60 QtWaylandServer::qt_drm_egl_server_buffer::format m_drm_format;
73 bool supportsFormat(QtWayland::ServerBuffer::Format format)
const override;
76 EGLDisplay
display()
const {
return m_egl_display; }
78 inline EGLImageKHR
eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const EGLint *attrib_list);
81 inline EGLBoolean
eglExportDRMImageMESA (EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
85 EGLDisplay m_egl_display = EGL_NO_DISPLAY;
86 PFNEGLCREATEDRMIMAGEMESAPROC m_egl_create_drm_image;
87 PFNEGLEXPORTDRMIMAGEMESAPROC m_egl_export_drm_image;
88 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture_2d;
90 PFNEGLCREATEIMAGEKHRPROC m_egl_create_image;
91 PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image;
96 if (!m_egl_create_image) {
97 qWarning(
"DrmEglServerBufferIntegration: Trying to used unresolved function eglCreateImageKHR");
98 return EGL_NO_IMAGE_KHR;
100 return m_egl_create_image(m_egl_display, ctx, target, buffer,attrib_list);
105 if (!m_egl_destroy_image) {
106 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR");
109 return m_egl_destroy_image(m_egl_display, image);
114 if (m_egl_create_drm_image)
115 return m_egl_create_drm_image(m_egl_display, attrib_list);
117 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglCreateDRMImageMESA");
118 return EGL_NO_IMAGE_KHR;
124 if (m_egl_export_drm_image)
125 return m_egl_export_drm_image(m_egl_display, image, name, handle, stride);
127 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglExportDRMImageMESA");
133 if (m_gl_egl_image_target_texture_2d)
134 return m_gl_egl_image_target_texture_2d(target, image);
136 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function glEGLImageTargetTexture2DOES");
bool supportsFormat(QtWayland::ServerBuffer::Format format) const override
~DrmEglServerBufferIntegration() override
EGLBoolean eglExportDRMImageMESA(EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride)
QtWayland::ServerBuffer * createServerBufferFromImage(const QImage &qimage, QtWayland::ServerBuffer::Format format) override
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
EGLDisplay display() const
bool initializeHardware(QWaylandCompositor *) override
EGLImageKHR eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
EGLImageKHR eglCreateDRMImageMESA(const EGLint *attrib_list)
EGLBoolean eglDestroyImageKHR(EGLImageKHR image)
DrmEglServerBufferIntegration()
bool bufferInUse() override
QOpenGLTexture * toOpenGlTexture() override
DrmEglServerBuffer(DrmEglServerBufferIntegration *integration, const QImage &qimage, QtWayland::ServerBuffer::Format format)
Combined button and popup list for selecting options.