xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 22 16:33:21 UTC 2024
hw/xwayland/xwayland-glamor-gbm.c | 7 +++----
hw/xwayland/xwayland-glamor.c | 5 ++++-
2 files changed, 7 insertions(+), 5 deletions(-)
New commits:
commit 91b5a003a5f48df2920e628c1f0a0bd02f476280
Author: Michel Dänzer <mdaenzer at redhat.com>
Date: Thu Oct 3 12:33:56 2024 +0200
xwayland/glamor/gbm: Don't close fence_fd after xwl_glamor_wait_fence
eglCreateSyncKHR takes ownership of the file descriptor. Noticed by
inspection.
While we're at it, move the fence_fd declaration to the scope where
it's used.
Last but not least, close the fd in xwl_glamor_wait_fence when bailing
before calling eglCreateSyncKHR, and document that it takes ownership.
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1712>
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 92241bd1e..45f18a47c 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -1516,16 +1516,15 @@ xwl_glamor_gbm_wait_syncpts(PixmapPtr pixmap)
#ifdef DRI3
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
- int fence_fd;
if (!xwl_screen->glamor || !xwl_pixmap)
return;
if (xwl_pixmap->syncobj) {
- fence_fd = xwl_pixmap->syncobj->export_fence(xwl_pixmap->syncobj,
- xwl_pixmap->timeline_point);
+ int fence_fd = xwl_pixmap->syncobj->export_fence(xwl_pixmap->syncobj,
+ xwl_pixmap->timeline_point);
+
xwl_glamor_wait_fence(xwl_screen, fence_fd);
- close(fence_fd);
}
#endif /* DRI3 */
}
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index c3aa483ff..6618a0a34 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -198,14 +198,17 @@ xwl_glamor_get_fence(struct xwl_screen *xwl_screen)
return fence_fd;
}
+/* Takes ownership of fence_fd, specifically eglCreateSyncKHR does */
void
xwl_glamor_wait_fence(struct xwl_screen *xwl_screen, int fence_fd)
{
EGLint attribs[3];
EGLSyncKHR sync;
- if (!xwl_screen->glamor)
+ if (!xwl_screen->glamor) {
+ close(fence_fd);
return;
+ }
xwl_glamor_egl_make_current(xwl_screen);
More information about the xorg-commit
mailing list