From: Hans de Goede Date: Fri, 7 Mar 2014 13:13:38 +0000 (+0100) Subject: intel: Add support for server managed fds X-Git-Tag: 2.99.911~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28cab948f50b1d67468edbd9c8e10d3d696155f5;p=platform%2Fupstream%2Fxf86-video-intel.git 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 --- diff --git a/src/intel_device.c b/src/intel_device.c index d0c8092..38b57e2 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 51de62a..75860be 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;