summaryrefslogtreecommitdiffstats
path: root/recipes-ti
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-ti')
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti.inc165
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0001-add-omapdmaifbsink.patch1336
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch86
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch73
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch33
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch132
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch313
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch302
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch26
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch26
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch119
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/dm355-evm/gst-ti.sh12
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/dm365-evm/loadmodules.sh37
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/gstreamer-ti-rc.sh28
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/gstti-init.service10
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/omap3/loadmodules.sh22
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/omapl137/loadmodules.sh12
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh16
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/loadmodules.sh15
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti/r962-remove-include-videodev.diff22
-rw-r--r--recipes-ti/gstreamer-ti/gstreamer-ti_svn.bb26
21 files changed, 0 insertions, 2811 deletions
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti.inc b/recipes-ti/gstreamer-ti/gstreamer-ti.inc
deleted file mode 100644
index e0e65a75..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti.inc
+++ /dev/null
@@ -1,165 +0,0 @@
1DESCRIPTION = "GSTREAMER Plugin (gstreamer-ti) for TI ARM/DSP processors"
2HOMEPAGE = "https://gforge.ti.com/gf/project/gstreamer_ti/"
3SECTION = "multimedia"
4LICENSE = "LGPL"
5
6# TODO :: Replace omapl137 with official support in GST (currently linking to omapl138)
7# TODO :: Codec Server Environment Variables shouldn't be required
8# TODO :: Add (and check) rc scripts for all targets (just copied for now) (365,6467,omapl137)
9# TODO :: Check if CPPFLAGS_append is still required
10# TODO :: Remove ENCODE/DECODE combo exports - these are not used anymore (check?)
11
12inherit autotools-brokensep
13inherit update-rc.d
14require recipes-ti/includes/ti-paths.inc
15require recipes-ti/includes/ti-staging.inc
16
17# Rebuild on kernel change since it links statically to ti-dmai, ti-codec-engine, etc
18PR = "r85+${MACHINE_KERNEL_PR}"
19
20DEPENDS = "ti-dmai gstreamer gst-plugins-base"
21
22# enable c6accel elements on omapl138 and omap3
23#DEPENDS_append_omapl138 = " ti-c6accel "
24#EXTRA_OECONF_omapl138 = "--enable-c6accel"
25#DEPENDS_append_omap3 = " ti-c6accel "
26#EXTRA_OECONF_omap3 = "--enable-c6accel"
27export C6ACCEL_INSTALL_DIR
28
29# gstreamer_ti picks up some config variables from the environment
30# - variables are used in the gstreamer makefile
31# - PLATFORM, XDC_PLATFORM, XDC_TARGET, MVTOOL_DIR
32# - others used by config.bld (which it gets from the dmai config.bld)
33# - CROSS_COMPILE, PLATFORM_XDC
34
35PLATFORM_dm6446 = "dm6446"
36PLATFORM_dm6467 = "dm6467"
37PLATFORM_dm6467t = "dm6467t"
38PLATFORM_omap3 = "omap3530"
39PLATFORM_dm355 = "dm355"
40PLATFORM_dm365 = "dm365"
41PLATFORM_omapl137 = "omapl137"
42PLATFORM_omapl138 = "omapl138"
43PLATFORM ?= "UNDEFINED_PLATFORM"
44GST_TI_PLATFORM = "${PLATFORM}"
45
46XDC_PLATFORM_dm6446 = "ti.platforms.evmDM6446"
47XDC_PLATFORM_dm6467 = "ti.platforms.evmDM6467"
48XDC_PLATFORM_omap3 = "ti.platforms.evm3530"
49XDC_PLATFORM_dm355 = "ti.platforms.evmDM355"
50XDC_PLATFORM_dm365 = "ti.platforms.evmDM365"
51XDC_PLATFORM_omapl137 = "ti.platforms.evmOMAPL137"
52XDC_PLATFORM_omapl138 = "ti.platforms.evmOMAPL138"
53XDC_PLATFORM ?= "UNDEFINED_XDC_PLATFORM"
54
55MEMARGS_omap3 = "99M@0x80000000"
56MEMARGS ?= "UNDEFINED_MEM_ARGS"
57
58export MEMARGS
59export PLATFORM
60export GST_TI_PLATFORM
61export XDC_PLATFORM
62export XDC_TARGET = "gnu.targets.arm.GCArmv5T"
63export PLATFORM_XDC = "${XDC_PLATFORM}"
64export CSTOOL_DIR = "${TOOLCHAIN_PATH}"
65export MVTOOL_DIR = "${TOOLCHAIN_PATH}"
66export MVTOOL_PREFIX = "${TARGET_PREFIX}"
67export CROSS_COMPILE = "${TOOLCHAIN_PATH}/${TARGET_PREFIX}"
68export LINK_XDC_ROOT = "${LINK_INSTALL_DIR}"
69
70# export codec combo (or server) locations
71# Why do we need to do this?? - These will get picked up from CODEC_INSTALL_DIR?
72# Sould only need this if we change from default server
73
74export CODEC_SERVER = "${installdir}/ti-codecs-server/cs.x64P"
75CPPFLAGS_append = " -DPlatform_${PLATFORM}"
76
77# We are still using encode/decode combo for DM6446
78export ENCODE_COMBO = "${installdir}/ti-codecs-server/encodeCombo.x64P"
79export DECODE_COMBO = "${installdir}/ti-codecs-server/decodeCombo.x64P"
80# Makefile also expects to be able to find the kernel headers from the envirionment
81export LINUXKERNEL_INSTALL_DIR = "${STAGING_KERNEL_DIR}"
82
83do_configure_prepend() {
84 # PSP kernel is based on older DSS. we need to replace linux/omapfb.h with mach/omapfb.h
85 if ! [ -e ${STAGING_KERNEL_DIR}/include/linux/omapfb.h ] ; then
86 sed -i -e s:linux/omapfb:mach/omapfb:g ${S}/src/omapfb.h || true
87 fi
88
89 # Angstrom 2008 breaks with -Wl,-T, while angstrom 2010 needs it
90 if [ $(${TARGET_PREFIX}gcc -dumpversion | awk -F. '{print $2}') -gt 3 ] ; then
91 # Fix up linkerscripts, recent toolchains need -T to prepend the default script to the custom one
92 for makefile in $(find ${S} -name "Makefile.am") ; do
93 sed -i -e 's:-Wl,$(XDC_CONFIG_BASENAME)/linker.cmd:-Wl,-T,$(XDC_CONFIG_BASENAME)/linker.cmd:g' $makefile
94 done
95 fi
96}
97
98do_compile() {
99 # Recent kernel headers warn against inclusion from userspace
100 for makefile in $(find ${S} -name "Makefile") ; do
101 sed -i -e s:-Werror::g $makefile
102 done
103
104 oe_runmake
105}
106
107do_install_prepend () {
108
109 install -d ${D}/${installdir}/gst/${PLATFORM}
110
111 # copy gstreamer demo scripts
112 cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/shared ${D}/${installdir}/gst
113
114 # If we have loadmodules.sh in WORKDIR then give preference to this over
115 # the default gst-ti loadmdules.sh
116 if [ -f ${WORKDIR}/loadmodules.sh ]; then
117 cp ${WORKDIR}/loadmodules.sh ${D}/${installdir}/gst/${PLATFORM}
118 else
119 cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/${PLATFORM} ${D}/${installdir}/gst
120 fi
121
122 # delete .svn files
123 find ${D}/${installdir}/gst -name .svn -type d | xargs rm -rf
124 chmod 0755 ${D}/${installdir}/gst -R
125
126 install -d ${D}${sysconfdir}/init.d/
127 install -m 0755 ${WORKDIR}/gstreamer-ti-rc.sh ${D}${sysconfdir}/init.d/gstti-init
128 sed -i -e 's|<platform>|${PLATFORM}|g' ${D}${sysconfdir}/init.d/gstti-init
129
130 install -d ${D}${base_libdir}/systemd/system
131 install -m 0644 ${WORKDIR}/gstti-init.service ${D}${base_libdir}/systemd/system/
132 sed -i -e 's|<platform>|${PLATFORM}|g' -e 's|MEMARGS|${MEMARGS}|' ${D}${base_libdir}/systemd/system/gstti-init.service
133}
134
135RRECOMMENDS_${PN}_append_dm6446 += "ti-codecs-dm6446-server ti-cmem-module ti-dsplink-module"
136RRECOMMENDS_${PN}_append_dm6467 += "ti-codecs-dm6467 ti-cmem-module ti-dsplink-module"
137RRECOMMENDS_${PN}_append_omap3 += "ti-codecs-omap3530-server ti-cmem-module ti-dsplink-module ti-lpm-module ti-sdma-module"
138RRECOMMENDS_${PN}_append_dm355 += "ti-codecs-dm355 ti-cmem-module ti-dm355mm-module"
139RRECOMMENDS_${PN}_append_dm365 += "ti-codecs-dm365 ti-cmem-module ti-dm365mm-module ti-edma-module ti-irq-module"
140RRECOMMENDS_${PN}_append_omapl137 += "ti-codecs-omapl137-server ti-cmem-module ti-dsplink-module"
141RRECOMMENDS_${PN}_append_omapl138 += "ti-codecs-omapl138-server ti-cmem-module ti-dsplink-module"
142
143FILES_${PN} += "${libdir}/gstreamer-0.10/*.so ${sysconfdir} ${installdir} ${base_libdir}/systemd"
144FILES_${PN}-dev += "${libdir}/gstreamer-0.10/*.la"
145FILES_${PN}-staticdev += "${libdir}/gstreamer-0.10/*.a"
146FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
147
148pkg_postinst_${PN} () {
149if test "x$D" != "x"; then
150 echo "Can't run gstreamer-ti postinst offline"
151 exit 1
152fi
153 if [ -e ${base_bindir}/systemctl ] ; then
154 systemctl enable gstti-init.service
155 fi
156
157 if [ -d ${installdir}/ti-codecs-server/ ]; then
158 ln -sf ${installdir}/ti-codecs-server/* ${installdir}/gst/${PLATFORM}/
159 fi
160}
161
162PACKAGE_ARCH = "${MACHINE_ARCH}"
163
164INITSCRIPT_NAME = "gstti-init"
165INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0001-add-omapdmaifbsink.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0001-add-omapdmaifbsink.patch
deleted file mode 100644
index bcf0d904..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0001-add-omapdmaifbsink.patch
+++ /dev/null
@@ -1,1336 +0,0 @@
1diff -uNr ticodecplugin/configure.ac ticodecplugin.new/configure.ac
2--- ticodecplugin/configure.ac 2010-08-24 15:08:58.609410984 -0500
3+++ ticodecplugin.new/configure.ac 2010-09-03 13:54:11.909410298 -0500
4@@ -25,6 +25,7 @@
5 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
6
7 AM_CONFIG_HEADER(config.h)
8+AM_PROG_AS
9
10 dnl check for tools
11 AC_PROG_CC
12diff -uNr ticodecplugin/src/gstticodecplugin.c ticodecplugin.new/src/gstticodecplugin.c
13--- ticodecplugin/src/gstticodecplugin.c 2010-08-24 15:08:58.609410984 -0500
14+++ ticodecplugin.new/src/gstticodecplugin.c 2010-09-03 13:54:11.929409696 -0500
15@@ -42,6 +42,7 @@
16 #include "gsttiaudenc1.h"
17 #include "gsttividresize.h"
18 #include "gsttidmaiperf.h"
19+#include "omapfb.h"
20
21 #ifdef HAVE_C6ACCEL
22 #include "gsttic6xcolorspace.h"
23@@ -134,6 +135,13 @@
24 return FALSE;
25 #endif
26
27+ env_value = getenv("GST_omapdmaifbsink_DISABLE");
28+
29+ if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
30+ TICodecPlugin, "omapdmaifbsink", GST_RANK_PRIMARY,
31+ GST_OMAPFB_SINK_TYPE))
32+ return FALSE;
33+
34 return TRUE;
35 }
36
37diff -uNr ticodecplugin/src/Makefile.am ticodecplugin.new/src/Makefile.am
38--- ticodecplugin/src/Makefile.am 2010-08-24 22:01:30.989165985 -0500
39+++ ticodecplugin.new/src/Makefile.am 2010-09-03 13:53:41.037663172 -0500
40@@ -12,16 +12,16 @@
41
42
43 # sources used to compile this plug-in
44-libgstticodecplugin_la_SOURCES = gstticodecplugin.c gsttiauddec1.c gsttividdec2.c gsttiimgenc1.c gsttiimgdec1.c gsttidmaibuffertransport.c gsttidmaibuftab.c gstticircbuffer.c gsttidmaivideosink.c gstticodecs.c gstticodecs_platform.c gsttiquicktime_aac.c gsttiquicktime_h264.c gsttividenc1.c gsttiaudenc1.c gstticommonutils.c gsttividresize.c gsttidmaiperf.c gsttiquicktime_mpeg4.c $(C6ACCEL_SRC)
45+libgstticodecplugin_la_SOURCES = gstticodecplugin.c gsttiauddec1.c gsttividdec2.c gsttiimgenc1.c gsttiimgdec1.c gsttidmaibuffertransport.c gsttidmaibuftab.c gstticircbuffer.c gsttidmaivideosink.c gstticodecs.c gstticodecs_platform.c gsttiquicktime_aac.c gsttiquicktime_h264.c gsttividenc1.c gsttiaudenc1.c gstticommonutils.c gsttividresize.c gsttidmaiperf.c gsttiquicktime_mpeg4.c $(C6ACCEL_SRC) omapfb.c yuv.S
46
47 # flags used to compile this plugin
48 # add other _CFLAGS and _LIBS as needed
49-libgstticodecplugin_la_CFLAGS = $(GST_CFLAGS) $(shell cat $(XDC_CONFIG_BASENAME)/compiler.opt)
50-libgstticodecplugin_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-0.10 -lgstaudio-0.10 -lm
51+libgstticodecplugin_la_CFLAGS = $(GST_CFLAGS) $(shell cat $(XDC_CONFIG_BASENAME)/compiler.opt) -I$(LINUXKERNEL_INSTALL_DIR)/include
52+libgstticodecplugin_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-0.10 -lgstaudio-0.10 -lm -lX11
53 libgstticodecplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -Wl,$(XDC_CONFIG_BASENAME)/linker.cmd -Wl,$(C6ACCEL_LIB)
54
55 # headers we need but don't want installed
56-noinst_HEADERS = gsttiauddec1.h gsttividdec2.h gsttiimgenc1.h gsttiimgdec1.h gsttidmaibuffertransport.h gsttidmaibuftab.h gstticircbuffer.h gsttidmaivideosink.h gsttithreadprops.h gstticodecs.h gsttiquicktime_aac.h gsttiquicktime_h264.h gsttividenc1.h gsttiaudenc1.h gstticommonutils.h gsttividresize.h gsttiquicktime_mpeg4.h $(C6ACCEL_HEAD)
57+noinst_HEADERS = gsttiauddec1.h gsttividdec2.h gsttiimgenc1.h gsttiimgdec1.h gsttidmaibuffertransport.h gsttidmaibuftab.h gstticircbuffer.h gsttidmaivideosink.h gsttithreadprops.h gstticodecs.h gsttiquicktime_aac.h gsttiquicktime_h264.h gsttividenc1.h gsttiaudenc1.h gstticommonutils.h gsttividresize.h gsttiquicktime_mpeg4.h $(C6ACCEL_HEAD) omapfb.h
58
59 # XDC Configuration
60 CONFIGURO = $(XDC_INSTALL_DIR)/xs xdc.tools.configuro
61diff -uNr ticodecplugin/src/omapfb.c ticodecplugin.new/src/omapfb.c
62--- ticodecplugin/src/omapfb.c 1969-12-31 18:00:00.000000000 -0600
63+++ ticodecplugin.new/src/omapfb.c 2010-09-03 13:54:11.929409696 -0500
64@@ -0,0 +1,1005 @@
65+/*
66+ * Copyright (C) 2008 Felipe Contreras <felipe.contreras@gmail.com>
67+ * Copyright (C) 2009 Tim Yamin <plasm@roo.me.uk>
68+ * Copyright (C) 2009 Brijesh Singh <brijesh.ksingh@gmail.com>
69+ *
70+ * X code largely copied from ximagesink by Julien Moutte and
71+ * vo_omapfb.c by Gregoire Gentil.
72+ *
73+ * Use DMAI hw framecopy module to copy the dmai transport buffers.
74+ *
75+ * This library is free software; you can redistribute it and/or
76+ * modify it under the terms of the GNU Lesser General Public
77+ * License as published by the Free Software Foundation
78+ * version 2.1 of the License.
79+ *
80+ * This library is distributed in the hope that it will be useful,
81+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
82+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
83+ * Lesser General Public License for more details.
84+ *
85+ * You should have received a copy of the GNU General Public License
86+ * along with this program; if not, write to the Free Software
87+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
88+ */
89+
90+#include <fcntl.h>
91+#include <sys/ioctl.h>
92+#include <sys/mman.h>
93+#include <unistd.h>
94+#include <string.h>
95+#include <sys/types.h>
96+#include <malloc.h>
97+#include <stdlib.h>
98+
99+#include "omapfb.h"
100+#include <gst/interfaces/xoverlay.h>
101+
102+static GstVideoSinkClass *parent_class = NULL;
103+
104+extern void yuv420_to_yuv422(__uint8_t *yuv, __uint8_t *y, __uint8_t *u, __uint8_t *v,
105+ int w, int h, int yw, int cw, int dw);
106+
107+static void x11_get_window_abs_position(Display *display, Window window,
108+ int *wx, int *wy, int *ww, int *wh)
109+{
110+ Window root, parent;
111+ Window *child;
112+ unsigned int n_children;
113+ XWindowAttributes attribs;
114+
115+ /* Get window attributes */
116+ XGetWindowAttributes(display, window, &attribs);
117+
118+ /* Get relative position of given window */
119+ *wx = attribs.x;
120+ *wy = attribs.y;
121+ if (ww)
122+ *ww = attribs.width;
123+ if (wh)
124+ *wh = attribs.height;
125+
126+ /* Query window tree information */
127+ XQueryTree(display, window, &root, &parent, &child, &n_children);
128+ if (parent)
129+ {
130+ int x, y;
131+
132+ /* If we have a parent we must go there and discover his position */
133+ x11_get_window_abs_position(display, parent, &x, &y, NULL, NULL);
134+ *wx += x;
135+ *wy += y;
136+ }
137+
138+ /* If we had children, free them */
139+ if(n_children)
140+ XFree(child);
141+}
142+
143+static GstXWindow *
144+gst_omapfbsink_xwindow_new (GstOmapFbSink * omapfbsink, gint width, gint height)
145+{
146+ GstXWindow *xwindow = NULL;
147+ XGCValues values;
148+
149+ if(!omapfbsink->xcontext)
150+ return NULL;
151+
152+ xwindow = g_new0 (GstXWindow, 1);
153+ xwindow->width = width;
154+ xwindow->height = height;
155+ xwindow->internal = TRUE;
156+
157+ g_mutex_lock (omapfbsink->x_lock);
158+ xwindow->win = XCreateSimpleWindow (omapfbsink->xcontext->disp,
159+ omapfbsink->xcontext->root,
160+ 0, 0, xwindow->width, xwindow->height,
161+ 0, 0, omapfbsink->colorKey);
162+
163+ /* We have to do that to prevent X from redrawing the background on
164+ ConfigureNotify. This takes away flickering of video when resizing. */
165+ XSetWindowBackgroundPixmap (omapfbsink->xcontext->disp, xwindow->win, None);
166+
167+ if (omapfbsink->handle_events) {
168+ Atom wm_delete;
169+
170+ XSelectInput (omapfbsink->xcontext->disp, xwindow->win, ExposureMask |
171+ StructureNotifyMask | PointerMotionMask | KeyPressMask |
172+ KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
173+
174+ /* Tell the window manager we'd like delete client messages instead of
175+ * being killed */
176+ wm_delete = XInternAtom (omapfbsink->xcontext->disp,
177+ "WM_DELETE_WINDOW", False);
178+ (void) XSetWMProtocols (omapfbsink->xcontext->disp, xwindow->win,
179+ &wm_delete, 1);
180+ }
181+
182+ xwindow->gc = XCreateGC (omapfbsink->xcontext->disp, xwindow->win,
183+ 0, &values);
184+
185+ XMapRaised (omapfbsink->xcontext->disp, xwindow->win);
186+ XSync (omapfbsink->xcontext->disp, FALSE);
187+
188+ g_mutex_unlock (omapfbsink->x_lock);
189+ gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (omapfbsink), xwindow->win);
190+
191+ return xwindow;
192+}
193+
194+static gboolean gst_omapfbsink_update_plane (GstOmapFbSink *omapfbsink)
195+{
196+ int wx, wy, ww, wh;
197+ if (!omapfbsink->xcontext)
198+ {
199+ if (ioctl (omapfbsink->overlay_fd, OMAPFB_SETUP_PLANE, &omapfbsink->plane_info))
200+ return FALSE;
201+ return TRUE;
202+ }
203+
204+ if (omapfbsink->plane_info.enabled != 1)
205+ return FALSE;
206+
207+ x11_get_window_abs_position(omapfbsink->xcontext->disp,
208+ omapfbsink->xwindow->win, &wx, &wy, &ww, &wh);
209+
210+ if (wx != omapfbsink->xwindow->wx || wy != omapfbsink->xwindow->wy ||
211+ wh != omapfbsink->xwindow->height || ww != omapfbsink->xwindow->width) {
212+ omapfbsink->plane_info.out_width = omapfbsink->xwindow->width = ww;
213+ omapfbsink->plane_info.out_height = omapfbsink->xwindow->height = wh;
214+ omapfbsink->plane_info.pos_x = omapfbsink->xwindow->wx = wx;
215+ omapfbsink->plane_info.pos_y = omapfbsink->xwindow->wy = wy;
216+
217+ GST_DEBUG_OBJECT(omapfbsink, "updating geometry to: (%d,%d) %dx%d", wx, wy, ww, wh);
218+
219+ XSetForeground (omapfbsink->xcontext->disp, omapfbsink->xwindow->gc, omapfbsink->colorKey);
220+ XFillRectangle (omapfbsink->xcontext->disp, omapfbsink->xwindow->win, omapfbsink->xwindow->gc, 0, 0, ww, wh);
221+
222+ if (ioctl (omapfbsink->overlay_fd, OMAPFB_SETUP_PLANE, &omapfbsink->plane_info))
223+ return FALSE;
224+ }
225+
226+ return TRUE;
227+}
228+
229+static void
230+gst_omapfbsink_expose (GstXOverlay * overlay)
231+{
232+ gst_omapfbsink_update_plane(GST_OMAPFB_SINK (overlay));
233+}
234+
235+static void
236+gst_omapfbsink_xwindow_destroy (GstOmapFbSink * omapfbsink,
237+ GstXWindow * xwindow)
238+{
239+ g_return_if_fail (xwindow != NULL);
240+ g_mutex_lock (omapfbsink->x_lock);
241+
242+ /* If we did not create that window we just free the GC and let it live */
243+ if (xwindow->internal)
244+ XDestroyWindow (omapfbsink->xcontext->disp, xwindow->win);
245+ else
246+ XSelectInput (omapfbsink->xcontext->disp, xwindow->win, 0);
247+
248+ XFreeGC (omapfbsink->xcontext->disp, xwindow->gc);
249+ XSync (omapfbsink->xcontext->disp, FALSE);
250+ g_mutex_unlock (omapfbsink->x_lock);
251+ g_free (xwindow);
252+}
253+
254+/* This function handles XEvents that might be in the queue. It generates
255+ GstEvent that will be sent upstream in the pipeline to handle interactivity
256+ and navigation.*/
257+static void
258+gst_omapfbsink_handle_xevents (GstOmapFbSink * omapfbsink)
259+{
260+ XEvent e;
261+ g_mutex_lock (omapfbsink->flow_lock);
262+ g_mutex_lock (omapfbsink->x_lock);
263+
264+ while (XCheckWindowEvent (omapfbsink->xcontext->disp,
265+ omapfbsink->xwindow->win, ExposureMask | StructureNotifyMask, &e)) {
266+ switch (e.type) {
267+ case Expose:
268+ case ConfigureNotify:
269+ gst_omapfbsink_update_plane (omapfbsink);
270+ break;
271+ default:
272+ break;
273+ }
274+ }
275+
276+ /* Handle Display events */
277+ while (XPending (omapfbsink->xcontext->disp)) {
278+ XNextEvent (omapfbsink->xcontext->disp, &e);
279+
280+ switch (e.type) {
281+ case ClientMessage:{
282+ Atom wm_delete;
283+
284+ wm_delete = XInternAtom (omapfbsink->xcontext->disp,
285+ "WM_DELETE_WINDOW", False);
286+ if (wm_delete == (Atom) e.xclient.data.l[0]) {
287+ /* Handle window deletion by posting an error on the bus */
288+ GST_ELEMENT_ERROR (omapfbsink, RESOURCE, NOT_FOUND,
289+ ("Output window was closed"), (NULL));
290+
291+ g_mutex_unlock (omapfbsink->x_lock);
292+ gst_omapfbsink_xwindow_destroy (omapfbsink, omapfbsink->xwindow);
293+ omapfbsink->xwindow = NULL;
294+ g_mutex_lock (omapfbsink->x_lock);
295+ }
296+ break;
297+ }
298+ default:
299+ break;
300+ }
301+ }
302+
303+ g_mutex_unlock (omapfbsink->x_lock);
304+ g_mutex_unlock (omapfbsink->flow_lock);
305+}
306+
307+static gpointer
308+gst_omapfbsink_event_thread (GstOmapFbSink * omapfbsink)
309+{
310+ GST_OBJECT_LOCK (omapfbsink);
311+ while (omapfbsink->running) {
312+ GST_OBJECT_UNLOCK (omapfbsink);
313+
314+ if (omapfbsink->xwindow)
315+ gst_omapfbsink_handle_xevents (omapfbsink);
316+ g_usleep (100000);
317+
318+ GST_OBJECT_LOCK (omapfbsink);
319+ }
320+ GST_OBJECT_UNLOCK (omapfbsink);
321+
322+ return NULL;
323+}
324+
325+/* This function gets the X Display and global info about it. Everything is
326+ stored in our object and will be cleaned when the object is disposed. */
327+static GstXContext *
328+gst_omapfbsink_xcontext_get (GstOmapFbSink * omapfbsink)
329+{
330+ GstXContext *xcontext = g_new0 (GstXContext, 1);
331+ g_mutex_lock (omapfbsink->x_lock);
332+
333+ xcontext->disp = XOpenDisplay (omapfbsink->display_name);
334+
335+ if (!xcontext->disp) {
336+ g_mutex_unlock (omapfbsink->x_lock);
337+ g_free (xcontext);
338+ GST_ELEMENT_WARNING (omapfbsink, RESOURCE, WRITE,
339+ ("Could not initialise X output"),
340+ ("Could not open display"));
341+ return NULL;
342+ }
343+
344+ xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
345+ xcontext->screen_num = DefaultScreen (xcontext->disp);
346+ xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
347+ xcontext->root = DefaultRootWindow (xcontext->disp);
348+
349+ xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
350+ xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
351+
352+ g_mutex_unlock (omapfbsink->x_lock);
353+
354+ /* Setup our event listening thread */
355+ GST_OBJECT_LOCK (omapfbsink);
356+ omapfbsink->running = TRUE;
357+ omapfbsink->event_thread = g_thread_create (
358+ (GThreadFunc) gst_omapfbsink_event_thread, omapfbsink, TRUE, NULL);
359+ GST_OBJECT_UNLOCK (omapfbsink);
360+
361+ return xcontext;
362+}
363+
364+static void
365+gst_omapfbsink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id)
366+{
367+ GstOmapFbSink *omapfbsink = GST_OMAPFB_SINK (overlay);
368+ GstXWindow *xwindow = NULL;
369+ XWindowAttributes attr;
370+
371+ /* If we already use that window, return */
372+ if (omapfbsink->xwindow && (xwindow_id == omapfbsink->xwindow->win))
373+ return;
374+
375+ /* If the element has not initialized the X11 context try to do so */
376+ if (!omapfbsink->xcontext &&
377+ !(omapfbsink->xcontext = gst_omapfbsink_xcontext_get (omapfbsink))) {
378+ g_mutex_unlock (omapfbsink->flow_lock);
379+ return;
380+ }
381+
382+ /* If a window is there already we destroy it */
383+ if (omapfbsink->xwindow) {
384+ gst_omapfbsink_xwindow_destroy (omapfbsink, omapfbsink->xwindow);
385+ omapfbsink->xwindow = NULL;
386+ }
387+
388+ /* If the xid is 0 we go back to an internal window */
389+ if (xwindow_id == 0) {
390+ /* If no width/height caps nego did not happen window will be created
391+ during caps nego then */
392+ if (GST_VIDEO_SINK_WIDTH (omapfbsink) && GST_VIDEO_SINK_HEIGHT (omapfbsink)) {
393+ xwindow = gst_omapfbsink_xwindow_new (omapfbsink,
394+ GST_VIDEO_SINK_WIDTH (omapfbsink),
395+ GST_VIDEO_SINK_HEIGHT (omapfbsink));
396+ }
397+ } else {
398+ xwindow = g_new0 (GstXWindow, 1);
399+ xwindow->wx = xwindow->wy = -1;
400+ xwindow->win = xwindow_id;
401+
402+ /* We get window geometry, set the event we want to receive,
403+ and create a GC */
404+ g_mutex_lock (omapfbsink->x_lock);
405+ XGetWindowAttributes (omapfbsink->xcontext->disp, xwindow->win, &attr);
406+ xwindow->width = attr.width;
407+ xwindow->height = attr.height;
408+ xwindow->internal = FALSE;
409+ if (omapfbsink->handle_events) {
410+ XSelectInput (omapfbsink->xcontext->disp, xwindow->win, ExposureMask |
411+ StructureNotifyMask | PointerMotionMask | KeyPressMask |
412+ KeyReleaseMask);
413+ }
414+
415+ xwindow->gc = XCreateGC (omapfbsink->xcontext->disp, xwindow->win, 0, NULL);
416+ g_mutex_unlock (omapfbsink->x_lock);
417+ }
418+
419+ if (xwindow) {
420+ omapfbsink->xwindow = xwindow;
421+
422+ g_mutex_lock (omapfbsink->x_lock);
423+ gst_omapfbsink_update_plane(omapfbsink);
424+ g_mutex_unlock (omapfbsink->x_lock);
425+ }
426+}
427+
428+static void
429+gst_omapfbsink_xwindow_clear (GstOmapFbSink * omapfbsink,
430+ GstXWindow * xwindow)
431+{
432+ g_return_if_fail (xwindow != NULL);
433+ g_mutex_lock (omapfbsink->x_lock);
434+
435+ XSetForeground (omapfbsink->xcontext->disp, xwindow->gc,
436+ XBlackPixel (omapfbsink->xcontext->disp,
437+ omapfbsink->xcontext->screen_num));
438+
439+ XFillRectangle (omapfbsink->xcontext->disp, xwindow->win, xwindow->gc,
440+ 0, 0, xwindow->width, xwindow->height);
441+
442+ XSync (omapfbsink->xcontext->disp, FALSE);
443+ g_mutex_unlock (omapfbsink->x_lock);
444+}
445+
446+static void
447+gst_omapfbsink_set_event_handling (GstXOverlay * overlay,
448+ gboolean handle_events)
449+{
450+ GstOmapFbSink *omapfbsink = GST_OMAPFB_SINK (overlay);
451+ omapfbsink->handle_events = handle_events;
452+
453+ g_mutex_lock (omapfbsink->flow_lock);
454+
455+ if (G_UNLIKELY (!omapfbsink->xwindow)) {
456+ g_mutex_unlock (omapfbsink->flow_lock);
457+ return;
458+ }
459+
460+ g_mutex_lock (omapfbsink->x_lock);
461+
462+ if (handle_events) {
463+ if (omapfbsink->xwindow->internal) {
464+ XSelectInput (omapfbsink->xcontext->disp, omapfbsink->xwindow->win,
465+ ExposureMask | StructureNotifyMask | PointerMotionMask |
466+ KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
467+ } else {
468+ XSelectInput (omapfbsink->xcontext->disp, omapfbsink->xwindow->win,
469+ ExposureMask | StructureNotifyMask | PointerMotionMask |
470+ KeyPressMask | KeyReleaseMask);
471+ }
472+ } else {
473+ XSelectInput (omapfbsink->xcontext->disp, omapfbsink->xwindow->win, 0);
474+ }
475+
476+ g_mutex_unlock (omapfbsink->x_lock);
477+ g_mutex_unlock (omapfbsink->flow_lock);
478+}
479+
480+static void
481+gst_omapfbsink_xoverlay_init (GstXOverlayClass * iface)
482+{
483+ iface->set_xwindow_id = gst_omapfbsink_set_xwindow_id;
484+ iface->expose = gst_omapfbsink_expose;
485+ iface->handle_events = gst_omapfbsink_set_event_handling;
486+}
487+
488+static GstCaps *
489+generate_sink_template (void)
490+{
491+ GstCaps *caps;
492+ GstStructure *struc;
493+
494+ caps = gst_caps_new_empty ();
495+
496+ struc = gst_structure_new ("video/x-raw-yuv",
497+ "width", GST_TYPE_INT_RANGE, 16, 4096,
498+ "height", GST_TYPE_INT_RANGE, 16, 4096,
499+ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 30, 1,
500+ NULL);
501+
502+ {
503+ GValue list;
504+ GValue val;
505+
506+ list.g_type = val.g_type = 0;
507+
508+ g_value_init (&list, GST_TYPE_LIST);
509+ g_value_init (&val, GST_TYPE_FOURCC);
510+
511+#if 0
512+ gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
513+ gst_value_list_append_value (&list, &val);
514+#else
515+ gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('I', '4', '2', '0'));
516+ gst_value_list_append_value (&list, &val);
517+
518+ gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'));
519+ gst_value_list_append_value (&list, &val);
520+#endif
521+
522+ gst_structure_set_value (struc, "format", &list);
523+
524+ g_value_unset (&val);
525+ g_value_unset (&list);
526+ }
527+
528+ gst_caps_append_structure (caps, struc);
529+
530+ return caps;
531+}
532+
533+static GstFlowReturn
534+buffer_alloc (GstBaseSink *bsink,
535+ guint64 offset,
536+ guint size,
537+ GstCaps *caps,
538+ GstBuffer **buf)
539+{
540+ GstOmapFbSink *self;
541+ GstBuffer *buffer = NULL;
542+ GstFlowReturn ret = GST_FLOW_OK;
543+ self = GST_OMAPFB_SINK (bsink);
544+
545+ if(self->row_skip) {
546+ buffer = gst_buffer_new ();
547+ GST_BUFFER_DATA (buffer) = self->buffer = self->framebuffer;
548+ GST_BUFFER_SIZE (buffer) = self->buffer_size = size;
549+ gst_buffer_set_caps (buffer, caps);
550+ } else {
551+ if(self->buffer && size == self->buffer_size) {
552+ buffer = gst_buffer_new ();
553+ GST_BUFFER_DATA (buffer) = self->buffer;
554+ GST_BUFFER_SIZE (buffer) = size;
555+ gst_buffer_set_caps (buffer, caps);
556+ } else {
557+ if(self->buffer)
558+ free(self->buffer);
559+ if(posix_memalign(&self->buffer, 16, (size_t) size) == 0) {
560+ buffer = gst_buffer_new ();
561+ GST_BUFFER_DATA (buffer) = self->buffer;
562+ GST_BUFFER_SIZE (buffer) = self->buffer_size = size;
563+ gst_buffer_set_caps (buffer, caps);
564+ } else {
565+ GST_ELEMENT_ERROR (self, RESOURCE, WRITE, ("Could not allocate aligned buf!"),
566+ ("Could not alloc aligned buf!"));
567+ }
568+ }
569+ }
570+
571+ *buf = buffer;
572+ return ret;
573+}
574+
575+static void
576+x_memcpy (GstOmapFbSink *omapfbsink, __uint8_t *outBuf, __uint8_t *inBuf)
577+{
578+ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
579+ Buffer_Handle hInBuf = NULL, hOutBuf = NULL;
580+ Framecopy_Attrs fcAttrs = Framecopy_Attrs_DEFAULT;
581+ int size;
582+
583+ if (omapfbsink->hFc == NULL) {
584+ fcAttrs.accel = TRUE;
585+ omapfbsink->hFc = Framecopy_create(&fcAttrs);
586+ if (omapfbsink->hFc == NULL) {
587+ GST_ELEMENT_ERROR(omapfbsink, RESOURCE, WRITE, ("failed to create dmai framecopy handle"), ("failed to create dmai framecopy handle"));
588+ goto cleanup;
589+ }
590+ }
591+
592+ gfxAttrs.bAttrs.reference = TRUE;
593+ gfxAttrs.dim.width = GST_VIDEO_SINK_WIDTH (omapfbsink);
594+ gfxAttrs.dim.height = GST_VIDEO_SINK_HEIGHT (omapfbsink);
595+ gfxAttrs.colorSpace = ColorSpace_UYVY;
596+ gfxAttrs.dim.lineLength = omapfbsink->fixinfo.line_length;
597+ size = gfxAttrs.dim.height * gfxAttrs.dim.width * 2;
598+
599+ hInBuf = Buffer_create(size, BufferGfx_getBufferAttrs(&gfxAttrs));
600+ if (hInBuf == NULL) {
601+ GST_ELEMENT_ERROR(omapfbsink, RESOURCE, WRITE, ("Could not allocate refer dmai buffer"), ("Could not allocate refer dmai buffer"));
602+ goto cleanup;
603+ }
604+ Buffer_setUserPtr(hInBuf, (Int8*) inBuf);
605+ Buffer_setNumBytesUsed(hInBuf,Buffer_getSize(hInBuf));
606+
607+ hOutBuf = Buffer_create(size, BufferGfx_getBufferAttrs(&gfxAttrs));
608+ if (hOutBuf == NULL) {
609+ GST_ELEMENT_ERROR(omapfbsink, RESOURCE, WRITE, ("Could not allocate refer dmai buffer"), ("Could not allocate refer dmai buffer"));
610+ goto cleanup;
611+ }
612+ Buffer_setUserPtr(hOutBuf, (Int8*) outBuf);
613+ Buffer_setNumBytesUsed(hOutBuf,Buffer_getSize(hOutBuf));
614+
615+
616+ if (Framecopy_config(omapfbsink->hFc, hInBuf, hOutBuf) < 0) {
617+ GST_ELEMENT_ERROR(omapfbsink, RESOURCE, WRITE, ("failed to configure dmai framecopy handle"), ("failed to configure dmai framecopy handle"));
618+ goto cleanup;
619+ }
620+
621+ if (Framecopy_execute(omapfbsink->hFc, hInBuf, hOutBuf) < 0) {
622+ GST_ELEMENT_ERROR(omapfbsink, RESOURCE, WRITE, ("failed to execute dmai framecopy handle"), ("failed to configure dmai framecopy handle"));
623+ goto cleanup;
624+ }
625+ cleanup:
626+
627+ if (hInBuf)
628+ Buffer_delete(hInBuf);
629+ if (hOutBuf)
630+ Buffer_delete(hOutBuf);
631+}
632+
633+static GstFlowReturn
634+render (GstBaseSink * bsink, GstBuffer * buf)
635+{
636+ int i, w, h;
637+ GstOmapFbSink *omapfbsink = GST_OMAPFB_SINK(bsink);
638+ __uint8_t *fb = omapfbsink->framebuffer, *data = GST_BUFFER_DATA(buf);
639+ gboolean useXcopy = FALSE;
640+
641+ if (GST_IS_TIDMAIBUFFERTRANSPORT(buf)) {
642+ GST_LOG("found dmai transport buffer, enabling hw framecopy.\n");
643+ useXcopy = TRUE;
644+ }
645+
646+ if(omapfbsink->plane_info.enabled == 2)
647+ {
648+ omapfbsink->plane_info.enabled = 1;
649+
650+ g_mutex_lock (omapfbsink->x_lock);
651+ gst_omapfbsink_update_plane(omapfbsink);
652+ g_mutex_unlock (omapfbsink->x_lock);
653+ }
654+
655+ /* If a buffer which wasn't supplied by us is given to us to render with,
656+ we need to copy to our buffer first so that memory alignment constraints
657+ are met. */
658+ if((data != omapfbsink->buffer && GST_BUFFER_SIZE(buf) <= omapfbsink->buffer_size) && !useXcopy)
659+ {
660+ memcpy(omapfbsink->buffer, data, GST_BUFFER_SIZE(buf));
661+ data = omapfbsink->buffer;
662+ }
663+
664+ /* buffer_alloc gave a direct buffer, so we have nothing to
665+ do here... */
666+ if(omapfbsink->row_skip)
667+ return GST_FLOW_OK;
668+
669+ switch(omapfbsink->image_format) {
670+ case GST_MAKE_FOURCC('I', '4', '2', '0'):
671+ /* Convert to YUV422 and send to FB */
672+
673+ h = GST_VIDEO_SINK_HEIGHT (omapfbsink);
674+ w = GST_VIDEO_SINK_WIDTH (omapfbsink);
675+
676+ __uint8_t *y, *u, *v;
677+ y = data;
678+ u = y + w * h;
679+ v = u + w / 2 * h / 2;
680+ yuv420_to_yuv422(fb, y, u, v, w & ~15, h, w, w / 2, omapfbsink->fixinfo.line_length);
681+ break;
682+
683+ case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
684+ /* Send to FB, taking into account line_length */
685+ if (useXcopy) {
686+ x_memcpy(omapfbsink, fb, data);
687+ }
688+ else {
689+
690+ w = 2 * GST_VIDEO_SINK_WIDTH (omapfbsink);
691+ for(i = 0; i < GST_VIDEO_SINK_HEIGHT (omapfbsink); i++)
692+ {
693+ memcpy(fb, data, w);
694+
695+ fb += omapfbsink->fixinfo.line_length;
696+ data += w;
697+ }
698+ }
699+ break;
700+ }
701+
702+ return GST_FLOW_OK;
703+}
704+
705+static gboolean
706+setcaps (GstBaseSink *bsink,
707+ GstCaps *vscapslist)
708+{
709+ GstOmapFbSink *self;
710+ GstStructure *structure;
711+
712+ gint width, height;
713+ struct omapfb_color_key color_key;
714+
715+ self = GST_OMAPFB_SINK (bsink);
716+
717+ structure = gst_caps_get_structure (vscapslist, 0);
718+
719+ gst_structure_get_int (structure, "width", &width);
720+ gst_structure_get_int (structure, "height", &height);
721+
722+ self->overlay_info.xres = MIN (self->varinfo.xres, width) & ~15;
723+ self->overlay_info.yres = MIN (self->varinfo.yres, height) & ~15;
724+ self->overlay_info.xres_virtual = self->overlay_info.xres;
725+ self->overlay_info.yres_virtual = self->overlay_info.yres;
726+
727+ self->overlay_info.xoffset = 0;
728+ self->overlay_info.yoffset = 0;
729+
730+ gst_structure_get_fourcc (structure, "format", &self->image_format);
731+ switch(self->image_format) {
732+ case GST_MAKE_FOURCC('I', '4', '2', '0'):
733+ self->row_skip = FALSE; /* Colorspace conversion required */
734+ self->overlay_info.nonstd = OMAPFB_COLOR_YUY422;
735+ break;
736+ case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
737+ /* Can data be pushed straight to the FB or do we need to interleave? */
738+ if (self->fixinfo.line_length != 2 * width)
739+ self->row_skip = FALSE;
740+ else
741+ self->row_skip = TRUE;
742+ self->overlay_info.nonstd = OMAPFB_COLOR_YUV422;
743+ break;
744+ }
745+
746+ if (ioctl (self->overlay_fd, FBIOPUT_VSCREENINFO, &self->overlay_info))
747+ return FALSE;
748+
749+ GST_VIDEO_SINK_WIDTH (self) = width;
750+ GST_VIDEO_SINK_HEIGHT (self) = height;
751+ if (!self->xwindow) {
752+ self->xwindow = gst_omapfbsink_xwindow_new (self,
753+ GST_VIDEO_SINK_WIDTH (self), GST_VIDEO_SINK_HEIGHT (self));
754+ }
755+
756+ color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD;
757+ color_key.background = 0x0;
758+ color_key.trans_key = self->colorKey;
759+ if (self->xwindow)
760+ color_key.key_type = OMAPFB_COLOR_KEY_GFX_DST;
761+ else
762+ color_key.key_type = OMAPFB_COLOR_KEY_DISABLED;
763+
764+ if (ioctl (self->overlay_fd, OMAPFB_SET_COLOR_KEY, &color_key))
765+ return FALSE;
766+
767+ self->plane_info.pos_x = 0;
768+ self->plane_info.pos_y = 0;
769+ self->plane_info.out_width = self->overlay_info.xres;
770+ self->plane_info.out_height = self->overlay_info.yres;
771+ self->plane_info.enabled = 2;
772+
773+ if (ioctl (self->overlay_fd, FBIOGET_FSCREENINFO, &self->fixinfo))
774+ return FALSE;
775+
776+ self->enabled = TRUE;
777+ return TRUE;
778+}
779+
780+static gboolean
781+start (GstBaseSink *bsink)
782+{
783+ GstOmapFbSink *self;
784+ int fd;
785+
786+ self = GST_OMAPFB_SINK (bsink);
787+
788+ fd = open ("/dev/fb0", O_RDWR);
789+
790+ if (fd == -1)
791+ return FALSE;
792+
793+ if (ioctl (fd, FBIOGET_VSCREENINFO, &self->varinfo))
794+ {
795+ close (fd);
796+ return FALSE;
797+ }
798+
799+ if (close (fd))
800+ return FALSE;
801+
802+ self->overlay_fd = open ("/dev/fb1", O_RDWR);
803+
804+ if (self->overlay_fd == -1)
805+ return FALSE;
806+
807+ if (ioctl (self->overlay_fd, FBIOGET_VSCREENINFO, &self->overlay_info))
808+ return FALSE;
809+
810+ if (ioctl (self->overlay_fd, OMAPFB_QUERY_PLANE, &self->plane_info))
811+ return FALSE;
812+
813+ if (ioctl (self->overlay_fd, OMAPFB_QUERY_MEM, &self->mem_info))
814+ return FALSE;
815+
816+ self->framebuffer = mmap (NULL, self->mem_info.size, PROT_WRITE, MAP_SHARED, self->overlay_fd, 0);
817+ if (self->framebuffer == MAP_FAILED)
818+ return FALSE;
819+
820+ return TRUE;
821+}
822+
823+static gboolean
824+stop (GstBaseSink *bsink)
825+{
826+ GstOmapFbSink *self;
827+
828+ self = GST_OMAPFB_SINK (bsink);
829+
830+ if (self->enabled)
831+ {
832+ self->plane_info.enabled = 0;
833+
834+ if (ioctl (self->overlay_fd, OMAPFB_SETUP_PLANE, &self->plane_info))
835+ return FALSE;
836+ }
837+
838+ if (munmap (self->framebuffer, self->mem_info.size))
839+ return FALSE;
840+
841+ if (close (self->overlay_fd))
842+ return FALSE;
843+
844+ if (self->hFc)
845+ Framecopy_delete(self->hFc);
846+
847+ return TRUE;
848+}
849+
850+/* This function cleans the X context. Closing the Display and unrefing the
851+ caps for supported formats. */
852+static void
853+gst_omapfbsink_xcontext_clear (GstOmapFbSink * omapfbsink)
854+{
855+ GstXContext *xcontext;
856+ GST_OBJECT_LOCK (omapfbsink);
857+ if (omapfbsink->xcontext == NULL) {
858+ GST_OBJECT_UNLOCK (omapfbsink);
859+ return;
860+ }
861+
862+ xcontext = omapfbsink->xcontext;
863+ omapfbsink->xcontext = NULL;
864+
865+ GST_OBJECT_UNLOCK (omapfbsink);
866+ g_mutex_lock (omapfbsink->x_lock);
867+
868+ XCloseDisplay (xcontext->disp);
869+ g_mutex_unlock (omapfbsink->x_lock);
870+ g_free (xcontext);
871+}
872+
873+static void
874+gst_omapfbsink_reset (GstOmapFbSink *omapfbsink)
875+{
876+ GThread *thread;
877+
878+ GST_OBJECT_LOCK (omapfbsink);
879+ omapfbsink->running = FALSE;
880+ /* grab thread and mark it as NULL */
881+ thread = omapfbsink->event_thread;
882+ omapfbsink->event_thread = NULL;
883+ GST_OBJECT_UNLOCK (omapfbsink);
884+
885+ /* Wait for our event thread to finish before we clean up our stuff. */
886+ if (thread)
887+ g_thread_join (thread);
888+
889+ g_mutex_lock (omapfbsink->flow_lock);
890+ if (omapfbsink->xwindow) {
891+ gst_omapfbsink_xwindow_clear (omapfbsink, omapfbsink->xwindow);
892+ gst_omapfbsink_xwindow_destroy (omapfbsink, omapfbsink->xwindow);
893+ omapfbsink->xwindow = NULL;
894+ }
895+ g_mutex_unlock (omapfbsink->flow_lock);
896+ gst_omapfbsink_xcontext_clear (omapfbsink);
897+}
898+
899+static GstStateChangeReturn
900+gst_omapfbsink_change_state (GstElement * element, GstStateChange transition)
901+{
902+ GstOmapFbSink *omapfbsink;
903+ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
904+ GstXContext *xcontext = NULL;
905+
906+ omapfbsink = GST_OMAPFB_SINK (element);
907+
908+ switch (transition) {
909+ case GST_STATE_CHANGE_NULL_TO_READY:
910+
911+ /* Initializing the XContext */
912+ if (omapfbsink->xcontext == NULL) {
913+ xcontext = gst_omapfbsink_xcontext_get (omapfbsink);
914+
915+ GST_OBJECT_LOCK (omapfbsink);
916+ omapfbsink->xcontext = xcontext;
917+ GST_OBJECT_UNLOCK (omapfbsink);
918+ }
919+ break;
920+ case GST_STATE_CHANGE_READY_TO_PAUSED:
921+ g_mutex_lock (omapfbsink->flow_lock);
922+ if (omapfbsink->xwindow)
923+ gst_omapfbsink_xwindow_clear (omapfbsink, omapfbsink->xwindow);
924+ g_mutex_unlock (omapfbsink->flow_lock);
925+ break;
926+ case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
927+ break;
928+ default:
929+ break;
930+ }
931+
932+ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
933+
934+ switch (transition) {
935+ case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
936+ break;
937+ case GST_STATE_CHANGE_PAUSED_TO_READY:
938+ GST_VIDEO_SINK_WIDTH (omapfbsink) = 0;
939+ GST_VIDEO_SINK_HEIGHT (omapfbsink) = 0;
940+ break;
941+ case GST_STATE_CHANGE_READY_TO_NULL:
942+ gst_omapfbsink_reset (omapfbsink);
943+ break;
944+ default:
945+ break;
946+ }
947+
948+ return ret;
949+}
950+
951+static void
952+type_class_init (gpointer g_class,
953+ gpointer class_data)
954+{
955+ GstElementClass *element_class;
956+ GstBaseSinkClass *base_sink_class;
957+
958+ element_class = (GstElementClass *) g_class;
959+ base_sink_class = (GstBaseSinkClass *) g_class;
960+
961+ parent_class = g_type_class_peek_parent (g_class);
962+
963+ base_sink_class->set_caps = GST_DEBUG_FUNCPTR (setcaps);
964+ base_sink_class->buffer_alloc = GST_DEBUG_FUNCPTR (buffer_alloc);
965+ base_sink_class->render = GST_DEBUG_FUNCPTR (render);
966+ base_sink_class->start = GST_DEBUG_FUNCPTR (start);
967+ base_sink_class->stop = GST_DEBUG_FUNCPTR (stop);
968+
969+ element_class->change_state = gst_omapfbsink_change_state;
970+}
971+
972+static void
973+type_base_init (gpointer g_class)
974+{
975+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
976+
977+ {
978+ GstElementDetails details;
979+
980+ details.longname = "Linux OMAP framebuffer sink";
981+ details.klass = "Sink/Video";
982+ details.description = "Renders video with omapfb";
983+ details.author = "Felipe Contreras";
984+
985+ gst_element_class_set_details (element_class, &details);
986+ }
987+
988+ {
989+ GstPadTemplate *template;
990+
991+ template = gst_pad_template_new ("sink", GST_PAD_SINK,
992+ GST_PAD_ALWAYS,
993+ generate_sink_template ());
994+
995+ gst_element_class_add_pad_template (element_class, template);
996+ }
997+}
998+
999+static gboolean
1000+gst_omapfbsink_interface_supported (GstImplementsInterface * iface, GType type)
1001+{
1002+ g_assert (type == GST_TYPE_X_OVERLAY);
1003+ return TRUE;
1004+}
1005+
1006+static void
1007+gst_omapfbsink_interface_init (GstImplementsInterfaceClass * klass)
1008+{
1009+ klass->supported = gst_omapfbsink_interface_supported;
1010+}
1011+
1012+static void
1013+gst_omapfbsink_init (GstOmapFbSink * omapfbsink)
1014+{
1015+ omapfbsink->display_name = NULL;
1016+ omapfbsink->xcontext = NULL;
1017+ omapfbsink->xwindow = NULL;
1018+
1019+ omapfbsink->event_thread = NULL;
1020+ omapfbsink->running = FALSE;
1021+
1022+ omapfbsink->x_lock = g_mutex_new ();
1023+ omapfbsink->flow_lock = g_mutex_new ();
1024+
1025+ omapfbsink->handle_events = TRUE;
1026+ omapfbsink->colorKey = 0xff0;
1027+
1028+ omapfbsink->plane_info.enabled = 0;
1029+ omapfbsink->row_skip = FALSE;
1030+
1031+ omapfbsink->buffer = NULL;
1032+ omapfbsink->buffer_size = 0;
1033+ omapfbsink->hFc = NULL;
1034+}
1035+
1036+GType
1037+gst_omapfbsink_get_type (void)
1038+{
1039+ static GType type = 0;
1040+
1041+ if (G_UNLIKELY (type == 0))
1042+ {
1043+ GTypeInfo *type_info;
1044+ static const GInterfaceInfo iface_info = {
1045+ (GInterfaceInitFunc) gst_omapfbsink_interface_init,
1046+ NULL,
1047+ NULL,
1048+ };
1049+ static const GInterfaceInfo overlay_info = {
1050+ (GInterfaceInitFunc) gst_omapfbsink_xoverlay_init,
1051+ NULL,
1052+ NULL,
1053+ };
1054+ type_info = g_new0 (GTypeInfo, 1);
1055+ type_info->class_size = sizeof (GstOmapFbSinkClass);
1056+ type_info->base_init = type_base_init;
1057+ type_info->class_init = type_class_init;
1058+ type_info->instance_size = sizeof (GstOmapFbSink);
1059+ type_info->instance_init = (GInstanceInitFunc) gst_omapfbsink_init;
1060+
1061+ type = g_type_register_static (GST_TYPE_BASE_SINK, "GstOmapFbSink", type_info, 0);
1062+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
1063+ g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &overlay_info);
1064+
1065+ g_free (type_info);
1066+ }
1067+
1068+ return type;
1069+}
1070diff -uNr ticodecplugin/src/omapfb.h ticodecplugin.new/src/omapfb.h
1071--- ticodecplugin/src/omapfb.h 1969-12-31 18:00:00.000000000 -0600
1072+++ ticodecplugin.new/src/omapfb.h 2010-09-03 13:54:11.929409696 -0500
1073@@ -0,0 +1,142 @@
1074+/*
1075+ * Copyright (C) 2008 Felipe Contreras <felipe.contreras@gmail.com>
1076+ *
1077+ * This library is free software; you can redistribute it and/or
1078+ * modify it under the terms of the GNU Lesser General Public
1079+ * License as published by the Free Software Foundation
1080+ * version 2.1 of the License.
1081+ *
1082+ * This library is distributed in the hope that it will be useful,
1083+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1084+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1085+ * Lesser General Public License for more details.
1086+ *
1087+ * You should have received a copy of the GNU General Public License
1088+ * along with this program; if not, write to the Free Software
1089+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1090+ */
1091+
1092+#ifndef GST_OMAPFB_H
1093+#define GST_OMAPFB_H
1094+
1095+#include <ti/sdo/dmai/BufferGfx.h>
1096+#include <ti/sdo/dmai/Framecopy.h>
1097+
1098+#include "gsttidmaibuffertransport.h"
1099+#include <gst/gst.h>
1100+#include <gst/video/gstvideosink.h>
1101+#include <gst/video/video.h>
1102+
1103+#include <X11/Xlib.h>
1104+#include <X11/Xutil.h>
1105+
1106+#include <linux/fb.h>
1107+#include <linux/omapfb.h>
1108+
1109+
1110+G_BEGIN_DECLS
1111+
1112+#define GST_OMAPFB_SINK_TYPE (gst_omapfbsink_get_type ())
1113+#define GST_OMAPFB_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_OMAPFB_SINK_TYPE, GstOmapFbSink))
1114+
1115+typedef struct GstXContext GstXContext;
1116+typedef struct GstXWindow GstXWindow;
1117+typedef struct GstOmapFbSink GstOmapFbSink;
1118+typedef struct GstOmapFbSinkClass GstOmapFbSinkClass;
1119+
1120+/**
1121+ * GstXWindow:
1122+ * @win: the Window ID of this X11 window
1123+ * @width: the width in pixels of Window @win
1124+ * @height: the height in pixels of Window @win
1125+ * @internal: used to remember if Window @win was created internally or passed
1126+ * through the #GstXOverlay interface
1127+ * @gc: the Graphical Context of Window @win
1128+ *
1129+ * Structure used to store informations about a Window.
1130+ */
1131+struct GstXWindow {
1132+ Window win;
1133+ gint width, height;
1134+ gboolean internal;
1135+ GC gc;
1136+
1137+ gint wx, wy;
1138+};
1139+
1140+/**
1141+ * GstXContext:
1142+ * @disp: the X11 Display of this context
1143+ * @screen: the default Screen of Display @disp
1144+ * @screen_num: the Screen number of @screen
1145+ * @visual: the default Visual of Screen @screen
1146+ * @root: the root Window of Display @disp
1147+ * @white: the value of a white pixel on Screen @screen
1148+ * @black: the value of a black pixel on Screen @screen
1149+ * @depth: the color depth of Display @disp
1150+ * @bpp: the number of bits per pixel on Display @disp
1151+ * @endianness: the endianness of image bytes on Display @disp
1152+ * @width: the width in pixels of Display @disp
1153+ * @height: the height in pixels of Display @disp
1154+ *
1155+ * Structure used to store various informations collected/calculated for a
1156+ * Display.
1157+ */
1158+struct GstXContext {
1159+ Display *disp;
1160+ Screen *screen;
1161+ gint screen_num;
1162+
1163+ Visual *visual;
1164+ Window root;
1165+
1166+ gint depth;
1167+ gint bpp;
1168+
1169+ gint width, height;
1170+};
1171+
1172+struct GstOmapFbSink
1173+{
1174+ GstVideoSink videosink;
1175+
1176+ struct fb_fix_screeninfo fixinfo;
1177+ struct fb_var_screeninfo varinfo;
1178+ struct fb_var_screeninfo overlay_info;
1179+ struct omapfb_mem_info mem_info;
1180+ struct omapfb_plane_info plane_info;
1181+
1182+ int overlay_fd;
1183+ unsigned char *framebuffer;
1184+ gboolean enabled;
1185+
1186+ GMutex *x_lock;
1187+ GMutex *flow_lock;
1188+
1189+ GstXContext *xcontext;
1190+ GstXWindow *xwindow;
1191+
1192+ gulong colorKey;
1193+ char *display_name;
1194+ GThread *event_thread;
1195+
1196+ void *buffer;
1197+ guint buffer_size;
1198+ guint image_format;
1199+
1200+ gboolean row_skip;
1201+ gboolean handle_events;
1202+ gboolean running;
1203+ Framecopy_Handle hFc;
1204+};
1205+
1206+struct GstOmapFbSinkClass
1207+{
1208+ GstBaseSinkClass parent_class;
1209+};
1210+
1211+GType gst_omapfbsink_get_type (void);
1212+
1213+G_END_DECLS
1214+
1215+#endif /* GST_OMAPFB_H */
1216diff -uNr ticodecplugin/src/yuv.S ticodecplugin.new/src/yuv.S
1217--- ticodecplugin/src/yuv.S 1969-12-31 18:00:00.000000000 -0600
1218+++ ticodecplugin.new/src/yuv.S 2010-09-03 13:54:11.929409696 -0500
1219@@ -0,0 +1,117 @@
1220+/*
1221+ Copyright (C) 2008 Mans Rullgard
1222+
1223+ Permission is hereby granted, free of charge, to any person
1224+ obtaining a copy of this software and associated documentation
1225+ files (the "Software"), to deal in the Software without
1226+ restriction, including without limitation the rights to use, copy,
1227+ modify, merge, publish, distribute, sublicense, and/or sell copies
1228+ of the Software, and to permit persons to whom the Software is
1229+ furnished to do so, subject to the following conditions:
1230+
1231+ The above copyright notice and this permission notice shall be
1232+ included in all copies or substantial portions of the Software.
1233+
1234+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1235+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1236+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1237+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1238+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1239+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1240+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1241+ DEALINGS IN THE SOFTWARE.
1242+*/
1243+
1244+ .fpu neon
1245+ .text
1246+
1247+@ yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v,
1248+@ int w, int h, int yw, int cw, int dw)
1249+
1250+#define yuv r0
1251+#define y r1
1252+#define u r2
1253+#define v r3
1254+#define w r4
1255+#define h r5
1256+#define yw r6
1257+#define cw r7
1258+#define dw r8
1259+
1260+#define tyuv r9
1261+#define ty r10
1262+#define tu r11
1263+#define tv r12
1264+#define i lr
1265+
1266+ .global yuv420_to_yuv422
1267+ .func yuv420_to_yuv422
1268+yuv420_to_yuv422:
1269+ push {r4-r11,lr}
1270+ add r4, sp, #36
1271+ ldm r4, {r4-r8}
1272+1:
1273+ mov tu, u
1274+ mov tv, v
1275+ vld1.64 {d2}, [u,:64], cw @ u0
1276+ vld1.64 {d3}, [v,:64], cw @ v0
1277+ mov tyuv, yuv
1278+ mov ty, y
1279+ vzip.8 d2, d3 @ u0v0
1280+ mov i, #16
1281+2:
1282+ pld [y, #64]
1283+ vld1.64 {d0, d1}, [y,:128], yw @ y0
1284+ pld [u, #64]
1285+ subs i, i, #4
1286+ vld1.64 {d6}, [u,:64], cw @ u2
1287+ pld [y, #64]
1288+ vld1.64 {d4, d5}, [y,:128], yw @ y1
1289+ pld [v, #64]
1290+ vld1.64 {d7}, [v,:64], cw @ v2
1291+ pld [y, #64]
1292+ vld1.64 {d16,d17}, [y,:128], yw @ y2
1293+ vzip.8 d6, d7 @ u2v2
1294+ pld [u, #64]
1295+ vld1.64 {d22}, [u,:64], cw @ u4
1296+ pld [v, #64]
1297+ vld1.64 {d23}, [v,:64], cw @ v4
1298+ pld [y, #64]
1299+ vld1.64 {d20,d21}, [y,:128], yw @ y3
1300+ vmov q9, q3 @ u2v2
1301+ vzip.8 d22, d23 @ u4v4
1302+ vrhadd.u8 q3, q1, q3 @ u1v1
1303+ vzip.8 q0, q1 @ y0u0y0v0
1304+ vmov q12, q11 @ u4v4
1305+ vzip.8 q2, q3 @ y1u1y1v1
1306+ vrhadd.u8 q11, q9, q11 @ u3v3
1307+ vst1.64 {d0-d3}, [yuv,:128], dw @ y0u0y0v0
1308+ vzip.8 q8, q9 @ y2u2y2v2
1309+ vst1.64 {d4-d7}, [yuv,:128], dw @ y1u1y1v1
1310+ vzip.8 q10, q11 @ y3u3y3v3
1311+ vst1.64 {d16-d19}, [yuv,:128], dw @ y2u2y2v2
1312+ vmov q1, q12
1313+ vst1.64 {d20-d23}, [yuv,:128], dw @ y3u3y3v3
1314+ bgt 2b
1315+ subs w, w, #16
1316+ add yuv, tyuv, #32
1317+ add y, ty, #16
1318+ add u, tu, #8
1319+ add v, tv, #8
1320+ bgt 1b
1321+
1322+ ldr w, [sp, #36]
1323+ subs h, h, #16
1324+ add yuv, yuv, dw, lsl #4
1325+ sub yuv, yuv, w, lsl #1
1326+ add y, y, yw, lsl #4
1327+ sub y, y, w
1328+ add u, u, cw, lsl #3
1329+ sub u, u, w, asr #1
1330+ add v, v, cw, lsl #3
1331+ sub v, v, w, asr #1
1332+ bgt 1b
1333+
1334+ pop {r4-r11,pc}
1335+ .endfunc
1336+
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch
deleted file mode 100644
index eb7181be..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0003-Support-setting-the-display-framerate-directly-when-.patch
+++ /dev/null
@@ -1,86 +0,0 @@
1From fb4dabcac144fcf1a7e9b1eba0114b2eed594d05 Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Thu, 26 Aug 2010 11:12:39 -0500
4Subject: [PATCH 3/8] Support setting the display framerate directly when possible.
5
6If can_set_display_framerate is set to true, TIDmaiVideoSink will attempt to
7set the display framerate directly in DMAI, instead of trying to simulate the
8desired framerate by occasionally repeating frames.
9
10Platforms that support this will need to enable it explicitly.
11---
12 .../ticodecplugin/src/gsttidmaivideosink.c | 24 ++++++++++++++++++++
13 .../ticodecplugin/src/gsttidmaivideosink.h | 1 +
14 2 files changed, 25 insertions(+), 0 deletions(-)
15
16diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
17index c87b89c..4e327ae 100644
18--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
19+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
20@@ -442,6 +442,7 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
21 dmaisink->numBufs = -1;
22 dmaisink->framerepeat = 0;
23 dmaisink->repeat_with_refresh = FALSE;
24+ dmaisink->can_set_display_framerate = FALSE;
25 dmaisink->rotation = -1;
26 dmaisink->tempDmaiBuf = NULL;
27 dmaisink->accelFrameCopy = TRUE;
28@@ -952,6 +953,9 @@ static void gst_tidmaivideosink_check_set_framerate(GstTIDmaiVideoSink * sink)
29 * then 1 is returned to indicate that there will be no frame
30 * repeating.
31 *
32+ * If the driver supports explicit configuration of the framerate, we
33+ * don't ever need to repeat frames, and 1 is returned.
34+ *
35 ******************************************************************************/
36 static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
37 {
38@@ -959,6 +963,13 @@ static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
39
40 GST_DEBUG("Begin\n");
41
42+ /* If the display allows you to configure the frame rate, we never need
43+ * to repeat a frame.
44+ */
45+ if (sink->can_set_display_framerate) {
46+ return 1;
47+ }
48+
49 /* Divide the native framerate by the desired framerate. If the result
50 * is a whole number, return it. Otherwise return 1 -- we don't support
51 * fractional repeat rates. */
52@@ -1151,6 +1162,19 @@ static gboolean gst_tidmaivideosink_set_display_attrs(GstTIDmaiVideoSink *sink,
53 sink->dAttrs.displayDevice = sink->displayDevice == NULL ?
54 sink->dAttrs.displayDevice : sink->displayDevice;
55
56+ /* Specify framerate if supported by DMAI and the display driver */
57+ if (sink->can_set_display_framerate) {
58+ #if defined (Platform_dm365)
59+ sink->dAttrs.forceFrameRateNum =
60+ gst_value_get_fraction_numerator(&sink->iattrs.framerate);
61+ sink->dAttrs.forceFrameRateDen =
62+ gst_value_get_fraction_denominator(&sink->iattrs.framerate);
63+ #else
64+ GST_ERROR("setting driver framerate is not supported\n");
65+ return FALSE;
66+ #endif
67+ }
68+
69 /* Set rotation on OMAP35xx */
70 if (sink->cpu_dev == Cpu_Device_OMAP3530) {
71 sink->dAttrs.rotation = sink->rotation == -1 ?
72diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
73index 5d13e08..4800fcd 100644
74--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
75+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
76@@ -124,6 +124,7 @@ struct _GstTIDmaiVideoSink {
77 */
78 int framerepeat;
79 gboolean repeat_with_refresh;
80+ gboolean can_set_display_framerate;
81 gboolean signal_handoffs;
82
83 /* Hardware accelerated copy */
84--
851.7.0.4
86
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch
deleted file mode 100644
index 229c4521..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0004-Cosmetic-cleanup-clarify-some-comments.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From 03ab3ad3f790dde2dbddfeb62001e8610dbb919a Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Thu, 26 Aug 2010 18:25:56 -0500
4Subject: [PATCH 4/8] Cosmetic cleanup / clarify some comments.
5
6---
7 .../ticodecplugin/src/gsttidmaivideosink.c | 42 ++++++++-----------
8 1 files changed, 18 insertions(+), 24 deletions(-)
9
10diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
11index 4e327ae..1d04e1c 100644
12--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
13+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
14@@ -434,23 +434,23 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
15 * Anything that has a NULL value will be initialized with DMAI defaults
16 * in the gst_tidmaivideosink_init_display function.
17 */
18- dmaisink->displayStd = NULL;
19- dmaisink->displayDevice = NULL;
20- dmaisink->dGfxAttrs = defaultGfxAttrs;
21- dmaisink->videoStd = NULL;
22- dmaisink->videoOutput = NULL;
23- dmaisink->numBufs = -1;
24- dmaisink->framerepeat = 0;
25- dmaisink->repeat_with_refresh = FALSE;
26+ dmaisink->displayStd = NULL;
27+ dmaisink->displayDevice = NULL;
28+ dmaisink->dGfxAttrs = defaultGfxAttrs;
29+ dmaisink->videoStd = NULL;
30+ dmaisink->videoOutput = NULL;
31+ dmaisink->numBufs = -1;
32+ dmaisink->framerepeat = 0;
33+ dmaisink->repeat_with_refresh = FALSE;
34 dmaisink->can_set_display_framerate = FALSE;
35- dmaisink->rotation = -1;
36- dmaisink->tempDmaiBuf = NULL;
37- dmaisink->accelFrameCopy = TRUE;
38- dmaisink->autoselect = FALSE;
39- dmaisink->prevVideoStd = 0;
40- dmaisink->useUserptrBufs = FALSE;
41- dmaisink->hideOSD = FALSE;
42- dmaisink->hDispBufTab = NULL;
43+ dmaisink->rotation = -1;
44+ dmaisink->tempDmaiBuf = NULL;
45+ dmaisink->accelFrameCopy = TRUE;
46+ dmaisink->autoselect = FALSE;
47+ dmaisink->prevVideoStd = 0;
48+ dmaisink->useUserptrBufs = FALSE;
49+ dmaisink->hideOSD = FALSE;
50+ dmaisink->hDispBufTab = NULL;
51
52 dmaisink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
53
54@@ -947,14 +947,8 @@ static void gst_tidmaivideosink_check_set_framerate(GstTIDmaiVideoSink * sink)
55 /******************************************************************************
56 * gst_tidmaivideosink_get_framerepeat
57 *
58- * This function will look at the output display frame rate and the
59- * input frame rate and determine how many times a frame should be
60- * repeated. If the output is not an integer multiple of the input
61- * then 1 is returned to indicate that there will be no frame
62- * repeating.
63- *
64- * If the driver supports explicit configuration of the framerate, we
65- * don't ever need to repeat frames, and 1 is returned.
66+ * Return how many times a frame should be repeated to support a
67+ * framerate lower than the display's native speed.
68 *
69 ******************************************************************************/
70 static int gst_tidmaivideosink_get_framerepeat(GstTIDmaiVideoSink * sink)
71--
721.7.0.4
73
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch
deleted file mode 100644
index e4059577..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0005-Enable-setting-the-framerate-directly-on-DM365.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 1cffa12c9ceb07558d2e4b35cc674070c7a3b8ee Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Thu, 26 Aug 2010 18:27:50 -0500
4Subject: [PATCH 5/8] Enable setting the framerate directly on DM365.
5
6This is supported by recent changes to the display driver. DM365 will no
7longer use the "repeat_with_refresh" method to display frames more than once.
8---
9 .../ticodecplugin/src/gsttidmaivideosink.c | 7 ++-----
10 1 files changed, 2 insertions(+), 5 deletions(-)
11
12diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
13index 1d04e1c..3615bfd 100644
14--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
15+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
16@@ -475,12 +475,9 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
17 g_assert(GST_VALUE_HOLDS_FRACTION(&dmaisink->oattrs.framerate));
18 gst_value_set_fraction(&dmaisink->oattrs.framerate, 0, 1);
19
20- /* On DM365, we don't have the bandwidth to copy a frame multiple times to
21- * display them more than once. We must put a frame to the display once
22- * and let it be refreshed multiple times.
23- */
24+ /* DM365 supports setting the display framerate */
25 #if defined(Platform_dm365)
26- dmaisink->repeat_with_refresh = TRUE;
27+ dmaisink->can_set_display_framerate = TRUE;
28 #endif
29
30 gst_tidmaivideosink_init_env(dmaisink);
31--
321.7.0.4
33
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch
deleted file mode 100644
index 4055d0b5..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0006-Remove-the-repeat_with_refresh-feature.patch
+++ /dev/null
@@ -1,132 +0,0 @@
1From c1205a792fd519cdebc32c00a5f604ccd78d3eac Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Thu, 26 Aug 2010 18:30:13 -0500
4Subject: [PATCH 6/8] Remove the "repeat_with_refresh" feature.
5
6No platforms are using it any longer.
7---
8 .../ticodecplugin/src/gsttidmaivideosink.c | 67 +-------------------
9 .../ticodecplugin/src/gsttidmaivideosink.h | 1 -
10 2 files changed, 1 insertions(+), 67 deletions(-)
11
12diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
13index 3615bfd..0125ed2 100644
14--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
15+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
16@@ -170,8 +170,6 @@ static gboolean
17 gst_tidmaivideosink_event(GstBaseSink * bsink, GstEvent * event);
18 static void
19 gst_tidmaivideosink_init_env(GstTIDmaiVideoSink *sink);
20-static int
21- gst_tidmaivideosink_videostd_get_refresh_latency(VideoStd_Type videoStd);
22 static gboolean
23 gst_tidmaivideosink_alloc_display_buffers(GstTIDmaiVideoSink * sink,
24 Int32 bufSize);
25@@ -441,7 +439,6 @@ static void gst_tidmaivideosink_init(GstTIDmaiVideoSink * dmaisink,
26 dmaisink->videoOutput = NULL;
27 dmaisink->numBufs = -1;
28 dmaisink->framerepeat = 0;
29- dmaisink->repeat_with_refresh = FALSE;
30 dmaisink->can_set_display_framerate = FALSE;
31 dmaisink->rotation = -1;
32 dmaisink->tempDmaiBuf = NULL;
33@@ -755,55 +752,6 @@ static int gst_tidmaivideosink_videostd_get_attrs(VideoStd_Type videoStd,
34
35
36 /*******************************************************************************
37- * gst_tidmaivideosink_videostd_get_refresh_latency
38- *
39- * Return the refresh latency in us for the given display standard.
40-*******************************************************************************/
41-static int gst_tidmaivideosink_videostd_get_refresh_latency(
42- VideoStd_Type videoStd)
43-{
44- switch (videoStd) {
45- case VideoStd_1080P_24:
46- return 41667;
47-
48- case VideoStd_SIF_PAL:
49- case VideoStd_D1_PAL:
50- case VideoStd_1080P_25:
51- case VideoStd_1080I_25:
52- return 40000;
53-
54- case VideoStd_CIF:
55- case VideoStd_SIF_NTSC:
56- case VideoStd_D1_NTSC:
57- return 33367;
58-
59- case VideoStd_1080I_30:
60- case VideoStd_1080P_30:
61- return 33333;
62-
63- case VideoStd_576P:
64- case VideoStd_720P_50:
65- return 20000;
66-
67- case VideoStd_480P:
68- case VideoStd_720P_60:
69- #if defined(Platform_dm6467t)
70- case VideoStd_1080P_60:
71- #endif
72- return 16667;
73-
74- case VideoStd_VGA:
75- return 16667;
76-
77- default:
78- break;
79- }
80- GST_ERROR("Unknown videoStd entered (VideoStd = %d)\n", videoStd);
81- return 0;
82-}
83-
84-
85-/*******************************************************************************
86 * gst_tidmaivideosink_find_videostd
87 *
88 * This function will take in a VideoStd_Attrs structure and find the
89@@ -1580,10 +1528,7 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
90
91 /* Display the frame as many times as specified by framerepeat. By
92 * default, the input buffer is copied to a display buffer for each time
93- * it is to be repeated. However, if repeat_with_refresh is TRUE, then
94- * the platform doesn't have the bandwidth for multiple copies. In this
95- * case we copy and display the input buffer only once, but let it refresh
96- * multiple times.
97+ * it is to be repeated.
98 */
99 for (i = 0; i < sink->framerepeat; i++) {
100
101@@ -1594,16 +1539,6 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
102 goto cleanup;
103 }
104
105- /* If repeat_with_refresh was specified, wait for the display to
106- * refresh framerepeat-1 times to make sure it has finished displaying
107- * this buffer before we write new data into it.
108- */
109- while (sink->repeat_with_refresh && i < (sink->framerepeat-1)) {
110- usleep(gst_tidmaivideosink_videostd_get_refresh_latency(
111- sink->dAttrs.videoStd) + 1);
112- i++;
113- }
114-
115 /* Retrieve the dimensions of the display buffer */
116 BufferGfx_getDimensions(hDispBuf, &dim);
117 GST_LOG("Display size %dx%d pitch %d\n",
118diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
119index 4800fcd..2a28e4f 100644
120--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
121+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.h
122@@ -123,7 +123,6 @@ struct _GstTIDmaiVideoSink {
123 * should be repeated to match the display output frame rate.
124 */
125 int framerepeat;
126- gboolean repeat_with_refresh;
127 gboolean can_set_display_framerate;
128 gboolean signal_handoffs;
129
130--
1311.7.0.4
132
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch
deleted file mode 100644
index 863bd34d..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0007-Add-support-for-pad-allocated-buffers-in-TIDmaiVideo.patch
+++ /dev/null
@@ -1,313 +0,0 @@
1From 108fa0bb550f9b7355bfd5ae5340220fd1a4c9b5 Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Thu, 5 Aug 2010 15:09:54 -0500
4Subject: [PATCH 7/8] Add support for pad-allocated buffers in TIDmaiVideoSink.
5
6This feature is currently only tested and enabled for DM365.
7---
8 .../ticodecplugin/src/gsttidmaibuffertransport.c | 4 +-
9 .../ticodecplugin/src/gsttidmaibuffertransport.h | 6 +-
10 .../ticodecplugin/src/gsttidmaivideosink.c | 197 ++++++++++++++++++--
11 3 files changed, 191 insertions(+), 16 deletions(-)
12
13diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
14index 5fad371..9c69285 100644
15--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
16+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.c
17@@ -136,8 +136,8 @@ static void gst_tidmaibuffertransport_finalize(GstBuffer *gstbuffer)
18 */
19 if (Buffer_getBufTab(self->dmaiBuffer) != NULL) {
20 GST_LOG("clearing GStreamer useMask bit\n");
21- Buffer_freeUseMask(self->dmaiBuffer,
22- gst_tidmaibuffer_GST_FREE);
23+ Buffer_freeUseMask(self->dmaiBuffer, gst_tidmaibuffer_GST_FREE);
24+ Buffer_freeUseMask(self->dmaiBuffer, gst_tidmaibuffer_VIDEOSINK_FREE);
25 } else {
26 GST_LOG("calling Buffer_delete()\n");
27 Buffer_delete(self->dmaiBuffer);
28diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
29index 0265e70..20945f3 100644
30--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
31+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaibuffertransport.h
32@@ -52,8 +52,10 @@ G_BEGIN_DECLS
33 GstTIDmaiBufferTransportClass))
34
35 /* Use mask flags that keep track of where buffer is in use */
36-#define gst_tidmaibuffer_GST_FREE 0x1
37-#define gst_tidmaibuffer_CODEC_FREE 0x2
38+#define gst_tidmaibuffer_GST_FREE 0x1
39+#define gst_tidmaibuffer_CODEC_FREE 0x2
40+#define gst_tidmaibuffer_VIDEOSINK_FREE 0x4
41+#define gst_tidmaibuffer_DISPLAY_FREE 0x8
42
43 typedef struct _GstTIDmaiBufferTransport GstTIDmaiBufferTransport;
44 typedef struct _GstTIDmaiBufferTransportClass GstTIDmaiBufferTransportClass;
45diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
46index 0125ed2..7b84a8e 100644
47--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
48+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttidmaivideosink.c
49@@ -151,6 +151,9 @@ static GstStateChangeReturn
50 gst_tidmaivideosink_change_state(GstElement * element,
51 GstStateChange transition);
52 static GstFlowReturn
53+ gst_tidmaivideosink_buffer_alloc(GstBaseSink * bsink, guint64 offset,
54+ guint size, GstCaps * caps, GstBuffer ** buf);
55+static GstFlowReturn
56 gst_tidmaivideosink_preroll(GstBaseSink * bsink, GstBuffer * buffer);
57 static int
58 gst_tidmaivideosink_videostd_get_attrs(VideoStd_Type videoStd,
59@@ -353,6 +356,13 @@ static void gst_tidmaivideosink_class_init(GstTIDmaiVideoSinkClass * klass)
60 GST_DEBUG_FUNCPTR(gst_tidmaivideosink_preroll);
61 gstbase_sink_class->render =
62 GST_DEBUG_FUNCPTR(gst_tidmaivideosink_render);
63+ gstbase_sink_class->buffer_alloc =
64+ GST_DEBUG_FUNCPTR(gst_tidmaivideosink_buffer_alloc);
65+
66+ /* Pad-buffer allocation is currently only supported for DM365 */
67+ #if !defined(Platform_dm365)
68+ gstbase_sink_class->buffer_alloc = NULL;
69+ #endif
70 }
71
72
73@@ -663,6 +673,132 @@ static gboolean gst_tidmaivideosink_event(GstBaseSink * bsink,
74
75
76 /******************************************************************************
77+ * gst_tidmaivideosink_buffer_alloc
78+ ******************************************************************************/
79+static GstFlowReturn gst_tidmaivideosink_buffer_alloc(GstBaseSink * bsink,
80+ guint64 offset, guint size, GstCaps * caps,
81+ GstBuffer ** buf)
82+{
83+ GstTIDmaiVideoSink *dmaisink = GST_TIDMAIVIDEOSINK(bsink);
84+ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
85+ gboolean alloc_unref = FALSE;
86+ Buffer_Handle hDispBuf = NULL;
87+ GstCaps *alloc_caps;
88+
89+ *buf = NULL;
90+
91+ GST_LOG_OBJECT(dmaisink,
92+ "a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT
93+ " and offset %" G_GUINT64_FORMAT, size, caps, offset);
94+
95+ /* assume we're going to alloc what was requested, keep track of wheter we
96+ * need to unref or not. When we suggest a new format upstream we will
97+ * create a new caps that we need to unref. */
98+ alloc_caps = caps;
99+
100+ /* Process the buffer caps */
101+ if (!gst_tidmaivideosink_process_caps(bsink, alloc_caps)) {
102+ return GST_FLOW_UNEXPECTED;
103+ }
104+
105+ /* Pad buffer allocation requires that we use user-allocated display
106+ * buffers.
107+ */
108+ if (!dmaisink->useUserptrBufs && dmaisink->hDisplay) {
109+ GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
110+ ("Cannot use pad buffer allocation after mmap buffers already "
111+ "in use\n"), (NULL));
112+ return GST_FLOW_UNEXPECTED;
113+ }
114+ else {
115+ dmaisink->useUserptrBufs = TRUE;
116+ }
117+
118+ /* Allocate the display buffers */
119+ if (!dmaisink->hDispBufTab && dmaisink->useUserptrBufs) {
120+
121+ /* Set the display attributes now so we can allocate display buffers */
122+ if (!gst_tidmaivideosink_set_display_attrs(dmaisink,
123+ dmaisink->dGfxAttrs.colorSpace)) {
124+ GST_ERROR("Error while trying to set the display attributes\n");
125+ return GST_FLOW_UNEXPECTED;
126+ }
127+
128+ if (!gst_tidmaivideosink_alloc_display_buffers(dmaisink, size)) {
129+ GST_ERROR("Failed to allocate display buffers");
130+ return GST_FLOW_UNEXPECTED;
131+ }
132+ }
133+
134+ /* Get a buffer from the BufTab or display driver */
135+ if (!(hDispBuf = gst_tidmaibuftab_get_buf(dmaisink->hDispBufTab))) {
136+ if (dmaisink->hDisplay &&
137+ Display_get(dmaisink->hDisplay, &hDispBuf) < 0) {
138+ GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
139+ ("Failed to get display buffer\n"), (NULL));
140+ return GST_FLOW_UNEXPECTED;
141+ }
142+ }
143+
144+ /* If the geometry doesn't match, generate a new caps for it */
145+ Buffer_getAttrs(hDispBuf, BufferGfx_getBufferAttrs(&gfxAttrs));
146+
147+ if (gfxAttrs.dim.width != dmaisink->dGfxAttrs.dim.width ||
148+ gfxAttrs.dim.height != dmaisink->dGfxAttrs.dim.height ||
149+ gfxAttrs.colorSpace != dmaisink->dGfxAttrs.colorSpace) {
150+
151+ GstCaps *desired_caps;
152+ GstStructure *desired_struct;
153+
154+ /* make a copy of the incomming caps to create the new suggestion. We
155+ * can't use make_writable because we might then destroy the original
156+ * caps which we still need when the peer does not accept the
157+ * suggestion.
158+ */
159+ desired_caps = gst_caps_copy (caps);
160+ desired_struct = gst_caps_get_structure (desired_caps, 0);
161+
162+ GST_DEBUG ("we prefer to receive a %ldx%ld video; %ldx%ld was requested",
163+ gfxAttrs.dim.width, gfxAttrs.dim.height,
164+ dmaisink->dGfxAttrs.dim.width, dmaisink->dGfxAttrs.dim.height);
165+ gst_structure_set (desired_struct, "width", G_TYPE_INT,
166+ gfxAttrs.dim.width, NULL);
167+ gst_structure_set (desired_struct, "height", G_TYPE_INT,
168+ gfxAttrs.dim.height, NULL);
169+
170+ if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (dmaisink),
171+ desired_caps)) {
172+ alloc_caps = desired_caps;
173+ alloc_unref = TRUE;
174+
175+ if (!gst_tidmaivideosink_process_caps(bsink, alloc_caps)) {
176+ return GST_FLOW_UNEXPECTED;
177+ }
178+ GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
179+ desired_caps);
180+ }
181+ else {
182+ GST_DEBUG ("peer pad does not accept our desired caps %"
183+ GST_PTR_FORMAT, desired_caps);
184+ }
185+ }
186+
187+ /* Return the display buffer */
188+ BufferGfx_resetDimensions(hDispBuf);
189+ Buffer_freeUseMask(hDispBuf, gst_tidmaibuffer_DISPLAY_FREE);
190+ *buf = gst_tidmaibuffertransport_new(hDispBuf, NULL);
191+ gst_buffer_set_caps(*buf, alloc_caps);
192+
193+ /* If we allocated new caps, unref them now */
194+ if (alloc_unref) {
195+ gst_caps_unref (alloc_caps);
196+ }
197+
198+ return GST_FLOW_OK;
199+}
200+
201+
202+/******************************************************************************
203 * gst_tidmaivideosink_preroll
204 ******************************************************************************/
205 static GstFlowReturn gst_tidmaivideosink_preroll(GstBaseSink * bsink,
206@@ -1282,6 +1418,18 @@ static gboolean gst_tidmaivideosink_init_display(GstTIDmaiVideoSink * sink)
207 return FALSE;
208 }
209
210+ /* If we own the display buffers, tell DMAI to delay starting the
211+ * display until we call Display_put for the first time.
212+ */
213+ if (sink->hDispBufTab) {
214+ #if defined(Platform_dm365)
215+ sink->dAttrs.delayStreamon = TRUE;
216+ #else
217+ GST_ERROR("delayed V4L2 streamon not supported\n");
218+ return FALSE;
219+ #endif
220+ }
221+
222 /* Allocate user-allocated display buffers, if requested */
223 if (!sink->hDispBufTab && sink->useUserptrBufs) {
224 if (!gst_tidmaivideosink_alloc_display_buffers(sink, 0)) {
225@@ -1416,9 +1564,6 @@ static gboolean gst_tidmaivideosink_process_caps(GstBaseSink * bsink,
226 gst_structure_get_fraction(structure, "framerate", &framerateNum,
227 &framerateDen);
228
229- /* Error check new values against existing ones */
230- /* TBD */
231-
232 /* Populate the display graphics attributes */
233 dmaisink->dGfxAttrs.bAttrs.reference = dmaisink->contiguousInputFrame;
234 dmaisink->dGfxAttrs.dim.width = width;
235@@ -1445,9 +1590,10 @@ static gboolean gst_tidmaivideosink_process_caps(GstBaseSink * bsink,
236 static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
237 GstBuffer * buf)
238 {
239- Buffer_Handle hDispBuf = NULL;
240- Buffer_Handle inBuf = NULL;
241- GstTIDmaiVideoSink *sink = GST_TIDMAIVIDEOSINK(bsink);
242+ Buffer_Handle hDispBuf = NULL;
243+ Buffer_Handle inBuf = NULL;
244+ gboolean inBufIsOurs = FALSE;
245+ GstTIDmaiVideoSink *sink = GST_TIDMAIVIDEOSINK(bsink);
246 BufferGfx_Dimensions dim;
247 gchar dur_str[64];
248 gchar ts_str[64];
249@@ -1470,7 +1616,10 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
250 * generated via videotestsrc plugin.
251 */
252 if (GST_IS_TIDMAIBUFFERTRANSPORT(buf)) {
253- inBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(buf);
254+ inBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(buf);
255+ inBufIsOurs = (sink->hDispBufTab &&
256+ GST_TIDMAIBUFTAB_BUFTAB(sink->hDispBufTab) ==
257+ Buffer_getBufTab(inBuf));
258 } else {
259 /* allocate DMAI buffer */
260 if (sink->tempDmaiBuf == NULL) {
261@@ -1532,11 +1681,33 @@ static GstFlowReturn gst_tidmaivideosink_render(GstBaseSink * bsink,
262 */
263 for (i = 0; i < sink->framerepeat; i++) {
264
265- /* Get a buffer from the display driver */
266- if (Display_get(sink->hDisplay, &hDispBuf) < 0) {
267- GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
268- ("Failed to get display buffer\n"), (NULL));
269- goto cleanup;
270+ /* If the input buffer originated from this element via pad allocation,
271+ * simply give it back to the display and continue.
272+ */
273+ if (inBufIsOurs) {
274+
275+ /* Mark buffer as in-use by the display so it can't be re-used
276+ * until it comes back from Display_get */
277+ Buffer_setUseMask(inBuf, Buffer_getUseMask(inBuf) |
278+ gst_tidmaibuffer_DISPLAY_FREE);
279+
280+ if (Display_put(sink->hDisplay, inBuf) < 0) {
281+ GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
282+ ("Failed to put display buffer\n"), (NULL));
283+ goto cleanup;
284+ }
285+ continue;
286+ }
287+
288+ /* Otherwise, our input buffer originated from up-stream. Retrieve a
289+ * display buffer to copy the contents into.
290+ */
291+ else {
292+ if (Display_get(sink->hDisplay, &hDispBuf) < 0) {
293+ GST_ELEMENT_ERROR(sink, RESOURCE, FAILED,
294+ ("Failed to get display buffer\n"), (NULL));
295+ goto cleanup;
296+ }
297 }
298
299 /* Retrieve the dimensions of the display buffer */
300@@ -1844,8 +2015,10 @@ static gboolean gst_tidmaivideosink_alloc_display_buffers(
301 gfxAttrs.dim.height, gfxAttrs.dim.lineLength, gfxAttrs.colorSpace);
302 }
303
304+ gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_VIDEOSINK_FREE;
305 sink->hDispBufTab = gst_tidmaibuftab_new(sink->dAttrs.numBufs, bufSize,
306 BufferGfx_getBufferAttrs(&gfxAttrs));
307+ gst_tidmaibuftab_set_blocking(sink->hDispBufTab, FALSE);
308
309 return TRUE;
310 }
311--
3121.7.0.4
313
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch
deleted file mode 100644
index 9ceb30f5..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0008-Add-support-for-pad-allocated-buffers-in-TIViddec2.patch
+++ /dev/null
@@ -1,302 +0,0 @@
1From e5a264465c1c77d5fc18eeb51b99c79fc3f28a3e Mon Sep 17 00:00:00 2001
2From: Don Darling <don.osc2@gmail.com>
3Date: Tue, 8 Jun 2010 13:48:51 -0500
4Subject: [PATCH 8/8] Add support for pad-allocated buffers in TIViddec2.
5
6When padAllocOutbufs=TRUE is specified to the TIViddec2 element, it will
7attempt to allocate buffers from downstream instead of allocating its own.
8
9Downstream buffers will only be used if it can be determined that they are
10all members of a DMAI BufTab, which means they are CMEM-based, and will work
11with the codecs. Currently, the only known downstream element that can provide
12these buffers is TIDmaiVideoSink, and it is only supported for DM365.
13
14There is currently no support for centering small clips in the middle of the
15display screen -- this would require additional support in the display driver.
16As a result, pad-allocation can currently only be used with clips that are at
17least as large as the display, and this feature not enabled by default because
18of these strict clip-size requirements.
19
20On DM365, there are known issues with the MPEG-2 decoder's output buffer size
21calculation that cause it not to work with D1 resolutions unless you hard-code
22the size. H.264 and MPEG-4 decoders work as expected, and MPEG-2 works as
23expected for 720p.
24---
25 .../ti_build/ticodecplugin/src/gsttividdec2.c | 159 ++++++++++++++++----
26 .../ti_build/ticodecplugin/src/gsttividdec2.h | 1 +
27 2 files changed, 127 insertions(+), 33 deletions(-)
28
29diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
30index c39208f..ec3cb05 100644
31--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
32+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.c
33@@ -73,7 +73,8 @@ enum
34 PROP_FRAMERATE, /* framerate (GstFraction) */
35 PROP_DISPLAY_BUFFER, /* displayBuffer (boolean) */
36 PROP_GEN_TIMESTAMPS, /* genTimeStamps (boolean) */
37- PROP_RTCODECTHREAD /* rtCodecThread (boolean) */
38+ PROP_RTCODECTHREAD, /* rtCodecThread (boolean) */
39+ PROP_PAD_ALLOC_OUTBUFS /* padAllocOutbufs (boolean) */
40 };
41
42 /* Define sink (input) pad capabilities. Currently, MPEG and H264 are
43@@ -170,8 +171,8 @@ static GstClockTime
44 gst_tividdec2_frame_duration(GstTIViddec2 *viddec2);
45 static gboolean
46 gst_tividdec2_resizeBufTab(GstTIViddec2 *viddec2);
47-static gboolean
48- gst_tividdec2_codec_start (GstTIViddec2 *viddec2);
49+static gboolean
50+ gst_tividdec2_codec_start (GstTIViddec2 *viddec2, GstBuffer **padBuffer);
51 static gboolean
52 gst_tividdec2_codec_stop (GstTIViddec2 *viddec2);
53 static void
54@@ -324,6 +325,11 @@ static void gst_tividdec2_class_init(GstTIViddec2Class *klass)
55 g_param_spec_boolean("genTimeStamps", "Generate Time Stamps",
56 "Set timestamps on output buffers",
57 TRUE, G_PARAM_WRITABLE));
58+
59+ g_object_class_install_property(gobject_class, PROP_PAD_ALLOC_OUTBUFS,
60+ g_param_spec_boolean("padAllocOutbufs", "Use pad allocation",
61+ "Try to allocate buffers with pad allocation",
62+ FALSE, G_PARAM_WRITABLE));
63 }
64
65 /******************************************************************************
66@@ -448,6 +454,7 @@ static void gst_tividdec2_init(GstTIViddec2 *viddec2, GstTIViddec2Class *gclass)
67
68 viddec2->numOutputBufs = 0UL;
69 viddec2->hOutBufTab = NULL;
70+ viddec2->padAllocOutbufs = FALSE;
71 viddec2->circBuf = NULL;
72
73 viddec2->sps_pps_data = NULL;
74@@ -548,6 +555,10 @@ static void gst_tividdec2_set_property(GObject *object, guint prop_id,
75 viddec2->rtCodecThread = g_value_get_boolean(value);
76 GST_LOG("setting \"RTCodecThread\" to \"%s\"\n",
77 viddec2->rtCodecThread ? "TRUE" : "FALSE");
78+ case PROP_PAD_ALLOC_OUTBUFS:
79+ viddec2->padAllocOutbufs = g_value_get_boolean(value);
80+ GST_LOG("setting \"padAllocOutbufs\" to \"%s\"\n",
81+ viddec2->padAllocOutbufs ? "TRUE" : "FALSE");
82 break;
83 default:
84 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
85@@ -1079,9 +1090,9 @@ static gboolean gst_tividdec2_init_video(GstTIViddec2 *viddec2)
86 */
87 Rendezvous_meet(viddec2->waitOnDecodeThread);
88
89- if (viddec2->circBuf == NULL || viddec2->hOutBufTab == NULL) {
90+ if (viddec2->circBuf == NULL) {
91 GST_ELEMENT_ERROR(viddec2, RESOURCE, FAILED,
92- ("decode thread failed to create circbuf or display buffer handles\n"),
93+ ("decode thread failed to create circbuf handles\n"),
94 (NULL));
95 return FALSE;
96 }
97@@ -1260,11 +1271,13 @@ static gboolean gst_tividdec2_codec_stop (GstTIViddec2 *viddec2)
98 * gst_tividdec2_codec_start
99 * Initialize codec engine
100 *****************************************************************************/
101-static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2)
102+static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2,
103+ GstBuffer **padBuffer)
104 {
105- VIDDEC2_Params params = Vdec2_Params_DEFAULT;
106- VIDDEC2_DynamicParams dynParams = Vdec2_DynamicParams_DEFAULT;
107- BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
108+ VIDDEC2_Params params = Vdec2_Params_DEFAULT;
109+ VIDDEC2_DynamicParams dynParams = Vdec2_DynamicParams_DEFAULT;
110+ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
111+ BufTab_Handle codecBufTab = NULL;
112 Cpu_Device device;
113 ColorSpace_Type colorSpace;
114 Int defaultNumBufs;
115@@ -1364,30 +1377,77 @@ static gboolean gst_tividdec2_codec_start (GstTIViddec2 *viddec2)
116 viddec2->numOutputBufs = defaultNumBufs;
117 }
118
119- /* Create codec output buffers */
120- GST_LOG("creating output buffer table\n");
121- gfxAttrs.colorSpace = colorSpace;
122- gfxAttrs.dim.width = params.maxWidth;
123- gfxAttrs.dim.height = params.maxHeight;
124- gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(
125- gfxAttrs.dim.width, gfxAttrs.colorSpace);
126+ /* Try to allocate a buffer from downstream. To do this, we must first
127+ * set the framerate to a reasonable default if one hasn't been specified,
128+ * and we need to set the source pad caps with the stream information we
129+ * have so far.
130+ */
131+ gst_tividdec2_frame_duration(viddec2);
132+ gst_tividdec2_set_source_caps_base(viddec2, params.maxWidth,
133+ params.maxHeight, colorSpace);
134+
135+ *padBuffer = NULL;
136+ if (viddec2->padAllocOutbufs) {
137+ if (gst_pad_alloc_buffer(viddec2->srcpad, 0,
138+ Vdec2_getOutBufSize(viddec2->hVd), GST_PAD_CAPS(viddec2->srcpad),
139+ padBuffer) != GST_FLOW_OK) {
140+ GST_LOG("failed to allocate a downstream buffer\n");
141+ *padBuffer = NULL;
142+ }
143+
144+ if (*padBuffer && !GST_IS_TIDMAIBUFFERTRANSPORT(*padBuffer)) {
145+ GST_LOG("downstream buffer is not a DMAI buffer; disabling use of "
146+ "pad-allocated buffers\n");
147+ gst_buffer_unref(*padBuffer);
148+ *padBuffer = NULL;
149+ }
150+
151+ if (*padBuffer) {
152+ codecBufTab = Buffer_getBufTab(
153+ GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(*padBuffer));
154+
155+ if (!codecBufTab) {
156+ GST_LOG("downstream buffer is not a BufTab member; disabling "
157+ "use of pad-allocated buffers\n");
158+ gst_buffer_unref(*padBuffer);
159+ *padBuffer = NULL;
160+ }
161+ }
162+ }
163+
164+ /* If we can't use pad-allocated buffers, allocate our own BufTab for
165+ * output buffers to push downstream.
166+ */
167+ if (!(*padBuffer)) {
168+
169+ GST_LOG("creating output buffer table\n");
170+ gfxAttrs.colorSpace = colorSpace;
171+ gfxAttrs.dim.width = params.maxWidth;
172+ gfxAttrs.dim.height = params.maxHeight;
173+ gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(
174+ gfxAttrs.dim.width, gfxAttrs.colorSpace);
175
176- /* By default, new buffers are marked as in-use by the codec */
177- gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_CODEC_FREE;
178+ /* By default, new buffers are marked as in-use by the codec */
179+ gfxAttrs.bAttrs.useMask = gst_tidmaibuffer_CODEC_FREE;
180
181- viddec2->hOutBufTab = gst_tidmaibuftab_new(
182- viddec2->numOutputBufs, Vdec2_getOutBufSize(viddec2->hVd),
183- BufferGfx_getBufferAttrs(&gfxAttrs));
184+ viddec2->hOutBufTab = gst_tidmaibuftab_new(
185+ viddec2->numOutputBufs, Vdec2_getOutBufSize(viddec2->hVd),
186+ BufferGfx_getBufferAttrs(&gfxAttrs));
187+
188+ codecBufTab = GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab);
189+ }
190
191- if (viddec2->hOutBufTab == NULL) {
192+ /* The value of codecBufTab should now either point to a downstream
193+ * BufTab or our own BufTab.
194+ */
195+ if (codecBufTab == NULL) {
196 GST_ELEMENT_ERROR(viddec2, RESOURCE, NO_SPACE_LEFT,
197- ("failed to create output buffers\n"), (NULL));
198+ ("no BufTab available for codec output\n"), (NULL));
199 return FALSE;
200 }
201
202- /* Tell the Vdec module that hOutBufTab will be used for display buffers */
203- Vdec2_setBufTab(viddec2->hVd,
204- GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
205+ /* Tell the Vdec module what BufTab it will be using for its output */
206+ Vdec2_setBufTab(viddec2->hVd, codecBufTab);
207
208 return TRUE;
209 }
210@@ -1403,8 +1463,10 @@ static void* gst_tividdec2_decode_thread(void *arg)
211 {
212 GstTIViddec2 *viddec2 = GST_TIVIDDEC2(gst_object_ref(arg));
213 GstBuffer *encDataWindow = NULL;
214+ GstBuffer *padBuffer = NULL;
215 Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;
216 gboolean codecFlushed = FALSE;
217+ gboolean usePadBufs = FALSE;
218 void *threadRet = GstTIThreadSuccess;
219 Buffer_Handle hDummyInputBuf = NULL;
220 Buffer_Handle hDstBuf;
221@@ -1420,7 +1482,8 @@ static void* gst_tividdec2_decode_thread(void *arg)
222 GST_LOG("init video decode_thread \n");
223
224 /* Initialize codec engine */
225- ret = gst_tividdec2_codec_start(viddec2);
226+ ret = gst_tividdec2_codec_start(viddec2, &padBuffer);
227+ usePadBufs = (padBuffer != NULL);
228
229 /* Notify main thread that is ok to continue initialization */
230 Rendezvous_meet(viddec2->waitOnDecodeThread);
231@@ -1476,7 +1539,34 @@ static void* gst_tividdec2_decode_thread(void *arg)
232 }
233
234 /* Obtain a free output buffer for the decoded data */
235- if (!(hDstBuf = gst_tidmaibuftab_get_buf(viddec2->hOutBufTab))) {
236+ if (usePadBufs) {
237+
238+ /* First time through this loop, padBuffer will already be set
239+ * to the buffer we got in codec_start. It will be NULL for every
240+ * frame after that.
241+ */
242+ if (G_LIKELY(!padBuffer)) {
243+ if (gst_pad_alloc_buffer(viddec2->srcpad, 0, 0,
244+ GST_PAD_CAPS(viddec2->srcpad), &padBuffer)
245+ != GST_FLOW_OK) {
246+ GST_ELEMENT_ERROR(viddec2, RESOURCE, READ,
247+ ("failed to allocate a downstream buffer\n"), (NULL));
248+ padBuffer = NULL;
249+ goto thread_exit;
250+ }
251+ }
252+ hDstBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(padBuffer);
253+ gst_buffer_unref(padBuffer);
254+ padBuffer = NULL;
255+
256+ /* Set the CODEC_FREE flag -- this isn't done automatically when
257+ * allocating buffers from downstream.
258+ */
259+ Buffer_setUseMask(hDstBuf, Buffer_getUseMask(hDstBuf) |
260+ gst_tidmaibuffer_CODEC_FREE);
261+
262+ }
263+ else if (!(hDstBuf = gst_tidmaibuftab_get_buf(viddec2->hOutBufTab))) {
264 GST_ELEMENT_ERROR(viddec2, RESOURCE, READ,
265 ("failed to get a free contiguous buffer from BufTab\n"),
266 (NULL));
267@@ -1623,12 +1713,15 @@ thread_failure:
268 thread_exit:
269
270 /* Re-claim any buffers owned by the codec */
271- bufIdx = BufTab_getNumBufs(GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
272+ if (viddec2->hOutBufTab) {
273+ bufIdx =
274+ BufTab_getNumBufs(GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab));
275
276- while (bufIdx-- > 0) {
277- Buffer_Handle hBuf = BufTab_getBuf(
278- GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab), bufIdx);
279- Buffer_freeUseMask(hBuf, gst_tidmaibuffer_CODEC_FREE);
280+ while (bufIdx-- > 0) {
281+ Buffer_Handle hBuf = BufTab_getBuf(
282+ GST_TIDMAIBUFTAB_BUFTAB(viddec2->hOutBufTab), bufIdx);
283+ Buffer_freeUseMask(hBuf, gst_tidmaibuffer_CODEC_FREE);
284+ }
285 }
286
287 /* Release the last buffer we retrieved from the circular buffer */
288diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
289index b16e9c5..6b09d2a 100644
290--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
291+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividdec2.h
292@@ -91,6 +91,7 @@ struct _GstTIViddec2
293 UInt32 numOutputBufs;
294 GstTIDmaiBufTab *hOutBufTab;
295 GstTICircBuffer *circBuf;
296+ gboolean padAllocOutbufs;
297
298 /* Quicktime h264 header */
299 GstBuffer *sps_pps_data;
300--
3011.7.0.4
302
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch
deleted file mode 100644
index b8525b79..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0009-dmaisink-compilation-fix.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 721970f80e6bff0f231625f00301fa37473a2bb3 Mon Sep 17 00:00:00 2001
2From: Brijesh Singh <bksingh@ti.com>
3Date: Wed, 7 Jul 2010 19:21:01 -0500
4Subject: [PATCH 9/9] dmaisink compilation fix
5
6temporary fix - should go in svn trunk
7---
8 src/gsttidmaivideosink.c | 2 +-
9 1 files changed, 1 insertions(+), 1 deletions(-)
10
11diff --git a/src/gsttidmaivideosink.c b/src/gsttidmaivideosink.c
12index 99ca25d..2fb5aad 100644
13--- a/src/gsttidmaivideosink.c
14+++ b/src/gsttidmaivideosink.c
15@@ -1817,7 +1817,7 @@ static gboolean gst_tidmaivideosink_alloc_display_buffers(
16 return FALSE;
17 }
18
19- GST_INFO("Allocating %ld display buffers", sink->dAttrs.numBufs);
20+ GST_INFO("Allocating %d display buffers", sink->dAttrs.numBufs);
21
22 /* Set the dimensions for the display */
23 if (VideoStd_getResolution(sink->dAttrs.videoStd, &gfxAttrs.dim.width,
24--
251.7.0.4
26
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch
deleted file mode 100644
index 0d36bf10..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0009-update-dm365-cfg-to-work-with-platinum-codecs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From d5601a8beec6144fb39ebdc93778c081028a7fdd Mon Sep 17 00:00:00 2001
2From: Brijesh Singh <bksingh@ti.com>
3Date: Tue, 28 Sep 2010 19:35:14 -0500
4Subject: [PATCH] update dm365 cfg to work with platinum codecs
5
6---
7 src/gstticodecplugin_dm365.cfg | 3 +++
8 1 files changed, 3 insertions(+), 0 deletions(-)
9
10diff --git a/src/gstticodecplugin_dm365.cfg b/src/gstticodecplugin_dm365.cfg
11index d682643..43174b1 100644
12--- a/src/gstticodecplugin_dm365.cfg
13+++ b/src/gstticodecplugin_dm365.cfg
14@@ -86,6 +86,9 @@ var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
15
16 var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
17
18+var MEMTCM = xdc.useModule('ti.sdo.fc.ires.memtcm.MEMTCM');
19+MEMTCM.cmemBlockId = 1; //Since we use _1 in our insmod command.
20+
21 /* Uncomment these lines if you wish to debug FC and enable FC trace */
22 /*
23 /*
24--
251.7.0.4
26
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch b/recipes-ti/gstreamer-ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch
deleted file mode 100644
index 85550e6c..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/0010-replace-omap3530_dv400-platform-support-with-omap353.patch
+++ /dev/null
@@ -1,119 +0,0 @@
1From 0f2ef84ad320ec141a7ba6727cf18817ac42e413 Mon Sep 17 00:00:00 2001
2From: Brijesh Singh <bksingh@ti.com>
3Date: Mon, 4 Oct 2010 14:11:39 -0500
4Subject: [PATCH] replace omap3530_dv400 platform support with omap3530
5
6---
7 Makefile.external | 19 +++----------
8 src/gstticodecplugin_omap3530_dv400.cfg | 44 -------------------------------
9 2 files changed, 5 insertions(+), 58 deletions(-)
10 delete mode 100644 src/gstticodecplugin_omap3530_dv400.cfg
11
12diff --git a/Makefile.external b/Makefile.external
13index 6d118d8..2a85108 100644
14--- a/Makefile.external
15+++ b/Makefile.external
16@@ -8,7 +8,7 @@
17 # Copyright (C) 2009 Ridgerun
18 #
19
20-.PHONY: default configure dm6446 omap3530 dm355 dm6467 dm365 omapl138 omap3530_dv400
21+.PHONY: default configure dm6446 omap3530 dm355 dm6467 dm365 omapl138
22
23 DVSDK_PATH=undefined
24 DMAI_INSTALL_DIR=undefined
25@@ -23,7 +23,7 @@ $(error You need to define the environment variable DMAI_INSTALL_DIR)
26 endif
27
28 default:
29- @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm6467t, dm365 omapl138 omap3530_dv400"
30+ @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm6467t, dm365 omapl138"
31
32 export GST_TI_PLATFORM=$(MAKECMDGOALS)
33 export BIOS_INSTALL_DIR
34@@ -87,6 +87,9 @@ ifeq ($(GST_TI_PLATFORM), omap3530)
35 export MVTOOL_DIR = $(CSTOOL_DIR)
36 export PLATFORM_XDC = ${XDC_PLATFORM}
37 export CROSS_COMPILE = ${CSTOOL_PREFIX}
38+ export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
39+ export C6ACCEL_INSTALL_DIR
40+ export ENABLE_C6ACCEL ="--enable-c6accel"
41 endif
42
43 ifeq ($(GST_TI_PLATFORM), omapl138)
44@@ -101,16 +104,6 @@ ifeq ($(GST_TI_PLATFORM), omapl138)
45 export ENABLE_C6ACCEL ="--enable-c6accel"
46 endif
47
48-ifeq ($(GST_TI_PLATFORM), omap3530_dv400)
49- export XDC_TARGET = gnu.targets.arm.GCArmv5T
50- export XDC_PLATFORM = ti.platforms.evm3530
51- export MVTOOL_PREFIX = $(CSTOOL_PREFIX)
52- export MVTOOL_DIR = $(CSTOOL_DIR)
53- export PLATFORM_XDC = ${XDC_PLATFORM}
54- export CROSS_COMPILE = ${CSTOOL_PREFIX}
55- export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)
56-endif
57-
58 CPPFLAGS=-DPlatform_$(GST_TI_PLATFORM)
59 HOST=arm-none-linux-gnueabi
60
61@@ -141,5 +134,3 @@ dm365: Makefile
62 omapl138: Makefile
63 $(MAKE) -f Makefile
64
65-omap3530_dv400: Makefile
66- $(MAKE) -f Makefile
67diff --git a/src/gstticodecplugin_omap3530_dv400.cfg b/src/gstticodecplugin_omap3530_dv400.cfg
68deleted file mode 100644
69index 90f4edf..0000000
70--- a/src/gstticodecplugin_omap3530_dv400.cfg
71+++ /dev/null
72@@ -1,44 +0,0 @@
73-/*
74- * Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/
75- *
76- * This program is free software; you can redistribute it and/or modify
77- * it under the terms of the GNU Lesser General Public License as
78- * published by the Free Software Foundation version 2.1 of the License.
79- *
80- * This program is distributed #as is# WITHOUT ANY WARRANTY of any kind,
81- * whether express or implied; without even the implied warranty of
82- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
83- * Lesser General Public License for more details.
84- *
85- */
86-
87-/* Load the Codec Engine 'Operating System Abstraction Layer' */
88-var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
89-
90-var os = xdc.useModule('ti.sdo.ce.osal.linux.Settings');
91-osalGlobal.os = os;
92-
93-/* Configure CE to use it's DSP Link Linux version */
94-var ipc = xdc.useModule('ti.sdo.ce.ipc.Settings');
95-ipc.commType = ipc.COMM_DSPLINK;
96-
97-/*
98- * ======== Engine Configuration ========
99- */
100-var Engine = xdc.useModule('ti.sdo.ce.Engine');
101-var demoEngine = Engine.createFromServer(
102- "codecServer",
103- "./bin/cs.x64P",
104- "ti.sdo.server.cs"
105- );
106-
107-var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
108-if (combopath != "" && combopath != "null") {
109- demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
110-}
111-
112-/* Load support for the DMAI module */
113-var DMAI = xdc.loadPackage('ti.sdo.dmai');
114-
115-var SCPY = xdc.useModule('ti.sdo.fc.scpy.SCPY');
116-var SDMA = xdc.useModule('ti.sdo.linuxutils.sdma.SDMA');
117--
1181.7.0.4
119
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/dm355-evm/gst-ti.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/dm355-evm/gst-ti.sh
deleted file mode 100644
index 5467a67b..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/dm355-evm/gst-ti.sh
+++ /dev/null
@@ -1,12 +0,0 @@
1#!/bin/sh
2
3# Disable XDM 0.9 elements
4export GST_TI_TIViddec_DISABLE=1
5export GST_TI_TIAuddec_DISABLE=1
6export GST_TI_TIVidenc_DISABLE=1
7export GST_TI_TIImgdec_DISABLE=1
8export GST_TI_TIImgenc_DISABLE=1
9
10# Disable XDM 1.x audio decoder
11export GST_TI_TIAuddec1_DISABLE=1
12
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/dm365-evm/loadmodules.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/dm365-evm/loadmodules.sh
deleted file mode 100644
index c70bee1e..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/dm365-evm/loadmodules.sh
+++ /dev/null
@@ -1,37 +0,0 @@
1#!/bin/sh
2#
3# Default DM365 Memory Map 128 MB
4#
5# Start Addr Size Description
6# ----------------------------------------------------------------
7# 0x00001000 32K ARM926 TCM memory used by platinum codec
8# 0x80000000 48 MB Linux
9# 0x83000000 12 MB Video driver memory (Linux)
10# 0x83C00000 68 MB CMEM
11# 0x88000000 BOTTOM ADDRESS
12#
13
14rmmod cmemk 2>/dev/null
15
16# Pools configuration
17modprobe 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
18
19# Decode + Display
20#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x16539648,1x4841472,14x1646592,1x282624,1x176128,1x147456,1x69632,1x61440,1x32768,2x20480,1x12288,1x8192,64x4096
21
22# Capture + Encode
23#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x3112960,1x2764800,3x1536000,1x65536,1x61440,1x49152,1x20480,1x16384,2x8192,87x4096
24
25# Resizer
26#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=3x1843200
27
28# Non-accel display
29#modprobe cmemk phys_start=0x83c00000 phys_end=0x88000000 pools=1x1843200
30
31modprobe irqk
32modprobe edmak
33modprobe dm365mmap
34
35rm -f /dev/dm365mmap
36mknod /dev/dm365mmap c `awk "\\$2==\"dm365mmap\" {print \\$1}" /proc/devices` 0
37
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/gstreamer-ti-rc.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/gstreamer-ti-rc.sh
deleted file mode 100644
index 35bf7818..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/gstreamer-ti-rc.sh
+++ /dev/null
@@ -1,28 +0,0 @@
1#!/bin/sh
2#
3# configure kernel modules to run gst-ti plugins elements
4#
5
6load_module() {
7 echo
8 echo -n "Running /usr/share/ti/gst/<platform>/loadmodules.sh"
9 /usr/share/ti/gst/<platform>/loadmodules.sh
10}
11
12case "$1" in
13 start)
14 echo -n "Loading kernel modules for gstreamer-ti... "
15 load_module
16 echo " done"
17 ;;
18 stop)
19 echo "Nothing to do"
20 ;;
21 restart)
22 echo "Nothing to do"
23 ;;
24 *)
25 echo "$0 <start/stop/restart>"
26 ;;
27esac
28
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/gstti-init.service b/recipes-ti/gstreamer-ti/gstreamer-ti/gstti-init.service
deleted file mode 100644
index cccf5343..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/gstti-init.service
+++ /dev/null
@@ -1,10 +0,0 @@
1[Unit]
2Description=TI Gstreamer plugins init
3ConditionKernelCommandLine=mem=MEMARGS
4
5[Service]
6ExecStart=/usr/share/ti/gst/<platform>/loadmodules.sh
7RemainAfterExit=yes
8
9[Install]
10WantedBy=multi-user.target
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/omap3/loadmodules.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/omap3/loadmodules.sh
deleted file mode 100644
index eb758834..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/omap3/loadmodules.sh
+++ /dev/null
@@ -1,22 +0,0 @@
1#!/bin/sh
2#
3# CMEM Allocation
4# 1x5250000 Circular buffer
5# 6x829440,1x691200 Video buffers (max D1 PAL)
6# 1x345600 Underlying software components (codecs, etc.)
7# 1x1 Dummy buffer used during final flush
8
9rmmod cmemk 2>/dev/null
10
11modprobe cmemk allowOverlap=1 phys_start=0x86300000 phys_end=0x87300000 \
12 pools=1x5250000,6x829440,1x345600,1x691200,1x1
13
14# insert DSP/BIOS Link driver
15modprobe dsplinkk
16
17# insert Local Power Manager driver
18modprobe lpm_omap3530
19
20# insert SDMA driver
21modprobe sdmak
22
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl137/loadmodules.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/omapl137/loadmodules.sh
deleted file mode 100644
index d0311881..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl137/loadmodules.sh
+++ /dev/null
@@ -1,12 +0,0 @@
1#!/bin/sh
2#
3# configure kernel modules for TI DSP based gstreamer plugin
4#
5
6# insert cmemk, tell it to occupy physical 34MB-64MB.
7#
8modprobe cmemk phys_start=0xC2200000 phys_end=0xC3200000 \
9 pools=1x5250000,3x1048576,3x829440,1x256000,4x131072
10
11modprobe dsplinkk
12
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh
deleted file mode 100644
index f4017251..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/da850-omapl138-evm/loadmodules.sh
+++ /dev/null
@@ -1,16 +0,0 @@
1#!/bin/sh
2#
3# configure kernel modules for TI DSP based gstreamer plugin
4#
5rmmod cmemk 2>/dev/null
6rmmod dsplink 2>/dev/null
7
8modprobe cmemk phys_start=0xC2200000 phys_end=0xC3200000 \
9 pools=1x5250000,3x1048576,3x829440,1x256000,4x131072 \
10 allowOverlap=1
11
12modprobe dsplinkk
13
14rm -f /dev/dsplink
15mknod /dev/dsplink c `awk "\\$2==\"dsplink\" {print \\$1}" /proc/devices` 0
16
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/loadmodules.sh b/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/loadmodules.sh
deleted file mode 100644
index 95cfc3da..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/omapl138/loadmodules.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/sh
2#
3# configure kernel modules for TI DSP based gstreamer plugin
4#
5
6rmmod cmemk 2>/dev/null
7
8modprobe cmemk phys_start=0xC2200000 phys_end=0xC3200000 \
9 pools=1x5250000,3x1048576,3x829440,1x256000,4x131072
10
11modprobe dsplinkk
12
13rm -f /dev/dsplink
14mknod /dev/dsplink c `awk "\\$2==\"dsplink\" {print \\$1}" /proc/devices` 0
15
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti/r962-remove-include-videodev.diff b/recipes-ti/gstreamer-ti/gstreamer-ti/r962-remove-include-videodev.diff
deleted file mode 100644
index cb106fc4..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti/r962-remove-include-videodev.diff
+++ /dev/null
@@ -1,22 +0,0 @@
1diff -ur ticodecplugin_orig/src/gstticapturesrc.c ticodecplugin/src/gstticapturesrc.c
2--- ticodecplugin_orig/src/gstticapturesrc.c 2011-08-09 17:03:39.201308305 +0200
3+++ ticodecplugin/src/gstticapturesrc.c 2011-08-09 17:02:35.177308274 +0200
4@@ -25,7 +25,6 @@
5 #include <gst/gst.h>
6 #include <string.h>
7 #include <gst/gstmarshal.h>
8-#include <linux/videodev.h>
9 #include <linux/videodev2.h>
10 #include <sys/ioctl.h>
11
12diff -ur ticodecplugin_orig/src/gsttidisplaysink2.c ticodecplugin/src/gsttidisplaysink2.c
13--- ticodecplugin_orig/src/gsttidisplaysink2.c 2011-08-09 17:03:53.329308312 +0200
14+++ ticodecplugin/src/gsttidisplaysink2.c 2011-08-09 17:03:11.337308292 +0200
15@@ -28,7 +28,6 @@
16 #include <gst/video/video.h>
17 #include <string.h>
18 #include <gst/gstmarshal.h>
19-#include <linux/videodev.h>
20 #include <linux/videodev2.h>
21 #include <sys/ioctl.h>
22
diff --git a/recipes-ti/gstreamer-ti/gstreamer-ti_svn.bb b/recipes-ti/gstreamer-ti/gstreamer-ti_svn.bb
deleted file mode 100644
index f314a35c..00000000
--- a/recipes-ti/gstreamer-ti/gstreamer-ti_svn.bb
+++ /dev/null
@@ -1,26 +0,0 @@
1require gstreamer-ti.inc
2
3LIC_FILES_CHKSUM = "file://COPYING;md5=c8a292be1d17ba07ecbf7b49049cbf22"
4
5PV = "svnr${SRCREV}"
6
7S = "${WORKDIR}/gstreamer_ti/ti_build/ticodecplugin"
8
9SRCREV = "962"
10
11# apply patches from tracker 1208 to get zero copy support.
12# https://gstreamer.ti.com/gf/project/gstreamer_ti/tracker/?action=TrackerItemEdit&tracker_item_id=1208&start=175
13
14SRC_URI = "svn://gforge.ti.com/svn/gstreamer_ti/trunk;module=gstreamer_ti;protocol=https;user=anonymous;pswd='' \
15 file://gstreamer-ti-rc.sh \
16 file://r962-remove-include-videodev.diff \
17 file://gstti-init.service \
18"
19
20# use local loadmodules.sh for these platform
21# TODO: must be removed onces these loadmodules goes in gstreamer.ti.com
22SRC_URI_append_dm365 = " file://loadmodules.sh"
23SRC_URI_append_omapl137 = " file://loadmodules.sh"
24SRC_URI_append_omapl138 = " file://loadmodules.sh "
25SRC_URI_append_omap3 = " file://loadmodules.sh "
26