From bd9b42912b13fda8a2726eed015c50a74b1956b2 Mon Sep 17 00:00:00 2001 From: Severin von Wnuck Date: Fri, 17 Sep 2021 13:28:13 +0200 Subject: [PATCH] Fix texture format handling for Nvidia driver --- src/wayland/drmclientbuffer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wayland/drmclientbuffer.cpp b/src/wayland/drmclientbuffer.cpp index 71e0d25897..8b30cf721e 100644 --- a/src/wayland/drmclientbuffer.cpp +++ b/src/wayland/drmclientbuffer.cpp @@ -36,12 +36,16 @@ DrmClientBuffer::DrmClientBuffer(wl_resource *resource, DrmClientBufferIntegrati Q_D(DrmClientBuffer); EGLDisplay eglDisplay = integration->display()->eglDisplay(); - eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &d->textureFormat); + 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_WIDTH, &d->width); eglQueryWaylandBufferWL(eglDisplay, resource, EGL_HEIGHT, &d->height); - bool ok = eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WAYLAND_Y_INVERTED_WL, &d->yInverted); - if (!ok) { + if (!eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WAYLAND_Y_INVERTED_WL, &d->yInverted)) { // If EGL_WAYLAND_Y_INVERTED_WL is unsupported, we must assume that the buffer is inverted. d->yInverted = true; }