From 956d6e8ff7eaa663a4f8ebcb6d7d7d6ef3b18e33 Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Wed, 27 Jan 2021 15:32:26 +0800 Subject: [PATCH] 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: --- sys/va/gstvadevice.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/va/gstvadevice.c b/sys/va/gstvadevice.c index a00293f449..0e251e158c 100644 --- a/sys/va/gstvadevice.c +++ b/sys/va/gstvadevice.c @@ -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); -- 2.34.1