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>
This commit is contained in:
parent
b306df5a60
commit
91b5a003a5
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue