va: sort the device queue

If so, the elements will be registered per drm node in order of
renderD128, renderD129, ... etc, an element with constant name will be
registered on renderD128 on a hardware with multiple drm nodes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1988>
This commit is contained in:
Haihao Xiang 2021-01-27 15:32:26 +08:00
parent 95e1ce7e7a
commit 956d6e8ff7

View file

@ -55,6 +55,14 @@ gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path)
return device;
}
static gint
compare_device_path (gconstpointer a, gconstpointer b, gpointer user_data)
{
const GstVaDevice *pa = a, *pb = b;
return strcmp (pa->render_device_path, pb->render_device_path);
}
GList *
gst_va_device_find_devices (void)
{
@ -80,9 +88,10 @@ gst_va_device_find_devices (void)
continue;
GST_INFO ("Found VA-API device: %s", path);
g_queue_push_tail (&devices, gst_va_device_new (dpy, path));
g_queue_push_head (&devices, gst_va_device_new (dpy, path));
}
g_queue_sort (&devices, compare_device_path, NULL);
g_list_free_full (udev_devices, g_object_unref);
g_object_unref (client);