xfree86: Store kernel driver name in platform device attribute

When opening a DRM device, query the version and store the driver name
as a new attribute for future reference.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-By: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Thierry Reding 2014-02-12 16:43:29 +01:00 committed by Keith Packard
parent 5a4e15c3f6
commit 856bb80cea
2 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,7 @@ static Bool
get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
{
drmSetVersion sv;
drmVersionPtr v;
char *buf;
int major, minor, fd;
int err = 0;
@ -74,6 +75,17 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
xf86_add_platform_device_attrib(delayed_index,
ODEV_ATTRIB_BUSID, buf);
drmFreeBusid(buf);
v = drmGetVersion(fd);
if (!v) {
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
goto out;
}
xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_DRIVER,
v->name);
drmFreeVersion(v);
out:
if (!server_fd)
close(fd);

View File

@ -87,6 +87,8 @@ config_odev_free_attributes(struct OdevAttributes *attribs);
#define ODEV_ATTRIB_MAJOR 5
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
#define ODEV_ATTRIB_MINOR 6
/* kernel driver name */
#define ODEV_ATTRIB_DRIVER 4
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);