Sync from SUSE:SLFO:Main libnvidia-egl-wayland revision f6dcdbd6dbf60002b959e51d14ab554a

This commit is contained in:
Adrian Schröter 2024-12-20 16:06:22 +01:00
parent f96e31d0e3
commit b6fdc433dd
18 changed files with 25 additions and 765 deletions

View File

@ -1,37 +0,0 @@
From c24fe0634f1f4f730ded955c69b20f1fc8b0a2d5 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Thu, 14 Nov 2024 12:37:11 -0700
Subject: [PATCH 1/2] Fix a segfault in wlEglCreatePlatformWindowSurfaceHook
In the error cleanup path in wlEglCreatePlatformWindowSurfaceHook, don't
try to dereference the WlEglSurface if we never allocated it.
---
src/wayland-eglsurface.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index ae6cafc..16161f0 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -2843,15 +2843,14 @@ EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
return surface;
fail:
- if (surface->drmSyncobjHandle) {
- drmSyncobjDestroy(display->drmFd, surface->drmSyncobjHandle);
- }
-
if (drmSyncobjFd > 0) {
close(drmSyncobjFd);
}
if (surface) {
+ if (surface->drmSyncobjHandle) {
+ drmSyncobjDestroy(display->drmFd, surface->drmSyncobjHandle);
+ }
wlEglDestroySurface(display, surface);
}
--
2.43.0

View File

@ -1,54 +0,0 @@
From 2d31baa7831166fd27a2fc01ecc684613046bb28 Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@badland.io>
Date: Fri, 23 Aug 2024 10:12:10 -0400
Subject: [PATCH 1/9] egl-wayland bump version to 1.1.17
We are changing the release process and bumping versions immediately
after a release tag is made, that way versions installed from the
latest git master will always have the "next" version.
---
configure.ac | 2 +-
include/wayland-external-exports.h | 2 +-
meson.build | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 75489a5..36594a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
m4_define([wayland_eglstream_major_version], [1])
m4_define([wayland_eglstream_minor_version], [1])
-m4_define([wayland_eglstream_micro_version], [16])
+m4_define([wayland_eglstream_micro_version], [17])
m4_define([wayland_eglstream_version],
[wayland_eglstream_major_version.wayland_eglstream_minor_version.wayland_eglstream_micro_version])
diff --git a/include/wayland-external-exports.h b/include/wayland-external-exports.h
index 43579c9..2993dea 100644
--- a/include/wayland-external-exports.h
+++ b/include/wayland-external-exports.h
@@ -53,7 +53,7 @@
#define WAYLAND_EXTERNAL_VERSION_MINOR 0
#endif
-#define WAYLAND_EXTERNAL_VERSION_MICRO 16
+#define WAYLAND_EXTERNAL_VERSION_MICRO 17
#define EGL_EXTERNAL_PLATFORM_VERSION_MAJOR WAYLAND_EXTERNAL_VERSION_MAJOR
diff --git a/meson.build b/meson.build
index 4d9bd1a..b3700fa 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('wayland-eglstream', 'c',
- version : '1.1.16',
+ version : '1.1.17',
default_options : [
'buildtype=debugoptimized',
'c_std=gnu99',
--
2.43.0

View File

@ -1,108 +0,0 @@
From 40e835f197178e7e4387a042acc8f1dc42f810ee Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@nvidia.com>
Date: Wed, 9 Oct 2024 14:53:52 -0400
Subject: [PATCH 1/3] egl-wayland: enable CI with github actions
This enables CI for github actions builds, aimed for helping verify
new pull requests. This adds tests for the meson and autotools builds
on ubuntu 24.04. Other distros are apparently not supported by default
so we aren't able to expand testing this way.
---
.github/workflows/arch-build.yml | 16 ++++++++++++++++
.github/workflows/autoconf-build.yml | 14 ++++++++++++++
.github/workflows/meson-build.yml | 14 ++++++++++++++
.github/workflows/meson-llvm-build.yml | 17 +++++++++++++++++
4 files changed, 61 insertions(+)
create mode 100644 .github/workflows/arch-build.yml
create mode 100644 .github/workflows/autoconf-build.yml
create mode 100644 .github/workflows/meson-build.yml
create mode 100644 .github/workflows/meson-llvm-build.yml
diff --git a/.github/workflows/arch-build.yml b/.github/workflows/arch-build.yml
new file mode 100644
index 0000000..3f56616
--- /dev/null
+++ b/.github/workflows/arch-build.yml
@@ -0,0 +1,16 @@
+name: Arch Build
+on: [push, pull_request]
+jobs:
+ Meson-Build:
+ runs-on: ubuntu-24.04
+ container:
+ image: archlinux:latest
+ steps:
+ - uses: actions/checkout@v4
+ - run: pacman --noconfirm -Syy
+ - run: pacman --noconfirm -S wayland-protocols libdrm libglvnd pkgconf
+ - run: pacman --noconfirm -S wayland eglexternalplatform
+ - run: pacman --noconfirm -S meson ninja gcc
+ - run: meson build
+ - run: ninja -C build
+ - run: ninja -C build install
diff --git a/.github/workflows/autoconf-build.yml b/.github/workflows/autoconf-build.yml
new file mode 100644
index 0000000..c52ed92
--- /dev/null
+++ b/.github/workflows/autoconf-build.yml
@@ -0,0 +1,14 @@
+name: Autotools GCC Build
+on: [push, pull_request]
+jobs:
+ Meson-Build:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - run: sudo apt update
+ - run: sudo apt install -y wayland-protocols libdrm-dev libegl-dev
+ - run: sudo apt install -y libwayland-dev libwayland-egl-backend-dev eglexternalplatform-dev
+ - run: sudo apt install -y meson ninja-build gcc
+ - run: ./autogen.sh
+ - run: make
+ - run: sudo make install
diff --git a/.github/workflows/meson-build.yml b/.github/workflows/meson-build.yml
new file mode 100644
index 0000000..ca070d6
--- /dev/null
+++ b/.github/workflows/meson-build.yml
@@ -0,0 +1,14 @@
+name: Meson GCC Build
+on: [push, pull_request]
+jobs:
+ Meson-Build:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - run: sudo apt update
+ - run: sudo apt install -y wayland-protocols libdrm-dev libegl-dev
+ - run: sudo apt install -y libwayland-dev libwayland-egl-backend-dev eglexternalplatform-dev
+ - run: sudo apt install -y meson ninja-build gcc
+ - run: meson build
+ - run: ninja -C build
+ - run: sudo ninja -C build install
diff --git a/.github/workflows/meson-llvm-build.yml b/.github/workflows/meson-llvm-build.yml
new file mode 100644
index 0000000..83a8dbe
--- /dev/null
+++ b/.github/workflows/meson-llvm-build.yml
@@ -0,0 +1,17 @@
+name: Meson LLVM Build
+on: [push, pull_request]
+jobs:
+ Meson-Build:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - run: sudo apt update
+ - run: sudo apt install -y wayland-protocols libdrm-dev libegl-dev
+ - run: sudo apt install -y libwayland-dev libwayland-egl-backend-dev eglexternalplatform-dev
+ - run: sudo apt install -y meson ninja-build clang
+ - name: meson build
+ run: meson build
+ env:
+ CC: clang
+ - run: ninja -C build
+ - run: sudo ninja -C build install
--
2.43.0

View File

@ -1,73 +0,0 @@
From eeb29e10e5e7bedb0ce81cfff34683eda960bc80 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Thu, 14 Nov 2024 12:40:45 -0700
Subject: [PATCH 2/2] Check for a duplicate wl_surface in
wlEglCreatePlatformWindowSurfaceHook
In wlEglCreatePlatformWindowSurfaceHook, check if there's already a
EGLSurface that uses the same wl_surface object, and if so, fail with
EGL_BAD_ALLOC.
We've got a check (using the wl_egl_window::driver_private pointer) to
catch if the app tries to create multiple EGLSurfaces from the same
wl_egl_window. But, an app could still call wl_egl_window_create
multiple times, which would give it multiple wl_egl_window structs for
the same wl_surface.
---
src/wayland-eglsurface.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index 16161f0..72c0863 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -2652,7 +2652,10 @@ EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
WlEglDisplay *display = wlEglAcquireDisplay(dpy);
WlEglPlatformData *data = NULL;
WlEglSurface *surface = NULL;
+ WlEglSurface *existingSurf = NULL;
struct wl_egl_window *window = (struct wl_egl_window *)nativeWin;
+ struct wl_surface *wsurf = NULL;
+ long int wver = 0;
EGLBoolean res = EGL_FALSE;
EGLint err = EGL_SUCCESS;
EGLint surfType;
@@ -2683,6 +2686,23 @@ EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
goto fail;
}
+ getWlEglWindowVersionAndSurface(window, &wver, &wsurf);
+ if (wsurf == NULL) {
+ err = EGL_BAD_ALLOC;
+ goto fail;
+ }
+
+ // Make sure that we don't have any existing EGLSurfaces for this
+ // wl_surface. The driver_private check above isn't sufficient for this: If
+ // the app calls wl_egl_window_create more than once on the same
+ // wl_surface, then it would get multiple wl_egl_window structs.
+ wl_list_for_each(existingSurf, &display->wlEglSurfaceList, link) {
+ if (existingSurf->wlSurface == wsurf) {
+ err = EGL_BAD_ALLOC;
+ goto fail;
+ }
+ }
+
res = data->egl.getConfigAttrib(dpy, config, EGL_SURFACE_TYPE, &surfType);
if (!res || !(surfType & EGL_STREAM_BIT_KHR)) {
@@ -2757,9 +2777,8 @@ EGLSurface wlEglCreatePlatformWindowSurfaceHook(EGLDisplay dpy,
// Create per surface wayland queue
surface->wlEventQueue = wl_display_create_queue(display->nativeDpy);
- getWlEglWindowVersionAndSurface(window,
- &surface->wlEglWinVer,
- &surface->wlSurface);
+ surface->wlEglWinVer = wver;
+ surface->wlSurface = wsurf;
err = assignWlEglSurfaceAttribs(surface, attribs);
if (err != EGL_SUCCESS) {
--
2.43.0

View File

@ -1,29 +0,0 @@
From 7c18d91d3605785b0d5a821b067cda5d61b2710f Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Mon, 26 Aug 2024 09:16:20 -0600
Subject: [PATCH 2/9] Fix the include path for drm_fourcc.h.
Remove the leading "libdrm/" when including drm_fourcc.h.
We shouldn't hard-code a path like that -- using pkg-config should add
the appropriate include path.
---
src/wayland-eglsurface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index da08fb2..1b8ff77 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -41,7 +41,7 @@
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
#include <sys/stat.h>
#include <xf86drm.h>
#include <stdio.h>
--
2.43.0

View File

@ -1,30 +0,0 @@
From 0cd471dcfd46e6cb8b71eceddb20cc02eadabf61 Mon Sep 17 00:00:00 2001
From: Robin Ebert <ebertrobin2002@gmail.com>
Date: Tue, 15 Oct 2024 16:26:05 +0200
Subject: [PATCH 2/3] egl-wayland: Fix use after free in library teardown
---
src/wayland-egldisplay.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 7089271..edd79c4 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -729,10 +729,10 @@ static EGLBoolean terminateDisplay(WlEglDisplay *display, EGLBoolean globalTeard
* destroy the display connection itself */
wlEglDestroyAllSurfaces(display);
- wlEglDestroyFormatSet(&display->formatSet);
- wlEglDestroyFeedback(&display->defaultFeedback);
-
if (!globalTeardown || display->ownNativeDpy) {
+ wlEglDestroyFormatSet(&display->formatSet);
+ wlEglDestroyFeedback(&display->defaultFeedback);
+
if (display->wlRegistry) {
wl_registry_destroy(display->wlRegistry);
display->wlRegistry = NULL;
--
2.43.0

View File

@ -1,30 +0,0 @@
From 80ecf7edc4659c580fcd9d752b57bf23ef7399c0 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Mon, 26 Aug 2024 09:19:15 -0600
Subject: [PATCH 3/9] Fix a declaration after code.
In wayland-egldisplay.c, move a declaration to the top of the function.
Older versions of C don't allow mixing declarations and code.
---
src/wayland-egldisplay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 4d25cd7..468b32d 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -568,9 +568,10 @@ static void
dmabuf_feedback_check_done(void *data, struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback)
{
WlServerProtocols *protocols = (WlServerProtocols *)data;
+ drmDevice *drm_device;
+
(void) dmabuf_feedback;
- drmDevice *drm_device;
assert(getDeviceFromDevId);
if (getDeviceFromDevId(protocols->devId, 0, &drm_device) == 0) {
if (drm_device->available_nodes & (1 << DRM_NODE_RENDER)) {
--
2.43.0

View File

@ -1,40 +0,0 @@
From 218f67846472c9310355210ee9a7e1fabed95062 Mon Sep 17 00:00:00 2001
From: shiningdracon <shiningdracon@gmail.com>
Date: Sun, 8 Sep 2024 19:34:26 -0700
Subject: [PATCH 3/3] egl-wayland: Handle failure to acquire image in
wlEglSendDamageEvent
The image parameter of send_explicit_sync_points is assumed not to be
null, however this is a case the rest of the code handles. This causes
sporadic problems on KDE when running overnight as the image will not
be valid at some point, causing us to crash.
Fixes #143
---
src/wayland-eglsurface.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index 4e4dcff..ae6cafc 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -265,11 +265,13 @@ wlEglSendDamageEvent(WlEglSurface *surface,
}
image = pop_acquired_image(surface);
- if (image) {
- surface->ctx.currentBuffer = image->buffer;
- image->attached = EGL_TRUE;
+ if (!image) {
+ return EGL_FALSE;
}
+ surface->ctx.currentBuffer = image->buffer;
+ image->attached = EGL_TRUE;
+
/*
* Send our explicit sync acquire and release points. This needs to be done
* as part of the surface attach as it is a protocol error to specify these
--
2.43.0

View File

@ -1,115 +0,0 @@
From 8dbdd61b7c07e23bc5b8913fe3d52f32995be98a Mon Sep 17 00:00:00 2001
From: Christian Hergert <chergert@redhat.com>
Date: Fri, 23 Aug 2024 19:10:27 +0200
Subject: [PATCH 4/9] egl-swap: provide damage rectangles to wl_surface
Previously, wlEglSendDamageEvent used the entire surface as damage to
the compositor but in the wrong coordinate system. wl_surface_damage()
requires coordinates for the surface which could be scaled while
wl_surface_damage_buffer() expects buffer coordinates which is what
surface->width and surface->height represent.
This ensures that the parameters to eglSwapBuffersWithDamage() are passed
along to the compositor as well. The coordinate system is flipped between
eglSwapBuffersWithDamage() and wl_surface_damage_buffer() which is handled
as well.
Signed-off-by: Christian Hergert <chergert@redhat.com>
---
include/wayland-eglsurface-internal.h | 4 +++-
src/wayland-eglsurface.c | 25 +++++++++++++++++++++----
src/wayland-eglswap.c | 4 ++--
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/include/wayland-eglsurface-internal.h b/include/wayland-eglsurface-internal.h
index dfc5fd4..b70b9d3 100644
--- a/include/wayland-eglsurface-internal.h
+++ b/include/wayland-eglsurface-internal.h
@@ -206,7 +206,9 @@ EGLBoolean
wlEglSurfaceCheckReleasePoints(WlEglDisplay *display, WlEglSurface *surface);
EGLBoolean wlEglSendDamageEvent(WlEglSurface *surface,
- struct wl_event_queue *queue);
+ struct wl_event_queue *queue,
+ EGLint *rects,
+ EGLint n_rects);
void wlEglCreateFrameSync(WlEglSurface *surface);
EGLint wlEglWaitFrameSync(WlEglSurface *surface);
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index da08fb2..1f01616 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -242,9 +242,13 @@ send_explicit_sync_points (WlEglDisplay *display, WlEglSurface *surface,
}
EGLBoolean
-wlEglSendDamageEvent(WlEglSurface *surface, struct wl_event_queue *queue)
+wlEglSendDamageEvent(WlEglSurface *surface,
+ struct wl_event_queue *queue,
+ EGLint *rects,
+ EGLint n_rects)
{
struct wl_display *wlDpy = surface->wlEglDpy->nativeDpy;
+ EGLint i;
if (surface->ctx.wlStreamResource) {
/* Attach same buffer to indicate new content for the surface is
@@ -286,8 +290,21 @@ wlEglSendDamageEvent(WlEglSurface *surface, struct wl_event_queue *queue)
surface->dy);
}
- wl_surface_damage(surface->wlSurface, 0, 0,
- surface->width, surface->height);
+ if (n_rects > 0 &&
+ (wl_proxy_get_version((struct wl_proxy *)surface->wlSurface) >=
+ WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)) {
+ for (i = 0; i < n_rects; i++) {
+ const EGLint *rect = &rects[i * 4];
+ // Coordinate systems are flipped between eglSwapBuffersWithDamage
+ // and wl_surface_damage_buffer, so invert Y values.
+ int inv_y = surface->height - (rect[1] + rect[3]);
+ wl_surface_damage_buffer(surface->wlSurface, rect[0], inv_y, rect[2], rect[3]);
+ }
+ } else {
+ wl_surface_damage(surface->wlSurface, 0, 0, UINT32_MAX, UINT32_MAX);
+ }
+
+
wl_surface_commit(surface->wlSurface);
surface->ctx.isAttached = EGL_TRUE;
@@ -357,7 +374,7 @@ damage_thread(void *args)
wlEglCreateFrameSync(surface);
- ok = wlEglSendDamageEvent(surface, queue);
+ ok = wlEglSendDamageEvent(surface, queue, NULL, 0);
surface->ctx.framesProcessed++;
pthread_cond_signal(&surface->condFrameSync);
diff --git a/src/wayland-eglswap.c b/src/wayland-eglswap.c
index bf1157d..ea99f49 100644
--- a/src/wayland-eglswap.c
+++ b/src/wayland-eglswap.c
@@ -147,7 +147,7 @@ EGLBoolean wlEglSwapBuffersWithDamageHook(EGLDisplay eglDisplay, EGLSurface eglS
surface->ctx.framesProduced++;
} else {
wlEglCreateFrameSync(surface);
- res = wlEglSendDamageEvent(surface, surface->wlEventQueue);
+ res = wlEglSendDamageEvent(surface, surface->wlEventQueue, rects, n_rects);
wlEglSurfaceCheckReleasePoints(display, surface);
}
}
@@ -434,7 +434,7 @@ EGLBoolean wlEglPostPresentExport2(WlEglSurface *surface,
surface->ctx.framesProduced++;
} else {
wlEglCreateFrameSync(surface);
- res = wlEglSendDamageEvent(surface, surface->wlEventQueue);
+ res = wlEglSendDamageEvent(surface, surface->wlEventQueue, NULL, 0);
}
// Release wlEglSurface lock.
--
2.43.0

View File

@ -1,27 +0,0 @@
From febf851acc9c6a9a067ec001104533777adb5572 Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Tue, 27 Aug 2024 08:17:20 -0600
Subject: [PATCH 5/9] Use INT32_MAX for wl_surface_damage
The wl_surface_damage request takes signed integer parameters, so
sending UINT32_MAX would be received as -1. Instead, send INT32_MAX.
---
src/wayland-eglsurface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wayland-eglsurface.c b/src/wayland-eglsurface.c
index c2e3fdc..4e4dcff 100644
--- a/src/wayland-eglsurface.c
+++ b/src/wayland-eglsurface.c
@@ -301,7 +301,7 @@ wlEglSendDamageEvent(WlEglSurface *surface,
wl_surface_damage_buffer(surface->wlSurface, rect[0], inv_y, rect[2], rect[3]);
}
} else {
- wl_surface_damage(surface->wlSurface, 0, 0, UINT32_MAX, UINT32_MAX);
+ wl_surface_damage(surface->wlSurface, 0, 0, INT32_MAX, INT32_MAX);
}
--
2.43.0

View File

@ -1,60 +0,0 @@
From 6355c1605a0b0ccfdc1963170c5564b291ad0eb0 Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@badland.io>
Date: Fri, 6 Sep 2024 14:06:32 -0400
Subject: [PATCH 6/9] egl-wayland: Accept device name from either wl_drm or
linux_dmabuf
Commit 11386cc allowed for listening for the DRM device using the
dmabuf protocol instead of wl_drm, when possible. Unfortunately some
headless compositors (kwin) do not properly send the device id through
dmabuf, even though they send the device path properly through wl_drm.
This change relaxes our check to ensure that one of the protocols sends
the information so that we can use it to verify compositor support.
---
src/wayland-egldisplay.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 468b32d..0128dbd 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -485,6 +485,7 @@ static void wl_drm_device(void *data, struct wl_drm *wl_drm, const char *name)
WlServerProtocols *protocols = (WlServerProtocols *)data;
(void) wl_drm;
+ free(protocols->drm_name);
protocols->drm_name = strdup(name);
}
@@ -575,6 +576,7 @@ dmabuf_feedback_check_done(void *data, struct zwp_linux_dmabuf_feedback_v1 *dmab
assert(getDeviceFromDevId);
if (getDeviceFromDevId(protocols->devId, 0, &drm_device) == 0) {
if (drm_device->available_nodes & (1 << DRM_NODE_RENDER)) {
+ free(protocols->drm_name);
protocols->drm_name = strdup(drm_device->nodes[DRM_NODE_RENDER]);
}
@@ -632,6 +634,7 @@ registry_handle_global_check_protocols(
if ((strcmp(interface, "wl_drm") == 0) && (version >= 2)) {
protocols->wlDrm = wl_registry_bind(registry, name, &wl_drm_interface, 2);
+ wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
}
}
@@ -828,10 +831,9 @@ static bool getServerProtocolsInfo(struct wl_display *nativeDpy,
wl_display_roundtrip_queue(nativeDpy, queue);
zwp_linux_dmabuf_feedback_v1_destroy(default_feedback);
}
- } else if (protocols->wlDrm) {
- wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
- wl_display_roundtrip_queue(nativeDpy, queue);
}
+
+ /* Check that one of our two protocols provided the device name */
result = protocols->drm_name != NULL;
if (protocols->wlDmaBuf) {
--
2.43.0

View File

@ -1,43 +0,0 @@
From 845568c64b69b462918ed89760abb21039e55368 Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@badland.io>
Date: Tue, 17 Sep 2024 10:39:26 -0400
Subject: [PATCH 7/9] egl-wayland: fix device name case where only wl_drm
exists
This fixes a problem in commit 6355c16 where we do not properly wait
for a roundtrip to get the wl_drm name, which can lead to failing to
initialize and falling back to another ICD. This fix also properly
prioritizes the device provided by dmabuf feedback over the wl_drm
name, only using wl_drm if dmabuf did not provide anything.
---
src/wayland-egldisplay.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 0128dbd..3921ede 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -634,7 +634,6 @@ registry_handle_global_check_protocols(
if ((strcmp(interface, "wl_drm") == 0) && (version >= 2)) {
protocols->wlDrm = wl_registry_bind(registry, name, &wl_drm_interface, 2);
- wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
}
}
@@ -833,6 +832,12 @@ static bool getServerProtocolsInfo(struct wl_display *nativeDpy,
}
}
+ /* If we didn't get a name through linux_dmabuf then fall back to wl_drm */
+ if (!protocols->drm_name && protocols->wlDrm) {
+ wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
+ wl_display_roundtrip_queue(nativeDpy, queue);
+ }
+
/* Check that one of our two protocols provided the device name */
result = protocols->drm_name != NULL;
--
2.43.0

View File

@ -1,37 +0,0 @@
From 954e094faacdacad6d82905d2f0a674c3e37fbec Mon Sep 17 00:00:00 2001
From: Simone Caronni <scaronni@nvidia.com>
Date: Thu, 19 Sep 2024 16:00:09 +0200
Subject: [PATCH 8/9] Add ICD json file
---
src/10_nvidia_wayland.json | 6 ++++++
src/meson.build | 3 +++
2 files changed, 9 insertions(+)
create mode 100644 src/10_nvidia_wayland.json
diff --git a/src/10_nvidia_wayland.json b/src/10_nvidia_wayland.json
new file mode 100644
index 0000000..c08a641
--- /dev/null
+++ b/src/10_nvidia_wayland.json
@@ -0,0 +1,6 @@
+{
+ "file_format_version" : "1.0.0",
+ "ICD" : {
+ "library_path" : "libnvidia-egl-wayland.so.1"
+ }
+}
diff --git a/src/meson.build b/src/meson.build
index 704632b..1f1ca34 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -86,3 +86,6 @@ egl_wayland = library('nvidia-egl-wayland',
version : meson.project_version(),
install : true,
)
+
+install_data('10_nvidia_wayland.json',
+ install_dir: '@0@/egl/egl_external_platform.d'.format(get_option('datadir')))
--
2.43.0

View File

@ -1,64 +0,0 @@
From c10c5300483a8ec975e64e5d76c0fb00ac94e026 Mon Sep 17 00:00:00 2001
From: Austin Shafer <ashafer@badland.io>
Date: Thu, 19 Sep 2024 09:35:47 -0400
Subject: [PATCH 9/9] egl-wayland: Fix roundtrip eating wl_drm events in
getServerProtocolsInfo
This resolves another issue where the wl_drm events sent by the
compositor are silently dropped by a roundtrip that happens before
the wl_drm listener is registered. This change immediately registers
wl_drm and triggers its roundtrip first. The dmabuf feedback can
then proceed, potentially replacing the wl_drm name if a valid device
was provided.
---
src/wayland-egldisplay.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/wayland-egldisplay.c b/src/wayland-egldisplay.c
index 3921ede..7089271 100644
--- a/src/wayland-egldisplay.c
+++ b/src/wayland-egldisplay.c
@@ -634,6 +634,7 @@ registry_handle_global_check_protocols(
if ((strcmp(interface, "wl_drm") == 0) && (version >= 2)) {
protocols->wlDrm = wl_registry_bind(registry, name, &wl_drm_interface, 2);
+ wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
}
}
@@ -817,11 +818,19 @@ static bool getServerProtocolsInfo(struct wl_display *nativeDpy,
protocols);
if (ret == 0) {
wl_display_roundtrip_queue(nativeDpy, queue);
+ /* use a second roundtrip to handle any wl_drm events triggered by binding the protocol */
+ wl_display_roundtrip_queue(nativeDpy, queue);
+
if (!getDeviceFromDevIdInitialised) {
getDeviceFromDevId = dlsym(RTLD_DEFAULT, "drmGetDeviceFromDevId");
getDeviceFromDevIdInitialised = true;
}
+ /*
+ * if dmabuf feedback is available then use that. This will potentially
+ * replace the drm_name provided by wl_drm, assuming the feedback provides
+ * a valid dev_t.
+ */
if (protocols->wlDmaBuf && getDeviceFromDevId) {
struct zwp_linux_dmabuf_feedback_v1 *default_feedback
= zwp_linux_dmabuf_v1_get_default_feedback(protocols->wlDmaBuf);
@@ -832,12 +841,6 @@ static bool getServerProtocolsInfo(struct wl_display *nativeDpy,
}
}
- /* If we didn't get a name through linux_dmabuf then fall back to wl_drm */
- if (!protocols->drm_name && protocols->wlDrm) {
- wl_drm_add_listener(protocols->wlDrm, &drmListener, protocols);
- wl_display_roundtrip_queue(nativeDpy, queue);
- }
-
/* Check that one of our two protocols provided the device name */
result = protocols->drm_name != NULL;
--
2.43.0

BIN
egl-wayland-1.1.16.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
egl-wayland-1.1.17.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,24 @@
-------------------------------------------------------------------
Wed Dec 11 22:17:37 UTC 2024 - Stefan Dirsch <sndirsch@suse.com>
- update to 1.1.17 tarball; no source code changes; actually we
had 1.1.7 before without noticing it ...
- supersedes
* 0001-egl-wayland-bump-version-to-1.1.17.patch
* 0002-Fix-the-include-path-for-drm_fourcc.h.patch
* 0003-Fix-a-declaration-after-code.patch
* 0004-egl-swap-provide-damage-rectangles-to-wl_surface.patch
* 0005-Use-INT32_MAX-for-wl_surface_damage.patch
* 0006-egl-wayland-Accept-device-name-from-either-wl_drm-or.patch
* 0007-egl-wayland-fix-device-name-case-where-only-wl_drm-e.patch
* 0008-Add-ICD-json-file.patch
* 0009-egl-wayland-Fix-roundtrip-eating-wl_drm-events-in-ge.patch
* 0001-egl-wayland-enable-CI-with-github-actions.patch
* 0002-egl-wayland-Fix-use-after-free-in-library-teardown.patch
* 0003-egl-wayland-Handle-failure-to-acquire-image-in-wlEgl.patch
* 0001-Fix-a-segfault-in-wlEglCreatePlatformWindowSurfaceHo.patch
* 0002-Check-for-a-duplicate-wl_surface-in-wlEglCreatePlatf.patch
-------------------------------------------------------------------
Fri Dec 6 13:44:48 UTC 2024 - Stefan Dirsch <sndirsch@suse.com>

View File

@ -20,7 +20,7 @@
%define lname libnvidia-egl-wayland%{so_ver}
%define rname egl-wayland
Name: libnvidia-egl-wayland
Version: 1.1.16
Version: 1.1.17
Release: 0
Summary: The EGLStream-based Wayland external platform
License: MIT
@ -28,20 +28,6 @@ Group: Development/Libraries/C and C++
URL: https://github.com/NVIDIA/egl-wayland
Source0: https://github.com/NVIDIA/egl-wayland/archive/%{version}/%{rname}-%{version}.tar.gz
Source1: baselibs.conf
Patch1: 0001-egl-wayland-bump-version-to-1.1.17.patch
Patch2: 0002-Fix-the-include-path-for-drm_fourcc.h.patch
Patch3: 0003-Fix-a-declaration-after-code.patch
Patch4: 0004-egl-swap-provide-damage-rectangles-to-wl_surface.patch
Patch5: 0005-Use-INT32_MAX-for-wl_surface_damage.patch
Patch6: 0006-egl-wayland-Accept-device-name-from-either-wl_drm-or.patch
Patch7: 0007-egl-wayland-fix-device-name-case-where-only-wl_drm-e.patch
Patch8: 0008-Add-ICD-json-file.patch
Patch9: 0009-egl-wayland-Fix-roundtrip-eating-wl_drm-events-in-ge.patch
Patch11: 0001-egl-wayland-enable-CI-with-github-actions.patch
Patch12: 0002-egl-wayland-Fix-use-after-free-in-library-teardown.patch
Patch13: 0003-egl-wayland-Handle-failure-to-acquire-image-in-wlEgl.patch
Patch21: 0001-Fix-a-segfault-in-wlEglCreatePlatformWindowSurfaceHo.patch
Patch22: 0002-Check-for-a-duplicate-wl_surface-in-wlEglCreatePlatf.patch
BuildRequires: gcc-c++
BuildRequires: meson >= 0.50
BuildRequires: ninja