mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
va: Add render node name in non-first devices.
There could be multi-GPU setups where the non-first has more entrypoints than the first one, and the elements names are not homogeneous, leading to pipeline building error. This patch add the render node in the elements names when they belong to the non-first device. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3491>
This commit is contained in:
parent
cccbf1f02d
commit
c8a0d706ca
11 changed files with 56 additions and 66 deletions
|
@ -1119,16 +1119,14 @@ gst_va_av1_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaAV1Dec");
|
||||
feature_name = g_strdup ("vaav1dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vaav1dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaAV1Dec");
|
||||
feature_name = g_strdup ("vaav1dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sAV1Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%sav1dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -42,7 +42,8 @@ gst_va_device_free (GstVaDevice * device)
|
|||
}
|
||||
|
||||
static GstVaDevice *
|
||||
gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path)
|
||||
gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path,
|
||||
gint index)
|
||||
{
|
||||
GstVaDevice *device = g_new0 (GstVaDevice, 1);
|
||||
|
||||
|
@ -52,6 +53,7 @@ gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path)
|
|||
/* take ownership */
|
||||
device->display = display;
|
||||
device->render_device_path = g_strdup (render_device_path);
|
||||
device->index = index;
|
||||
|
||||
return device;
|
||||
}
|
||||
|
@ -61,7 +63,7 @@ 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);
|
||||
return g_strcmp0 (pa->render_device_path, pb->render_device_path);
|
||||
}
|
||||
|
||||
#if HAVE_GUDEV
|
||||
|
@ -71,6 +73,7 @@ gst_va_device_find_devices (void)
|
|||
GUdevClient *client;
|
||||
GList *udev_devices, *dev;
|
||||
GQueue devices = G_QUEUE_INIT;
|
||||
gint i = 0;
|
||||
|
||||
client = g_udev_client_new (NULL);
|
||||
udev_devices = g_udev_client_query_by_subsystem (client, "drm");
|
||||
|
@ -90,7 +93,7 @@ gst_va_device_find_devices (void)
|
|||
continue;
|
||||
|
||||
GST_INFO ("Found VA-API device: %s", path);
|
||||
g_queue_push_head (&devices, gst_va_device_new (dpy, path));
|
||||
g_queue_push_head (&devices, gst_va_device_new (dpy, path, i++));
|
||||
}
|
||||
|
||||
g_queue_sort (&devices, compare_device_path, NULL);
|
||||
|
@ -106,7 +109,7 @@ gst_va_device_find_devices (void)
|
|||
GstVaDisplay *dpy;
|
||||
GQueue devices = G_QUEUE_INIT;
|
||||
gchar path[64];
|
||||
guint i;
|
||||
guint i, j = 0;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
g_snprintf (path, sizeof (path), "/dev/dri/renderD%d", 128 + i);
|
||||
|
@ -117,7 +120,7 @@ gst_va_device_find_devices (void)
|
|||
continue;
|
||||
|
||||
GST_INFO ("Found VA-API device: %s", path);
|
||||
g_queue_push_head (&devices, gst_va_device_new (dpy, path));
|
||||
g_queue_push_head (&devices, gst_va_device_new (dpy, path, j++));
|
||||
}
|
||||
|
||||
g_queue_sort (&devices, compare_device_path, NULL);
|
||||
|
|
|
@ -36,6 +36,7 @@ typedef struct
|
|||
|
||||
GstVaDisplay *display;
|
||||
gchar *render_device_path;
|
||||
gint index;
|
||||
} GstVaDevice;
|
||||
|
||||
GType gst_va_device_get_type (void);
|
||||
|
|
|
@ -1034,16 +1034,14 @@ gst_va_h264_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaH264Dec");
|
||||
feature_name = g_strdup ("vah264dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vah264dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaH264Dec");
|
||||
feature_name = g_strdup ("vah264dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sH264Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%sh264dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -3814,21 +3814,20 @@ gst_va_h264_enc_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup ("GstVaH264Enc");
|
||||
feature_name = g_strdup ("vah264enc");
|
||||
} else {
|
||||
type_name = g_strdup ("GstVaH264LPEnc");
|
||||
feature_name = g_strdup ("vah264lpenc");
|
||||
}
|
||||
|
||||
/* The first encoder to be registered should use a constant name,
|
||||
* like vah264enc, for any additional encoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup ("GstVaH264Enc");
|
||||
feature_name = g_strdup ("vah264enc");
|
||||
} else {
|
||||
type_name = g_strdup ("GstVaH264LPEnc");
|
||||
feature_name = g_strdup ("vah264lpenc");
|
||||
}
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup_printf ("GstVa%sH264Enc", basename);
|
||||
feature_name = g_strdup_printf ("va%sh264enc", basename);
|
||||
|
|
|
@ -1380,16 +1380,14 @@ gst_va_h265_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaH265Dec");
|
||||
feature_name = g_strdup ("vah265dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vah265dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaH265Dec");
|
||||
feature_name = g_strdup ("vah265dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sH265Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%sh265dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -5292,21 +5292,20 @@ gst_va_h265_enc_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup ("GstVaH265Enc");
|
||||
feature_name = g_strdup ("vah265enc");
|
||||
} else {
|
||||
type_name = g_strdup ("GstVaH265LPEnc");
|
||||
feature_name = g_strdup ("vah265lpenc");
|
||||
}
|
||||
|
||||
/* The first encoder to be registered should use a constant name,
|
||||
* like vah265enc, for any additional encoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup ("GstVaH265Enc");
|
||||
feature_name = g_strdup ("vah265enc");
|
||||
} else {
|
||||
type_name = g_strdup ("GstVaH265LPEnc");
|
||||
feature_name = g_strdup ("vah265lpenc");
|
||||
}
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
if (entrypoint == VAEntrypointEncSlice) {
|
||||
type_name = g_strdup_printf ("GstVa%sH265Enc", basename);
|
||||
feature_name = g_strdup_printf ("va%sh265enc", basename);
|
||||
|
@ -5315,6 +5314,7 @@ gst_va_h265_enc_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
feature_name = g_strdup_printf ("va%sh265lpenc", basename);
|
||||
}
|
||||
cdata->description = basename;
|
||||
|
||||
/* lower rank for non-first device */
|
||||
if (rank > 0)
|
||||
rank--;
|
||||
|
|
|
@ -623,16 +623,15 @@ gst_va_jpeg_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaJpegDec");
|
||||
feature_name = g_strdup ("vajpegdec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vajpegdec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaJpegDec");
|
||||
feature_name = g_strdup ("vajpegdec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sJpegDec", basename);
|
||||
feature_name = g_strdup_printf ("va%sjpegdec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -712,16 +712,14 @@ gst_va_mpeg2_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaMpeg2Dec");
|
||||
feature_name = g_strdup ("vampeg2dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vampeg2dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaMpeg2Dec");
|
||||
feature_name = g_strdup ("vampeg2dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sMpeg2Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%smpeg2dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -581,16 +581,14 @@ gst_va_vp8_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaVp8Dec");
|
||||
feature_name = g_strdup ("vavp8dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vavp8dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaVp8Dec");
|
||||
feature_name = g_strdup ("vavp8dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sVp8Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%svp8dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
|
@ -740,16 +740,14 @@ gst_va_vp9_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
|||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstVaVp9Dec");
|
||||
feature_name = g_strdup ("vavp9dec");
|
||||
|
||||
/* The first decoder to be registered should use a constant name,
|
||||
* like vavp9dec, for any additional decoders, we create unique
|
||||
* names, using inserting the render device name. */
|
||||
if (g_type_from_name (type_name)) {
|
||||
if (device->index == 0) {
|
||||
type_name = g_strdup ("GstVaVp9Dec");
|
||||
feature_name = g_strdup ("vavp9dec");
|
||||
} else {
|
||||
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
type_name = g_strdup_printf ("GstVa%sVp9Dec", basename);
|
||||
feature_name = g_strdup_printf ("va%svp9dec", basename);
|
||||
cdata->description = basename;
|
||||
|
|
Loading…
Reference in a new issue