loader: reimplement loader_get_user_preferred_fd via libdrm
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 7 Sep 2016 17:30:48 +0000 (18:30 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 18 Oct 2016 16:06:10 +0000 (17:06 +0100)
commitfcdc02f5121823bb37588de507254c926471e28d
tree81caf0f0e26c4496a7615f1a38da883ca6327aac
parent82221006319e3d41f8ac672cb3cf846575ca22f3
loader: reimplement loader_get_user_preferred_fd via libdrm

Currently not everyone has libudev and with follow-up patches we'll
completely remove the divergent codepaths.

Use the libdrm drm device API to construct the required ID_PATH_TAG-like
string, to preserve the current functionality for libudev users and
allow others to benefit from it as well.

v2: Drop ranty comments, pick the correct device
v3: \n -> \0 in PCI_ID_PATH_TAG_LENGTH comment (Axel).
v4: Use snprintf (Nicolai)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/loader/loader.c