mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
tests: va: fix vapostproc test for DMABuf
Now it picks the first format in the template srcpad list and do the convertion. Also the format size is reduced because not all drives support 4K as DMABuf (radeonsi). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7654>
This commit is contained in:
parent
8be82ad9e5
commit
b4b06cd6f0
1 changed files with 57 additions and 2 deletions
|
@ -62,18 +62,73 @@ GST_START_TEST (raw_copy)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
static GstCaps *
|
||||||
|
get_drmdma_format (void)
|
||||||
|
{
|
||||||
|
GstElement *vpp;
|
||||||
|
GstCaps *templ, *allowed_caps, *drm_caps = NULL;
|
||||||
|
GstPad *srcpad;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
vpp = gst_element_factory_make ("vapostproc", NULL);
|
||||||
|
if (!vpp)
|
||||||
|
return NULL;
|
||||||
|
srcpad = gst_element_get_static_pad (vpp, "src");
|
||||||
|
fail_unless (srcpad != NULL);
|
||||||
|
templ = gst_pad_get_pad_template_caps (srcpad);
|
||||||
|
fail_unless (templ != NULL);
|
||||||
|
|
||||||
|
allowed_caps = gst_caps_normalize (templ);
|
||||||
|
|
||||||
|
for (i = 0; i < gst_caps_get_size (allowed_caps); ++i) {
|
||||||
|
GstStructure *new_structure;
|
||||||
|
GstStructure *structure;
|
||||||
|
|
||||||
|
/* non-dmabuf caps don't describe drm-format: skip them */
|
||||||
|
structure = gst_caps_get_structure (allowed_caps, i);
|
||||||
|
if (!gst_structure_has_field (structure, "drm-format"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
drm_caps = gst_caps_new_empty ();
|
||||||
|
new_structure = gst_structure_copy (structure);
|
||||||
|
gst_structure_set (new_structure, "framerate", GST_TYPE_FRACTION,
|
||||||
|
1, 1, NULL);
|
||||||
|
gst_structure_remove_field (new_structure, "width");
|
||||||
|
gst_structure_remove_field (new_structure, "height");
|
||||||
|
gst_caps_append_structure (drm_caps, new_structure);
|
||||||
|
gst_caps_set_features_simple (drm_caps,
|
||||||
|
gst_caps_features_new_single ("memory:DMABuf"));
|
||||||
|
|
||||||
|
GST_DEBUG ("have caps %" GST_PTR_FORMAT, drm_caps);
|
||||||
|
/* should be fixed without width/height */
|
||||||
|
fail_unless (gst_caps_is_fixed (drm_caps));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (allowed_caps);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
gst_object_unref (vpp);
|
||||||
|
|
||||||
|
return drm_caps;
|
||||||
|
}
|
||||||
|
|
||||||
GST_START_TEST (dmabuf_copy)
|
GST_START_TEST (dmabuf_copy)
|
||||||
{
|
{
|
||||||
GstHarness *h;
|
GstHarness *h;
|
||||||
GstBuffer *buf, *buf_copy;
|
GstBuffer *buf, *buf_copy;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
GstCaps *drm_caps;
|
||||||
|
|
||||||
h = gst_harness_new_parse ("videotestsrc num-buffers=1 ! "
|
h = gst_harness_new_parse ("videotestsrc num-buffers=1 ! "
|
||||||
"video/x-raw, width=(int)1024, height=(int)768 ! vapostproc");
|
"video/x-raw, width=(int)1024, height=(int)768 ! vapostproc");
|
||||||
ck_assert (h);
|
ck_assert (h);
|
||||||
|
|
||||||
gst_harness_set_sink_caps_str (h,
|
drm_caps = get_drmdma_format ();
|
||||||
"video/x-raw(memory:DMABuf), format=(string)NV12, width=(int)3840, height=(int)2160");
|
ck_assert (drm_caps);
|
||||||
|
gst_caps_set_simple (drm_caps, "width", G_TYPE_INT, 1600, "height",
|
||||||
|
G_TYPE_INT, 1200, NULL);
|
||||||
|
|
||||||
|
gst_harness_set_sink_caps (h, drm_caps);
|
||||||
|
|
||||||
gst_harness_add_propose_allocation_meta (h, GST_VIDEO_META_API_TYPE, NULL);
|
gst_harness_add_propose_allocation_meta (h, GST_VIDEO_META_API_TYPE, NULL);
|
||||||
gst_harness_play (h);
|
gst_harness_play (h);
|
||||||
|
|
Loading…
Reference in a new issue