hotplug: Extend OdevAttributes for server-managed fd support
With systemd-logind support, the xserver, rather than the drivers will be responsible for opening/closing the fd for drm nodes. This commit adds a fd member to OdevAttributes to store the fd to pass it along to the driver. systemd-logind tracks devices by their chardev major + minor numbers, so also add OdevAttributes to store the major and minor. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a8d802cb01
commit
5fb641a29b
|
@ -128,6 +128,20 @@ xf86_get_platform_device_unowned(int index)
|
|||
TRUE : FALSE;
|
||||
}
|
||||
|
||||
struct xf86_platform_device *
|
||||
xf86_find_platform_device_by_devnum(int major, int minor)
|
||||
{
|
||||
int i, attr_major, attr_minor;
|
||||
|
||||
for (i = 0; i < xf86_num_platform_devices; i++) {
|
||||
attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0);
|
||||
attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0);
|
||||
if (attr_major == major && attr_minor == minor)
|
||||
return &xf86_platform_devices[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* xf86IsPrimaryPlatform() -- return TRUE if primary device
|
||||
* is a platform device and it matches this one.
|
||||
|
|
|
@ -35,6 +35,7 @@ struct xf86_platform_device {
|
|||
|
||||
/* xf86_platform_device flags */
|
||||
#define XF86_PDEV_UNOWNED 0x01
|
||||
#define XF86_PDEV_SERVER_FD 0x02
|
||||
|
||||
#ifdef XSERVER_PLATFORM_BUS
|
||||
int xf86platformProbe(void);
|
||||
|
|
|
@ -78,6 +78,12 @@ config_odev_free_attributes(struct OdevAttributes *attribs);
|
|||
#define ODEV_ATTRIB_SYSPATH 2
|
||||
/* DRI-style bus id */
|
||||
#define ODEV_ATTRIB_BUSID 3
|
||||
/* Server managed FD */
|
||||
#define ODEV_ATTRIB_FD 4
|
||||
/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
|
||||
#define ODEV_ATTRIB_MAJOR 5
|
||||
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
|
||||
#define ODEV_ATTRIB_MINOR 6
|
||||
|
||||
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
|
||||
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
|
||||
|
@ -88,4 +94,8 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs);
|
|||
#endif
|
||||
|
||||
#define ServerIsNotSeat0() (SeatId && strcmp(SeatId, "seat0"))
|
||||
|
||||
struct xf86_platform_device *
|
||||
xf86_find_platform_device_by_devnum(int major, int minor);
|
||||
|
||||
#endif /* HOTPLUG_H */
|
||||
|
|
Loading…
Reference in New Issue