[PATCH v2 2/2] Require video drivers to report that they support server managed fds

Dave Airlie airlied at gmail.com
Sun Mar 9 23:40:16 PDT 2014


On Fri, Mar 7, 2014 at 8:34 PM, Hans de Goede <hdegoede at redhat.com> wrote:
> This makes how we handle video drivers identical to what we do for input
> drivers, and this should make live easier for old non kms drivers.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>

Looks good to me,

Reviewed-by: Dave Airlie <airlied at redhat.com>
> ---
>  hw/xfree86/common/xf86platformBus.c | 14 +++++++++++++-
>  hw/xfree86/common/xf86str.h         |  3 ++-
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
> index 564567e..4e80f9e 100644
> --- a/hw/xfree86/common/xf86platformBus.c
> +++ b/hw/xfree86/common/xf86platformBus.c
> @@ -38,6 +38,7 @@
>  #include <unistd.h>
>  #include "os.h"
>  #include "hotplug.h"
> +#include "systemd-logind.h"
>
>  #include "xf86.h"
>  #include "xf86_OSproc.h"
> @@ -310,7 +311,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
>                              GDevPtr gdev, int flags, intptr_t match_data)
>  {
>      Bool foundScreen = FALSE;
> -    int entity;
> +    int entity, fd, major, minor;
>
>      if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
>          return FALSE;
> @@ -334,6 +335,17 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
>          }
>      }
>      if (entity != -1) {
> +        if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
> +                !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
> +            fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
> +            major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
> +            minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
> +            systemd_logind_release_fd(major, minor);
> +            close(fd);
> +            config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
> +            dev->flags &= ~XF86_PDEV_SERVER_FD;
> +        }
> +
>          if (drvp->platformProbe(drvp, entity, flags, dev, match_data))
>              foundScreen = TRUE;
>          else
> diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
> index b164b7f..a81e886 100644
> --- a/hw/xfree86/common/xf86str.h
> +++ b/hw/xfree86/common/xf86str.h
> @@ -256,7 +256,8 @@ typedef enum {
>      RR_GET_INFO,
>      RR_SET_CONFIG,
>      RR_GET_MODE_MM,
> -    GET_REQUIRED_HW_INTERFACES = 10
> +    GET_REQUIRED_HW_INTERFACES = 10,
> +    SUPPORTS_SERVER_FDS = 11,
>  } xorgDriverFuncOp;
>
>  typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
> --
> 1.9.0
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list