AnsweredAssumed Answered

How connect playbin + deinterlace  + DMA .  Processor overloading

Question asked by Ignat Ivanov on Feb 28, 2019
Latest reply on Mar 1, 2019 by Ignat Ivanov

Hi all!

I have big trouble with interaliasing in gstreamer pipeline

That pipeline 

 gst-launch-1.0 playbin flags=0x00000207 uri=dvd:// video-sink="imxeglvivsink"

create overload of proccessor IMX because that code constantly copy data with help CPU  from interaliasing buffers in gstreamer-imx-master/src/eglvivsink/gles2_renderer.c

GST_LOG("copying pixels into VIV direct texture buffer");

If i launch that pipeline my cpu load very low (5-10 %) load because i use DMA but frames is not deinterlaced:

gst-launch-1.0 playbin flags=0x00000007 uri=dvd:// video-sink="imxeglvivsink"

Quesiton : how enable DMA with deinterlace in gstreamer?

Thanks .

I am repeating gles2_renderer.c  piece code: 

if (is_phys_buf)
{
GLvoid *virt_addr;
GLuint phys_addr;

phys_addr = (GLuint)(phys_mem_meta->phys_addr);

/* Safeguard to catch data loss if in any future i.MX version the types do not match */
g_assert(((gst_imx_phys_addr_t)(phys_addr)) == phys_mem_meta->phys_addr);

GST_LOG("mapping physical address %" GST_IMX_PHYS_ADDR_FORMAT " of video frame in buffer %p into VIV texture", phys_mem_meta->phys_addr, (gpointer)buffer);

gst_buffer_map(buffer, &map_info, GST_MAP_READ);
virt_addr = map_info.data;

/* Just set to make sure the == NULL check above is false */
renderer->viv_planes[0] = virt_addr;

glTexDirectVIVMap(
GL_TEXTURE_2D,
total_w, total_h,
gl_format,
(GLvoid **)(&virt_addr), &phys_addr
);

gst_buffer_unmap(buffer, &map_info);
GST_LOG("done showing frame in buffer %p with virtual address %p physical address %" GST_IMX_PHYS_ADDR_FORMAT, (gpointer)buffer, virt_addr, phys_mem_meta->phys_addr);

if (!gst_imx_egl_viv_sink_gles2_renderer_check_gl_error("render", "glTexDirectVIVMap"))
return FALSE;
}
else
{
glTexDirectVIV(
GL_TEXTURE_2D,
total_w, total_h,
gl_format,
(GLvoid **) &(renderer->viv_planes)
);
if (!gst_imx_egl_viv_sink_gles2_renderer_check_gl_error("render", "glTexDirectVIV"))
return FALSE;

GST_LOG("copying pixels into VIV direct texture buffer");

gst_buffer_map(buffer, &map_info, GST_MAP_READ);
switch (fmt)
{
case GST_VIDEO_FORMAT_I420:
case GST_VIDEO_FORMAT_YV12:
memcpy(renderer->viv_planes[0], map_info.data + offset[0], stride[0] * total_h);
memcpy(renderer->viv_planes[1], map_info.data + offset[1], stride[1] * total_h / 2);
memcpy(renderer->viv_planes[2], map_info.data + offset[2], stride[2] * total_h / 2);
break;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
memcpy(renderer->viv_planes[0], map_info.data + offset[0], stride[0] * total_h);
memcpy(renderer->viv_planes[1], map_info.data + offset[1], stride[1] * total_h / 2);
break;
default:
memcpy(renderer->viv_planes[0], map_info.data, stride[0] * total_h);
}
gst_buffer_unmap(buffer, &map_info);

}

Outcomes