[PATCH v2 09/14] hotplug: Extend OdevAttributes for server-managed fd support

Hans de Goede hdegoede at redhat.com
Tue Feb 11 10:09:03 CET 2014


Hi,

On 02/11/2014 06:56 AM, Peter Hutterer wrote:
> On Tue, Feb 04, 2014 at 12:49:15PM +0100, Hans de Goede wrote:
>> 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 at redhat.com>
>> ---
>>  hw/xfree86/common/xf86platformBus.c | 14 ++++++++++++++
>>  hw/xfree86/common/xf86platformBus.h |  1 +
>>  include/hotplug.h                   | 10 ++++++++++
>>  3 files changed, 25 insertions(+)
>>
>> diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
>> index 97d606a..e1d7bd0 100644
>> --- a/hw/xfree86/common/xf86platformBus.c
>> +++ b/hw/xfree86/common/xf86platformBus.c
>> @@ -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.
>> diff --git a/hw/xfree86/common/xf86platformBus.h b/hw/xfree86/common/xf86platformBus.h
>> index 9a49260..3e27d34 100644
>> --- a/hw/xfree86/common/xf86platformBus.h
>> +++ b/hw/xfree86/common/xf86platformBus.h
>> @@ -35,6 +35,7 @@ struct xf86_platform_device {
>>  
>>  /* xf86_platform_device flags */
>>  #define XF86_PDEV_UNOWNED       0x01
>> +#define XF86_PDEV_SERVER_FD     0x02
> 
> this seems to belong to a different patch?

This mirrors the "xf86Xinput: Modify API for server-managed fd support",
patch, which adds a similar flag in the same patch as other changes.

The idea behind this being here is to have all driver relevant API
changes (drivers may want to check for this flag) to be in a single
commit.

Regards,

Hans


More information about the xorg-devel mailing list