summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/xwayland/xwayland-glamor-gbm.c7
-rw-r--r--hw/xwayland/xwayland-glamor.c5
2 files changed, 7 insertions, 5 deletions
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);