mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +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_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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vaav1dec, for any additional decoders, we create unique
|
* like vaav1dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sAV1Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%sav1dec", basename);
|
feature_name = g_strdup_printf ("va%sav1dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -42,7 +42,8 @@ gst_va_device_free (GstVaDevice * device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstVaDevice *
|
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);
|
GstVaDevice *device = g_new0 (GstVaDevice, 1);
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path)
|
||||||
/* take ownership */
|
/* take ownership */
|
||||||
device->display = display;
|
device->display = display;
|
||||||
device->render_device_path = g_strdup (render_device_path);
|
device->render_device_path = g_strdup (render_device_path);
|
||||||
|
device->index = index;
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +63,7 @@ compare_device_path (gconstpointer a, gconstpointer b, gpointer user_data)
|
||||||
{
|
{
|
||||||
const GstVaDevice *pa = a, *pb = b;
|
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
|
#if HAVE_GUDEV
|
||||||
|
@ -71,6 +73,7 @@ gst_va_device_find_devices (void)
|
||||||
GUdevClient *client;
|
GUdevClient *client;
|
||||||
GList *udev_devices, *dev;
|
GList *udev_devices, *dev;
|
||||||
GQueue devices = G_QUEUE_INIT;
|
GQueue devices = G_QUEUE_INIT;
|
||||||
|
gint i = 0;
|
||||||
|
|
||||||
client = g_udev_client_new (NULL);
|
client = g_udev_client_new (NULL);
|
||||||
udev_devices = g_udev_client_query_by_subsystem (client, "drm");
|
udev_devices = g_udev_client_query_by_subsystem (client, "drm");
|
||||||
|
@ -90,7 +93,7 @@ gst_va_device_find_devices (void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_INFO ("Found VA-API device: %s", path);
|
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);
|
g_queue_sort (&devices, compare_device_path, NULL);
|
||||||
|
@ -106,7 +109,7 @@ gst_va_device_find_devices (void)
|
||||||
GstVaDisplay *dpy;
|
GstVaDisplay *dpy;
|
||||||
GQueue devices = G_QUEUE_INIT;
|
GQueue devices = G_QUEUE_INIT;
|
||||||
gchar path[64];
|
gchar path[64];
|
||||||
guint i;
|
guint i, j = 0;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
g_snprintf (path, sizeof (path), "/dev/dri/renderD%d", 128 + i);
|
g_snprintf (path, sizeof (path), "/dev/dri/renderD%d", 128 + i);
|
||||||
|
@ -117,7 +120,7 @@ gst_va_device_find_devices (void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_INFO ("Found VA-API device: %s", path);
|
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);
|
g_queue_sort (&devices, compare_device_path, NULL);
|
||||||
|
|
|
@ -36,6 +36,7 @@ typedef struct
|
||||||
|
|
||||||
GstVaDisplay *display;
|
GstVaDisplay *display;
|
||||||
gchar *render_device_path;
|
gchar *render_device_path;
|
||||||
|
gint index;
|
||||||
} GstVaDevice;
|
} GstVaDevice;
|
||||||
|
|
||||||
GType gst_va_device_get_type (void);
|
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_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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vah264dec, for any additional decoders, we create unique
|
* like vah264dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sH264Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%sh264dec", basename);
|
feature_name = g_strdup_printf ("va%sh264dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -3814,21 +3814,20 @@ gst_va_h264_enc_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first encoder to be registered should use a constant name,
|
||||||
* like vah264enc, for any additional encoders, we create unique
|
* like vah264enc, for any additional encoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||||
g_free (type_name);
|
|
||||||
g_free (feature_name);
|
|
||||||
if (entrypoint == VAEntrypointEncSlice) {
|
if (entrypoint == VAEntrypointEncSlice) {
|
||||||
type_name = g_strdup_printf ("GstVa%sH264Enc", basename);
|
type_name = g_strdup_printf ("GstVa%sH264Enc", basename);
|
||||||
feature_name = g_strdup_printf ("va%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_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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vah265dec, for any additional decoders, we create unique
|
* like vah265dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sH265Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%sh265dec", basename);
|
feature_name = g_strdup_printf ("va%sh265dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -5292,21 +5292,20 @@ gst_va_h265_enc_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first encoder to be registered should use a constant name,
|
||||||
* like vah265enc, for any additional encoders, we create unique
|
* like vah265enc, for any additional encoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
gchar *basename = g_path_get_basename (device->render_device_path);
|
||||||
g_free (type_name);
|
|
||||||
g_free (feature_name);
|
|
||||||
if (entrypoint == VAEntrypointEncSlice) {
|
if (entrypoint == VAEntrypointEncSlice) {
|
||||||
type_name = g_strdup_printf ("GstVa%sH265Enc", basename);
|
type_name = g_strdup_printf ("GstVa%sH265Enc", basename);
|
||||||
feature_name = g_strdup_printf ("va%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);
|
feature_name = g_strdup_printf ("va%sh265lpenc", basename);
|
||||||
}
|
}
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
||||||
/* lower rank for non-first device */
|
/* lower rank for non-first device */
|
||||||
if (rank > 0)
|
if (rank > 0)
|
||||||
rank--;
|
rank--;
|
||||||
|
|
|
@ -623,16 +623,15 @@ gst_va_jpeg_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vajpegdec, for any additional decoders, we create unique
|
* like vajpegdec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sJpegDec", basename);
|
||||||
feature_name = g_strdup_printf ("va%sjpegdec", basename);
|
feature_name = g_strdup_printf ("va%sjpegdec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -712,16 +712,14 @@ gst_va_mpeg2_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vampeg2dec, for any additional decoders, we create unique
|
* like vampeg2dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sMpeg2Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%smpeg2dec", basename);
|
feature_name = g_strdup_printf ("va%smpeg2dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -581,16 +581,14 @@ gst_va_vp8_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vavp8dec, for any additional decoders, we create unique
|
* like vavp8dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sVp8Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%svp8dec", basename);
|
feature_name = g_strdup_printf ("va%svp8dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
|
@ -740,16 +740,14 @@ gst_va_vp9_dec_register (GstPlugin * plugin, GstVaDevice * device,
|
||||||
|
|
||||||
type_info.class_data = cdata;
|
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,
|
/* The first decoder to be registered should use a constant name,
|
||||||
* like vavp9dec, for any additional decoders, we create unique
|
* like vavp9dec, for any additional decoders, we create unique
|
||||||
* names, using inserting the render device name. */
|
* 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);
|
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);
|
type_name = g_strdup_printf ("GstVa%sVp9Dec", basename);
|
||||||
feature_name = g_strdup_printf ("va%svp9dec", basename);
|
feature_name = g_strdup_printf ("va%svp9dec", basename);
|
||||||
cdata->description = basename;
|
cdata->description = basename;
|
||||||
|
|
Loading…
Reference in a new issue