File 0016-Don-t-pass-EGL_RENDER_BUFFER-to-the-driver.patch of Package libnvidia-egl-wayland2

From 14c013b12ef4cccdabaa7df5269939a563d51898 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Mon, 24 Nov 2025 11:25:15 -0700
Subject: [PATCH 16/18] Don't pass EGL_RENDER_BUFFER to the driver.

In eplWlCreateWindowSurface, if the application passes the
EGL_RENDER_BUFFER attribute, then consume it locally instead of passing
it to the driver.

If the application requests EGL_SINGLE_BUFFER, then we'll issue a
warning, but not an error. Wayland doesn't allow front-buffered
rendering, but that attribute is only a hint.
---
 src/wayland/wayland-surface.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/wayland/wayland-surface.c b/src/wayland/wayland-surface.c
index 214a7e5..f34489e 100644
--- a/src/wayland/wayland-surface.c
+++ b/src/wayland/wayland-surface.c
@@ -810,6 +810,25 @@ EGLSurface eplWlCreateWindowSurface(EplPlatformData *plat, EplDisplay *pdpy, Epl
                 eplSetError(plat, EGL_BAD_ATTRIBUTE, "Invalid attribute 0x%04x\n", attribs[i]);
                 goto done;
             }
+            else if (attribs[i] == EGL_RENDER_BUFFER)
+            {
+                if (attribs[i + 1] == EGL_SINGLE_BUFFER)
+                {
+                    /*
+                     * Wayland doesn't allow front-buffered rendering, but this
+                     * attribute is only a hint. So, issue a warning, but don't
+                     * treat it as an error.
+                     */
+                    plat->callbacks.debugMessage(EGL_DEBUG_MSG_WARN_KHR,
+                            "EGL_SINGLE_BUFFER requested, but Wayland does not support front-buffered rendering");
+                }
+                else if (attribs[i + 1] != EGL_BACK_BUFFER)
+                {
+                    eplSetError(plat, EGL_BAD_ATTRIBUTE,
+                            "Invalid EGL_RENDER_BUFFER value 0x%04x", attribs[i + 1]);
+                    goto done;
+                }
+            }
             else
             {
                 driverAttribs[numAttribs++] = attribs[i];
-- 
2.51.0

openSUSE Build Service is sponsored by