6#include <QtWaylandCompositor/qwaylandsurface.h>
7#include <qpa/qplatformnativeinterface.h>
8#include <QtGui/QGuiApplication>
9#include <QtGui/QOpenGLContext>
10#include <QOpenGLTexture>
11#include <qpa/qplatformscreen.h>
12#include <QtGui/QWindow>
15#include <EGL/eglext.h>
17#include <EGL/eglext_brcm.h>
20#include <GLES2/gl2ext.h>
49 if (nativeInterface) {
52 qWarning(
"Failed to acquire EGL display from platform integration");
54 d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress(
"eglQueryGlobalImageBRCM");
56 if (!
d->eglQueryGlobalImageBRCM) {
57 qWarning(
"Failed to resolve eglQueryGlobalImageBRCM");
61 d->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress(
"glEGLImageTargetTexture2DOES");
63 if (!
d->glEGLImageTargetTexture2DOES) {
64 qWarning(
"Failed to resolve glEGLImageTargetTexture2DOES");
68 d->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress(
"eglCreateImageKHR");
70 if (!
d->eglCreateImageKHR) {
71 qWarning(
"Failed to resolve eglCreateImageKHR");
75 d->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress(
"eglDestroyImageKHR");
77 if (!
d->eglDestroyImageKHR) {
78 qWarning(
"Failed to resolve eglDestroyImageKHR");
88 if (wl_shm_buffer_get(
buffer))
95 return integration->d_ptr.
data();
104 qWarning(
"bindTextureToBuffer failed!");
110 if (!
d->eglQueryGlobalImageBRCM(brcmBuffer->
handle(), brcmBuffer->
handle() + 2)) {
111 qWarning(
"eglQueryGlobalImageBRCM failed!");
115 EGLImageKHR image =
d->eglCreateImageKHR(
d->egl_display, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)brcmBuffer->
handle(), NULL);
116 if (
image == EGL_NO_IMAGE_KHR)
117 qWarning(
"eglCreateImageKHR() failed: %x\n", eglGetError());
126 d->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D,
image);
128 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
129 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
133 d->eglDestroyImageKHR(
d->egl_display,
image);
149 , m_integration(integration)
161 return brcmBuffer->
size();
static BrcmBuffer * fromResource(struct ::wl_resource *resource)
QWaylandBufferRef::BufferFormatEgl bufferFormatEgl() const override
QSize size() const override
BrcmEglClientBuffer(BrcmEglIntegration *integration, wl_resource *buffer)
QWaylandSurface::Origin origin() const override
QOpenGLTexture * toOpenGlTexture(int plane) override
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR
PFNEGLQUERYGLOBALIMAGEBRCMPROC eglQueryGlobalImageBRCM
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR
static BrcmEglIntegrationPrivate * get(BrcmEglIntegration *integration)
BrcmEglIntegrationPrivate()=default
void brcm_bind_resource(Resource *resource) override
QtWayland::ClientBuffer * createBufferFor(wl_resource *buffer) override
void initializeHardware(struct ::wl_display *display) override
void brcm_create_buffer(Resource *resource, uint32_t id, int32_t width, int32_t height, wl_array *data) override
static QPlatformNativeInterface * platformNativeInterface()
bool create()
Creates the underlying OpenGL texture object.
void bind()
Binds this texture to the currently active texture unit ready for rendering.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
Origin
This enum type is used to specify the origin of a QWaylandSurface's buffer.
struct::wl_resource * m_buffer
struct wl_display * display
Combined button and popup list for selecting options.
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)