From 128570ed53a7cc1b6bdb0a3a33f73d7bd6214995 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Nov 2021 13:54:56 +0200 Subject: [PATCH] Restore correct type check for wl_drm client buffers With the EGLStreams support gone, we can restore the correct type check for wl_drm client buffers. The spec suggests to query the EGL_TEXTURE_FORMAT attribute to determine whether the specified wl_buffer is a wl_drm buffer. --- src/wayland/drmclientbuffer.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/wayland/drmclientbuffer.cpp b/src/wayland/drmclientbuffer.cpp index 5773ee0aff..530f178d9b 100644 --- a/src/wayland/drmclientbuffer.cpp +++ b/src/wayland/drmclientbuffer.cpp @@ -36,12 +36,7 @@ DrmClientBuffer::DrmClientBuffer(wl_resource *resource, DrmClientBufferIntegrati Q_D(DrmClientBuffer); EGLDisplay eglDisplay = integration->display()->eglDisplay(); - if (!eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &d->textureFormat)) { - // The proprietary Nvidia driver doesn't support querying the EGL_TEXTURE_FORMAT. - // We must assume that the buffer has an alpha channel for transparency to work. - d->textureFormat = EGL_TEXTURE_RGBA; - } - + eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &d->textureFormat); eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WIDTH, &d->width); eglQueryWaylandBufferWL(eglDisplay, resource, EGL_HEIGHT, &d->height); @@ -89,8 +84,8 @@ ClientBuffer *DrmClientBufferIntegration::createBuffer(::wl_resource *resource) resolved = true; } - EGLint height; - if (eglQueryWaylandBufferWL(eglDisplay, resource, EGL_HEIGHT, &height)) { + EGLint format; + if (eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &format)) { return new DrmClientBuffer(resource, this); } return nullptr;