modesetting: fix shared pixmap dmabuf fd leakage

After the dmabuf fd exported by another screen is imported to a pixmap,
the pixmap holds a reference for the buffer, thus the FD itself finished
its job and needs to be closed to prevent a stale reference to the
buffer.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
This commit is contained in:
Icenowy Zheng 2025-09-23 19:08:45 +08:00
parent b096785df4
commit 11a52e3095

View file

@ -1877,6 +1877,7 @@ msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle)
ppix->devKind,
ppix->drawable.depth,
ppix->drawable.bitsPerPixel);
close(ihandle);
} else {
int size = ppix->devKind * ppix->drawable.height;
ret = drmmode_SetSlaveBO(ppix, &ms->drmmode, ihandle, ppix->devKind, size);