24class BrcmEglIntegrationPrivate
27 BrcmEglIntegrationPrivate() =
default;
29 static BrcmEglIntegrationPrivate *get(BrcmEglIntegration *integration);
31 EGLDisplay egl_display = EGL_NO_DISPLAY;
33 PFNEGLQUERYGLOBALIMAGEBRCMPROC eglQueryGlobalImageBRCM;
34 PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
35 PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
36 PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
46 Q_D(BrcmEglIntegration);
48 QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
49 if (nativeInterface) {
50 d->egl_display = nativeInterface->nativeResourceForIntegration(
"EglDisplay");
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");
102 auto d = BrcmEglIntegrationPrivate::get(m_integration);
104 qWarning(
"bindTextureToBuffer failed!");
108 BrcmBuffer *brcmBuffer = BrcmBuffer::fromResource(m_buffer);
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());
120 m_texture =
new QOpenGLTexture(QOpenGLTexture::Target2D);
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);
144 new BrcmBuffer(resource->client(), id, QSize(width, height),
static_cast<EGLint *>(data->data), data->size /
sizeof(EGLint));