diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-11-07 23:13:13 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-11-11 12:27:49 +0000 |
commit | 51abcc7460da76bd64d4336dcf253c571b820e71 (patch) | |
tree | 0372b7828dda48d5dc8933f1a02e1ea1952be108 | |
parent | 618c2bfc35b522d2fae05b00b0ef5412d9bf28f5 (diff) | |
download | qtwayland-51abcc7460da76bd64d4336dcf253c571b820e71.tar.gz |
RPi: Resolve all BRCM functions dynamically
Directly calling eglCreateGlobalImageBRCM and friends is not ideal due to the
messy RPi distro setups: shipping Mesa (sw rasterizer only) in standard locations
may cause picking up those EGL/GLES libs instead of the Broadcom ones from /opt/vc
when building Qt. While this is something that should be fixed in the sysroot (since
it is a problem at runtime anyway), let's make life easier by resolving via
eglGetProcAddress, which is the right approach in any case.
Change-Id: I73f7698b638691d97743a6f819bc7c8ee6ebd245
Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
6 files changed, 8 insertions, 11 deletions
diff --git a/config.tests/brcm_egl/main.cpp b/config.tests/brcm_egl/main.cpp index 5102ba66..bb3cab73 100644 --- a/config.tests/brcm_egl/main.cpp +++ b/config.tests/brcm_egl/main.cpp @@ -43,7 +43,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> int main() @@ -63,8 +62,8 @@ int main() EGLint pixel_format = EGL_PIXEL_FORMAT_ARGB_8888_BRCM; EGLint id[2]; - eglCreateGlobalImageBRCM(32, 32, pixel_format, 0, 32 * 4, id); - eglDestroyGlobalImageBRCM(id); + PFNEGLCREATEGLOBALIMAGEBRCMPROC createImage = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); + createImage(32, 32, pixel_format, 0, 32 * 4, id); eglTerminate(display); diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp index c9ebb96b..ca4b653a 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.cpp @@ -90,13 +90,13 @@ void QWaylandBrcmEglIntegration::initialize(QWaylandDisplay *waylandDisplay) qWarning("failed to resolve eglFlushBRCM, performance will suffer"); } - eglCreateGlobalImageBRCM = ::eglCreateGlobalImageBRCM; + eglCreateGlobalImageBRCM = (PFNEGLCREATEGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglCreateGlobalImageBRCM"); if (!eglCreateGlobalImageBRCM) { qWarning("failed to resolve eglCreateGlobalImageBRCM"); return; } - eglDestroyGlobalImageBRCM = ::eglDestroyGlobalImageBRCM; + eglDestroyGlobalImageBRCM = (PFNEGLDESTROYGLOBALIMAGEBRCMPROC)eglGetProcAddress("eglDestroyGlobalImageBRCM"); if (!eglDestroyGlobalImageBRCM) { qWarning("failed to resolve eglDestroyGlobalImageBRCM"); return; diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h index 7fe557fb..cc5940f4 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglintegration.h @@ -40,7 +40,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <QtCore/qglobal.h> diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index 7cead1dc..54e95317 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -42,7 +42,6 @@ #include <QtGui/QWindow> #include <qpa/qwindowsysteminterface.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <wayland-client.h> diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp index 79ea1470..7e0288bb 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp +++ b/src/hardwareintegration/compositor/brcm-egl/brcmbuffer.cpp @@ -42,7 +42,6 @@ #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> QT_BEGIN_NAMESPACE @@ -59,7 +58,9 @@ BrcmBuffer::BrcmBuffer(struct ::wl_client *client, uint32_t id, const QSize &siz BrcmBuffer::~BrcmBuffer() { - eglDestroyGlobalImageBRCM(handle()); + static PFNEGLDESTROYGLOBALIMAGEBRCMPROC eglDestroyGlobalImage = + (PFNEGLDESTROYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglDestroyGlobalImageBRCM"); + eglDestroyGlobalImage(handle()); } void BrcmBuffer::buffer_destroy_resource(Resource *) diff --git a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp index 9e2ae52b..9162a082 100644 --- a/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp +++ b/src/hardwareintegration/compositor/brcm-egl/brcmeglintegration.cpp @@ -52,7 +52,6 @@ #include <EGL/egl.h> #include <EGL/eglext.h> -#define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext_brcm.h> #include <GLES2/gl2.h> @@ -92,7 +91,7 @@ void BrcmEglIntegration::initializeHardware(QtWayland::Display *waylandDisplay) if (!d->egl_display) qWarning("Failed to acquire EGL display from platform integration"); - d->eglQueryGlobalImageBRCM = eglQueryGlobalImageBRCM; + d->eglQueryGlobalImageBRCM = (PFNEGLQUERYGLOBALIMAGEBRCMPROC) eglGetProcAddress("eglQueryGlobalImageBRCM"); if (!d->eglQueryGlobalImageBRCM) { qWarning("Failed to resolve eglQueryGlobalImageBRCM"); |