From 209b62d522271dcaa8ae29132404618a3b00bb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 3 Mar 2015 10:18:51 +0100 Subject: [PATCH] [wayland] Pass EGLDisplay to KWayland::Server::Display This allows the Server to calculate the size of a Buffer and we don't need to use the queryBuffer for the size. --- abstract_egl_backend.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/abstract_egl_backend.cpp b/abstract_egl_backend.cpp index 4a363909a6..6b5cb39b78 100644 --- a/abstract_egl_backend.cpp +++ b/abstract_egl_backend.cpp @@ -144,6 +144,8 @@ void AbstractEglBackend::initWayland() if (!eglBindWaylandDisplayWL(eglDisplay(), *(WaylandServer::self()->display()))) { eglUnbindWaylandDisplayWL = nullptr; eglQueryWaylandBufferWL = nullptr; + } else { + waylandServer()->display()->setEglDisplay(eglDisplay()); } } #endif @@ -360,15 +362,13 @@ bool AbstractEglTexture::loadEglTexture(const QPointer< KWayland::Server::Buffer EGLImageKHR AbstractEglTexture::attach(const QPointer< KWayland::Server::BufferInterface > &buffer) { - EGLint format, width, height, yInverted; + EGLint format, yInverted; eglQueryWaylandBufferWL(m_backend->eglDisplay(), buffer->resource(), EGL_TEXTURE_FORMAT, &format); if (format != EGL_TEXTURE_RGB && format != EGL_TEXTURE_RGBA) { qCDebug(KWIN_CORE) << "Unsupported texture format: " << format; return EGL_NO_IMAGE_KHR; } eglQueryWaylandBufferWL(m_backend->eglDisplay(), buffer->resource(), EGL_WAYLAND_Y_INVERTED_WL, &yInverted); - eglQueryWaylandBufferWL(m_backend->eglDisplay(), buffer->resource(), EGL_WIDTH, &width); - eglQueryWaylandBufferWL(m_backend->eglDisplay(), buffer->resource(), EGL_HEIGHT, &height); const EGLint attribs[] = { EGL_WAYLAND_PLANE_WL, 0, @@ -378,7 +378,7 @@ EGLImageKHR AbstractEglTexture::attach(const QPointer< KWayland::Server::BufferI (EGLClientBuffer)buffer->resource(), attribs); if (image != EGL_NO_IMAGE_KHR) { glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)image); - m_size = QSize(width, height); + m_size = buffer->size(); updateMatrix(); q->setYInverted(yInverted); }