diff --git a/hw/xfree86/common/seatd-libseat.h b/hw/xfree86/common/seatd-libseat.h index a9da51a0b0..fa6252b305 100644 --- a/hw/xfree86/common/seatd-libseat.h +++ b/hw/xfree86/common/seatd-libseat.h @@ -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); diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/video/modesetting/driver.c index 88c15a4d20..0b0afef9ba 100644 --- a/hw/xfree86/drivers/video/modesetting/driver.c +++ b/hw/xfree86/drivers/video/modesetting/driver.c @@ -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; }