From d21c6598eff91f6ff739e340f708b13a566f9b57 Mon Sep 17 00:00:00 2001 From: Grigory Kletsko Date: Wed, 2 Nov 2016 17:42:27 +0300 Subject: patch to gst to add export of DMA fd of input port This patch adds h264 decode plugin using DMA for gstreamer. This plugin is supposed to be used to encode video data for CES2017 cluster demo. Change-Id: I19e3595aac8943ce3f348764aca66d2b4132cf28 Signed-off-by: Grigory Kletsko --- ...deodec-add-planebuf-to-allocation-request.patch | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch (limited to 'meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch') diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch new file mode 100644 index 0000000..d863414 --- /dev/null +++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch @@ -0,0 +1,85 @@ +diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c +index c5b69ab..647ac88 100644 +--- a/omx/gstomxvideodec.c ++++ b/omx/gstomxvideodec.c +@@ -581,7 +581,7 @@ gst_omx_buffer_pool_free_buffer (GstBufferPool * bpool, GstBuffer * buffer) + #ifdef HAVE_MMNGRBUF + static GstBuffer * + gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool, +- gint dmabuf_fd[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES]) ++ gint dmabuf_fd[GST_VIDEO_MAX_PLANES], gpointer plane_buf[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES]) + { + GstQuery *query; + GValue val = { 0, }; +@@ -590,6 +590,7 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool, + GstBuffer *buffer; + GArray *dmabuf_array; + GArray *stride_array; ++ GArray *planebuf_array; + gint n_planes; + gint i; + +@@ -598,11 +599,13 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool, + + dmabuf_array = g_array_new (FALSE, FALSE, sizeof (gint)); + stride_array = g_array_new (FALSE, FALSE, sizeof (gint)); ++ planebuf_array = g_array_new (FALSE, FALSE, sizeof (gpointer)); + + n_planes = GST_VIDEO_INFO_N_PLANES (&pool->video_info); + for (i = 0; i < n_planes; i++) { + g_array_append_val (dmabuf_array, dmabuf_fd[i]); + g_array_append_val (stride_array, stride[i]); ++ g_array_append_val (planebuf_array, plane_buf[i]); + } + + structure = gst_structure_new ("videosink_buffer_creation_request", +@@ -610,6 +613,7 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool, + "height", G_TYPE_INT, pool->port->port_def.format.video.nFrameHeight, + "stride", G_TYPE_ARRAY, stride_array, + "dmabuf", G_TYPE_ARRAY, dmabuf_array, ++ "planebuf", G_TYPE_ARRAY, planebuf_array, + "allocator", G_TYPE_POINTER, &val, + "format", G_TYPE_STRING, + gst_video_format_to_string (pool->video_info.finfo->format), +@@ -704,6 +708,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool, + gint i; + gint dmabuf_fd[GST_VIDEO_MAX_PLANES]; + gint plane_size[GST_VIDEO_MAX_PLANES]; ++ gpointer plane_buf[GST_VIDEO_MAX_PLANES]; + guint phys_addr; + OMXR_MC_VIDEO_DECODERESULTTYPE *decode_res = + (OMXR_MC_VIDEO_DECODERESULTTYPE *) omx_buf-> +@@ -730,6 +735,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool, + + plane_size[0] = vmeta->stride[0] * + GST_VIDEO_INFO_COMP_HEIGHT (&pool->video_info, 0); ++ plane_buf[0] = omx_buf->omx_buf->pBuffer; + + /* Export dmabuf file descriptors from second and subsequent planes */ + n_planes = GST_VIDEO_INFO_N_PLANES (&pool->video_info); +@@ -737,6 +743,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool, + phys_addr = (guint) decode_res->pvPhysImageAddressY + vmeta->offset[i]; + plane_size[i] = vmeta->stride[i] * + GST_VIDEO_INFO_COMP_HEIGHT (&pool->video_info, i); ++ plane_buf[i] = omx_buf->omx_buf->pBuffer + vmeta->offset[i]; + + if (!gst_omx_buffer_pool_export_dmabuf (pool, phys_addr, plane_size[i], + page_size, &vdbuf_data->id_export[i], &dmabuf_fd[i])) { +@@ -747,7 +754,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool, + + if (pool->vsink_buf_req_supported) + new_buf = gst_omx_buffer_pool_request_videosink_buffer_creation (pool, +- dmabuf_fd, vmeta->stride); ++ dmabuf_fd, plane_buf, vmeta->stride); + else { + GstVideoMeta *new_meta; + +@@ -1947,6 +1954,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self) + goto caps_failed; + } + ++ /* ...force clearing of reconfiguration flag to prevent subsequent buffers allocation */ ++ gst_pad_check_reconfigure(GST_VIDEO_DECODER_SRC_PAD(self)); + gst_video_codec_state_unref (state); + + GST_VIDEO_DECODER_STREAM_UNLOCK (self); -- cgit 1.2.3-korg