Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libnvidia-egl-wayland for 
openSUSE:Factory checked in at 2022-11-05 14:46:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libnvidia-egl-wayland (Old)
 and      /work/SRC/openSUSE:Factory/.libnvidia-egl-wayland.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libnvidia-egl-wayland"

Sat Nov  5 14:46:46 2022 rev:7 rq:1033618 version:1.1.11

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/libnvidia-egl-wayland/libnvidia-egl-wayland.changes  
    2022-04-23 00:25:36.367761517 +0200
+++ 
/work/SRC/openSUSE:Factory/.libnvidia-egl-wayland.new.2275/libnvidia-egl-wayland.changes
    2022-11-05 14:46:52.510630977 +0100
@@ -1,0 +2,10 @@
+Fri Nov  4 19:38:35 UTC 2022 - Stefan Dirsch <[email protected]>
+
+- update to version 1.1.11
+  * latest bugfix release
+- supersedes 
+  * U_0001-wayland-Fail-eglGetDisplay-if-wl_drm-is-not-availabl.patch
+  * U_0002-generate-wayland-drm-client-protocol.h.patch
+  * U_0003-egl-wayland-retrieve-DRM-device-name-before-acquirin.patch
+
+-------------------------------------------------------------------

Old:
----
  U_0001-wayland-Fail-eglGetDisplay-if-wl_drm-is-not-availabl.patch
  U_0002-generate-wayland-drm-client-protocol.h.patch
  U_0003-egl-wayland-retrieve-DRM-device-name-before-acquirin.patch
  egl-wayland-1.1.9.tar.gz

New:
----
  egl-wayland-1.1.11.tar.gz

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

Other differences:
------------------
++++++ libnvidia-egl-wayland.spec ++++++
--- /var/tmp/diff_new_pack.sN09XC/_old  2022-11-05 14:46:53.482636647 +0100
+++ /var/tmp/diff_new_pack.sN09XC/_new  2022-11-05 14:46:53.498636740 +0100
@@ -20,7 +20,7 @@
 %define lname libnvidia-egl-wayland%{so_ver}
 %define rname egl-wayland
 Name:           libnvidia-egl-wayland
-Version:        1.1.9
+Version:        1.1.11
 Release:        0
 Summary:        The EGLStream-based Wayland external platform
 License:        MIT
@@ -28,15 +28,13 @@
 URL:            https://github.com/NVIDIA/egl-wayland
 Source0:        
https://github.com/NVIDIA/egl-wayland/archive/%{version}/%{rname}-%{version}.tar.gz
 Source1:        baselibs.conf
-Patch1:         
U_0001-wayland-Fail-eglGetDisplay-if-wl_drm-is-not-availabl.patch
-Patch2:         U_0002-generate-wayland-drm-client-protocol.h.patch
-Patch3:         
U_0003-egl-wayland-retrieve-DRM-device-name-before-acquirin.patch
 BuildRequires:  gcc-c++
 BuildRequires:  meson >= 0.50
 BuildRequires:  ninja
 BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(egl)
 BuildRequires:  pkgconfig(eglexternalplatform) >= 1.1
+BuildRequires:  pkgconfig(libdrm)
 BuildRequires:  pkgconfig(wayland-client)
 BuildRequires:  pkgconfig(wayland-egl-backend) >= 3
 BuildRequires:  pkgconfig(wayland-protocols)

++++++ egl-wayland-1.1.9.tar.gz -> egl-wayland-1.1.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/Makefile.am 
new/egl-wayland-1.1.11/Makefile.am
--- old/egl-wayland-1.1.9/Makefile.am   2021-09-08 01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/Makefile.am  2022-08-06 01:54:11.000000000 +0200
@@ -49,7 +49,8 @@
 
 libnvidia_egl_wayland_la_built_client_headers =               \
     wayland-eglstream/wayland-eglstream-client-protocol.h     \
-    wayland-eglstream/wayland-eglstream-controller-client-protocol.h
+    wayland-eglstream/wayland-eglstream-controller-client-protocol.h \
+    wayland-drm/wayland-drm-client-protocol.h
 
 libnvidia_egl_wayland_la_built_server_headers =               \
     wayland-eglstream/wayland-eglstream-server-protocol.h     \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/configure.ac 
new/egl-wayland-1.1.11/configure.ac
--- old/egl-wayland-1.1.9/configure.ac  2021-09-08 01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/configure.ac 2022-08-06 01:54:11.000000000 +0200
@@ -2,7 +2,7 @@
 
 m4_define([wayland_eglstream_major_version], [1])
 m4_define([wayland_eglstream_minor_version], [1])
-m4_define([wayland_eglstream_micro_version], [9])
+m4_define([wayland_eglstream_micro_version], [11])
 m4_define([wayland_eglstream_version],
           
[wayland_eglstream_major_version.wayland_eglstream_minor_version.wayland_eglstream_micro_version])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-drm.h 
new/egl-wayland-1.1.11/include/wayland-drm.h
--- old/egl-wayland-1.1.9/include/wayland-drm.h 2021-09-08 01:52:12.000000000 
+0200
+++ new/egl-wayland-1.1.11/include/wayland-drm.h        2022-08-06 
01:54:11.000000000 +0200
@@ -23,9 +23,14 @@
 #ifndef WAYLAND_DRM_H
 #define WAYLAND_DRM_H
 
+extern const char *
+wl_drm_get_dev_name(const WlEglPlatformData *data,
+                    EGLDisplay dpy);
+
 extern EGLBoolean
 wl_drm_display_bind(struct wl_display *display,
-                    struct wl_eglstream_display *wlStreamDpy);
+                    struct wl_eglstream_display *wlStreamDpy,
+                    const char *dev_name);
 extern void
 wl_drm_display_unbind(struct wl_eglstream_display *wlStreamDpy);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-egldisplay.h 
new/egl-wayland-1.1.11/include/wayland-egldisplay.h
--- old/egl-wayland-1.1.9/include/wayland-egldisplay.h  2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/include/wayland-egldisplay.h 2022-08-06 
01:54:11.000000000 +0200
@@ -91,6 +91,8 @@
 
     WlEglDmaBufFormat *dmaBufFormats;
     uint32_t numFormats;
+
+    EGLBoolean primeRenderOffload;
 } WlEglDisplay;
 
 typedef struct WlEventQueueRec {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-eglhandle.h 
new/egl-wayland-1.1.11/include/wayland-eglhandle.h
--- old/egl-wayland-1.1.9/include/wayland-eglhandle.h   2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/include/wayland-eglhandle.h  2022-08-06 
01:54:11.000000000 +0200
@@ -76,6 +76,7 @@
         PWLEGLFNTERMINATECOREPROC                   terminate;
         PWLEGLFNCHOOSECONFIGCOREPROC                chooseConfig;
         PWLEGLFNGETCONFIGATTRIBCOREPROC             getConfigAttrib;
+        PFNEGLQUERYSURFACEPROC                      querySurface;
 
         PWLEGLFNGETCURRENTCONTEXTCOREPROC           getCurrentContext;
         PWLEGLFNGETCURRENTSURFACECOREPROC           getCurrentSurface;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-eglstream-server.h 
new/egl-wayland-1.1.11/include/wayland-eglstream-server.h
--- old/egl-wayland-1.1.9/include/wayland-eglstream-server.h    2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/include/wayland-eglstream-server.h   2022-08-06 
01:54:11.000000000 +0200
@@ -49,7 +49,8 @@
 wl_eglstream_display_bind(WlEglPlatformData *data,
                           struct wl_display *wlDisplay,
                           EGLDisplay eglDisplay,
-                          const char *exts);
+                          const char *exts,
+                          const char *dev_name);
 
 /*
  * wl_eglstream_display_unbind()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/egl-wayland-1.1.9/include/wayland-eglsurface-internal.h 
new/egl-wayland-1.1.11/include/wayland-eglsurface-internal.h
--- old/egl-wayland-1.1.9/include/wayland-eglsurface-internal.h 1970-01-01 
01:00:00.000000000 +0100
+++ new/egl-wayland-1.1.11/include/wayland-eglsurface-internal.h        
2022-08-06 01:54:11.000000000 +0200
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef WAYLAND_EGLSURFACE_INTERNAL_H
+#define WAYLAND_EGLSURFACE_INTERNAL_H
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <pthread.h>
+#include <wayland-client.h>
+#include "wayland-egldisplay.h"
+#include "wayland-eglutils.h"
+#include "wayland-eglsurface.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct WlEglStreamImageRec {
+    /* Pointer back to the parent surface for use in Wayland callbacks */
+    struct WlEglSurfaceRec *surface;
+
+    /*
+     * Use an individual mutex to guard access to each image's data. This 
avoids
+     * sharing the surface lock between the app and buffer release event
+     * threads, resulting in simplified lock management and smaller critical
+     * sections.
+     */
+    pthread_mutex_t         mutex;
+
+    EGLImageKHR             eglImage;
+    struct wl_buffer       *buffer;
+    EGLBoolean              attached;
+    struct wl_list          acquiredLink;
+} WlEglStreamImage;
+
+typedef struct WlEglSurfaceCtxRec {
+    EGLBoolean              isOffscreen;
+    EGLSurface              eglSurface;
+    EGLStreamKHR            eglStream;
+    void                   *wlStreamResource;
+    EGLBoolean              isAttached;
+
+    int          useDamageThread;
+    pthread_t    damageThreadId;
+    EGLSyncKHR   damageThreadSync;
+    int          damageThreadFlush;
+    int          damageThreadShutdown;
+    EGLuint64KHR framesProduced;
+    EGLuint64KHR framesFinished;
+    EGLuint64KHR framesProcessed;
+
+    /*
+     * The double pointer is because of the need to allocate the data for each
+     * image slot separately to avoid clobbering the acquiredLink member
+     * whenever the streamImages arrary is resized with realloc().
+     */
+    WlEglStreamImage      **streamImages;
+    struct wl_list          acquiredImages;
+    struct wl_buffer       *currentBuffer;
+    uint32_t                numStreamImages;
+
+    struct wl_list link;
+} WlEglSurfaceCtx;
+
+struct WlEglSurfaceRec {
+    WlEglDisplay *wlEglDpy;
+    EGLConfig     eglConfig;
+    EGLint       *attribs;
+    EGLBoolean    pendingSwapIntervalUpdate;
+
+    struct wl_egl_window *wlEglWin;
+    long int              wlEglWinVer;
+    struct wl_surface    *wlSurface;
+    int                   width, height;
+    int                   dx,    dy;
+
+    WlEglSurfaceCtx ctx;
+    struct wl_list  oldCtxList;
+
+    EGLint swapInterval;
+    EGLint fifoLength;
+
+    struct wl_callback    *throttleCallback;
+    struct wl_event_queue *wlEventQueue;
+
+    /* Asynchronous wl_buffer.release event processing */
+    struct {
+        struct wl_event_queue  *wlBufferEventQueue;
+        pthread_t               bufferReleaseThreadId;
+        int                     bufferReleaseThreadPipe[2];
+    };
+
+    struct wl_list link;
+
+    EGLBoolean isSurfaceProducer;
+
+    /* The refCount is initialized to 1 during EGLSurface creation,
+     * gets incremented/decrementsd in wlEglSurfaceRef()/wlEglSurfaceUnref(),
+     * when we enter/exit from eglSwapBuffers().
+     */
+    unsigned int refCount;
+    /*
+     * Set to EGL_TRUE before destroying the EGLSurface in eglDestroySurface().
+     */
+    EGLBoolean isDestroyed;
+
+    /* The lock is used to serialize eglSwapBuffers()/eglDestroySurface(),
+     * Using wlExternalApiLock() for this requires that we release lock
+     * before dispatching frame sync events in wlEglWaitFrameSync().
+     */
+    pthread_mutex_t mutexLock;
+
+    /* True when the EGL_PRESENT_OPAQUE_EXT surface attrib is set by the app */
+    EGLBoolean presentOpaque;
+
+    /* This pair of mutex and conditional variable is used
+     * for sychronization between eglSwapBuffers() and damage
+     * thread on creating frame sync and waiting for it.
+     */
+    pthread_mutex_t mutexFrameSync;
+    pthread_cond_t condFrameSync;
+
+    /* We want to delay the resizing of the window surface until the next
+     * eglSwapBuffers(), so just set a resize flag.
+     */
+    EGLBoolean isResized;
+};
+
+void wlEglResizeSurface(WlEglDisplay *display,
+                        WlEglPlatformData *pData,
+                        WlEglSurface *surface);
+
+EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
+                                                EGLConfig config,
+                                                void *nativeWin,
+                                                const EGLAttrib *attribs);
+EGLSurface wlEglCreatePlatformPixmapSurfaceHook(EGLDisplay dpy,
+                                                EGLConfig config,
+                                                void *nativePixmap,
+                                                const EGLAttrib *attribs);
+EGLSurface wlEglCreatePbufferSurfaceHook(EGLDisplay dpy,
+                                         EGLConfig config,
+                                         const EGLint *attribs);
+EGLSurface wlEglCreateStreamProducerSurfaceHook(EGLDisplay dpy,
+                                                EGLConfig config,
+                                                EGLStreamKHR stream,
+                                                const EGLint *attribs);
+EGLBoolean wlEglDestroySurfaceHook(EGLDisplay dpy, EGLSurface eglSurface);
+EGLBoolean wlEglDestroyAllSurfaces(WlEglDisplay *display);
+
+EGLBoolean wlEglIsWaylandWindowValid(struct wl_egl_window *window);
+EGLBoolean wlEglIsWlEglSurfaceForDisplay(WlEglDisplay *display, WlEglSurface 
*wlEglSurface);
+
+EGLBoolean wlEglQuerySurfaceHook(EGLDisplay dpy, EGLSurface eglSurface, EGLint 
attribute, EGLint *value);
+
+EGLBoolean wlEglQueryNativeResourceHook(EGLDisplay dpy,
+                                        void *nativeResource,
+                                        EGLint attribute,
+                                        int *value);
+
+EGLBoolean wlEglSendDamageEvent(WlEglSurface *surface,
+                                struct wl_event_queue *queue);
+
+void wlEglCreateFrameSync(WlEglSurface *surface);
+EGLint wlEglWaitFrameSync(WlEglSurface *surface);
+
+EGLBoolean wlEglSurfaceRef(WlEglDisplay *display, WlEglSurface *surface);
+void wlEglSurfaceUnref(WlEglSurface *surface);
+
+EGLint wlEglHandleImageStreamEvents(WlEglSurface *surface);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-eglsurface.h 
new/egl-wayland-1.1.11/include/wayland-eglsurface.h
--- old/egl-wayland-1.1.9/include/wayland-eglsurface.h  2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/include/wayland-eglsurface.h 2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -34,141 +34,17 @@
 extern "C" {
 #endif
 
-typedef struct WlEglStreamImageRec {
-    /* Pointer back to the parent surface for use in Wayland callbacks */
-    struct WlEglSurfaceRec *surface;
-
-    /*
-     * Use an individual mutex to guard access to each image's data. This 
avoids
-     * sharing the surface lock between the app and buffer release event
-     * threads, resulting in simplified lock management and smaller critical
-     * sections.
-     */
-    pthread_mutex_t         mutex;
-
-    EGLImageKHR             eglImage;
-    struct wl_buffer       *buffer;
-    EGLBoolean              attached;
-    struct wl_list          acquiredLink;
-} WlEglStreamImage;
-
-typedef struct WlEglSurfaceCtxRec {
-    EGLBoolean              isOffscreen;
-    EGLSurface              eglSurface;
-    EGLStreamKHR            eglStream;
-    void                   *wlStreamResource;
-    EGLBoolean              isAttached;
-
-    int          useDamageThread;
-    pthread_t    damageThreadId;
-    EGLSyncKHR   damageThreadSync;
-    int          damageThreadFlush;
-    int          damageThreadShutdown;
-    EGLuint64KHR framesProduced;
-    EGLuint64KHR framesFinished;
-    EGLuint64KHR framesProcessed;
-
-    /*
-     * The double pointer is because of the need to allocate the data for each
-     * image slot separately to avoid clobbering the acquiredLink member
-     * whenever the streamImages arrary is resized with realloc().
-     */
-    WlEglStreamImage      **streamImages;
-    struct wl_list          acquiredImages;
-    struct wl_buffer       *currentBuffer;
-    uint32_t                numStreamImages;
-
-    struct wl_list link;
-} WlEglSurfaceCtx;
-
-typedef struct WlEglSurfaceRec {
-    WlEglDisplay *wlEglDpy;
-    EGLConfig     eglConfig;
-    EGLint       *attribs;
-    EGLBoolean    pendingSwapIntervalUpdate;
-
-    struct wl_egl_window *wlEglWin;
-    long int              wlEglWinVer;
-    struct wl_surface    *wlSurface;
-    int                   width, height;
-    int                   dx,    dy;
-
-    WlEglSurfaceCtx ctx;
-    struct wl_list  oldCtxList;
-
-    EGLint swapInterval;
-    EGLint fifoLength;
-
-    struct wl_callback    *throttleCallback;
-    struct wl_event_queue *wlEventQueue;
-
-    /* Asynchronous wl_buffer.release event processing */
-    struct {
-        struct wl_event_queue  *wlBufferEventQueue;
-        pthread_t               bufferReleaseThreadId;
-        int                     bufferReleaseThreadPipe[2];
-    };
-
-    struct wl_list link;
-
-    EGLBoolean isSurfaceProducer;
-
-    /* The refCount is initialized to 1 during EGLSurface creation,
-     * gets incremented/decrementsd in wlEglSurfaceRef()/wlEglSurfaceUnref(),
-     * when we enter/exit from eglSwapBuffers().
-     */
-    unsigned int refCount;
-    /*
-     * Set to EGL_TRUE before destroying the EGLSurface in eglDestroySurface().
-     */
-    EGLBoolean isDestroyed;
-
-    /* The lock is used to serialize eglSwapBuffers()/eglDestroySurface(),
-     * Using wlExternalApiLock() for this requires that we release lock
-     * before dispatching frame sync events in wlEglWaitFrameSync().
-     */
-    pthread_mutex_t mutexLock;
-} WlEglSurface;
+typedef struct WlEglSurfaceRec WlEglSurface;
 
 WL_EXPORT
-EGLBoolean wlEglInitializeSurfaceExport(WlEglSurface *surface);
+EGLStreamKHR wlEglGetSurfaceStreamExport(WlEglSurface *surface);
 
-EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
-                                                EGLConfig config,
-                                                void *nativeWin,
-                                                const EGLAttrib *attribs);
-EGLSurface wlEglCreatePlatformPixmapSurfaceHook(EGLDisplay dpy,
-                                                EGLConfig config,
-                                                void *nativePixmap,
-                                                const EGLAttrib *attribs);
-EGLSurface wlEglCreatePbufferSurfaceHook(EGLDisplay dpy,
-                                         EGLConfig config,
-                                         const EGLint *attribs);
-EGLSurface wlEglCreateStreamProducerSurfaceHook(EGLDisplay dpy,
-                                                EGLConfig config,
-                                                EGLStreamKHR stream,
-                                                const EGLint *attribs);
-EGLBoolean wlEglDestroySurfaceHook(EGLDisplay dpy, EGLSurface eglSurface);
-EGLBoolean wlEglDestroyAllSurfaces(WlEglDisplay *display);
-
-EGLBoolean wlEglIsWaylandWindowValid(struct wl_egl_window *window);
-EGLBoolean wlEglIsWlEglSurfaceForDisplay(WlEglDisplay *display, WlEglSurface 
*wlEglSurface);
-
-EGLBoolean wlEglQueryNativeResourceHook(EGLDisplay dpy,
-                                        void *nativeResource,
-                                        EGLint attribute,
-                                        int *value);
-
-EGLBoolean wlEglSendDamageEvent(WlEglSurface *surface,
-                                struct wl_event_queue *queue);
-
-void wlEglCreateFrameSync(WlEglSurface *surface);
-EGLint wlEglWaitFrameSync(WlEglSurface *surface);
-
-EGLBoolean wlEglSurfaceRef(WlEglDisplay *display, WlEglSurface *surface);
-void wlEglSurfaceUnref(WlEglSurface *surface);
-
-EGLint wlEglHandleImageStreamEvents(WlEglSurface *surface);
+WL_EXPORT
+WlEglSurface *wlEglCreateSurfaceExport(EGLDisplay dpy,
+                                       int width,
+                                       int height,
+                                       struct wl_surface *native_surface,
+                                       int fifo_length);
 
 #ifdef __cplusplus
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/include/wayland-external-exports.h 
new/egl-wayland-1.1.11/include/wayland-external-exports.h
--- old/egl-wayland-1.1.9/include/wayland-external-exports.h    2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/include/wayland-external-exports.h   2022-08-06 
01:54:11.000000000 +0200
@@ -53,7 +53,7 @@
  #define WAYLAND_EXTERNAL_VERSION_MINOR                      0
 #endif
 
-#define WAYLAND_EXTERNAL_VERSION_MICRO                       9
+#define WAYLAND_EXTERNAL_VERSION_MICRO                       11
 
 
 #define EGL_EXTERNAL_PLATFORM_VERSION_MAJOR WAYLAND_EXTERNAL_VERSION_MAJOR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/meson.build 
new/egl-wayland-1.1.11/meson.build
--- old/egl-wayland-1.1.9/meson.build   2021-09-08 01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/meson.build  2022-08-06 01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 project('wayland-eglstream', 'c',
-        version : '1.1.9',
+        version : '1.1.11',
         default_options : [
           'buildtype=debugoptimized',
           'c_std=gnu99',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/meson.build 
new/egl-wayland-1.1.11/src/meson.build
--- old/egl-wayland-1.1.9/src/meson.build       2021-09-08 01:52:12.000000000 
+0200
+++ new/egl-wayland-1.1.11/src/meson.build      2022-08-06 01:54:11.000000000 
+0200
@@ -47,6 +47,7 @@
     wayland_eglstream_controller_protocol_c,
     wayland_eglstream_controller_client_protocol_h,
     wayland_drm_protocol_c,
+    wayland_drm_client_protocol_h,
     wayland_drm_server_protocol_h,
 ]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-drm.c 
new/egl-wayland-1.1.11/src/wayland-drm.c
--- old/egl-wayland-1.1.9/src/wayland-drm.c     2021-09-08 01:52:12.000000000 
+0200
+++ new/egl-wayland-1.1.11/src/wayland-drm.c    2022-08-06 01:54:11.000000000 
+0200
@@ -152,37 +152,36 @@
         wl_resource_post_event(resource, WL_DRM_CAPABILITIES, 0);
 }
 
-EGLBoolean
-wl_drm_display_bind(struct wl_display *display,
-                    struct wl_eglstream_display *wlStreamDpy)
+const char *
+wl_drm_get_dev_name(const WlEglPlatformData *data,
+                    EGLDisplay dpy)
 {
-    EGLDisplay dpy = wlStreamDpy->eglDisplay;
     EGLDeviceEXT egl_dev;
     const char *dev_exts;
-    const char *dev_name;
 
-    if (!wlStreamDpy->data->egl.queryDisplayAttrib(dpy,
-                                                   EGL_DEVICE_EXT,
-                                                   (EGLAttribKHR*)&egl_dev)) {
-        return EGL_FALSE;
+    if (!data->egl.queryDisplayAttrib(dpy, EGL_DEVICE_EXT,
+                                      (EGLAttribKHR*)&egl_dev)) {
+        return NULL;
     }
 
-
-    dev_exts = wlStreamDpy->data->egl.queryDeviceString(egl_dev,
-                                                        EGL_EXTENSIONS);
+    dev_exts = data->egl.queryDeviceString(egl_dev, EGL_EXTENSIONS);
 
     if (!dev_exts) {
-        return EGL_FALSE;
+        return NULL;
     }
 
     if (!wlEglFindExtension("EGL_EXT_device_drm_render_node", dev_exts)) {
-        return EGL_FALSE;
+        return NULL;
     }
 
-    dev_name =
-        wlStreamDpy->data->egl.queryDeviceString(egl_dev,
-                                                 EGL_DRM_RENDER_NODE_FILE_EXT);
+    return data->egl.queryDeviceString(egl_dev, EGL_DRM_RENDER_NODE_FILE_EXT);
+}
 
+EGLBoolean
+wl_drm_display_bind(struct wl_display *display,
+                    struct wl_eglstream_display *wlStreamDpy,
+                    const char *dev_name)
+{
     if (!dev_name) {
         return EGL_FALSE;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-egldisplay.c 
new/egl-wayland-1.1.11/src/wayland-egldisplay.c
--- old/egl-wayland-1.1.9/src/wayland-egldisplay.c      2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/src/wayland-egldisplay.c     2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -26,16 +26,23 @@
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
 #include "wayland-eglstream-server.h"
 #include "wayland-thread.h"
-#include "wayland-eglsurface.h"
+#include "wayland-eglsurface-internal.h"
 #include "wayland-eglhandle.h"
 #include "wayland-eglutils.h"
+#include "wayland-drm-client-protocol.h"
+#include "wayland-drm.h"
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
 
 typedef struct WlServerProtocolsRec {
     EGLBoolean hasEglStream;
     EGLBoolean hasDmaBuf;
+    EGLBoolean hasDrm;
+    struct wl_drm *wldrm;
+    char *drm_name;
 } WlServerProtocols;
 
 /* TODO: Make global display lists hang off platform data */
@@ -64,15 +71,16 @@
 
 EGLBoolean wlEglBindDisplaysHook(void *data, EGLDisplay dpy, void *nativeDpy)
 {
-    /* Retrieve extension string before taking external API lock */
-    const char *exts = ((WlEglPlatformData *)data)->egl.queryString(dpy, 
EGL_EXTENSIONS);
+    /* Retrieve extension string and device name before taking external API 
lock */
+    const char *exts = ((WlEglPlatformData *)data)->egl.queryString(dpy, 
EGL_EXTENSIONS),
+               *dev_name = wl_drm_get_dev_name(data, dpy);
     EGLBoolean res = EGL_FALSE;
 
     wlExternalApiLock();
 
     res = wl_eglstream_display_bind((WlEglPlatformData *)data,
                                     (struct wl_display *)nativeDpy,
-                                    dpy, exts);
+                                    dpy, exts, dev_name);
 
     wlExternalApiUnlock();
 
@@ -241,6 +249,40 @@
     registry_handle_global_remove
 };
 
+static void wl_drm_device(void *data, struct wl_drm *wl_drm, const char *name)
+{
+    WlServerProtocols *protocols = (WlServerProtocols *)data;
+    (void) wl_drm;
+
+    protocols->drm_name = strdup(name);
+}
+
+static void wl_drm_authenticated(void *data, struct wl_drm *wl_drm)
+{
+    (void) data;
+    (void) wl_drm;
+}
+static void wl_drm_format(void *data, struct wl_drm *wl_drm, uint32_t format)
+{
+    (void) data;
+    (void) wl_drm;
+    (void) format;
+}
+static void wl_drm_capabilities(void *data, struct wl_drm *wl_drm, uint32_t 
value)
+{
+    (void) data;
+    (void) wl_drm;
+    (void) value;
+}
+
+static const struct wl_drm_listener drmListener = {
+    .device = wl_drm_device,
+    .authenticated = wl_drm_authenticated,
+    .format = wl_drm_format,
+    .capabilities = wl_drm_capabilities,
+};
+
+
 static void
 registry_handle_global_check_protocols(
                        void *data,
@@ -262,6 +304,12 @@
         (version >= 3)) {
         protocols->hasDmaBuf = EGL_TRUE;
     }
+
+    if ((strcmp(interface, "wl_drm") == 0) && (version >= 2)) {
+        protocols->hasDrm = EGL_TRUE;
+        protocols->wldrm = wl_registry_bind(registry, name, &wl_drm_interface, 
2);
+        wl_drm_add_listener(protocols->wldrm, &drmListener, protocols);
+    }
 }
 
 static void
@@ -389,8 +437,8 @@
     return res;
 }
 
-static void checkServerProtocols(struct wl_display *nativeDpy,
-                                 WlServerProtocols *protocols)
+static void getServerProtocolsInfo(struct wl_display *nativeDpy,
+                                   WlServerProtocols *protocols)
 {
     struct wl_display     *wrapper      = NULL;
     struct wl_registry    *wlRegistry   = NULL;
@@ -418,6 +466,11 @@
                                    protocols);
     if (ret == 0) {
         wl_display_roundtrip_queue(nativeDpy, queue);
+        if (protocols->hasDrm) {
+            wl_display_roundtrip_queue(nativeDpy, queue);
+            /* destroy our wl_drm object */
+            wl_drm_destroy(protocols->wldrm);
+        }
     }
 
     if (queue) {
@@ -438,9 +491,14 @@
     WlServerProtocols      protocols;
     EGLint                 numDevices      = 0;
     int                    i               = 0;
+    EGLDeviceEXT          *eglDeviceList   = NULL;
     EGLDeviceEXT           eglDevice       = NULL;
+    EGLDeviceEXT           tmpDev          = NULL;
     EGLint                 err             = EGL_SUCCESS;
     EGLBoolean             useInitRefCount = EGL_FALSE;
+    const char *dev_exts;
+    const char *dev_name;
+    const char *primeRenderOffloadStr;
 
     if (platform != EGL_PLATFORM_WAYLAND_EXT) {
         wlEglSetError(data, EGL_BAD_PARAMETER);
@@ -480,7 +538,6 @@
 
     display = calloc(1, sizeof(*display));
     if (!display) {
-        wlExternalApiUnlock();
         err = EGL_BAD_ALLOC;
         goto fail;
     }
@@ -498,7 +555,6 @@
     if (!display->nativeDpy) {
         display->nativeDpy = wl_display_connect(NULL);
         if (!display->nativeDpy) {
-            wlExternalApiUnlock();
             err = EGL_BAD_ALLOC;
             goto fail;
         }
@@ -508,26 +564,92 @@
     }
 
     memset(&protocols, 0, sizeof(protocols));
-    checkServerProtocols(display->nativeDpy, &protocols);
+    /*
+     * This is where we check the supported protocols on the compositor,
+     * and bind to wl_drm to get the device name.
+     * protocols.drm_name will be allocated here if using wl_drm
+     */
+    getServerProtocolsInfo(display->nativeDpy, &protocols);
 
-    if (!protocols.hasEglStream && !protocols.hasDmaBuf) {
-        wlExternalApiUnlock();
-        goto fail;
+    if (!protocols.hasDrm || (!protocols.hasEglStream && 
!protocols.hasDmaBuf)) {
+        goto fail_cleanup_protocols;
     }
 
-    if (!pData->egl.queryDevices(1, &eglDevice, &numDevices) || numDevices == 
0) {
-        wlExternalApiUnlock();
-        goto fail;
+    /* Get the number of devices available */
+    if (!pData->egl.queryDevices(-1, NULL, &numDevices) || numDevices == 0) {
+        goto fail_cleanup_protocols;
+    }
+
+    eglDeviceList = calloc(numDevices, sizeof(*eglDeviceList));
+    if (!eglDeviceList) {
+        goto fail_cleanup_protocols;
+    }
+
+    primeRenderOffloadStr = getenv("__NV_PRIME_RENDER_OFFLOAD");
+    display->primeRenderOffload = primeRenderOffloadStr &&
+        !strcmp(primeRenderOffloadStr, "1");
+
+    /*
+     * Now we need to find an EGLDevice. If __NV_PRIME_RENDER_OFFLOAD=1, we 
will use the
+     * first NVIDIA GPU returned by eglQueryDevices. Otherwise, if wl_drm is 
in use, we will
+     * try to find one that matches the device the compositor is using. We 
know that device
+     * is an nvidia device since we just checked that above.
+     */
+    if (!pData->egl.queryDevices(numDevices, eglDeviceList, &numDevices) || 
numDevices == 0) {
+        goto fail_cleanup_devices;
+    }
+
+    if (display->primeRenderOffload) {
+        eglDevice = eglDeviceList[0];
+    } else if (protocols.drm_name) {
+        for (int i = 0; i < numDevices; i++) {
+            tmpDev = eglDeviceList[i];
+
+            /*
+             * To check against the wl_drm name, we need to check if we can use
+             * the drm extension
+             */
+            dev_exts = display->data->egl.queryDeviceString(tmpDev,
+                    EGL_EXTENSIONS);
+            if (dev_exts) {
+                if (wlEglFindExtension("EGL_EXT_device_drm_render_node", 
dev_exts)) {
+                    dev_name =
+                        display->data->egl.queryDeviceString(tmpDev,
+                                EGL_DRM_RENDER_NODE_FILE_EXT);
+
+                    if (dev_name) {
+                        /*
+                         * At this point we have gotten the name from wl_drm, 
gotten
+                         * the drm node from the EGLDevice. If they match, then
+                         * this is the final device to use, since it is the 
compositor's
+                         * device.
+                         */
+                        if (strcmp(dev_name, protocols.drm_name) == 0) {
+                            eglDevice = eglDeviceList[0];
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * Right now we are pretty much limited to running on the same GPU as the
+     * compositor. If we couldn't find an EGLDevice that has 
EGL_EXT_device_drm_render_node
+     * and the same DRM device path, then fail.
+     */
+    if (!eglDevice) {
+        goto fail_cleanup_devices;
     }
+
     display->devDpy = wlGetInternalDisplay(pData, eglDevice);
     if (display->devDpy == NULL) {
-        wlExternalApiUnlock();
-        goto fail;
+        goto fail_cleanup_devices;
     }
 
     if (!wlEglInitializeMutex(&display->mutex)) {
-        wlExternalApiUnlock();
-        goto fail;
+        goto fail_cleanup_devices;
     }
     display->refCount = 1;
     WL_LIST_INIT(&display->wlEglSurfaceList);
@@ -537,10 +659,21 @@
     // in wlEglDisplayList.
     wl_list_insert(&wlEglDisplayList, &display->link);
 
+    free(eglDeviceList);
+    if (protocols.drm_name) {
+        free(protocols.drm_name);
+    }
     wlExternalApiUnlock();
     return display;
 
+fail_cleanup_devices:
+    free(eglDeviceList);
+fail_cleanup_protocols:
+    if (protocols.drm_name) {
+        free(protocols.drm_name);
+    }
 fail:
+    wlExternalApiUnlock();
 
     if (display->ownNativeDpy) {
         wl_display_disconnect(display->nativeDpy);
@@ -931,13 +1064,13 @@
                                    exts)) {
                 if (wlEglFindExtension("EGL_KHR_stream_cross_process_fd",
                                        exts)) {
-                    res = "EGL_WL_bind_wayland_display "
+                    res = "EGL_EXT_present_opaque EGL_WL_bind_wayland_display "
                         "EGL_WL_wayland_eglstream";
                 } else if 
(wlEglFindExtension("EGL_NV_stream_consumer_eglimage",
                                               exts) &&
                            wlEglFindExtension("EGL_MESA_image_dma_buf_export",
                                               exts)) {
-                    res = "EGL_WL_bind_wayland_display";
+                    res = "EGL_EXT_present_opaque EGL_WL_bind_wayland_display";
                 }
             }
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-eglhandle.c 
new/egl-wayland-1.1.11/src/wayland-eglhandle.c
--- old/egl-wayland-1.1.9/src/wayland-eglhandle.c       2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/src/wayland-eglhandle.c      2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -22,7 +22,7 @@
 
 #include "wayland-eglhandle.h"
 #include "wayland-egldisplay.h"
-#include "wayland-eglsurface.h"
+#include "wayland-eglsurface-internal.h"
 #include "wayland-thread.h"
 #include <stdlib.h>
 #include <errno.h>
@@ -72,6 +72,7 @@
     GET_PROC(terminate,                   eglTerminate);
     GET_PROC(chooseConfig,                eglChooseConfig);
     GET_PROC(getConfigAttrib,             eglGetConfigAttrib);
+    GET_PROC(querySurface,                eglQuerySurface);
 
     GET_PROC(getCurrentContext,           eglGetCurrentContext);
     GET_PROC(getCurrentSurface,           eglGetCurrentSurface);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-eglstream-server.c 
new/egl-wayland-1.1.11/src/wayland-eglstream-server.c
--- old/egl-wayland-1.1.9/src/wayland-eglstream-server.c        2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/src/wayland-eglstream-server.c       2022-08-06 
01:54:11.000000000 +0200
@@ -289,7 +289,8 @@
 wl_eglstream_display_bind(WlEglPlatformData *data,
                           struct wl_display *wlDisplay,
                           EGLDisplay eglDisplay,
-                          const char *exts)
+                          const char *exts,
+                          const char *dev_name)
 {
     struct wl_eglstream_display *wlStreamDpy = NULL;
     char                        *env         = NULL;
@@ -355,7 +356,7 @@
                                            wl_eglstream_display_global_bind);
 
     /* Failure is not fatal */
-    wl_drm_display_bind(wlDisplay, wlStreamDpy);
+    wl_drm_display_bind(wlDisplay, wlStreamDpy, dev_name);
 
     wl_list_insert(&wlStreamDpyList, &wlStreamDpy->link);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-eglsurface.c 
new/egl-wayland-1.1.11/src/wayland-eglsurface.c
--- old/egl-wayland-1.1.9/src/wayland-eglsurface.c      2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/src/wayland-eglsurface.c     2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -20,7 +20,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include "wayland-eglsurface.h"
+#include "wayland-eglsurface-internal.h"
 #include "wayland-eglstream-client-protocol.h"
 #include "wayland-eglstream-controller-client-protocol.h"
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -40,6 +40,7 @@
 #include <fcntl.h>
 #include <poll.h>
 #include <errno.h>
+#include <libdrm/drm_fourcc.h>
 
 #define WL_EGL_WINDOW_DESTROY_CALLBACK_SINCE 3
 
@@ -126,22 +127,6 @@
                                      &throttle_listener, surface) == -1) {
             return;
         }
-
-        /* After a window resize, the compositor has to be
-         * updated with the new buffer's geometry. However, we
-         * won't have updated geometry information until the
-         * underlying buffer is attached. A surface attach
-         * may be deferred to a later time in some situations
-         * (e.g. FIFO_SYNCHRONOUS + damage thread).
-         *
-         * Therefore, the surface_commit done from here would
-         * use outdated geometry information if the buffer is
-         * not attached, which would make xdg-shell fail with
-         * error. To avoid this, skip the surface commit here
-         * if the surface attach is not yet done. */
-        if (surface->ctx.isAttached) {
-            wl_surface_commit(surface->wlSurface);
-        }
     }
 }
 
@@ -257,9 +242,18 @@
                     data->egl.streamFlush(display->devDpy->eglDisplay,
                                           surface->ctx.eglStream);
                 }
+
+                pthread_mutex_lock(&surface->mutexFrameSync);
+
+                wlEglCreateFrameSync(surface);
+
                 ok = wlEglSendDamageEvent(surface, queue);
                 surface->ctx.framesProcessed++;
-             }
+
+                pthread_cond_signal(&surface->condFrameSync);
+
+                pthread_mutex_unlock(&surface->mutexFrameSync);
+            }
 
             // Otherwise, wait for sync to trigger
             else {
@@ -453,6 +447,7 @@
         surface->bufferReleaseThreadPipe[BUFFER_RELEASE_PIPE_READ] = -1;
 
         wl_event_queue_destroy(surface->wlBufferEventQueue);
+        surface->wlBufferEventQueue = NULL;
     }
 }
 
@@ -1023,6 +1018,24 @@
                                        modifier >> 32,
                                        modifier & 0xffffffff);
 
+        /*
+         * Before sending the format, check if we are ignoring alpha due to a
+         * surface attribute.
+         */
+        if (surface->presentOpaque) {
+            /*
+             * We are ignoring alpha, so we need to find a DRM_FORMAT_* that 
is equivalent to
+             * the current format, but ignores the alpha. i.e. RGBA -> RGBX
+             *
+             * There is also only one format with alpha that we expose on 
wayland: ARGB8888. If
+             * the format does not match this, silently ignore it as the app 
must be mistakenly
+             * using EGL_PRESENT_OPAQUE_EXT on an already opaque surface.
+             */
+            if (format == DRM_FORMAT_ARGB8888) {
+                format = DRM_FORMAT_XRGB8888;
+            }
+        }
+
         image->buffer = zwp_linux_buffer_params_v1_create_immed(params,
                                                                 surface->width,
                                                                 
surface->height,
@@ -1252,6 +1265,9 @@
         EGL_NONE,                   EGL_NONE,
         EGL_NONE
     };
+    /* EGLImage stream consumer will be configured with linear modifier
+     * if __NV_PRIME_RENDER_OFFLOAD was set during initialization. */
+    uint64_t linearModifier = DRM_FORMAT_MOD_LINEAR;
     EGLint err = EGL_SUCCESS;
 
     /* We don't have any mechanism to check whether the compositor is going to
@@ -1279,8 +1295,8 @@
     /* Now create the local EGLImage consumer */
     if (!data->egl.streamImageConsumerConnect(dpy,
                                               surface->ctx.eglStream,
-                                              0, /* XXX modifier count */
-                                              NULL, /* XXX modifier list */
+                                              display->primeRenderOffload ? 1 
: 0,
+                                              &linearModifier,
                                               NULL)) {
         err = data->egl.getError();
         goto fail;
@@ -1510,36 +1526,72 @@
 
 fail:
     destroy_surface_context(surface, &surface->ctx);
+    finish_wl_buffer_release_thread(surface);
     return err;
 }
 
-EGLBoolean wlEglInitializeSurfaceExport(WlEglSurface *surface)
+WL_EXPORT
+EGLStreamKHR wlEglGetSurfaceStreamExport(WlEglSurface *surface)
 {
-    WlEglDisplay *display = wlEglAcquireDisplay((WlEglDisplay 
*)surface->wlEglDpy);
+    if (!surface)
+        return EGL_NO_STREAM_KHR;
+
+    return surface->ctx.eglStream;
+}
+
+WL_EXPORT
+WlEglSurface *wlEglCreateSurfaceExport(EGLDisplay dpy,
+                                       int width,
+                                       int height,
+                                       struct wl_surface *native_surface,
+                                       int fifo_length)
+{
+    WlEglDisplay *display = (WlEglDisplay *)wlEglAcquireDisplay(dpy);
+    WlEglSurface *surface = NULL;
 
     if (!display) {
-        return EGL_FALSE;
+        return NULL;
     }
 
     pthread_mutex_lock(&display->mutex);
 
+    surface = calloc(1, sizeof (*surface));
+    if (!surface) {
+        goto fail;
+    }
+
+    surface->wlEglDpy = display;
+    surface->width = width;
+    surface->height = height;
+    surface->wlSurface = native_surface;
+    surface->fifoLength = fifo_length;
+    surface->swapInterval = fifo_length > 0 ? 1 : 0;
+
     // Create per surface wayland queue
     surface->wlEventQueue = wl_display_create_queue(display->nativeDpy);
     surface->refCount = 1;
 
     if (!wlEglInitializeMutex(&surface->mutexLock)) {
+        goto fail;
+    }
+
+    if (!wlEglInitializeMutex(&surface->mutexFrameSync)) {
         pthread_mutex_unlock(&display->mutex);
         wlEglReleaseDisplay(display);
         return EGL_FALSE;
     }
 
-    if (create_surface_context(surface) != EGL_SUCCESS) {
-        wl_event_queue_destroy(surface->wlEventQueue);
+    if (pthread_cond_init(&surface->condFrameSync, NULL)) {
         pthread_mutex_unlock(&display->mutex);
         wlEglReleaseDisplay(display);
         return EGL_FALSE;
     }
 
+    if (create_surface_context(surface) != EGL_SUCCESS) {
+        wl_event_queue_destroy(surface->wlEventQueue);
+        goto fail;
+    }
+
     wl_list_insert(&display->wlEglSurfaceList, &surface->link);
     wl_list_init(&surface->oldCtxList);
 
@@ -1552,16 +1604,59 @@
 
     pthread_mutex_unlock(&display->mutex);
     wlEglReleaseDisplay(display);
-    return EGL_TRUE;
+    return surface;
+
+fail:
+    pthread_mutex_unlock(&display->mutex);
+    wlEglReleaseDisplay(display);
+    free(surface);
+    return NULL;
+}
+
+void
+wlEglResizeSurface(WlEglDisplay *display,
+                   WlEglPlatformData *pData,
+                   WlEglSurface *surface)
+{
+    EGLint err = EGL_SUCCESS;
+
+    // If a damage thread is in use, wait for it to finish processing all
+    //   pending frames
+    finish_wl_eglstream_damage_thread(surface, &surface->ctx, 0);
+
+    discard_surface_context(surface);
+    surface->isResized = EGL_FALSE;
+    surface->ctx.wlStreamResource = NULL;
+    surface->ctx.isAttached = EGL_FALSE;
+    surface->ctx.eglSurface = EGL_NO_SURFACE;
+    surface->ctx.eglStream = EGL_NO_STREAM_KHR;
+    surface->ctx.damageThreadSync = EGL_NO_SYNC_KHR;
+    surface->ctx.damageThreadId = (pthread_t)0;
+
+    err = create_surface_context(surface);
+    if (err == EGL_SUCCESS) {
+        /* This looks like a no-op, but we've replaced the surface's internal
+         * handle with a new surface, so we need to make it current again. */
+        pData->egl.makeCurrent(display,
+                               pData->egl.getCurrentSurface(EGL_DRAW),
+                               pData->egl.getCurrentSurface(EGL_READ),
+                               pData->egl.getCurrentContext());
+
+        if (surface->ctx.wlStreamResource) {
+            /* Set client's pendingSwapIntervalUpdate for updating client's
+             * swapinterval
+             */
+            surface->pendingSwapIntervalUpdate = EGL_TRUE;
+        }
+    }
 }
 
 static void
 resize_callback(struct wl_egl_window *window, void *data)
 {
     WlEglDisplay      *display = NULL;
-    WlEglPlatformData *pData   = NULL;
+    WlEglPlatformData *pData;
     WlEglSurface      *surface = (WlEglSurface *)data;
-    EGLint             err     = EGL_SUCCESS;
 
     if (!window || !surface) {
         return;
@@ -1572,6 +1667,7 @@
         !wlEglIsWaylandWindowValid(surface->wlEglWin)) {
         return;
     }
+
     pData = display->data;
 
     pthread_mutex_lock(&surface->mutexLock);
@@ -1581,33 +1677,14 @@
         (surface->height != window->height) ||
         (surface->dx != window->dx) ||
         (surface->dy != window->dy)) {
-        // If a damage thread is in use, wait for it to finish processing all
-        //   pending frames
-        finish_wl_eglstream_damage_thread(surface, &surface->ctx, 0);
-
-        discard_surface_context(surface);
-        surface->ctx.wlStreamResource = NULL;
-        surface->ctx.isAttached = EGL_FALSE;
-        surface->ctx.eglSurface = EGL_NO_SURFACE;
-        surface->ctx.eglStream = EGL_NO_STREAM_KHR;
-        surface->ctx.damageThreadSync = EGL_NO_SYNC_KHR;
-        surface->ctx.damageThreadId = (pthread_t)0;
-
-        err = create_surface_context(surface);
-        if (err == EGL_SUCCESS) {
-            pData->egl.makeCurrent(display,
-                                   surface,
-                                   surface,
-                                   pData->egl.getCurrentContext());
-
-            if (surface->ctx.wlStreamResource) {
-                /* Set client's pendingSwapIntervalUpdate for updating client's
-                 * swapinterval
-                 */
-                surface->pendingSwapIntervalUpdate = EGL_TRUE;
+            if (surface == pData->egl.getCurrentSurface(EGL_DRAW) ||
+                surface == pData->egl.getCurrentSurface(EGL_READ)) {
+                wlEglResizeSurface(display, pData, surface);
+            } else {
+                surface->isResized = EGL_TRUE;
             }
-        }
     }
+    
     pthread_mutex_unlock(&surface->mutexLock);
 }
 
@@ -1629,6 +1706,9 @@
     case EGL_HEIGHT:
         return EGL_FALSE;
 
+    case EGL_PRESENT_OPAQUE_EXT:
+        return EGL_TRUE;
+
     /* If attribute is supported/unsupported for both EGL_WINDOW_BIT and
      * EGL_STREAM_BIT_KHR, then that will be handled inside the actual
      * eglCreateStreamProducerSurfaceKHR() */
@@ -1672,6 +1752,10 @@
 
     if (attribs) {
         for (i = 0; attribs[i] != EGL_NONE; i += 2) {
+            if (attribs[i] == EGL_PRESENT_OPAQUE_EXT) {
+                surface->presentOpaque = EGL_TRUE;
+                continue;
+            }
             if ((attribs[i] != EGL_RENDER_BUFFER) &&
                 (attribs[i] != EGL_POST_SUB_BUFFER_SUPPORTED_NV)) {
                 int_attribs[nAttribs++] = (EGLint)attribs[i];
@@ -1687,6 +1771,41 @@
     return EGL_SUCCESS;
 }
 
+
+EGLBoolean wlEglQuerySurfaceHook(EGLDisplay dpy, EGLSurface eglSurface,
+                                 EGLint attribute, EGLint *value)
+{
+    WlEglDisplay *display       = wlEglAcquireDisplay(dpy);
+    WlEglPlatformData *data     = NULL;
+    WlEglSurface *surface       = (WlEglSurface *)eglSurface;
+    EGLint ret                  = EGL_FALSE;
+    EGLint err                  = EGL_SUCCESS;
+
+    if (!display) {
+        return EGL_FALSE;
+    }
+    data = display->data;
+
+    if (!wlEglIsWlEglSurfaceForDisplay(display, surface)) {
+        err = EGL_BAD_SURFACE;
+        wlEglSetError(data, err);
+        goto done;
+    }
+
+    if (attribute == EGL_PRESENT_OPAQUE_EXT) {
+        *value = surface->presentOpaque;
+        ret = EGL_TRUE;
+        goto done;
+    }
+
+    dpy = display->devDpy->eglDisplay;
+    ret = data->egl.querySurface(dpy, surface->ctx.eglSurface, attribute, 
value);
+
+done:
+    wlEglReleaseDisplay(display);
+    return ret;
+}
+
 EGLBoolean wlEglSurfaceRef(WlEglDisplay *display, WlEglSurface *surface)
 {
 
@@ -1711,6 +1830,11 @@
 
     wlEglMutexDestroy(&surface->mutexLock);
 
+    if (!surface->ctx.isOffscreen) {
+        wlEglMutexDestroy(&surface->mutexFrameSync);
+        pthread_cond_destroy(&surface->condFrameSync);
+    }
+
     for (i = 0; i < surface->ctx.numStreamImages; i++) {
         wlEglMutexDestroy(&surface->ctx.streamImages[i]->mutex);
         free(surface->ctx.streamImages[i]);
@@ -1909,6 +2033,17 @@
         goto fail;
     }
 
+    if (!wlEglInitializeMutex(&surface->mutexFrameSync)) {
+        err = EGL_BAD_ALLOC;
+        goto fail;
+    }
+
+    if (pthread_cond_init(&surface->condFrameSync, NULL)) {
+        err = EGL_BAD_ALLOC;
+        goto fail;
+    }
+
+
     surface->wlEglDpy = display;
     surface->eglConfig = config;
     surface->wlEglWin = window;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-eglswap.c 
new/egl-wayland-1.1.11/src/wayland-eglswap.c
--- old/egl-wayland-1.1.9/src/wayland-eglswap.c 2021-09-08 01:52:12.000000000 
+0200
+++ new/egl-wayland-1.1.11/src/wayland-eglswap.c        2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -24,7 +24,7 @@
 #include "wayland-eglstream-client-protocol.h"
 #include "wayland-thread.h"
 #include "wayland-egldisplay.h"
-#include "wayland-eglsurface.h"
+#include "wayland-eglsurface-internal.h"
 #include "wayland-eglhandle.h"
 #include "wayland-eglutils.h"
 #include <assert.h>
@@ -68,6 +68,7 @@
         /* Send request from client to override swapinterval value based on
          * server's swapinterval for overlay compositing
          */
+        assert(surface->ctx.wlStreamResource);
         wl_eglstream_display_swap_interval(display->wlStreamDpy,
                                            surface->ctx.wlStreamResource,
                                            surface->swapInterval);
@@ -97,6 +98,16 @@
             goto fail_locked;
         }
 
+        if (surface->ctx.useDamageThread) {
+            pthread_mutex_lock(&surface->mutexFrameSync);
+            // Wait for damage thread to submit the
+            // previous frame and generate frame sync
+            while (surface->ctx.framesProduced != 
surface->ctx.framesProcessed) {
+                pthread_cond_wait(&surface->condFrameSync, 
&surface->mutexFrameSync);
+            }
+            pthread_mutex_unlock(&surface->mutexFrameSync);
+        }
+
         wlEglWaitFrameSync(surface);
     }
 
@@ -125,10 +136,14 @@
         if (surface->ctx.useDamageThread) {
             surface->ctx.framesProduced++;
         } else {
+            wlEglCreateFrameSync(surface);
             res = wlEglSendDamageEvent(surface, surface->wlEventQueue);
         }
     }
-    wlEglCreateFrameSync(surface);
+
+    if (surface->isResized) {
+        wlEglResizeSurface(display, data, surface);
+    }
 
 done:
     // Release wlEglSurface lock.
@@ -193,29 +208,28 @@
 
     pthread_mutex_lock(&display->mutex);
 
-    /* Check this is a valid wayland EGL surface with a server-side stream
-     * resource before sending the swap interval value to the consumer */
+    /* Check this is a valid wayland EGL surface */
     if (display->initCount == 0 ||
         !wlEglIsWlEglSurfaceForDisplay(display, surface) ||
         (surface->swapInterval == interval) ||
-        (surface->ctx.wlStreamResource == NULL) ||
-        (surface->ctx.eglStream == EGL_NO_STREAM_KHR) ||
-        (data->egl.queryStream(display->devDpy->eglDisplay,
-                               surface->ctx.eglStream,
-                               EGL_STREAM_STATE_KHR,
-                               &state) == EGL_FALSE) ||
-        (state == EGL_STREAM_STATE_DISCONNECTED_KHR))
-    {
+        (surface->ctx.eglStream == EGL_NO_STREAM_KHR)) {
         goto done;
     }
 
     /* Cache interval value so we can reset it upon surface reattach */
     surface->swapInterval = interval;
 
-    /* Set client's pendingSwapIntervalUpdate for updating client's
-     * swapinterval
-     */
-    surface->pendingSwapIntervalUpdate = EGL_TRUE;
+    if (surface->ctx.wlStreamResource &&
+        data->egl.queryStream(display->devDpy->eglDisplay,
+                              surface->ctx.eglStream,
+                              EGL_STREAM_STATE_KHR, &state) &&
+        state != EGL_STREAM_STATE_DISCONNECTED_KHR) {
+        /* Set client's pendingSwapIntervalUpdate for updating client's
+         * swapinterval if the compositor supports wl_eglstream_display
+         * and the surface has a valid server-side stream
+         */
+        surface->pendingSwapIntervalUpdate = EGL_TRUE;
+    }
 
 done:
     pthread_mutex_unlock(&display->mutex);
@@ -224,6 +238,7 @@
     return ret;
 }
 
+WL_EXPORT
 EGLBoolean wlEglPrePresentExport(WlEglSurface *surface) {
     WlEglDisplay *display = wlEglAcquireDisplay((WlEglDisplay 
*)surface->wlEglDpy);
     if (!display) {
@@ -254,6 +269,16 @@
     // Acquire wlEglSurface lock.
     pthread_mutex_lock(&surface->mutexLock);
 
+    if (surface->ctx.useDamageThread) {
+        pthread_mutex_lock(&surface->mutexFrameSync);
+        // Wait for damage thread to submit the
+        // previous frame and generate frame sync
+        while (surface->ctx.framesProduced != surface->ctx.framesProcessed) {
+            pthread_cond_wait(&surface->condFrameSync, 
&surface->mutexFrameSync);
+        }
+        pthread_mutex_unlock(&surface->mutexFrameSync);
+    }
+
     wlEglWaitFrameSync(surface);
 
     // Release wlEglSurface lock.
@@ -263,6 +288,7 @@
     return EGL_TRUE;
 }
 
+WL_EXPORT
 EGLBoolean wlEglPostPresentExport(WlEglSurface *surface) {
     WlEglDisplay          *display = wlEglAcquireDisplay((WlEglDisplay 
*)surface->wlEglDpy);
     WlEglPlatformData     *data    = NULL;
@@ -285,11 +311,10 @@
     if (surface->ctx.useDamageThread) {
         surface->ctx.framesProduced++;
     } else {
+        wlEglCreateFrameSync(surface);
         res = wlEglSendDamageEvent(surface, surface->wlEventQueue);
     }
 
-    wlEglCreateFrameSync(surface);
-
     // Release wlEglSurface lock.
     pthread_mutex_unlock(&surface->mutexLock);
     wlEglReleaseDisplay(display);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/src/wayland-external-exports.c 
new/egl-wayland-1.1.11/src/wayland-external-exports.c
--- old/egl-wayland-1.1.9/src/wayland-external-exports.c        2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/src/wayland-external-exports.c       2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -24,7 +24,7 @@
 #include "wayland-external-exports.h"
 #include "wayland-egldisplay.h"
 #include "wayland-eglstream.h"
-#include "wayland-eglsurface.h"
+#include "wayland-eglsurface-internal.h"
 #include "wayland-eglswap.h"
 #include "wayland-eglutils.h"
 #include "wayland-eglhandle.h"
@@ -50,6 +50,7 @@
     { "eglInitialize",                     wlEglInitializeHook },
     { "eglQueryDisplayAttribEXT",          wlEglQueryDisplayAttribHook },
     { "eglQueryDisplayAttribKHR",          wlEglQueryDisplayAttribHook },
+    { "eglQuerySurface",                   wlEglQuerySurfaceHook },
     { "eglQueryWaylandBufferWL",           wlEglQueryNativeResourceHook },
     { "eglSwapBuffers",                    wlEglSwapBuffersHook },
     { "eglSwapBuffersWithDamageKHR",       wlEglSwapBuffersWithDamageHook },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/egl-wayland-1.1.9/wayland-drm/meson.build 
new/egl-wayland-1.1.11/wayland-drm/meson.build
--- old/egl-wayland-1.1.9/wayland-drm/meson.build       2021-09-08 
01:52:12.000000000 +0200
+++ new/egl-wayland-1.1.11/wayland-drm/meson.build      2022-08-06 
01:54:11.000000000 +0200
@@ -1,5 +1,7 @@
-foreach output_type: ['server-header', 'public-code']
-    if output_type == 'server-header'
+foreach output_type: ['client-header', 'server-header', 'public-code']
+    if output_type == 'client-header'
+        output_file = 'wayland-drm-client-protocol.h'
+    elif output_type == 'server-header'
         output_file = 'wayland-drm-server-protocol.h'
     else
         output_file = 'wayland-drm-protocol.c'

Reply via email to