mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-23 06:43:07 +00:00
modesetting: release seatd GPU FDs through libseat
ms_try_open() falls back to seatd_libseat_open_graphics() when the driver can't open the node itself, but every FD from open_hw() is closed with a plain close(). seatd keeps its own reference to the device, and the FD stays in seatd-libseat.c's list, where a later open that reuses the FD number can be mistaken for it. Export seatd_libseat_close_graphics() and call it before closing an FD that may have come from open_hw(). It does nothing for an FD that wasn't opened through seatd, so the driver doesn't have to remember where each FD came from. drmOpen() FDs of PCI entities and server FDs aren't closed on these paths. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: galternat <galternat.twins223@simplelogin.com>
This commit is contained in:
parent
8dc955bf44
commit
a10ffde406
2 changed files with 15 additions and 5 deletions
|
|
@ -46,6 +46,7 @@ extern void seatd_libseat_fini(void);
|
|||
**/
|
||||
_X_EXPORT
|
||||
extern int seatd_libseat_open_graphics(const char *path);
|
||||
_X_EXPORT
|
||||
extern void seatd_libseat_close_graphics(int fd);
|
||||
extern void seatd_libseat_open_device(InputInfoPtr p, int *fd, Bool *paus);
|
||||
extern void seatd_libseat_close_device(InputInfoPtr p);
|
||||
|
|
|
|||
|
|
@ -260,6 +260,15 @@ ms_try_open(const char *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
ms_close_hw(int fd)
|
||||
{
|
||||
#ifdef SEATD_LIBSEAT
|
||||
seatd_libseat_close_graphics(fd);
|
||||
#endif
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
static int
|
||||
open_hw(const char *dev)
|
||||
{
|
||||
|
|
@ -286,7 +295,7 @@ open_hw(const char *dev)
|
|||
break;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
ms_close_hw(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -345,7 +354,7 @@ probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
|
|||
if (fd != -1) {
|
||||
int ret = check_outputs(fd, NULL);
|
||||
|
||||
close(fd);
|
||||
ms_close_hw(fd);
|
||||
return ret;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -380,7 +389,7 @@ probe_hw_pci(const char *dev, struct pci_device *pdev)
|
|||
sv.drm_dd_major = -1;
|
||||
sv.drm_dd_minor = -1;
|
||||
if (drmSetInterfaceVersion(fd, &sv)) {
|
||||
close(fd);
|
||||
ms_close_hw(fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +399,7 @@ probe_hw_pci(const char *dev, struct pci_device *pdev)
|
|||
if (id && devid && !strcmp(id, devid))
|
||||
ret = check_outputs(fd, NULL);
|
||||
|
||||
close(fd);
|
||||
ms_close_hw(fd);
|
||||
free(id);
|
||||
free(devid);
|
||||
return ret;
|
||||
|
|
@ -1119,7 +1128,7 @@ FreeScreen(ScrnInfoPtr pScrn)
|
|||
if (!(ms->pEnt->location.type == BUS_PLATFORM &&
|
||||
(ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)))
|
||||
#endif
|
||||
ret = close(ms->fd);
|
||||
ret = ms_close_hw(ms->fd);
|
||||
(void) ret;
|
||||
ms_ent->fd = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue