summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/compositor/wayland-egl
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2014-01-01 16:40:13 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-29 13:48:00 +0100
commit5b5ad2079394880ab3379ba2e6fb7f9295490627 (patch)
tree69540228b0efbbc0674297dd388455376ca535a3 /src/hardwareintegration/compositor/wayland-egl
parenta578c2801a134a8d97e37ab9b6d9fd0a3093952a (diff)
fix compile with Mesa 10.0
Mesa 10.0 replaces struct wl_buffer with struct wl_resource in the eglQueryWaylandBufferWL signature. The structures are binary compatible (struct wl_buffer is a superset of struct wl_resource), but C++ complains about the type mismatch: error: cannot convert ‘wl_buffer*’ to ‘wl_resource*’ in argument passing We are already using struct wl_resource on our side, so removing the now redundant reinterpret_cast would fix it. But then we could not compile with Mesa versions older than 10.0 any more, and those are still common in mainstream distributions today. A compile-time switch for different Mesa versions is possible, but unnecessarily clumsy. Instead, re-declare the new signature and use that independently of the Mesa version. The duplicate declaration can be removed when backwards compatibility is no longer needed. Change-Id: I3d0e326f5a0eb88d125b8c9fd23147682e23b94b Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/hardwareintegration/compositor/wayland-egl')
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index c9b8c9e44..ede8a9abf 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -54,10 +54,12 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+/* Needed for compatibility with Mesa older than 10.0. */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL_compat) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
+
#ifndef EGL_WL_bind_wayland_display
typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, struct wl_buffer *buffer, EGLint attribute, EGLint *value);
#endif
#ifndef EGL_KHR_image
@@ -91,7 +93,7 @@ public:
bool display_bound;
PFNEGLBINDWAYLANDDISPLAYWL egl_bind_wayland_display;
PFNEGLUNBINDWAYLANDDISPLAYWL egl_unbind_wayland_display;
- PFNEGLQUERYWAYLANDBUFFERWL egl_query_wayland_buffer;
+ PFNEGLQUERYWAYLANDBUFFERWL_compat egl_query_wayland_buffer;
PFNEGLCREATEIMAGEKHRPROC egl_create_image;
PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image;
@@ -136,7 +138,7 @@ void WaylandEglClientBufferIntegration::initializeHardware(QtWayland::Display *w
return;
}
- d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL>(eglGetProcAddress("eglQueryWaylandBufferWL"));
+ d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
qWarning("Failed to initialize egl display. Could not find eglQueryWaylandBufferWL.\n");
return;
@@ -197,7 +199,7 @@ bool WaylandEglClientBufferIntegration::isYInverted(struct ::wl_resource *buffer
EGLint isYInverted;
EGLBoolean ret;
- ret = d->egl_query_wayland_buffer(d->egl_display, reinterpret_cast<struct ::wl_buffer *>(buffer), EGL_WAYLAND_Y_INVERTED_WL, &isYInverted);
+ ret = d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_WAYLAND_Y_INVERTED_WL, &isYInverted);
// Yes, this looks strange, but the specification says that EGL_FALSE return
// value (not supported) should be treated the same as EGL_TRUE return value
@@ -233,8 +235,8 @@ QSize WaylandEglClientBufferIntegration::bufferSize(struct ::wl_resource *buffer
Q_D(const WaylandEglClientBufferIntegration);
int width, height;
- d->egl_query_wayland_buffer(d->egl_display, reinterpret_cast<struct ::wl_buffer *>(buffer), EGL_WIDTH, &width);
- d->egl_query_wayland_buffer(d->egl_display, reinterpret_cast<struct ::wl_buffer *>(buffer), EGL_HEIGHT, &height);
+ d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_WIDTH, &width);
+ d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_HEIGHT, &height);
return QSize(width, height);
}