4#ifndef DRMEGLSERVERBUFFERINTEGRATION_H
5#define DRMEGLSERVERBUFFERINTEGRATION_H
7#include <QtCore/QVariant>
8#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
10#include "qwayland-server-drm-egl-server-buffer.h"
12#include <QtGui/QWindow>
13#include <QtGui/qpa/qplatformnativeinterface.h>
14#include <QtGui/QGuiApplication>
16#include <QtWaylandCompositor/qwaylandcompositor.h>
17#include <QtWaylandCompositor/private/qwayland-server-server-buffer-extension.h>
19#include <QtCore/QDebug>
21#include <EGL/eglext.h>
24typedef void *EGLImageKHR;
25typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const EGLint *attrib_list);
26typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
29#ifndef GL_OES_EGL_image
32#ifndef EGL_MESA_drm_image
33typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy,
const EGLint *attrib_list);
34typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
39class DrmEglServerBufferIntegration;
58 QOpenGLTexture *m_texture =
nullptr;
59 QtWaylandServer::qt_drm_egl_server_buffer::format m_drm_format;
72 bool supportsFormat(QtWayland::ServerBuffer::Format format)
const override;
75 EGLDisplay
display()
const {
return m_egl_display; }
77 inline EGLImageKHR
eglCreateImageKHR(EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
const EGLint *attrib_list);
80 inline EGLBoolean
eglExportDRMImageMESA (EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
84 EGLDisplay m_egl_display = EGL_NO_DISPLAY;
85 PFNEGLCREATEDRMIMAGEMESAPROC m_egl_create_drm_image;
86 PFNEGLEXPORTDRMIMAGEMESAPROC m_egl_export_drm_image;
87 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC m_gl_egl_image_target_texture_2d;
89 PFNEGLCREATEIMAGEKHRPROC m_egl_create_image;
90 PFNEGLDESTROYIMAGEKHRPROC m_egl_destroy_image;
95 if (!m_egl_create_image) {
96 qWarning(
"DrmEglServerBufferIntegration: Trying to used unresolved function eglCreateImageKHR");
97 return EGL_NO_IMAGE_KHR;
99 return m_egl_create_image(m_egl_display, ctx, target, buffer,attrib_list);
104 if (!m_egl_destroy_image) {
105 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglDestroyImageKHR");
108 return m_egl_destroy_image(m_egl_display, image);
113 if (m_egl_create_drm_image)
114 return m_egl_create_drm_image(m_egl_display, attrib_list);
116 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglCreateDRMImageMESA");
117 return EGL_NO_IMAGE_KHR;
123 if (m_egl_export_drm_image)
124 return m_egl_export_drm_image(m_egl_display, image, name, handle, stride);
126 qWarning(
"DrmEglServerBufferIntegration: Trying to use unresolved function eglExportDRMImageMESA");
132 if (m_gl_egl_image_target_texture_2d)
133 return m_gl_egl_image_target_texture_2d(target, image);
135 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)
typedef void(GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum target
Combined button and popup list for selecting options.