aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/ti
diff options
context:
space:
mode:
authorBrijesh Singh <bksingh@ti.com>2010-10-09 11:33:10 -0500
committerKoen Kooi <koen@openembedded.org>2010-10-13 10:34:24 +0200
commit3a16dfae68bff765460d64fb878c575fcceb1340 (patch)
treec4e01fb03d4997e2277a8649e412220f5ad4b42c /recipes/ti
parent9936414a48d40a1d7c4a7ad84ff48c7e7f3eef87 (diff)
downloadopenembedded-3a16dfae68bff765460d64fb878c575fcceb1340.tar.gz
gstreamer-ti_svn: various updates
* apply patch from tracker 1208 to get zero copy support on DM365 platform. * enable c6accel based element on omap3 platforms. * update dm365 loadmodules to reserve ARM TCM need by platinum codecs. * add loadmodule for omapl138. Signed-off-by: Brijesh Singh <bksingh@ti.com> Signed-off-by: Koen Kooi <k-kooi@ti.com>
Diffstat (limited to 'recipes/ti')
-rw-r--r--recipes/ti/gstreamer-ti.inc6
-rw-r--r--recipes/ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch86
-rw-r--r--recipes/ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch73
-rw-r--r--recipes/ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch33
-rw-r--r--recipes/ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch132
-rw-r--r--recipes/ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch313
-rw-r--r--recipes/ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch302
-rw-r--r--recipes/ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch26
-rw-r--r--recipes/ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch26
-rw-r--r--recipes/ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch119
-rw-r--r--recipes/ti/gstreamer-ti/dm365-evm/loadmodules.sh28
-rw-r--r--recipes/ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh16
-rw-r--r--recipes/ti/gstreamer-ti_svn.bb15
13 files changed, 1162 insertions, 13 deletions
diff --git a/recipes/ti/gstreamer-ti.inc b/recipes/ti/gstreamer-ti.inc
index e18816c387..ee45194f64 100644
--- a/recipes/ti/gstreamer-ti.inc
+++ b/recipes/ti/gstreamer-ti.inc
@@ -15,13 +15,15 @@ require ti-paths.inc
require ti-staging.inc
# Rebuild on kernel change since it links statically to ti-dmai, ti-codec-engine, etc
-PR = "r75+${MACHINE_KERNEL_PR}"
+PR = "r79+${MACHINE_KERNEL_PR}"
DEPENDS = "ti-dmai gstreamer gst-plugins-base"
-# enable c6accel elements on omapl138
+# enable c6accel elements on omapl138 and omap3
DEPENDS_append_omapl138 = " ti-c6accel "
EXTRA_OECONF_omapl138 = "--enable-c6accel"
+DEPENDS_append_omap3 = " ti-c6accel "
+EXTRA_OECONF_omap3 = "--enable-c6accel"
export C6ACCEL_INSTALL_DIR
# gstreamer_ti picks up some config variables from the environment
diff --git a/recipes/ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch b/recipes/ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch
new file mode 100644
index 0000000000..eb7181be64
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch
@@ -0,0 +1,86 @@
+From fb4dabcac144fcf1a7e9b1eba0114b2eed594d05 Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Thu, 26 Aug 2010 11:12:39 -0500
+Subject: [PATCH 3/8] Support setting the display framerate directly when possible.
+
+If can_set_display_framerate is set to true, TIDmaiVideoSink will attempt to
+set the display framerate directly in DMAI, instead of trying to simulate the
+desired framerate by occasionally repeating frames.
+
+Platforms that support this will need to enable it explicitly.
+---
+ .../ticodecplugin/src/gsttidmaivideosink.c | 24 ++++++++++++++++++++
+ .../ticodecplugin/src/gsttidmaivideosink.h | 1 +
+ 2 files changed, 25 insertions(+), 0 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+index c87b89c..4e327ae 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+@@ -442,6 +442,7 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
+ dmaisink->numBufs = -1;
+ dmaisink->framerepeat = 0;
+ dmaisink->repeat_with_refresh = FALSE;
++ dmaisink->can_set_display_framerate = FALSE;
+ dmaisink->rotation = -1;
+ dmaisink->tempDmaiBuf = NULL;
+ dmaisink->accelFrameCopy = TRUE;
+@@ -952,6 +953,9 @@ static void gst_tidmaivideosink_check_set_framerate(GstTIDmaiVideoSink * sink)
+ * then 1 is returned to indicate that there will be no frame
+ * repeating.
+ *
++ * If the driver supports explicit configuration of the framerate, we
++ * don't ever need to repeat frames, and 1 is returned.
++ *
+ ******************************************************************************/
+ static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
+ {
+@@ -959,6 +963,13 @@ static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
+
+ GST_DEBUG("Begin\n");
+
++ /* If the display allows you to configure the frame rate, we never need
++ * to repeat a frame.
++ */
++ if (sink->can_set_display_framerate) {
++ return 1;
++ }
++
+ /* Divide the native framerate by the desired framerate. If the result
+ * is a whole number, return it. Otherwise return 1 -- we don't support
+ * fractional repeat rates. */
+@@ -1151,6 +1162,19 @@ static gboolean gst_tidmaivideosink_set_display_attrs(GstTIDmaiVideoSink *sink,
+ sink->dAttrs.displayDevice = sink->displayDevice == NULL ?
+ sink->dAttrs.displayDevice : sink->displayDevice;
+
++ /* Specify framerate if supported by DMAI and the display driver */
++ if (sink->can_set_display_framerate) {
++ #if defined (Platform_dm365)
++ sink->dAttrs.forceFrameRateNum =
++ gst_value_get_fraction_numerator(&sink->iattrs.framerate);
++ sink->dAttrs.forceFrameRateDen =
++ gst_value_get_fraction_denominator(&sink->iattrs.framerate);
++ #else
++ GST_ERROR("setting driver framerate is not supported\n");
++ return FALSE;
++ #endif
++ }
++
+ /* Set rotation on OMAP35xx */
+ if (sink->cpu_dev == Cpu_Device_OMAP3530) {
+ sink->dAttrs.rotation = sink->rotation == -1 ?
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
+index 5d13e08..4800fcd 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
+@@ -124,6 +124,7 @@ struct _GstTIDmaiVideoSink {
+ */
+ int framerepeat;
+ gboolean repeat_with_refresh;
++ gboolean can_set_display_framerate;
+ gboolean signal_handoffs;
+
+ /* Hardware accelerated copy */
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch b/recipes/ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch
new file mode 100644
index 0000000000..229c452123
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch
@@ -0,0 +1,73 @@
+From 03ab3ad3f790dde2dbddfeb62001e8610dbb919a Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Thu, 26 Aug 2010 18:25:56 -0500
+Subject: [PATCH 4/8] Cosmetic cleanup / clarify some comments.
+
+---
+ .../ticodecplugin/src/gsttidmaivideosink.c | 42 ++++++++-----------
+ 1 files changed, 18 insertions(+), 24 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+index 4e327ae..1d04e1c 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+@@ -434,23 +434,23 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
+ * Anything that has a NULL value will be initialized with DMAI defaults
+ * in the gst_tidmaivideosink_init_display function.
+ */
+- dmaisink->displayStd = NULL;
+- dmaisink->displayDevice = NULL;
+- dmaisink->dGfxAttrs = defaultGfxAttrs;
+- dmaisink->videoStd = NULL;
+- dmaisink->videoOutput = NULL;
+- dmaisink->numBufs = -1;
+- dmaisink->framerepeat = 0;
+- dmaisink->repeat_with_refresh = FALSE;
++ dmaisink->displayStd = NULL;
++ dmaisink->displayDevice = NULL;
++ dmaisink->dGfxAttrs = defaultGfxAttrs;
++ dmaisink->videoStd = NULL;
++ dmaisink->videoOutput = NULL;
++ dmaisink->numBufs = -1;
++ dmaisink->framerepeat = 0;
++ dmaisink->repeat_with_refresh = FALSE;
+ dmaisink->can_set_display_framerate = FALSE;
+- dmaisink->rotation = -1;
+- dmaisink->tempDmaiBuf = NULL;
+- dmaisink->accelFrameCopy = TRUE;
+- dmaisink->autoselect = FALSE;
+- dmaisink->prevVideoStd = 0;
+- dmaisink->useUserptrBufs = FALSE;
+- dmaisink->hideOSD = FALSE;
+- dmaisink->hDispBufTab = NULL;
++ dmaisink->rotation = -1;
++ dmaisink->tempDmaiBuf = NULL;
++ dmaisink->accelFrameCopy = TRUE;
++ dmaisink->autoselect = FALSE;
++ dmaisink->prevVideoStd = 0;
++ dmaisink->useUserptrBufs = FALSE;
++ dmaisink->hideOSD = FALSE;
++ dmaisink->hDispBufTab = NULL;
+
+ dmaisink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
+
+@@ -947,14 +947,8 @@ static void gst_tidmaivideosink_check_set_framerate(GstTIDmaiVideoSink * sink)
+ /******************************************************************************
+ * gst_tidmaivideosink_get_framerepeat
+ *
+- * This function will look at the output display frame rate and the
+- * input frame rate and determine how many times a frame should be
+- * repeated. If the output is not an integer multiple of the input
+- * then 1 is returned to indicate that there will be no frame
+- * repeating.
+- *
+- * If the driver supports explicit configuration of the framerate, we
+- * don't ever need to repeat frames, and 1 is returned.
++ * Return how many times a frame should be repeated to support a
++ * framerate lower than the display's native speed.
+ *
+ ******************************************************************************/
+ static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch b/recipes/ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch
new file mode 100644
index 0000000000..e40595771f
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch
@@ -0,0 +1,33 @@
+From 1cffa12c9ceb07558d2e4b35cc674070c7a3b8ee Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Thu, 26 Aug 2010 18:27:50 -0500
+Subject: [PATCH 5/8] Enable setting the framerate directly on DM365.
+
+This is supported by recent changes to the display driver. DM365 will no
+longer use the "repeat_with_refresh" method to display frames more than once.
+---
+ .../ticodecplugin/src/gsttidmaivideosink.c | 7 ++-----
+ 1 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+index 1d04e1c..3615bfd 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+@@ -475,12 +475,9 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
+ g_assert(GST_VALUE_HOLDS_FRACTION(&dmaisink->oattrs.framerate));
+ gst_value_set_fraction(&dmaisink->oattrs.framerate, 0, 1);
+
+- /* On DM365, we don't have the bandwidth to copy a frame multiple times to
+- * display them more than once. We must put a frame to the display once
+- * and let it be refreshed multiple times.
+- */
++ /* DM365 supports setting the display framerate */
+ #if defined(Platform_dm365)
+- dmaisink->repeat_with_refresh = TRUE;
++ dmaisink->can_set_display_framerate = TRUE;
+ #endif
+
+ gst_tidmaivideosink_init_env(dmaisink);
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch b/recipes/ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch
new file mode 100644
index 0000000000..4055d0b5ac
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch
@@ -0,0 +1,132 @@
+From c1205a792fd519cdebc32c00a5f604ccd78d3eac Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Thu, 26 Aug 2010 18:30:13 -0500
+Subject: [PATCH 6/8] Remove the "repeat_with_refresh" feature.
+
+No platforms are using it any longer.
+---
+ .../ticodecplugin/src/gsttidmaivideosink.c | 67 +-------------------
+ .../ticodecplugin/src/gsttidmaivideosink.h | 1 -
+ 2 files changed, 1 insertions(+), 67 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+index 3615bfd..0125ed2 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+@@ -170,8 +170,6 @@ static gboolean
+ gst_tidmaivideosink_event(GstBaseSink * bsink, GstEvent * event);
+ static void
+ gst_tidmaivideosink_init_env(GstTIDmaiVideoSink *sink);
+-static int
+- gst_tidmaivideosink_videostd_get_refresh_latency(VideoStd_Type videoStd);
+ static gboolean
+ gst_tidmaivideosink_alloc_display_buffers(GstTIDmaiVideoSink * sink,
+ Int32 bufSize);
+@@ -441,7 +439,6 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
+ dmaisink->videoOutput = NULL;
+ dmaisink->numBufs = -1;
+ dmaisink->framerepeat = 0;
+- dmaisink->repeat_with_refresh = FALSE;
+ dmaisink->can_set_display_framerate = FALSE;
+ dmaisink->rotation = -1;
+ dmaisink->tempDmaiBuf = NULL;
+@@ -755,55 +752,6 @@ static int gst_tidmaivideosink_videostd_get_attrs(VideoStd_Type videoStd,
+
+
+ /*******************************************************************************
+- * gst_tidmaivideosink_videostd_get_refresh_latency
+- *
+- * Return the refresh latency in us for the given display standard.
+-*******************************************************************************/
+-static int gst_tidmaivideosink_videostd_get_refresh_latency(
+- VideoStd_Type videoStd)
+-{
+- switch (videoStd) {
+- case VideoStd_1080P_24:
+- return 41667;
+-
+- case VideoStd_SIF_PAL:
+- case VideoStd_D1_PAL:
+- case VideoStd_1080P_25:
+- case VideoStd_1080I_25:
+- return 40000;
+-
+- case VideoStd_CIF:
+- case VideoStd_SIF_NTSC:
+- case VideoStd_D1_NTSC:
+- return 33367;
+-
+- case VideoStd_1080I_30:
+- case VideoStd_1080P_30:
+- return 33333;
+-
+- case VideoStd_576P:
+- case VideoStd_720P_50:
+- return 20000;
+-
+- case VideoStd_480P:
+- case VideoStd_720P_60:
+- #if defined(Platform_dm6467t)
+- case VideoStd_1080P_60:
+- #endif
+- return 16667;
+-
+- case VideoStd_VGA:
+- return 16667;
+-
+- default:
+- break;
+- }
+- GST_ERROR("Unknown videoStd entered (VideoStd = %d)\n", videoStd);
+- return 0;
+-}
+-
+-
+-/*******************************************************************************
+ * gst_tidmaivideosink_find_videostd
+ *
+ * This function will take in a VideoStd_Attrs structure and find the
+@@ -1580,10 +1528,7 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
+
+ /* Display the frame as many times as specified by framerepeat. By
+ * default, the input buffer is copied to a display buffer for each time
+- * it is to be repeated. However, if repeat_with_refresh is TRUE, then
+- * the platform doesn't have the bandwidth for multiple copies. In this
+- * case we copy and display the input buffer only once, but let it refresh
+- * multiple times.
++ * it is to be repeated.
+ */
+ for (i = 0; i < sink->framerepeat; i++) {
+
+@@ -1594,16 +1539,6 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
+ goto cleanup;
+ }
+
+- /* If repeat_with_refresh was specified, wait for the display to
+- * refresh framerepeat-1 times to make sure it has finished displaying
+- * this buffer before we write new data into it.
+- */
+- while (sink->repeat_with_refresh && i < (sink->framerepeat-1)) {
+- usleep(gst_tidmaivideosink_videostd_get_refresh_latency(
+- sink->dAttrs.videoStd) + 1);
+- i++;
+- }
+-
+ /* Retrieve the dimensions of the display buffer */
+ BufferGfx_getDimensions(hDispBuf, &dim);
+ GST_LOG("Display size %dx%d pitch %d\n",
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
+index 4800fcd..2a28e4f 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
+@@ -123,7 +123,6 @@ struct _GstTIDmaiVideoSink {
+ * should be repeated to match the display output frame rate.
+ */
+ int framerepeat;
+- gboolean repeat_with_refresh;
+ gboolean can_set_display_framerate;
+ gboolean signal_handoffs;
+
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch b/recipes/ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch
new file mode 100644
index 0000000000..863bd34d11
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch
@@ -0,0 +1,313 @@
+From 108fa0bb550f9b7355bfd5ae5340220fd1a4c9b5 Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Thu, 5 Aug 2010 15:09:54 -0500
+Subject: [PATCH 7/8] Add support for pad-allocated buffers in TIDmaiVideoSink.
+
+This feature is currently only tested and enabled for DM365.
+---
+ .../ticodecplugin/src/gsttidmaibuffertransport.c | 4 +-
+ .../ticodecplugin/src/gsttidmaibuffertransport.h | 6 +-
+ .../ticodecplugin/src/gsttidmaivideosink.c | 197 ++++++++++++++++++--
+ 3 files changed, 191 insertions(+), 16 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
+index 5fad371..9c69285 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
+@@ -136,8 +136,8 @@ static void gst_tidmaibuffertransport_finalize(GstBuffer *gstbuffer)
+ */
+ if (Buffer_getBufTab(self->dmaiBuffer) != NULL) {
+ GST_LOG("clearing GStreamer useMask bit\n");
+- Buffer_freeUseMask(self->dmaiBuffer,
+- gst_tidmaibuffer_GST_FREE);
++ Buffer_freeUseMask(self->dmaiBuffer, gst_tidmaibuffer_GST_FREE);
++ Buffer_freeUseMask(self->dmaiBuffer, gst_tidmaibuffer_VIDEOSINK_FREE);
+ } else {
+ GST_LOG("calling Buffer_delete()\n");
+ Buffer_delete(self->dmaiBuffer);
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
+index 0265e70..20945f3 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
+@@ -52,8 +52,10 @@ G_BEGIN_DECLS
+ GstTIDmaiBufferTransportClass))
+
+ /* Use mask flags that keep track of where buffer is in use */
+-#define gst_tidmaibuffer_GST_FREE 0x1
+-#define gst_tidmaibuffer_CODEC_FREE 0x2
++#define gst_tidmaibuffer_GST_FREE 0x1
++#define gst_tidmaibuffer_CODEC_FREE 0x2
++#define gst_tidmaibuffer_VIDEOSINK_FREE 0x4
++#define gst_tidmaibuffer_DISPLAY_FREE 0x8
+
+ typedef struct _GstTIDmaiBufferTransport GstTIDmaiBufferTransport;
+ typedef struct _GstTIDmaiBufferTransportClass GstTIDmaiBufferTransportClass;
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+index 0125ed2..7b84a8e 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
+@@ -151,6 +151,9 @@ static GstStateChangeReturn
+ gst_tidmaivideosink_change_state(GstElement * element,
+ GstStateChange transition);
+ static GstFlowReturn
++ gst_tidmaivideosink_buffer_alloc(GstBaseSink * bsink, guint64 offset,
++ guint size, GstCaps * caps, GstBuffer ** buf);
++static GstFlowReturn
+ gst_tidmaivideosink_preroll(GstBaseSink * bsink, GstBuffer * buffer);
+ static int
+ gst_tidmaivideosink_videostd_get_attrs(VideoStd_Type videoStd,
+@@ -353,6 +356,13 @@ static void gst_tidmaivideosink_class_init(GstTIDmaiVideoSinkClass * klass)
+ GST_DEBUG_FUNCPTR(gst_tidmaivideosink_preroll);
+ gstbase_sink_class->render =
+ GST_DEBUG_FUNCPTR(gst_tidmaivideosink_render);
++ gstbase_sink_class->buffer_alloc =
++ GST_DEBUG_FUNCPTR(gst_tidmaivideosink_buffer_alloc);
++
++ /* Pad-buffer allocation is currently only supported for DM365 */
++ #if !defined(Platform_dm365)
++ gstbase_sink_class->buffer_alloc = NULL;
++ #endif
+ }
+
+
+@@ -663,6 +673,132 @@ static gboolean gst_tidmaivideosink_event(GstBaseSink * bsink,
+
+
+ /******************************************************************************
++ * gst_tidmaivideosink_buffer_alloc
++ ******************************************************************************/
++static GstFlowReturn gst_tidmaivideosink_buffer_alloc(GstBaseSink * bsink,
++ guint64 offset, guint size, GstCaps * caps,
++ GstBuffer ** buf)
++{
++ GstTIDmaiVideoSink *dmaisink = GST_TIDMAIVIDEOSINK(bsink);
++ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
++ gboolean alloc_unref = FALSE;
++ Buffer_Handle hDispBuf = NULL;
++ GstCaps *alloc_caps;
++
++ *buf = NULL;
++
++ GST_LOG_OBJECT(dmaisink,
++ "a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT
++ " and offset %" G_GUINT64_FORMAT, size, caps, offset);
++
++ /* assume we're going to alloc what was requested, keep track of wheter we
++ * need to unref or not. When we suggest a new format upstream we will
++ * create a new caps that we need to unref. */
++ alloc_caps = caps;
++
++ /* Process the buffer caps */
++ if (!gst_tidmaivideosink_process_caps(bsink, alloc_caps)) {
++ return GST_FLOW_UNEXPECTED;
++ }
++
++ /* Pad buffer allocation requires that we use user-allocated display
++ * buffers.
++ */
++ if (!dmaisink->useUserptrBufs && dmaisink->hDisplay) {
++ GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
++ ("Cannot use pad buffer allocation after mmap buffers already "
++ "in use\n"), (NULL));
++ return GST_FLOW_UNEXPECTED;
++ }
++ else {
++ dmaisink->useUserptrBufs = TRUE;
++ }
++
++ /* Allocate the display buffers */
++ if (!dmaisink->hDispBufTab && dmaisink->useUserptrBufs) {
++
++ /* Set the display attributes now so we can allocate display buffers */
++ if (!gst_tidmaivideosink_set_display_attrs(dmaisink,
++ dmaisink->dGfxAttrs.colorSpace)) {
++ GST_ERROR("Error while trying to set the display attributes\n");
++ return GST_FLOW_UNEXPECTED;
++ }
++
++ if (!gst_tidmaivideosink_alloc_display_buffers(dmaisink, size)) {
++ GST_ERROR("Failed to allocate display buffers");
++ return GST_FLOW_UNEXPECTED;
++ }
++ }
++
++ /* Get a buffer from the BufTab or display driver */
++ if (!(hDispBuf = gst_tidmaibuftab_get_buf(dmaisink->hDispBufTab))) {
++ if (dmaisink->hDisplay &&
++ Display_get(dmaisink->hDisplay, &hDispBuf) < 0) {
++ GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
++ ("Failed to get display buffer\n"), (NULL));
++ return GST_FLOW_UNEXPECTED;
++ }
++ }
++
++ /* If the geometry doesn't match, generate a new caps for it */
++ Buffer_getAttrs(hDispBuf, BufferGfx_getBufferAttrs(&gfxAttrs));
++
++ if (gfxAttrs.dim.width != dmaisink->dGfxAttrs.dim.width ||
++ gfxAttrs.dim.height != dmaisink->dGfxAttrs.dim.height ||
++ gfxAttrs.colorSpace != dmaisink->dGfxAttrs.colorSpace) {
++
++ GstCaps *desired_caps;
++ GstStructure *desired_struct;
++
++ /* make a copy of the incomming caps to create the new suggestion. We
++ * can't use make_writable because we might then destroy the original
++ * caps which we still need when the peer does not accept the
++ * suggestion.
++ */
++ desired_caps = gst_caps_copy (caps);
++ desired_struct = gst_caps_get_structure (desired_caps, 0);
++
++ GST_DEBUG ("we prefer to receive a %ldx%ld video; %ldx%ld was requested",
++ gfxAttrs.dim.width, gfxAttrs.dim.height,
++ dmaisink->dGfxAttrs.dim.width, dmaisink->dGfxAttrs.dim.height);
++ gst_structure_set (desired_struct, "width", G_TYPE_INT,
++ gfxAttrs.dim.width, NULL);
++ gst_structure_set (desired_struct, "height", G_TYPE_INT,
++ gfxAttrs.dim.height, NULL);
++
++ if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (dmaisink),
++ desired_caps)) {
++ alloc_caps = desired_caps;
++ alloc_unref = TRUE;
++
++ if (!gst_tidmaivideosink_process_caps(bsink, alloc_caps)) {
++ return GST_FLOW_UNEXPECTED;
++ }
++ GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
++ desired_caps);
++ }
++ else {
++ GST_DEBUG ("peer pad does not accept our desired caps %"
++ GST_PTR_FORMAT, desired_caps);
++ }
++ }
++
++ /* Return the display buffer */
++ BufferGfx_resetDimensions(hDispBuf);
++ Buffer_freeUseMask(hDispBuf, gst_tidmaibuffer_DISPLAY_FREE);
++ *buf = gst_tidmaibuffertransport_new(hDispBuf, NULL);
++ gst_buffer_set_caps(*buf, alloc_caps);
++
++ /* If we allocated new caps, unref them now */
++ if (alloc_unref) {
++ gst_caps_unref (alloc_caps);
++ }
++
++ return GST_FLOW_OK;
++}
++
++
++/******************************************************************************
+ * gst_tidmaivideosink_preroll
+ ******************************************************************************/
+ static GstFlowReturn gst_tidmaivideosink_preroll(GstBaseSink * bsink,
+@@ -1282,6 +1418,18 @@ static gboolean gst_tidmaivideosink_init_display(GstTIDmaiVideoSink * sink)
+ return FALSE;
+ }
+
++ /* If we own the display buffers, tell DMAI to delay starting the
++ * display until we call Display_put for the first time.
++ */
++ if (sink->hDispBufTab) {
++ #if defined(Platform_dm365)
++ sink->dAttrs.delayStreamon = TRUE;
++ #else
++ GST_ERROR("delayed V4L2 streamon not supported\n");
++ return FALSE;
++ #endif
++ }
++
+ /* Allocate user-allocated display buffers, if requested */
+ if (!sink->hDispBufTab && sink->useUserptrBufs) {
+ if (!gst_tidmaivideosink_alloc_display_buffers(sink, 0)) {
+@@ -1416,9 +1564,6 @@ static gboolean gst_tidmaivideosink_process_caps(GstBaseSink * bsink,
+ gst_structure_get_fraction(structure, "framerate", &framerateNum,
+ &framerateDen);
+
+- /* Error check new values against existing ones */
+- /* TBD */
+-
+ /* Populate the display graphics attributes */
+ dmaisink->dGfxAttrs.bAttrs.reference = dmaisink->contiguousInputFrame;
+ dmaisink->dGfxAttrs.dim.width = width;
+@@ -1445,9 +1590,10 @@ static gboolean gst_tidmaivideosink_process_caps(GstBaseSink * bsink,
+ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
+ GstBuffer * buf)
+ {
+- Buffer_Handle hDispBuf = NULL;
+- Buffer_Handle inBuf = NULL;
+- GstTIDmaiVideoSink *sink = GST_TIDMAIVIDEOSINK(bsink);
++ Buffer_Handle hDispBuf = NULL;
++ Buffer_Handle inBuf = NULL;
++ gboolean inBufIsOurs = FALSE;
++ GstTIDmaiVideoSink *sink = GST_TIDMAIVIDEOSINK(bsink);
+ BufferGfx_Dimensions dim;
+ gchar dur_str[64];
+ gchar ts_str[64];
+@@ -1470,7 +1616,10 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
+ * generated via videotestsrc plugin.
+ */
+ if (GST_IS_TIDMAIBUFFERTRANSPORT(buf)) {
+- inBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(buf);
++ inBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(buf);
++ inBufIsOurs = (sink->hDispBufTab &&
++ GST_TIDMAIBUFTAB_BUFTAB(sink->hDispBufTab) ==
++ Buffer_getBufTab(inBuf));
+ } else {
+ /* allocate DMAI buffer */
+ if (sink->tempDmaiBuf == NULL) {
+@@ -1532,11 +1681,33 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
+ */
+ for (i = 0; i < sink->framerepeat; i++) {
+
+- /* Get a buffer from the display driver */
+- if (Display_get(sink->hDisplay, &hDispBuf) < 0) {
+- GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
+- ("Failed to get display buffer\n"), (NULL));
+- goto cleanup;
++ /* If the input buffer originated from this element via pad allocation,
++ * simply give it back to the display and continue.
++ */
++ if (inBufIsOurs) {
++
++ /* Mark buffer as in-use by the display so it can't be re-used
++ * until it comes back from Display_get */
++ Buffer_setUseMask(inBuf, Buffer_getUseMask(inBuf) |
++ gst_tidmaibuffer_DISPLAY_FREE);
++
++ if (Display_put(sink->hDisplay, inBuf) < 0) {
++ GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
++ ("Failed to put display buffer\n"), (NULL));
++ goto cleanup;
++ }
++ continue;
++ }
++
++ /* Otherwise, our input buffer originated from up-stream. Retrieve a
++ * display buffer to copy the contents into.
++ */
++ else {
++ if (Display_get(sink->hDisplay, &hDispBuf) < 0) {
++ GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
++ ("Failed to get display buffer\n"), (NULL));
++ goto cleanup;
++ }
+ }
+
+ /* Retrieve the dimensions of the display buffer */
+@@ -1844,8 +2015,10 @@ static gboolean gst_tidmaivideosink_alloc_display_buffers(
+ gfxAttrs.dim.height, gfxAttrs.dim.lineLength, gfxAttrs.colorSpace);
+ }
+
++ gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_VIDEOSINK_FREE;
+ sink->hDispBufTab = gst_tidmaibuftab_new(sink->dAttrs.numBufs, bufSize,
+ BufferGfx_getBufferAttrs(&gfxAttrs));
++ gst_tidmaibuftab_set_blocking(sink->hDispBufTab, FALSE);
+
+ return TRUE;
+ }
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch b/recipes/ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch
new file mode 100644
index 0000000000..9ceb30f5e3
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch
@@ -0,0 +1,302 @@
+From e5a264465c1c77d5fc18eeb51b99c79fc3f28a3e Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Tue, 8 Jun 2010 13:48:51 -0500
+Subject: [PATCH 8/8] Add support for pad-allocated buffers in TIViddec2.
+
+When padAllocOutbufs=TRUE is specified to the TIViddec2 element, it will
+attempt to allocate buffers from downstream instead of allocating its own.
+
+Downstream buffers will only be used if it can be determined that they are
+all members of a DMAI BufTab, which means they are CMEM-based, and will work
+with the codecs. Currently, the only known downstream element that can provide
+these buffers is TIDmaiVideoSink, and it is only supported for DM365.
+
+There is currently no support for centering small clips in the middle of the
+display screen -- this would require additional support in the display driver.
+As a result, pad-allocation can currently only be used with clips that are at
+least as large as the display, and this feature not enabled by default because
+of these strict clip-size requirements.
+
+On DM365, there are known issues with the MPEG-2 decoder's output buffer size
+calculation that cause it not to work with D1 resolutions unless you hard-code
+the size. H.264 and MPEG-4 decoders work as expected, and MPEG-2 works as
+expected for 720p.
+---
+ .../ti_build/ticodecplugin/src/gsttividdec2.c | 159 ++++++++++++++++----
+ .../ti_build/ticodecplugin/src/gsttividdec2.h | 1 +
+ 2 files changed, 127 insertions(+), 33 deletions(-)
+
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
+index c39208f..ec3cb05 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
+@@ -73,7 +73,8 @@ enum
+ PROP_FRAMERATE, /* framerate (GstFraction) */
+ PROP_DISPLAY_BUFFER, /* displayBuffer (boolean) */
+ PROP_GEN_TIMESTAMPS, /* genTimeStamps (boolean) */
+- PROP_RTCODECTHREAD /* rtCodecThread (boolean) */
++ PROP_RTCODECTHREAD, /* rtCodecThread (boolean) */
++ PROP_PAD_ALLOC_OUTBUFS /* padAllocOutbufs (boolean) */
+ };
+
+ /* Define sink (input) pad capabilities. Currently, MPEG and H264 are
+@@ -170,8 +171,8 @@ static GstClockTime
+ gst_tividdec2_frame_duration(GstTIViddec2 *viddec2);
+ static gboolean
+ gst_tividdec2_resizeBufTab(GstTIViddec2 *viddec2);
+-static gboolean
+- gst_tividdec2_codec_start (GstTIViddec2 *viddec2);
++static gboolean
++ gst_tividdec2_codec_start (GstTIViddec2 *viddec2, GstBuffer **padBuffer);
+ static gboolean
+ gst_tividdec2_codec_stop (GstTIViddec2 *viddec2);
+ static void
+@@ -324,6 +325,11 @@ static void gst_tividdec2_class_init(GstTIViddec2Class *klass)
+ g_param_spec_boolean("genTimeStamps", "Generate Time Stamps",
+ "Set timestamps on output buffers",
+ TRUE, G_PARAM_WRITABLE));
++
++ g_object_class_install_property(gobject_class, PROP_PAD_ALLOC_OUTBUFS,
++ g_param_spec_boolean("padAllocOutbufs", "Use pad allocation",
++ "Try to allocate buffers with pad allocation",
++ FALSE, G_PARAM_WRITABLE));
+ }
+
+ /******************************************************************************
+@@ -448,6 +454,7 @@ static void gst_tividdec2_init(GstTIViddec2 *viddec2, GstTIViddec2Class *gclass)
+
+ viddec2->numOutputBufs = 0UL;
+ viddec2->hOutBufTab = NULL;
++ viddec2->padAllocOutbufs = FALSE;
+ viddec2->circBuf = NULL;
+
+ viddec2->sps_pps_data = NULL;
+@@ -548,6 +555,10 @@ static void gst_tividdec2_set_property(GObject *object, guint prop_id,
+ viddec2->rtCodecThread = g_value_get_boolean(value);
+ GST_LOG("setting \"RTCodecThread\" to \"%s\"\n",
+ viddec2->rtCodecThread ? "TRUE" : "FALSE");
++ case PROP_PAD_ALLOC_OUTBUFS:
++ viddec2->padAllocOutbufs = g_value_get_boolean(value);
++ GST_LOG("setting \"padAllocOutbufs\" to \"%s\"\n",
++ viddec2->padAllocOutbufs ? "TRUE" : "FALSE");
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+@@ -1079,9 +1090,9 @@ static gboolean gst_tividdec2_init_video(GstTIViddec2 *viddec2)
+ */
+ Rendezvous_meet(viddec2->waitOnDecodeThread);
+
+- if (viddec2->circBuf == NULL || viddec2->hOutBufTab == NULL) {
++ if (viddec2->circBuf == NULL) {
+ GST_ELEMENT_ERROR(viddec2, RESOURCE, FAILED,
+- ("decode thread failed to create circbuf or display buffer handles\n"),
++ ("decode thread failed to create circbuf handles\n"),
+ (NULL));
+ return FALSE;
+ }
+@@ -1260,11 +1271,13 @@ static gboolean gst_tividdec2_codec_stop (GstTIViddec2 *viddec2)
+ * gst_tividdec2_codec_start
+ * Initialize codec engine
+ *****************************************************************************/
+-static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2)
++static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2,
++ GstBuffer **padBuffer)
+ {
+- VIDDEC2_Params params = Vdec2_Params_DEFAULT;
+- VIDDEC2_DynamicParams dynParams = Vdec2_DynamicParams_DEFAULT;
+- BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
++ VIDDEC2_Params params = Vdec2_Params_DEFAULT;
++ VIDDEC2_DynamicParams dynParams = Vdec2_DynamicParams_DEFAULT;
++ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
++ BufTab_Handle codecBufTab = NULL;
+ Cpu_Device device;
+ ColorSpace_Type colorSpace;
+ Int defaultNumBufs;
+@@ -1364,30 +1377,77 @@ static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2)
+ viddec2->numOutputBufs = defaultNumBufs;
+ }
+
+- /* Create codec output buffers */
+- GST_LOG("creating output buffer table\n");
+- gfxAttrs.colorSpace = colorSpace;
+- gfxAttrs.dim.width = params.maxWidth;
+- gfxAttrs.dim.height = params.maxHeight;
+- gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(
+- gfxAttrs.dim.width, gfxAttrs.colorSpace);
++ /* Try to allocate a buffer from downstream. To do this, we must first
++ * set the framerate to a reasonable default if one hasn't been specified,
++ * and we need to set the source pad caps with the stream information we
++ * have so far.
++ */
++ gst_tividdec2_frame_duration(viddec2);
++ gst_tividdec2_set_source_caps_base(viddec2, params.maxWidth,
++ params.maxHeight, colorSpace);
++
++ *padBuffer = NULL;
++ if (viddec2->padAllocOutbufs) {
++ if (gst_pad_alloc_buffer(viddec2->srcpad, 0,
++ Vdec2_getOutBufSize(viddec2->hVd), GST_PAD_CAPS(viddec2->srcpad),
++ padBuffer) != GST_FLOW_OK) {
++ GST_LOG("failed to allocate a downstream buffer\n");
++ *padBuffer = NULL;
++ }
++
++ if (*padBuffer && !GST_IS_TIDMAIBUFFERTRANSPORT(*padBuffer)) {
++ GST_LOG("downstream buffer is not a DMAI buffer; disabling use of "
++ "pad-allocated buffers\n");
++ gst_buffer_unref(*padBuffer);
++ *padBuffer = NULL;
++ }
++
++ if (*padBuffer) {
++ codecBufTab = Buffer_getBufTab(
++ GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(*padBuffer));
++
++ if (!codecBufTab) {
++ GST_LOG("downstream buffer is not a BufTab member; disabling "
++ "use of pad-allocated buffers\n");
++ gst_buffer_unref(*padBuffer);
++ *padBuffer = NULL;
++ }
++ }
++ }
++
++ /* If we can't use pad-allocated buffers, allocate our own BufTab for
++ * output buffers to push downstream.
++ */
++ if (!(*padBuffer)) {
++
++ GST_LOG("creating output buffer table\n");
++ gfxAttrs.colorSpace = colorSpace;
++ gfxAttrs.dim.width = params.maxWidth;
++ gfxAttrs.dim.height = params.maxHeight;
++ gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(
++ gfxAttrs.dim.width, gfxAttrs.colorSpace);
+
+- /* By default, new buffers are marked as in-use by the codec */
+- gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_CODEC_FREE;
++ /* By default, new buffers are marked as in-use by the codec */
++ gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_CODEC_FREE;
+
+- viddec2->hOutBufTab = gst_tidmaibuftab_new(
+- viddec2->numOutputBufs, Vdec2_getOutBufSize(viddec2->hVd),
+- BufferGfx_getBufferAttrs(&gfxAttrs));
++ viddec2->hOutBufTab = gst_tidmaibuftab_new(
++ viddec2->numOutputBufs, Vdec2_getOutBufSize(viddec2->hVd),
++ BufferGfx_getBufferAttrs(&gfxAttrs));
++
++ codecBufTab = GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab);
++ }
+
+- if (viddec2->hOutBufTab == NULL) {
++ /* The value of codecBufTab should now either point to a downstream
++ * BufTab or our own BufTab.
++ */
++ if (codecBufTab == NULL) {
+ GST_ELEMENT_ERROR(viddec2, RESOURCE, NO_SPACE_LEFT,
+- ("failed to create output buffers\n"), (NULL));
++ ("no BufTab available for codec output\n"), (NULL));
+ return FALSE;
+ }
+
+- /* Tell the Vdec module that hOutBufTab will be used for display buffers */
+- Vdec2_setBufTab(viddec2->hVd,
+- GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
++ /* Tell the Vdec module what BufTab it will be using for its output */
++ Vdec2_setBufTab(viddec2->hVd, codecBufTab);
+
+ return TRUE;
+ }
+@@ -1403,8 +1463,10 @@ static void* gst_tividdec2_decode_thread(void *arg)
+ {
+ GstTIViddec2 *viddec2 = GST_TIVIDDEC2(gst_object_ref(arg));
+ GstBuffer *encDataWindow = NULL;
++ GstBuffer *padBuffer = NULL;
+ Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;
+ gboolean codecFlushed = FALSE;
++ gboolean usePadBufs = FALSE;
+ void *threadRet = GstTIThreadSuccess;
+ Buffer_Handle hDummyInputBuf = NULL;
+ Buffer_Handle hDstBuf;
+@@ -1420,7 +1482,8 @@ static void* gst_tividdec2_decode_thread(void *arg)
+ GST_LOG("init video decode_thread \n");
+
+ /* Initialize codec engine */
+- ret = gst_tividdec2_codec_start(viddec2);
++ ret = gst_tividdec2_codec_start(viddec2, &padBuffer);
++ usePadBufs = (padBuffer != NULL);
+
+ /* Notify main thread that is ok to continue initialization */
+ Rendezvous_meet(viddec2->waitOnDecodeThread);
+@@ -1476,7 +1539,34 @@ static void* gst_tividdec2_decode_thread(void *arg)
+ }
+
+ /* Obtain a free output buffer for the decoded data */
+- if (!(hDstBuf = gst_tidmaibuftab_get_buf(viddec2->hOutBufTab))) {
++ if (usePadBufs) {
++
++ /* First time through this loop, padBuffer will already be set
++ * to the buffer we got in codec_start. It will be NULL for every
++ * frame after that.
++ */
++ if (G_LIKELY(!padBuffer)) {
++ if (gst_pad_alloc_buffer(viddec2->srcpad, 0, 0,
++ GST_PAD_CAPS(viddec2->srcpad), &padBuffer)
++ != GST_FLOW_OK) {
++ GST_ELEMENT_ERROR(viddec2, RESOURCE, READ,
++ ("failed to allocate a downstream buffer\n"), (NULL));
++ padBuffer = NULL;
++ goto thread_exit;
++ }
++ }
++ hDstBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(padBuffer);
++ gst_buffer_unref(padBuffer);
++ padBuffer = NULL;
++
++ /* Set the CODEC_FREE flag -- this isn't done automatically when
++ * allocating buffers from downstream.
++ */
++ Buffer_setUseMask(hDstBuf, Buffer_getUseMask(hDstBuf) |
++ gst_tidmaibuffer_CODEC_FREE);
++
++ }
++ else if (!(hDstBuf = gst_tidmaibuftab_get_buf(viddec2->hOutBufTab))) {
+ GST_ELEMENT_ERROR(viddec2, RESOURCE, READ,
+ ("failed to get a free contiguous buffer from BufTab\n"),
+ (NULL));
+@@ -1623,12 +1713,15 @@ thread_failure:
+ thread_exit:
+
+ /* Re-claim any buffers owned by the codec */
+- bufIdx = BufTab_getNumBufs(GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
++ if (viddec2->hOutBufTab) {
++ bufIdx =
++ BufTab_getNumBufs(GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
+
+- while (bufIdx-- > 0) {
+- Buffer_Handle hBuf = BufTab_getBuf(
+- GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab), bufIdx);
+- Buffer_freeUseMask(hBuf, gst_tidmaibuffer_CODEC_FREE);
++ while (bufIdx-- > 0) {
++ Buffer_Handle hBuf = BufTab_getBuf(
++ GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab), bufIdx);
++ Buffer_freeUseMask(hBuf, gst_tidmaibuffer_CODEC_FREE);
++ }
+ }
+
+ /* Release the last buffer we retrieved from the circular buffer */
+diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
+index b16e9c5..6b09d2a 100644
+--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
++++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
+@@ -91,6 +91,7 @@ struct _GstTIViddec2
+ UInt32 numOutputBufs;
+ GstTIDmaiBufTab *hOutBufTab;
+ GstTICircBuffer *circBuf;
++ gboolean padAllocOutbufs;
+
+ /* Quicktime h264 header */
+ GstBuffer *sps_pps_data;
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch b/recipes/ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch
new file mode 100644
index 0000000000..b8525b79bf
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch
@@ -0,0 +1,26 @@
+From 721970f80e6bff0f231625f00301fa37473a2bb3 Mon Sep 17 00:00:00 2001
+From: Brijesh Singh <bksingh@ti.com>
+Date: Wed, 7 Jul 2010 19:21:01 -0500
+Subject: [PATCH 9/9] dmaisink compilation fix
+
+temporary fix - should go in svn trunk
+---
+ src/gsttidmaivideosink.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/gsttidmaivideosink.c b/src/gsttidmaivideosink.c
+index 99ca25d..2fb5aad 100644
+--- a/src/gsttidmaivideosink.c
++++ b/src/gsttidmaivideosink.c
+@@ -1817,7 +1817,7 @@ static gboolean gst_tidmaivideosink_alloc_display_buffers(
+ return FALSE;
+ }
+
+- GST_INFO("Allocating %ld display buffers", sink->dAttrs.numBufs);
++ GST_INFO("Allocating %d display buffers", sink->dAttrs.numBufs);
+
+ /* Set the dimensions for the display */
+ if (VideoStd_getResolution(sink->dAttrs.videoStd, &gfxAttrs.dim.width,
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch b/recipes/ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch
new file mode 100644
index 0000000000..0d36bf107d
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch
@@ -0,0 +1,26 @@
+From d5601a8beec6144fb39ebdc93778c081028a7fdd Mon Sep 17 00:00:00 2001
+From: Brijesh Singh <bksingh@ti.com>
+Date: Tue, 28 Sep 2010 19:35:14 -0500
+Subject: [PATCH] update dm365 cfg to work with platinum codecs
+
+---
+ src/gstticodecplugin_dm365.cfg | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/src/gstticodecplugin_dm365.cfg b/src/gstticodecplugin_dm365.cfg
+index d682643..43174b1 100644
+--- a/src/gstticodecplugin_dm365.cfg
++++ b/src/gstticodecplugin_dm365.cfg
+@@ -86,6 +86,9 @@ var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
+
+ var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
+
++var MEMTCM = xdc.useModule('ti.sdo.fc.ires.memtcm.MEMTCM');
++MEMTCM.cmemBlockId = 1; //Since we use _1 in our insmod command.
++
+ /* Uncomment these lines if you wish to debug FC and enable FC trace */
+ /*
+ /*
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch b/recipes/ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch
new file mode 100644
index 0000000000..85550e6c41
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch
@@ -0,0 +1,119 @@
+From 0f2ef84ad320ec141a7ba6727cf18817ac42e413 Mon Sep 17 00:00:00 2001
+From: Brijesh Singh <bksingh@ti.com>
+Date: Mon, 4 Oct 2010 14:11:39 -0500
+Subject: [PATCH] replace omap3530_dv400 platform support with omap3530
+
+---
+ Makefile.external | 19 +++----------
+ src/gstticodecplugin_omap3530_dv400.cfg | 44 -------------------------------
+ 2 files changed, 5 insertions(+), 58 deletions(-)
+ delete mode 100644 src/gstticodecplugin_omap3530_dv400.cfg
+
+diff --git a/Makefile.external b/Makefile.external
+index 6d118d8..2a85108 100644
+--- a/Makefile.external
++++ b/Makefile.external
+@@ -8,7 +8,7 @@
+ # Copyright (C) 2009 Ridgerun
+ #
+
+-.PHONY: default configure dm6446 omap3530 dm355 dm6467 dm365 omapl138 omap3530_dv400
++.PHONY: default configure dm6446 omap3530 dm355 dm6467 dm365 omapl138
+
+ DVSDK_PATH=undefined
+ DMAI_INSTALL_DIR=undefined
+@@ -23,7 +23,7 @@ $(error You need to define the environment variable DMAI_INSTALL_DIR)
+ endif
+
+ default:
+- @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm6467t, dm365 omapl138 omap3530_dv400"
++ @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm6467t, dm365 omapl138"
+
+ export GST_TI_PLATFORM=$(MAKECMDGOALS)
+ export BIOS_INSTALL_DIR
+@@ -87,6 +87,9 @@ ifeq ($(GST_TI_PLATFORM), omap3530)
+ export MVTOOL_DIR = $(CSTOOL_DIR)
+ export PLATFORM_XDC = ${XDC_PLATFORM}
+ export CROSS_COMPILE = ${CSTOOL_PREFIX}
++ export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
++ export C6ACCEL_INSTALL_DIR
++ export ENABLE_C6ACCEL ="--enable-c6accel"
+ endif
+
+ ifeq ($(GST_TI_PLATFORM), omapl138)
+@@ -101,16 +104,6 @@ ifeq ($(GST_TI_PLATFORM), omapl138)
+ export ENABLE_C6ACCEL ="--enable-c6accel"
+ endif
+
+-ifeq ($(GST_TI_PLATFORM), omap3530_dv400)
+- export XDC_TARGET = gnu.targets.arm.GCArmv5T
+- export XDC_PLATFORM = ti.platforms.evm3530
+- export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
+- export MVTOOL_DIR = $(CSTOOL_DIR)
+- export PLATFORM_XDC = ${XDC_PLATFORM}
+- export CROSS_COMPILE = ${CSTOOL_PREFIX}
+- export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
+-endif
+-
+ CPPFLAGS=-DPlatform_$(GST_TI_PLATFORM)
+ HOST=arm-none-linux-gnueabi
+
+@@ -141,5 +134,3 @@ dm365: Makefile
+ omapl138: Makefile
+ $(MAKE) -f Makefile
+
+-omap3530_dv400: Makefile
+- $(MAKE) -f Makefile
+diff --git a/src/gstticodecplugin_omap3530_dv400.cfg b/src/gstticodecplugin_omap3530_dv400.cfg
+deleted file mode 100644
+index 90f4edf..0000000
+--- a/src/gstticodecplugin_omap3530_dv400.cfg
++++ /dev/null
+@@ -1,44 +0,0 @@
+-/*
+- * Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU Lesser General Public License as
+- * published by the Free Software Foundation version 2.1 of the License.
+- *
+- * This program is distributed #as is# WITHOUT ANY WARRANTY of any kind,
+- * whether express or implied; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Lesser General Public License for more details.
+- *
+- */
+-
+-/* Load the Codec Engine 'Operating System Abstraction Layer' */
+-var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
+-
+-var os = xdc.useModule('ti.sdo.ce.osal.linux.Settings');
+-osalGlobal.os = os;
+-
+-/* Configure CE to use it's DSP Link Linux version */
+-var ipc = xdc.useModule('ti.sdo.ce.ipc.Settings');
+-ipc.commType = ipc.COMM_DSPLINK;
+-
+-/*
+- * ======== Engine Configuration ========
+- */
+-var Engine = xdc.useModule('ti.sdo.ce.Engine');
+-var demoEngine = Engine.createFromServer(
+- "codecServer",
+- "./bin/cs.x64P",
+- "ti.sdo.server.cs"
+- );
+-
+-var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
+-if (combopath != "" && combopath != "null") {
+- demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
+-}
+-
+-/* Load support for the DMAI module */
+-var DMAI = xdc.loadPackage('ti.sdo.dmai');
+-
+-var SCPY = xdc.useModule('ti.sdo.fc.scpy.SCPY');
+-var SDMA = xdc.useModule('ti.sdo.linuxutils.sdma.SDMA');
+--
+1.7.0.4
+
diff --git a/recipes/ti/gstreamer-ti/dm365-evm/loadmodules.sh b/recipes/ti/gstreamer-ti/dm365-evm/loadmodules.sh
index 32201b6bce..c70bee1e30 100644
--- a/recipes/ti/gstreamer-ti/dm365-evm/loadmodules.sh
+++ b/recipes/ti/gstreamer-ti/dm365-evm/loadmodules.sh
@@ -1,27 +1,37 @@
#!/bin/sh
+#
+# Default DM365 Memory Map 128 MB
+#
+# Start Addr Size Description
+# ----------------------------------------------------------------
+# 0x00001000 32K ARM926 TCM memory used by platinum codec
+# 0x80000000 48 MB Linux
+# 0x83000000 12 MB Video driver memory (Linux)
+# 0x83C00000 68 MB CMEM
+# 0x88000000 BOTTOM ADDRESS
+#
+
rmmod cmemk 2>/dev/null
-rmmod irqk 2>/dev/null
-rmmod edmak 2>/dev/null
-rmmod dm365mmap 2>/dev/null
# Pools configuration
-modprobe cmemk phys_start=0x84d00000 phys_end=0x88000000 pools=1x16539648,1x4841472,4x1843200,14x1646592,1x282624,1x176128,1x147456,1x69632,1x61440,1x32768,2x20480,1x12288,1x8192,72x4096
+modprobe cmemk phys_start=0x83C00000 phys_end=0x88000000 pools=1x16539648,1x4841472,4x1843200,14x1646592,1x282624,1x176128,1x147456,1x69632,1x61440,1x32768,2x20480,1x16384,1x12288,4x8192,69x4096 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672
# Decode + Display
-#insmod cmemk.ko phys_start=0x83c00000 phys_end=0x88000000 pools=1x16539648,1x4841472,14x1646592,1x282624,1x176128,1x147456,1x69632,1x61440,1x32768,2x20480,1x12288,1x8192,64x4096
+#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x16539648,1x4841472,14x1646592,1x282624,1x176128,1x147456,1x69632,1x61440,1x32768,2x20480,1x12288,1x8192,64x4096
# Capture + Encode
-#insmod cmemk.ko phys_start=0x83c00000 phys_end=0x88000000 pools=1x3112960,1x2764800,3x1536000,1x65536,1x61440,1x49152,1x20480,1x16384,2x8192,87x4096
+#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x3112960,1x2764800,3x1536000,1x65536,1x61440,1x49152,1x20480,1x16384,2x8192,87x4096
# Resizer
-#insmod cmemk.ko phys_start=0x83c00000 phys_end=0x88000000 pools=3x1843200
+#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=3x1843200
# Non-accel display
-#insmod cmemk.ko phys_start=0x83c00000 phys_end=0x88000000 pools=1x1843200
+#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x1843200
-modprobe irqk
+modprobe irqk
modprobe edmak
modprobe dm365mmap
rm -f /dev/dm365mmap
mknod /dev/dm365mmap c `awk "\\$2==\"dm365mmap\" {print \\$1}" /proc/devices` 0
+
diff --git a/recipes/ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh b/recipes/ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh
new file mode 100644
index 0000000000..f401725190
--- /dev/null
+++ b/recipes/ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# configure kernel modules for TI DSP based gstreamer plugin
+#
+rmmod cmemk 2>/dev/null
+rmmod dsplink 2>/dev/null
+
+modprobe cmemk phys_start=0xC2200000 phys_end=0xC3200000 \
+ pools=1x5250000,3x1048576,3x829440,1x256000,4x131072 \
+ allowOverlap=1
+
+modprobe dsplinkk
+
+rm -f /dev/dsplink
+mknod /dev/dsplink c `awk "\\$2==\"dsplink\" {print \\$1}" /proc/devices` 0
+
diff --git a/recipes/ti/gstreamer-ti_svn.bb b/recipes/ti/gstreamer-ti_svn.bb
index fe717990d9..f9fc31ff5d 100644
--- a/recipes/ti/gstreamer-ti_svn.bb
+++ b/recipes/ti/gstreamer-ti_svn.bb
@@ -4,10 +4,21 @@ PV = "svnr${SRCREV}"
S = "${WORKDIR}/gstreamer_ti/ti_build/ticodecplugin"
-SRCREV = "811"
+SRCREV = "822"
+
+# apply patches from tracker 1208 to get zero copy support.
+# https://gstreamer.ti.com/gf/project/gstreamer_ti/tracker/?action=TrackerItemEdit&tracker_item_id=1208&start=175
SRC_URI = "svn://gforge.ti.com/svn/gstreamer_ti/trunk;module=gstreamer_ti;proto=https;user=anonymous;pswd='' \
- file://gstreamer-ti-rc.sh \
+file://gstreamer-ti-rc.sh \
+file://0003-Support-setting-the-display-framerate-directly-when-.patch;striplevel=4 \
+file://0004-Cosmetic-cleanup-clarify-some-comments.patch;striplevel=4 \
+file://0005-Enable-setting-the-framerate-directly-on-DM365.patch;striplevel=4 \
+file://0006-Remove-the-repeat_with_refresh-feature.patch;striplevel=4 \
+file://0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch;striplevel=4 \
+file://0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch;striplevel=4 \
+file://0009-update-dm365-cfg-to-work-with-platinum-codecs.patch \
+file://0010-replace-omap3530_dv400-platform-support-with-omap353.patch \
"
# use local loadmodules.sh for these platform