[PATCH libdrm v2] xf86drm: Parse the separate files to retrieve the vendor, ... info

Michel Dänzer michel at daenzer.net
Thu Nov 10 08:00:44 UTC 2016


On 10/11/16 03:08 AM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Parsing config sysfs file wakes up the device. The latter of which may
> be slow and isn't required to begin with.
> 
> Reading through config is/was required since the revision is not
> available by other means, although with a kernel patch in the way that
> is about to change.
> 
> Since returning 0 when one might expect a valid value is a no-go add a
> workaround drmDeviceUseRevisionFile() which one can use to say "I don't
> care if the revision file returns 0."
> 
> v2: Complete rework - add new API to control the method, instead of
> changing it underneat the users' feet.
> 
> Cc: Michel Dänzer <michel.daenzer at amd.com>
> Cc: Mauro Santos <registo.mailling at gmail.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> I don't have a strong preference for/against this or v1.
> 
> With this Mesa will require a 2 line patch. With v1 things will get
> fixed magically, when rebuilt against newer libdrm.

"drmDeviceUseRevisionFile" seems slightly misleading — the intent is "I
don't care about the revision", not "I want you to use the revision file".


> +static int drmParsePciDeviceInfo(const char *d_name,
> +                                 drmPciDeviceInfoPtr device)
> +{
> +#ifdef __linux__
> +    if (use_revision_file)
> +        return parse_separate_sysfs_files(d_name, device);
> +
> +    return parse_config_sysfs_file(d_name, device);

I might be better to always try parse_separate_sysfs_files first, but
bail from there if the revision files don't exist and the new API wasn't
called.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the dri-devel mailing list