summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@kdab.com>2016-02-08 15:59:45 +0200
committerGiulio Camuffo <giuliocamuffo@gmail.com>2016-02-08 13:09:10 +0000
commit1ce01dde7afa5ebbe7de6392ce9d99efe0e2d13a (patch)
treeb922f95ee0dbbdb4a6fe585cf39379f553c97c90 /src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
parent5ad565ab86c06ac46cc5054a4608a9892864e02b (diff)
Fix querying the buffer size on some platforms
On Mesa/Intel apparently querying a buffer's size can return bogus values if an EGLImage was not created from it yet. Change-Id: I186dcc70f64d310ef3f5e9f908267a8c28b113f2 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp')
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index 2413df915..63da3ea4a 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -288,20 +288,6 @@ void WaylandEglClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource
EGLint format;
EGLNativeFileDescriptorKHR streamFd = EGL_NO_FILE_DESCRIPTOR_KHR;
- EGLint width, 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);
- state.size = QSize(width, height);
-
-#if defined(EGL_WAYLAND_Y_INVERTED_WL)
- EGLint isYInverted;
- EGLBoolean 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
- // and EGL_TRUE in value.
- state.isYInverted = (ret == EGL_FALSE || isYInverted == EGL_TRUE);
-#endif
-
if (d->egl_query_wayland_buffer(d->egl_display, buffer, EGL_TEXTURE_FORMAT, &format)) {
// Resolving GL functions may need a context current, so do it only here.
if (!d->gl_egl_image_target_texture_2d)
@@ -337,6 +323,20 @@ void WaylandEglClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource
qWarning("%s:%d: eglStreamConsumerGLTextureExternalKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError());
}
+ EGLint width, 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);
+ state.size = QSize(width, height);
+
+#if defined(EGL_WAYLAND_Y_INVERTED_WL)
+ EGLint isYInverted;
+ EGLBoolean 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
+ // and EGL_TRUE in value.
+ state.isYInverted = (ret == EGL_FALSE || isYInverted == EGL_TRUE);
+#endif
+
d->buffers[buffer] = state;
}
}