test: Update all video related tests because of adding DMA_DRM format

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
This commit is contained in:
He Junyan 2023-07-10 17:44:40 +08:00 committed by GStreamer Marge Bot
parent 8b38614173
commit e14d4e08c1
4 changed files with 57 additions and 22 deletions

View file

@ -85,6 +85,9 @@ check_pad_template (GstPadTemplate * tmpl)
gst_caps_unref (caps); gst_caps_unref (caps);
for (i = 2; i < num_formats; ++i) { for (i = 2; i < num_formats; ++i) {
if (i == GST_VIDEO_FORMAT_DMA_DRM)
continue;
if (!formats_supported[i]) { if (!formats_supported[i]) {
g_error ("videoconvert doesn't support format '%s'", g_error ("videoconvert doesn't support format '%s'",
gst_video_format_to_string ((GstVideoFormat) i)); gst_video_format_to_string ((GstVideoFormat) i));

View file

@ -131,6 +131,7 @@ check_pad_template (GstPadTemplate * tmpl)
case GST_VIDEO_FORMAT_NV12_8L128: case GST_VIDEO_FORMAT_NV12_8L128:
case GST_VIDEO_FORMAT_NV12_10BE_8L128: case GST_VIDEO_FORMAT_NV12_10BE_8L128:
case GST_VIDEO_FORMAT_NV12_10LE40_4L4: case GST_VIDEO_FORMAT_NV12_10LE40_4L4:
case GST_VIDEO_FORMAT_DMA_DRM:
GST_LOG ("Ignoring lack of support for format %s", fmt_str); GST_LOG ("Ignoring lack of support for format %s", fmt_str);
break; break;
default: default:

View file

@ -402,8 +402,8 @@ GST_START_TEST (test_video_formats_all)
fail_if (gst_video_format_from_string (fmt_str) == fail_if (gst_video_format_from_string (fmt_str) ==
GST_VIDEO_FORMAT_UNKNOWN); GST_VIDEO_FORMAT_UNKNOWN);
} }
/* Take into account GST_VIDEO_FORMAT_ENCODED and UNKNOWN */ /* Take into account GST_VIDEO_FORMAT_ENCODED, UNKNOWN and DMA_DRM. */
fail_unless_equals_int (num, num_formats - 2); fail_unless_equals_int (num, num_formats - 3);
gst_caps_unref (caps); gst_caps_unref (caps);
} }
@ -428,6 +428,9 @@ GST_START_TEST (test_video_formats_pack_unpack)
gsize vsize, unpack_size; gsize vsize, unpack_size;
guint p; guint p;
if (n == GST_VIDEO_FORMAT_DMA_DRM)
continue;
GST_INFO ("testing %s", gst_video_format_to_string (fmt)); GST_INFO ("testing %s", gst_video_format_to_string (fmt));
vfinfo = gst_video_format_get_info (fmt); vfinfo = gst_video_format_get_info (fmt);
@ -2198,6 +2201,9 @@ GST_START_TEST (test_video_pack_unpack2)
gdouble unpack_sec, pack_sec; gdouble unpack_sec, pack_sec;
ConvertResult res; ConvertResult res;
if (format == GST_VIDEO_FORMAT_DMA_DRM)
continue;
finfo = gst_video_format_get_info (format); finfo = gst_video_format_get_info (format);
fail_unless (finfo != NULL); fail_unless (finfo != NULL);
@ -2531,6 +2537,9 @@ run_video_color_convert (ColorType in_type, ColorType out_type)
GstVideoFrame inframe; GstVideoFrame inframe;
GstBuffer *inbuffer; GstBuffer *inbuffer;
if (infmt == GST_VIDEO_FORMAT_DMA_DRM)
continue;
if (!check_video_format_is_type (infmt, in_type)) if (!check_video_format_is_type (infmt, in_type))
continue; continue;
@ -2545,6 +2554,9 @@ run_video_color_convert (ColorType in_type, ColorType out_type)
GstBuffer *outbuffer; GstBuffer *outbuffer;
GstVideoConverter *convert; GstVideoConverter *convert;
if (outfmt == GST_VIDEO_FORMAT_DMA_DRM)
continue;
if (!check_video_format_is_type (outfmt, out_type)) if (!check_video_format_is_type (outfmt, out_type))
continue; continue;
@ -2638,6 +2650,9 @@ GST_START_TEST (test_video_size_convert)
gint count, method; gint count, method;
ConvertResult res; ConvertResult res;
if (infmt == GST_VIDEO_FORMAT_DMA_DRM)
continue;
fail_unless (gst_video_info_set_format (&ininfo, infmt, WIDTH_IN, fail_unless (gst_video_info_set_format (&ininfo, infmt, WIDTH_IN,
HEIGHT_IN)); HEIGHT_IN));
inbuffer = gst_buffer_new_and_alloc (ininfo.size); inbuffer = gst_buffer_new_and_alloc (ininfo.size);
@ -3217,7 +3232,8 @@ GST_START_TEST (test_video_formats_pstrides)
|| fmt == GST_VIDEO_FORMAT_Y410 || fmt == GST_VIDEO_FORMAT_Y410
|| fmt == GST_VIDEO_FORMAT_NV12_8L128 || fmt == GST_VIDEO_FORMAT_NV12_8L128
|| fmt == GST_VIDEO_FORMAT_NV12_10BE_8L128 || fmt == GST_VIDEO_FORMAT_NV12_10BE_8L128
|| fmt == GST_VIDEO_FORMAT_NV12_10LE40_4L4) { || fmt == GST_VIDEO_FORMAT_NV12_10LE40_4L4
|| fmt == GST_VIDEO_FORMAT_DMA_DRM) {
fmt++; fmt++;
continue; continue;
} }
@ -4120,11 +4136,12 @@ GST_START_TEST (test_info_dma_drm)
const char *dma_str = "video/x-raw(memory:DMABuf), format=NV12, width=16, " const char *dma_str = "video/x-raw(memory:DMABuf), format=NV12, width=16, "
"height=16"; "height=16";
const char *drm_str = "video/x-raw(memory:DMABuf), width=16, height=16, " const char *drm_str = "video/x-raw(memory:DMABuf), width=16, height=16, "
"drm-format=NV12:0x100000000000002"; "format=DMA_DRM, drm-format=NV12:0x100000000000002";
const char *invaliddrm_str = "video/x-raw(memory:DMABuf), width=16, " const char *invaliddrm_str = "video/x-raw(memory:DMABuf), width=16, "
"height=16, drm-format=ZZZZ:0xRGCSEz9ew80"; "height=16, format=DMA_DRM, drm-format=ZZZZ:0xRGCSEz9ew80";
GstCaps *caps, *ncaps; GstCaps *caps, *ncaps;
GstVideoInfoDmaDrm info; GstVideoInfo info;
GstVideoInfoDmaDrm drm_info;
GstVideoInfo vinfo; GstVideoInfo vinfo;
caps = gst_caps_from_string (nondma_str); caps = gst_caps_from_string (nondma_str);
@ -4132,41 +4149,49 @@ GST_START_TEST (test_info_dma_drm)
gst_caps_unref (caps); gst_caps_unref (caps);
caps = gst_caps_from_string (dma_str); caps = gst_caps_from_string (dma_str);
fail_if (gst_video_info_dma_drm_from_caps (&info, caps)); fail_if (gst_video_info_dma_drm_from_caps (&drm_info, caps));
gst_caps_unref (caps); gst_caps_unref (caps);
caps = gst_caps_from_string (drm_str); caps = gst_caps_from_string (drm_str);
fail_unless (gst_video_info_dma_drm_from_caps (&info, caps)); fail_unless (gst_video_info_from_caps (&info, caps));
fail_unless (info.drm_fourcc == 0x3231564e fail_unless (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_DMA_DRM);
&& info.drm_modifier == 0x100000000000002); fail_unless (gst_video_info_dma_drm_from_caps (&drm_info, caps));
ncaps = gst_video_info_dma_drm_to_caps (&info); fail_unless (drm_info.drm_fourcc == 0x3231564e
&& drm_info.drm_modifier == 0x100000000000002);
fail_unless (gst_video_info_dma_drm_to_video_info (&drm_info, &info));
fail_unless (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_NV12);
ncaps = gst_video_info_dma_drm_to_caps (&drm_info);
fail_unless (ncaps); fail_unless (ncaps);
fail_if (gst_caps_is_equal (caps, ncaps)); fail_if (gst_caps_is_equal (caps, ncaps));
gst_caps_unref (caps); gst_caps_unref (caps);
gst_caps_unref (ncaps); gst_caps_unref (ncaps);
caps = gst_caps_from_string (invaliddrm_str); caps = gst_caps_from_string (invaliddrm_str);
fail_if (gst_video_info_dma_drm_from_caps (&info, caps)); fail_if (gst_video_info_dma_drm_from_caps (&drm_info, caps));
gst_caps_unref (caps); gst_caps_unref (caps);
fail_unless (gst_video_info_set_format (&vinfo, GST_VIDEO_FORMAT_NV12, 16, fail_unless (gst_video_info_set_format (&vinfo,
16)); GST_VIDEO_FORMAT_NV12, 16, 16));
info.vinfo = vinfo; drm_info.vinfo = vinfo;
info.drm_fourcc = 0x3231564e; drm_info.drm_fourcc = 0x3231564e;
info.drm_modifier = 0x100000000000002; drm_info.drm_modifier = 0x100000000000002;
ncaps = gst_video_info_dma_drm_to_caps (&info); ncaps = gst_video_info_dma_drm_to_caps (&drm_info);
fail_unless (ncaps); fail_unless (ncaps);
caps = gst_caps_from_string (drm_str); caps = gst_caps_from_string (drm_str);
fail_if (gst_caps_is_equal (caps, ncaps)); fail_if (gst_caps_is_equal (caps, ncaps));
gst_caps_unref (caps); gst_caps_unref (caps);
gst_caps_unref (ncaps); gst_caps_unref (ncaps);
fail_unless (gst_video_info_dma_drm_from_video_info (&info, &vinfo, 0)); fail_unless (gst_video_info_dma_drm_from_video_info (&drm_info, &vinfo, 0));
fail_unless (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_NV12); fail_unless (GST_VIDEO_INFO_FORMAT (&drm_info.vinfo) ==
GST_VIDEO_FORMAT_NV12);
fail_unless (gst_video_info_dma_drm_from_video_info (&info, &vinfo, fail_unless (gst_video_info_dma_drm_from_video_info (&drm_info, &vinfo,
0x100000000000002)); 0x100000000000002));
fail_unless (GST_VIDEO_INFO_FORMAT (&info.vinfo) == GST_VIDEO_FORMAT_ENCODED); fail_unless (GST_VIDEO_INFO_FORMAT (&drm_info.vinfo) ==
GST_VIDEO_FORMAT_DMA_DRM);
} }
GST_END_TEST; GST_END_TEST;

View file

@ -59,6 +59,9 @@ do_benchmark_conversions (guint width, guint height, const gchar * in_format,
GstVideoFrame inframe; GstVideoFrame inframe;
GstBuffer *inbuffer; GstBuffer *inbuffer;
if (infmt == GST_VIDEO_FORMAT_DMA_DRM)
continue;
infmt_str = gst_video_format_to_string (infmt); infmt_str = gst_video_format_to_string (infmt);
if (in_format != NULL && !g_str_equal (in_format, infmt_str)) if (in_format != NULL && !g_str_equal (in_format, infmt_str))
continue; continue;
@ -76,6 +79,9 @@ do_benchmark_conversions (guint width, guint height, const gchar * in_format,
gdouble elapsed, convert_sec; gdouble elapsed, convert_sec;
gint count; gint count;
if (outfmt == GST_VIDEO_FORMAT_DMA_DRM)
continue;
outfmt_str = gst_video_format_to_string (outfmt); outfmt_str = gst_video_format_to_string (outfmt);
if (out_format != NULL && !g_str_equal (out_format, outfmt_str)) if (out_format != NULL && !g_str_equal (out_format, outfmt_str))
continue; continue;