diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-03-07 14:13:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-10 22:19:25 +0000 |
commit | 28cab948f50b1d67468edbd9c8e10d3d696155f5 (patch) | |
tree | 99a5e908bd5c22137e003b9edbcb77a69695e216 /src | |
parent | e5f8118bdbc4655d987ab1c52e0a46fa85cc92c4 (diff) |
intel: Add support for server managed fds
In the post-modern world, the platform device nodes are handed to a
non-privileged Xserver by systemd/logind. We can then query the core for
our assigned fd rather than try to open the device for ourselves (which
would fail when trying to obtain DRM_MASTER status). A consequence is
that we then do not directly control DRM_MASTER status and must act as a
delegate of systemd.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel_device.c | 28 | ||||
-rw-r--r-- | src/intel_module.c | 6 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/intel_device.c b/src/intel_device.c index d0c80920..38b57e20 100644 --- a/src/intel_device.c +++ b/src/intel_device.c @@ -240,19 +240,10 @@ static char *get_path(struct xf86_platform_device *dev) #endif -#if defined(ODEV_ATTRIB_FD) && 0 +#if defined(ODEV_ATTRIB_FD) static int get_fd(struct xf86_platform_device *dev) { - const char *str; - - if (dev == NULL) - return -1; - - str = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_FD); - if (str == NULL) - return -1; - - return atoi(str); + return xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1); } #else @@ -261,7 +252,6 @@ static int get_fd(struct xf86_platform_device *dev) { return -1; } - #endif int intel_open_device(int entity_num, @@ -270,7 +260,7 @@ int intel_open_device(int entity_num, { struct intel_device *dev; char *local_path; - int fd; + int fd, master_count; if (intel_device_key == -1) intel_device_key = xf86AllocateEntityPrivateIndex(); @@ -283,11 +273,15 @@ int intel_open_device(int entity_num, local_path = get_path(platform); + master_count = 1; /* DRM_MASTER is managed by Xserver */ fd = get_fd(platform); - if (fd == -1) + if (fd == -1) { fd = __intel_open_device(pci, &local_path); - if (fd == -1) - goto err_path; + if (fd == -1) + goto err_path; + + master_count = 0; + } if (!__intel_check_device(fd)) goto err_close; @@ -298,7 +292,7 @@ int intel_open_device(int entity_num, dev->fd = fd; dev->open_count = 0; - dev->master_count = 0; + dev->master_count = master_count; dev->master_node = local_path; dev->render_node = find_render_node(fd); if (dev->render_node == NULL) diff --git a/src/intel_module.c b/src/intel_module.c index 51de62ad..75860be2 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -419,6 +419,12 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn, #endif return TRUE; + +#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1,15,99,902,0) + case SUPPORTS_SERVER_FDS: + return TRUE; +#endif + default: /* Unknown or deprecated function */ return FALSE; |