libs: display: drm: fix set_device_path_from_fd
authorHaihao Xiang <haihao.xiang@intel.com>
Mon, 25 Jan 2021 06:45:47 +0000 (14:45 +0800)
committerHaihao Xiang <haihao.xiang@intel.com>
Thu, 28 Jan 2021 01:48:56 +0000 (09:48 +0800)
commit23967fc02bf1d9a1ecaf06704d024bdc8904e295
tree4eec43e3ef6477e27e4daecae595237967bab3b8
parentc4e76d6fc57b792164356da57a20bbe23b8b7270
libs: display: drm: fix set_device_path_from_fd

drmGetBusid() (GET_UNIQUE ioctl) won't return a valid bus id when
drmSetInterfaceVersion() (SET_VERSION ioctl) hasn't been called(see[1]),
so we can't get the right device path. Running test-display will get the
error below:

** (test-display:18630): ERROR **: 10:26:00.434: could not create Gst/VA
display

Calling drmSetInterfaceVersion() before drmGetBusid() can't fix this
issue because a special permission is required for SET_VERSION ioctl.

This patch retrieves the device path from file descriptor via
g_file_read_link()

[1] https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/drm_ioctl.c#L48-L104

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/412>
gst-libs/gst/vaapi/gstvaapidisplay_drm.c