Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libnvidia-egl-x11 for 
openSUSE:Factory checked in at 2025-12-30 12:01:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libnvidia-egl-x11 (Old)
 and      /work/SRC/openSUSE:Factory/.libnvidia-egl-x11.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libnvidia-egl-x11"

Tue Dec 30 12:01:24 2025 rev:7 rq:1324723 version:1.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/libnvidia-egl-x11/libnvidia-egl-x11.changes      
2025-08-13 16:31:43.771443512 +0200
+++ 
/work/SRC/openSUSE:Factory/.libnvidia-egl-x11.new.1928/libnvidia-egl-x11.changes
    2025-12-30 12:01:46.820049527 +0100
@@ -1,0 +2,12 @@
+Mon Dec 22 15:08:23 UTC 2025 - Stefan Dirsch <[email protected]>
+
+- update to v1.0.4 tarball/version 1.0.5
+- supersedes the following patches:
+  * 0001-Increment-the-version-number-to-1.0.3.patch
+  * 0002-egl-x11-Add-support-for-tegradisp-drm.patch
+- added latest patches from git since 1.0.4
+  * 0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch
+  * 0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
+  * 0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch
+
+-------------------------------------------------------------------

Old:
----
  0001-Increment-the-version-number-to-1.0.3.patch
  0002-egl-x11-Add-support-for-tegradisp-drm.patch
  egl-x11-1.0.2.tar.gz

New:
----
  0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch
  0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
  0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch
  egl-x11-1.0.4.tar.gz

----------(Old B)----------
  Old:- supersedes the following patches:
  * 0001-Increment-the-version-number-to-1.0.3.patch
  * 0002-egl-x11-Add-support-for-tegradisp-drm.patch
  Old:  * 0001-Increment-the-version-number-to-1.0.3.patch
  * 0002-egl-x11-Add-support-for-tegradisp-drm.patch
- added latest patches from git since 1.0.4
----------(Old E)----------

----------(New B)----------
  New:- added latest patches from git since 1.0.4
  * 0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch
  * 0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
  New:  * 0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch
  * 0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
  * 0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch
  New:  * 0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
  * 0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libnvidia-egl-x11.spec ++++++
--- /var/tmp/diff_new_pack.aHvxMY/_old  2025-12-30 12:01:48.768129523 +0100
+++ /var/tmp/diff_new_pack.aHvxMY/_new  2025-12-30 12:01:48.780130016 +0100
@@ -20,17 +20,18 @@
 %define lname libnvidia-egl-x11%{so_ver}
 %define rname egl-x11
 Name:           libnvidia-egl-x11
-Version:        1.0.3
+Version:        1.0.5
 Release:        0
 Summary:        NVIDIA XLib and XCB EGL Platform Library
 # src/x11/dma-buf.h:/* SPDX-License-Identifier: GPL-2.0 WITH 
Linux-syscall-note */
 License:        Apache-2.0
 Group:          Development/Libraries/C and C++
 URL:            https://github.com/NVIDIA/egl-x11
-Source0:        %{rname}-1.0.2.tar.gz
+Source0:        %{rname}-1.0.4.tar.gz
 Source1:        baselibs.conf
-Patch1:         0001-Increment-the-version-number-to-1.0.3.patch
-Patch2:         0002-egl-x11-Add-support-for-tegradisp-drm.patch
+Patch1:         0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch
+Patch2:         0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch
+Patch3:         0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch
 BuildRequires:  gcc-c++
 BuildRequires:  meson
 BuildRequires:  ninja
@@ -94,7 +95,7 @@
 using %{name}.
 
 %prep
-%autosetup -n %{rname}-1.0.2 -p1
+%autosetup -n %{rname}-1.0.4 -p1
 
 %build
 export LDFLAGS="-Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?_lto_cflags}"

++++++ 0001-Fix-attribute-handling-for-eglCreateWindow-PixmapSur.patch ++++++
>From e511d6586e261b54d4443e073c30615ea520b21b Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <[email protected]>
Date: Mon, 1 Dec 2025 12:05:41 -0700
Subject: [PATCH 1/4] Fix attribute handling for eglCreateWindow/PixmapSurface

Fix eplX11CreateWindowSurface and eplX11CreatePixmapSurface so that they
pass the attribute list from the application to
eplX11GetInternalSurfaceAttribs.

Currently, they pass NULL, and ignore the application's attributes.

Also, update eplX11GetInternalSurfaceAttribs so that it'll check the
EGL_RENDER_BUFFER attribute, without passing it to the driver. The
driver doesn't accept EGL_RENDER_BUFFER for platform surfaces, since
that's determined instead by whether we pass a GL_BACK attachment to
eglPlatformCreateSurfaceNVX.

egl-x11 doesn't currently support single-buffered windows, so it'll
issue a warning if the application requests EGL_SINGLE_BUFFER but
otherwise ignore it.
---
 src/x11/x11-pixmap.c   |  5 ++-
 src/x11/x11-platform.c | 83 ++++++++++++++++++++++++++++++++++--------
 src/x11/x11-platform.h |  5 ++-
 src/x11/x11-window.c   |  9 ++++-
 4 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/src/x11/x11-pixmap.c b/src/x11/x11-pixmap.c
index 0a8cb1c..e2d7dc4 100644
--- a/src/x11/x11-pixmap.c
+++ b/src/x11/x11-pixmap.c
@@ -370,6 +370,7 @@ static void PixmapDamageCallback(void *param, int syncfd, 
unsigned int flags)
 void eplX11DestroyPixmap(EplSurface *surf)
 {
     X11Pixmap *ppix = (X11Pixmap *) surf->priv;
+
     surf->priv = NULL;
     if (ppix != NULL)
     {
@@ -468,10 +469,10 @@ EGLSurface eplX11CreatePixmapSurface(EplPlatformData 
*plat, EplDisplay *pdpy, Ep
     fmt = eplFormatInfoLookup(configInfo->fourcc);
     assert(fmt != NULL);
 
-    internalAttribs = eplX11GetInternalSurfaceAttribs(plat, pdpy, 
internalAttribs);
+    internalAttribs = eplX11GetInternalSurfaceAttribs(plat, pdpy, 
EPL_SURFACE_TYPE_PIXMAP, attribs);
     if (internalAttribs == NULL)
     {
-        goto done;
+        return EGL_NO_SURFACE;
     }
 
     geomCookie = xcb_get_geometry(inst->conn, xpix);
diff --git a/src/x11/x11-platform.c b/src/x11/x11-platform.c
index 13e67a1..9be220e 100644
--- a/src/x11/x11-platform.c
+++ b/src/x11/x11-platform.c
@@ -1311,34 +1311,85 @@ static EGLBoolean eplX11WaitGL(EplDisplay *pdpy, 
EplSurface *psurf)
     return ret;
 }
 
-EGLAttrib *eplX11GetInternalSurfaceAttribs(EplPlatformData *plat, EplDisplay 
*pdpy, const EGLAttrib *attribs)
+EGLAttrib *eplX11GetInternalSurfaceAttribs(EplPlatformData *plat,
+        EplDisplay *pdpy, EplSurfaceType surface_type, const EGLAttrib 
*attribs)
 {
     EGLAttrib *internalAttribs = NULL;
-    int count = 0;
+    int count = eplCountAttribs(attribs);
+
+    // Allocate extra space so that we can add EGL_SURFACE_Y_INVERTED_NVX 
below.
+    internalAttribs = malloc((count + 3) * sizeof(EGLAttrib));
+    if (internalAttribs == NULL)
+    {
+        eplSetError(plat, EGL_BAD_ALLOC, "Out of memory\n");
+        return NULL;
+    }
+
+    count = 0;
+    internalAttribs[count++] = EGL_SURFACE_Y_INVERTED_NVX;
+    internalAttribs[count++] = EGL_TRUE;
 
     if (attribs != NULL)
     {
-        for (count = 0; attribs[count] != EGL_NONE; count += 2)
+        int i;
+        for (i=0; attribs[i] != EGL_NONE; i += 2)
         {
-            if (attribs[count] == EGL_SURFACE_Y_INVERTED_NVX)
+            if (attribs[i] == EGL_SURFACE_Y_INVERTED_NVX)
             {
-                eplSetError(plat, EGL_BAD_ATTRIBUTE, "Invalid attribute 
0x%04x\n", attribs[count]);
+                eplSetError(plat, EGL_BAD_ATTRIBUTE, "Invalid attribute 
0x%04x\n", attribs[i]);
+                free(internalAttribs);
                 return NULL;
             }
+            else if (attribs[i] == EGL_RENDER_BUFFER)
+            {
+                /*
+                 * eglPlatformCreateSurfaceNVX doesn't accept the
+                 * EGL_RENDER_BUFFER attribute, since it's the platform library
+                 * that allocates and specifies the front and back buffers, not
+                 * the driver.
+                 */
+                if (surface_type != EPL_SURFACE_TYPE_WINDOW)
+                {
+                    /*
+                     * The EGL_RENDER_BUFFER is not valid for pixmaps, since
+                     * they're always single-buffered.
+                     */
+                    eplSetError(plat, EGL_BAD_ATTRIBUTE, "EGL_RENDER_BUFFER is 
not valid for pixmaps");
+                    free(internalAttribs);
+                    return NULL;
+                }
+                else if (attribs[i + 1] == EGL_SINGLE_BUFFER)
+                {
+                    /*
+                     * We don't currently support single-buffered rendering for
+                     * a window, but this attribute is only a hint, so it's not
+                     * an error to request it.
+                     *
+                     * If we do implement EGL_SINGLE_BUFFER for windows in the
+                     * future, then we'd do that by passing only a GL_FRONT
+                     * buffer to eglPlatformCreateSurfaceNVX, like we do for
+                     * pixmaps.
+                     */
+                    plat->callbacks.debugMessage(EGL_DEBUG_MSG_WARN_KHR,
+                            "EGL_SINGLE_BUFFER requested, but single-buffered 
rendering is not supported");
+                }
+                else if (attribs[i + 1] != EGL_BACK_BUFFER)
+                {
+                    eplSetError(plat, EGL_BAD_ATTRIBUTE,
+                            "Invalid EGL_RENDER_BUFFER value 0x%04x", 
attribs[i + 1]);
+                    free(internalAttribs);
+                    return NULL;
+                }
+            }
+            else
+            {
+                internalAttribs[count++] = attribs[i];
+                internalAttribs[count++] = attribs[i + 1];
+            }
         }
     }
 
-    internalAttribs = malloc((count + 3) * sizeof(EGLAttrib));
-    if (internalAttribs == NULL)
-    {
-        eplSetError(plat, EGL_BAD_ALLOC, "Out of memory\n");
-        return NULL;
-    }
-
-    memcpy(internalAttribs, attribs, count * sizeof(EGLAttrib));
-    internalAttribs[count] = EGL_SURFACE_Y_INVERTED_NVX;
-    internalAttribs[count + 1] = EGL_TRUE;
-    internalAttribs[count + 2] = EGL_NONE;
+    internalAttribs[count] = EGL_NONE;
     return internalAttribs;
 }
 
diff --git a/src/x11/x11-platform.h b/src/x11/x11-platform.h
index ebd8b8a..c90f67d 100644
--- a/src/x11/x11-platform.h
+++ b/src/x11/x11-platform.h
@@ -429,13 +429,14 @@ EGLBoolean eplX11InitConfigList(EplPlatformData *plat, 
X11DisplayInstance *inst)
  *
  * \param plat The platform data
  * \param pdpy The display data
+ * \param surface_type The type of surface that the attributes are for.
  * \param attribs The attribute list that was passed to eglCreateWindowSurface
  *      or eglCreatePixmapSurface.
  * \return The EGLAttrib array to pass to the driver, or NULL on error. The
  *      caller must free the array using free().
  */
-
-EGLAttrib *eplX11GetInternalSurfaceAttribs(EplPlatformData *plat, EplDisplay 
*pdpy, const EGLAttrib *attribs);
+EGLAttrib *eplX11GetInternalSurfaceAttribs(EplPlatformData *plat,
+        EplDisplay *pdpy, EplSurfaceType surface_type, const EGLAttrib 
*attribs);
 
 EGLBoolean eplX11HookChooseConfig(EGLDisplay edpy, EGLint const *attribs,
         EGLConfig *configs, EGLint configSize, EGLint *numConfig);
diff --git a/src/x11/x11-window.c b/src/x11/x11-window.c
index 2376b61..040d7bf 100644
--- a/src/x11/x11-window.c
+++ b/src/x11/x11-window.c
@@ -732,6 +732,11 @@ void eplX11FreeWindow(EplSurface *surf)
 {
     X11Window *pwin = (X11Window *) surf->priv;
 
+    if (pwin == NULL)
+    {
+        return;
+    }
+
     FreeWindowBuffers(surf);
 
     if (pwin->inst->conn != NULL && pwin->present_event != NULL)
@@ -1308,10 +1313,10 @@ EGLSurface eplX11CreateWindowSurface(EplPlatformData 
*plat, EplDisplay *pdpy, Ep
         return EGL_NO_SURFACE;
     }
 
-    internalAttribs = eplX11GetInternalSurfaceAttribs(plat, pdpy, 
internalAttribs);
+    internalAttribs = eplX11GetInternalSurfaceAttribs(plat, pdpy, 
EPL_SURFACE_TYPE_WINDOW, attribs);
     if (internalAttribs == NULL)
     {
-        goto done;
+        return EGL_NO_SURFACE;
     }
 
     fmt = eplX11FindDriverFormat(inst, configInfo->fourcc);
-- 
2.51.0


++++++ 0002-Handle-eglQuerySurface-EGL_RENDER_BUFFER.patch ++++++
>From 5e373f88a21b8aa190bf67eec8c6158d8642f289 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <[email protected]>
Date: Mon, 1 Dec 2025 13:33:44 -0700
Subject: [PATCH 2/4] Handle eglQuerySurface(EGL_RENDER_BUFFER)

Add a hook for eglQuerySurface to handle EGL_RENDER_BUFFER.

For windows, always return EGL_BACK_BUFFER, and for pixmaps, always
return EGL_SINGLE_BUFFER.
---
 src/x11/x11-platform.c | 56 ++++++++++++++++++++++++++++++++++++++++++
 src/x11/x11-platform.h |  1 +
 2 files changed, 57 insertions(+)

diff --git a/src/x11/x11-platform.c b/src/x11/x11-platform.c
index 9be220e..1d73bdc 100644
--- a/src/x11/x11-platform.c
+++ b/src/x11/x11-platform.c
@@ -79,11 +79,13 @@ static void eplX11TerminateDisplay(EplPlatformData *plat, 
EplDisplay *pdpy);
 static void eplX11DestroySurface(EplDisplay *pdpy, EplSurface *surf);
 static void eplX11FreeSurface(EplDisplay *pdpy, EplSurface *surf);
 static EGLBoolean eplX11WaitGL(EplDisplay *pdpy, EplSurface *psurf);
+static EGLBoolean eplX11HookQuerySurface(EGLDisplay edpy, EGLSurface esurf, 
EGLint attribute, EGLint *value);
 
 static const EplHookFunc X11_HOOK_FUNCTIONS[] =
 {
     { "eglChooseConfig", eplX11HookChooseConfig },
     { "eglGetConfigAttrib", eplX11HookGetConfigAttrib },
+    { "eglQuerySurface", eplX11HookQuerySurface },
     { "eglSwapInterval", eplX11SwapInterval },
 };
 static const int NUM_X11_HOOK_FUNCTIONS = sizeof(X11_HOOK_FUNCTIONS) / 
sizeof(X11_HOOK_FUNCTIONS[0]);
@@ -183,6 +185,7 @@ EGLBoolean eplX11LoadEGLExternalPlatformCommon(int major, 
int minor,
 
     plat->priv->egl.QueryDisplayAttribKHR = 
driver->getProcAddress("eglQueryDisplayAttribKHR");
     plat->priv->egl.SwapInterval = driver->getProcAddress("eglSwapInterval");
+    plat->priv->egl.QuerySurface = driver->getProcAddress("eglQuerySurface");
     plat->priv->egl.QueryDmaBufFormatsEXT = 
driver->getProcAddress("eglQueryDmaBufFormatsEXT");
     plat->priv->egl.QueryDmaBufModifiersEXT = 
driver->getProcAddress("eglQueryDmaBufModifiersEXT");
     plat->priv->egl.CreateSync = driver->getProcAddress("eglCreateSync");
@@ -202,6 +205,7 @@ EGLBoolean eplX11LoadEGLExternalPlatformCommon(int major, 
int minor,
 
     if (plat->priv->egl.QueryDisplayAttribKHR == NULL
             || plat->priv->egl.SwapInterval == NULL
+            || plat->priv->egl.QuerySurface == NULL
             || plat->priv->egl.QueryDmaBufFormatsEXT == NULL
             || plat->priv->egl.QueryDmaBufModifiersEXT == NULL
             || plat->priv->egl.CreateSync == NULL
@@ -1512,3 +1516,55 @@ uint32_t eplX11GetNativeXID(EplDisplay *pdpy, void 
*native_surface, EGLBoolean c
 
     return xid;
 }
+
+EGLBoolean eplX11HookQuerySurface(EGLDisplay edpy, EGLSurface esurf, EGLint 
attribute, EGLint *value)
+{
+    EplDisplay *pdpy = NULL;
+    EplSurface *psurf = NULL;
+    EGLBoolean ret = EGL_FALSE;
+
+    pdpy = eplDisplayAcquire(edpy);
+    if (pdpy == NULL)
+    {
+        return EGL_FALSE;
+    }
+
+    if (value == NULL)
+    {
+        eplSetError(pdpy->platform, EGL_BAD_ATTRIBUTE, "value pointer must not 
be NULL");
+        eplDisplayRelease(pdpy);
+        return EGL_FALSE;
+    }
+
+    psurf = eplSurfaceAcquire(pdpy, esurf);
+    if (psurf != NULL)
+    {
+        if (attribute == EGL_RENDER_BUFFER)
+        {
+            if (psurf->type == EPL_SURFACE_TYPE_WINDOW)
+            {
+                *value = EGL_BACK_BUFFER;
+            }
+            else
+            {
+                *value = EGL_SINGLE_BUFFER;
+            }
+            ret = EGL_TRUE;
+        }
+        else
+        {
+            ret = 
pdpy->platform->priv->egl.QuerySurface(pdpy->internal_display,
+                    psurf->internal_surface, attribute, value);
+        }
+        eplSurfaceRelease(pdpy, psurf);
+    }
+    else
+    {
+        // If we don't recognize the EGLSurface, then just pass the call
+        // through to the driver.
+        ret = pdpy->platform->priv->egl.QuerySurface(pdpy->internal_display, 
esurf, attribute, value);
+    }
+
+    eplDisplayRelease(pdpy);
+    return ret;
+}
diff --git a/src/x11/x11-platform.h b/src/x11/x11-platform.h
index c90f67d..62fd866 100644
--- a/src/x11/x11-platform.h
+++ b/src/x11/x11-platform.h
@@ -73,6 +73,7 @@ struct _EplImplPlatform
     {
         PFNEGLQUERYDISPLAYATTRIBKHRPROC QueryDisplayAttribKHR;
         PFNEGLSWAPINTERVALPROC SwapInterval;
+        PFNEGLQUERYSURFACEPROC QuerySurface;
         PFNEGLQUERYDMABUFFORMATSEXTPROC QueryDmaBufFormatsEXT;
         PFNEGLQUERYDMABUFMODIFIERSEXTPROC QueryDmaBufModifiersEXT;
         PFNEGLCREATESYNCPROC CreateSync;
-- 
2.51.0


++++++ 0003-Enable-implicit-sync-if-we-re-talking-to-the-NVIDIA-.patch ++++++
>From f0c64b0fd24b884247889cb86a343c2adf65edc7 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <[email protected]>
Date: Wed, 25 Jun 2025 17:17:15 -0600
Subject: [PATCH 4/4] Enable implicit sync if we're talking to the NVIDIA Xorg
 server module.

Although the NVIDIA driver doesn't support implicit sync semantics, the
NVIDIA Xorg driver will extract and attach the fence attached to the
dma-buf when it processes a PresentPixmap or CopyArea request, which is
enough for egl-x11 to use its implicit sync path.

Thus, we can set supports_implicit_sync if the server is on a non-NV
device, or if the server is running on the NVIDIA Xorg module (which we
can check by looking for the NVIDIA-specific NV-GLX extension).

Also added some environment variables to control the sync path:

Setting __NV_X11_FORCE_IMPLICIT_SYNC=1 will force egl-x11 to enable its
implicit sync path, though it will still use explicit sync first if
that's available. Setting it to "0" will disable the implicit sync path.

Setting __NV_X11_DISABLE_EXPLICIT_SYNC=1 will disable the explicit sync
path.
---
 src/x11/x11-platform.c | 62 ++++++++++++++++++++++++++++++++----------
 src/x11/x11-window.c   | 28 +++++++++++--------
 2 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/src/x11/x11-platform.c b/src/x11/x11-platform.c
index 1d73bdc..a073f34 100644
--- a/src/x11/x11-platform.c
+++ b/src/x11/x11-platform.c
@@ -709,6 +709,21 @@ static void eplX11CleanupDisplay(EplDisplay *pdpy)
     }
 }
 
+static EGLBoolean CheckX11Extension(xcb_connection_t *conn, const char *name)
+{
+    xcb_generic_error_t *error = NULL;
+    xcb_query_extension_reply_t *reply = xcb_query_extension_reply(conn,
+            xcb_query_extension(conn, strlen(name), name), &error);
+    EGLBoolean ret = EGL_FALSE;
+    if (reply != NULL)
+    {
+        ret = (reply->present != 0);
+        free(reply);
+    }
+    free(error);
+    return ret;
+}
+
 /**
  * Checks whether the server has the necessary support that we need.
  *
@@ -727,7 +742,6 @@ static EGLBoolean CheckServerExtensions(X11DisplayInstance 
*inst)
     xcb_dri3_query_version_reply_t *dri3Reply = NULL;
     xcb_present_query_version_cookie_t presentCookie;
     xcb_present_query_version_reply_t *presentReply = NULL;
-    xcb_query_extension_reply_t *nvglxReply = NULL;
     EGLBoolean success = EGL_FALSE;
 
     // Check to make sure that we're using a domain socket, since we need to be
@@ -765,17 +779,7 @@ static EGLBoolean CheckServerExtensions(X11DisplayInstance 
*inst)
          * we could add some requests to NV-GLX to support older (pre DRI3 1.2)
          * servers or non-Linux systems.
          */
-        const char NVGLX_EXTENSION_NAME[] = "NV-GLX";
-        xcb_query_extension_cookie_t extCookie = 
xcb_query_extension(inst->conn,
-                sizeof(NVGLX_EXTENSION_NAME) - 1, NVGLX_EXTENSION_NAME);
-        nvglxReply = xcb_query_extension_reply(inst->conn, extCookie, &error);
-        if (nvglxReply == NULL)
-        {
-            // XQueryExtension isn't supposed to generate any errors.
-            goto done;
-        }
-
-        if (nvglxReply->present)
+        if (CheckX11Extension(inst->conn, "NV-GLX"))
         {
             goto done;
         }
@@ -821,7 +825,6 @@ static EGLBoolean CheckServerExtensions(X11DisplayInstance 
*inst)
     success = EGL_TRUE;
 
 done:
-    free(nvglxReply);
     free(presentReply);
     free(dri3Reply);
     free(error);
@@ -893,6 +896,7 @@ X11DisplayInstance *eplX11DisplayInstanceCreate(EplDisplay 
*pdpy, EGLBoolean fro
     EplInternalDisplay *internalDpy = NULL;
     EGLBoolean supportsDirect = EGL_FALSE;
     EGLBoolean supportsLinear = EGL_FALSE;
+    const char *env;
 
     inst = calloc(1, sizeof(X11DisplayInstance));
     if (inst == NULL)
@@ -1013,7 +1017,15 @@ X11DisplayInstance 
*eplX11DisplayInstanceCreate(EplDisplay *pdpy, EGLBoolean fro
             return NULL;
         }
 
-        inst->supports_implicit_sync = EGL_FALSE;
+        /*
+         * The NVIDIA driver does not support implicit sync semantics in OpenGL
+         * and similar. However, if the NVIDIA server-side driver module for
+         * Xorg supports DRI3 1.2, then it will will extract and attach fences
+         * from the dma-buf when it processes a PresentPixmap or CopyArea
+         * request, which is all we actually need in order to use our implicit
+         * sync path.
+         */
+        inst->supports_implicit_sync = CheckX11Extension(inst->conn, "NV-GLX");
     }
     else
     {
@@ -1047,6 +1059,19 @@ X11DisplayInstance 
*eplX11DisplayInstanceCreate(EplDisplay *pdpy, EGLBoolean fro
         inst->supports_implicit_sync = EGL_TRUE;
     }
 
+    env = getenv("__NV_X11_FORCE_IMPLICIT_SYNC");
+    if (env != NULL)
+    {
+        if (strcmp(env, "1") == 0)
+        {
+            inst->supports_implicit_sync = EGL_TRUE;
+        }
+        else if (strcmp(env, "0") == 0)
+        {
+            inst->supports_implicit_sync = EGL_FALSE;
+        }
+    }
+
     if (inst->device == EGL_NO_DEVICE_EXT)
     {
         if (from_init)
@@ -1192,6 +1217,15 @@ X11DisplayInstance 
*eplX11DisplayInstanceCreate(EplDisplay *pdpy, EGLBoolean fro
         }
     }
 
+    if (inst->supports_explicit_sync)
+    {
+        env = getenv("__NV_X11_DISABLE_EXPLICIT_SYNC");
+        if (env != NULL && atoi(env) != 0)
+        {
+            inst->supports_explicit_sync = EGL_FALSE;
+        }
+    }
+
     if (inst->force_prime && !inst->supports_prime)
     {
         if (from_init)
diff --git a/src/x11/x11-window.c b/src/x11/x11-window.c
index 040d7bf..5a458ba 100644
--- a/src/x11/x11-window.c
+++ b/src/x11/x11-window.c
@@ -340,15 +340,14 @@ static void FreeColorBuffer(X11DisplayInstance *inst, 
X11ColorBuffer *buffer)
 static X11ColorBuffer *AllocOneColorBuffer(X11DisplayInstance *inst,
         const EplFormatInfo *fmt, uint32_t width, uint32_t height,
         const uint64_t *modifiers, int num_modifiers,
-        EGLBoolean scanout)
+        EGLBoolean prime)
 {
-    int fd = -1;
     uint32_t flags = 0;
     X11ColorBuffer *buffer = NULL;
 
     assert(num_modifiers > 0);
 
-    if (scanout)
+    if (!prime)
     {
         flags |= GBM_BO_USE_SCANOUT;
     }
@@ -370,14 +369,14 @@ static X11ColorBuffer 
*AllocOneColorBuffer(X11DisplayInstance *inst,
         goto done;
     }
 
-    fd = gbm_bo_get_fd(buffer->gbo);
-    if (fd < 0)
+    buffer->fd = gbm_bo_get_fd(buffer->gbo);
+    if (buffer->fd < 0)
     {
         goto done;
     }
 
     buffer->buffer = 
inst->platform->priv->egl.PlatformImportColorBufferNVX(inst->internal_display->edpy,
-            fd, width, height, gbm_bo_get_format(buffer->gbo),
+            buffer->fd, width, height, gbm_bo_get_format(buffer->gbo),
             gbm_bo_get_stride(buffer->gbo),
             gbm_bo_get_offset(buffer->gbo, 0),
             gbm_bo_get_modifier(buffer->gbo));
@@ -386,11 +385,15 @@ static X11ColorBuffer 
*AllocOneColorBuffer(X11DisplayInstance *inst,
         goto done;
     }
 
-done:
-    if (fd >= 0)
+    if (prime || !inst->supports_implicit_sync)
     {
-        close(fd);
+        // We only need to hold on to a file descriptor for a shared dma-buf,
+        // and only if we're using implicit sync.
+        close(buffer->fd);
+        buffer->fd = -1;
     }
+
+done:
     if (buffer->buffer == NULL)
     {
         FreeColorBuffer(inst, buffer);
@@ -497,7 +500,7 @@ static EGLBoolean AllocWindowBuffers(EplSurface *surf,
     EGLBoolean success = EGL_TRUE;
 
     front = AllocOneColorBuffer(pwin->inst, pwin->format->fmt, 
pwin->pending_width, pwin->pending_height,
-            modifiers, num_modifiers, !prime);
+            modifiers, num_modifiers, prime);
     if (front == NULL)
     {
         goto done;
@@ -508,7 +511,7 @@ static EGLBoolean AllocWindowBuffers(EplSurface *surf,
     modifier = gbm_bo_get_modifier(front->gbo);
 
     back = AllocOneColorBuffer(pwin->inst, pwin->format->fmt, 
pwin->pending_width, pwin->pending_height,
-            &modifier, 1, !prime);
+            &modifier, 1, prime);
     if (back == NULL)
     {
         goto done;
@@ -1785,6 +1788,7 @@ static int CheckBufferReleaseImplicit(EplDisplay *pdpy, 
EplSurface *surf,
     {
         if (buffer != skip && buffer->status == BUFFER_STATUS_IDLE_NOTIFIED)
         {
+            assert(buffer->fd >= 0);
             buffers[count] = buffer;
             fds[count].fd = buffer->fd;
             fds[count].events = POLLOUT;
@@ -2107,7 +2111,7 @@ static X11ColorBuffer *GetFreeBuffer(EplDisplay *pdpy, 
EplSurface *surf,
             else
             {
                 buffer = AllocOneColorBuffer(pwin->inst, pwin->format->fmt, 
pwin->width, pwin->height,
-                        &pwin->modifier, 1, !pwin->prime);
+                        &pwin->modifier, 1, pwin->prime);
             }
             if (buffer == NULL)
             {
-- 
2.51.0


++++++ egl-x11-1.0.2.tar.gz -> egl-x11-1.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/meson.build 
new/egl-x11-1.0.4/meson.build
--- old/egl-x11-1.0.2/meson.build       2025-05-02 16:51:47.000000000 +0200
+++ new/egl-x11-1.0.4/meson.build       2025-11-12 17:32:54.000000000 +0100
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 project('egl-x11', 'c',
-  version : '1.0.2',
+  version : '1.0.4',
   default_options : ['c_std=gnu99'],
 )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/driver-platform-surface.h 
new/egl-x11-1.0.4/src/x11/driver-platform-surface.h
--- old/egl-x11-1.0.2/src/x11/driver-platform-surface.h 2025-05-02 
16:51:47.000000000 +0200
+++ new/egl-x11-1.0.4/src/x11/driver-platform-surface.h 2025-11-12 
17:32:54.000000000 +0100
@@ -56,7 +56,15 @@
 #define EGL_SURFACE_Y_INVERTED_NVX 0x31DB
 
 #define EGL_PLATFORM_SURFACE_INTERFACE_MAJOR_VERSION 0
-#define EGL_PLATFORM_SURFACE_INTERFACE_MINOR_VERSION 1
+
+/**
+ * Version 0.2 adds the ability to call eglSwapBuffers (or 
eglSwapBuffersWithDamage)
+ * to perform any internal operations that are necessary before presentation.
+ *
+ * This is used for downsampling or any other internal bookkeeping that the
+ * driver needs.
+ */
+#define EGL_PLATFORM_SURFACE_INTERNAL_SWAP_SINCE 2
 
 static inline EGLint EGL_PLATFORM_SURFACE_INTERFACE_GET_MAJOR_VERSION(EGLint 
version)
 {
@@ -71,14 +79,13 @@
  * Checks if the version number reported by the driver is compatible.
  *
  * \param driver_version The version number reported by \c 
eglPlatformGetVersionNVX.
- * \param major_version The major version number that the library expects.
  * \param min_minor_version The minimum minor version number that the library 
requires.
  * \return EGL_TRUE if the driver's version is compatible.
  */
 static inline EGLBoolean EGL_PLATFORM_SURFACE_INTERFACE_CHECK_VERSION(EGLint 
driver_version,
-        EGLint major_version, EGLint min_minor_version)
+        EGLint min_minor_version)
 {
-    return EGL_PLATFORM_SURFACE_INTERFACE_GET_MAJOR_VERSION(driver_version) == 
major_version
+    return EGL_PLATFORM_SURFACE_INTERFACE_GET_MAJOR_VERSION(driver_version) == 
EGL_PLATFORM_SURFACE_INTERFACE_MAJOR_VERSION
         && EGL_PLATFORM_SURFACE_INTERFACE_GET_MINOR_VERSION(driver_version) >= 
min_minor_version;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/x11-config.c 
new/egl-x11-1.0.4/src/x11/x11-config.c
--- old/egl-x11-1.0.2/src/x11/x11-config.c      2025-05-02 16:51:47.000000000 
+0200
+++ new/egl-x11-1.0.4/src/x11/x11-config.c      2025-11-12 17:32:54.000000000 
+0100
@@ -259,6 +259,11 @@
         return;
     }
 
+    if ((config->surfaceMask & EGL_STREAM_BIT_KHR) == 0)
+    {
+        return;
+    }
+
     support = eplX11FindDriverFormat(inst, fourcc);
     if (support == NULL)
     {
@@ -273,9 +278,27 @@
     visual = FindVisualForFormat(inst->platform, inst->conn, inst->xscreen, 
support->fmt);
     if (visual != 0)
     {
+        EGLBoolean can_support_windows = EGL_TRUE;
+
+        if 
(!EGL_PLATFORM_SURFACE_INTERFACE_CHECK_VERSION(plat->priv->egl.platform_surface_version,
+                    EGL_PLATFORM_SURFACE_INTERNAL_SWAP_SINCE))
+        {
+            // Multisampled surfaces require additional driver support which 
was
+            // added in interface version 0.2.
+            EGLint msaa = 0;
+            if 
(plat->priv->egl.PlatformGetConfigAttribNVX(inst->internal_display->edpy,
+                        config->config, EGL_SAMPLE_BUFFERS, &msaa))
+            {
+                can_support_windows = (msaa == 0);
+            }
+        }
+
         config->nativeVisualID = visual;
         config->nativeVisualType = XCB_VISUAL_CLASS_TRUE_COLOR;
-        config->surfaceMask |= EGL_WINDOW_BIT;
+        if (can_support_windows)
+        {
+            config->surfaceMask |= EGL_WINDOW_BIT;
+        }
     }
     else
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/x11-pixmap.c 
new/egl-x11-1.0.4/src/x11/x11-pixmap.c
--- old/egl-x11-1.0.2/src/x11/x11-pixmap.c      2025-05-02 16:51:47.000000000 
+0200
+++ new/egl-x11-1.0.4/src/x11/x11-pixmap.c      2025-11-12 17:32:54.000000000 
+0100
@@ -436,7 +436,7 @@
     EGLSurface esurf = EGL_NO_SURFACE;
     EGLAttrib buffers[] =
     {
-        GL_BACK, 0,
+        GL_FRONT, 0,
         EGL_PLATFORM_SURFACE_BLIT_TARGET_NVX, 0,
         EGL_PLATFORM_SURFACE_DAMAGE_CALLBACK_NVX, (EGLAttrib) 
PixmapDamageCallback,
         EGL_PLATFORM_SURFACE_DAMAGE_CALLBACK_PARAM_NVX, (EGLAttrib) surf,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/x11-platform.c 
new/egl-x11-1.0.4/src/x11/x11-platform.c
--- old/egl-x11-1.0.2/src/x11/x11-platform.c    2025-05-02 16:51:47.000000000 
+0200
+++ new/egl-x11-1.0.4/src/x11/x11-platform.c    2025-11-12 17:32:54.000000000 
+0100
@@ -1,5 +1,5 @@
 /*
- * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. 
All rights reserved.
+ * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & 
AFFILIATES. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,7 +53,6 @@
 #define CLIENT_EXTENSIONS_XLIB "EGL_KHR_platform_x11 EGL_EXT_platform_x11"
 #define CLIENT_EXTENSIONS_XCB "EGL_EXT_platform_xcb"
 
-static const EGLint NEED_PLATFORM_SURFACE_MAJOR = 0;
 static const EGLint NEED_PLATFORM_SURFACE_MINOR = 1;
 static const uint32_t NEED_DRI3_MAJOR = 1;
 static const uint32_t NEED_DRI3_MINOR = 2;
@@ -166,13 +165,18 @@
         return EGL_FALSE;
     }
 
+    // Check that the driver supports a compatible version of the platform
+    // surface interface.
     ptr_eglPlatformGetVersionNVX = 
driver->getProcAddress("eglPlatformGetVersionNVX");
-    if (ptr_eglPlatformGetVersionNVX == NULL
-            || 
!EGL_PLATFORM_SURFACE_INTERFACE_CHECK_VERSION(ptr_eglPlatformGetVersionNVX(),
-                NEED_PLATFORM_SURFACE_MAJOR, NEED_PLATFORM_SURFACE_MINOR))
+    if (ptr_eglPlatformGetVersionNVX == NULL)
+    {
+        eplPlatformBaseInitFail(plat);
+        return EGL_FALSE;
+    }
+    plat->priv->egl.platform_surface_version = ptr_eglPlatformGetVersionNVX();
+    if 
(!EGL_PLATFORM_SURFACE_INTERFACE_CHECK_VERSION(plat->priv->egl.platform_surface_version,
+                NEED_PLATFORM_SURFACE_MINOR))
     {
-        // The driver doesn't support a compatible version of the platform
-        // surface interface.
         eplPlatformBaseInitFail(plat);
         return EGL_FALSE;
     }
@@ -500,6 +504,7 @@
                 if (version->name != NULL)
                 {
                     if (strcmp(version->name, "nvidia-drm") == 0
+                            || strcmp(version->name, "tegradisp-drm") == 0
                             || strcmp(version->name, "tegra-udrm") == 0
                             || strcmp(version->name, "tegra") == 0)
                     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/x11-platform.h 
new/egl-x11-1.0.4/src/x11/x11-platform.h
--- old/egl-x11-1.0.2/src/x11/x11-platform.h    2025-05-02 16:51:47.000000000 
+0200
+++ new/egl-x11-1.0.4/src/x11/x11-platform.h    2025-11-12 17:32:54.000000000 
+0100
@@ -90,6 +90,8 @@
         pfn_eglPlatformCopyColorBufferNVX PlatformCopyColorBufferNVX;
         pfn_eglPlatformAllocColorBufferNVX PlatformAllocColorBufferNVX;
         pfn_eglPlatformExportColorBufferNVX PlatformExportColorBufferNVX;
+
+        EGLint platform_surface_version;
     } egl;
 
     struct
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-x11-1.0.2/src/x11/x11-window.c 
new/egl-x11-1.0.4/src/x11/x11-window.c
--- old/egl-x11-1.0.2/src/x11/x11-window.c      2025-05-02 16:51:47.000000000 
+0200
+++ new/egl-x11-1.0.4/src/x11/x11-window.c      2025-11-12 17:32:54.000000000 
+0100
@@ -2201,6 +2201,16 @@
     // reallocating the color buffers while we're trying to rearrange them.
     pwin->skip_update_callback++;
 
+    if 
(EGL_PLATFORM_SURFACE_INTERFACE_CHECK_VERSION(plat->priv->egl.platform_surface_version,
+                EGL_PLATFORM_SURFACE_INTERNAL_SWAP_SINCE))
+    {
+        // Call into the driver to do any extra pre-present work.
+        if (!plat->egl.SwapBuffers(pwin->inst->internal_display->edpy, 
surf->internal_surface))
+        {
+            goto done;
+        }
+    }
+
     if (CheckWindowDeleted(surf, &ret))
     {
         goto done;

Reply via email to