總瀏覽量

2011年12月28日 星期三

gstreamer on dm8148 evm with ubuntu 10.04

    When testing gst-openmax on dm8148 evm with ubuntu 10.04, ti-ezsdk_dm814x-evm_5_03_00_09, and gstreamer_ti_dm81xx.

Refer to http://processors.wiki.ti.com/index.php/DM81xx_Gstreamer_Plugin, use this command to get gstreamer source.

# svn checkout -r 983 --username anonymous https://gstreamer.ti.com/svn/gstreamer_ti/trunk/gstreamer_ti_dm81xx

Use this command to open debug message for gst-launch,

#export GST_REGISTRY=/tmp/gst_registry.bin
#export LD_LIBRARY_PATH=/opt/gstreamer/lib
#export GST_PLUGIN_PATH=/opt/gstreamer/lib/gstreamer-0.10
#export PATH=/opt/gstreamer/bin:$PATH
#export GST_PLUGIN_SCANNER=/opt/gstreamer/libexec/gstreamer-0.10/gst-plugin-scanner
#GST_DEBUG=3 gst-launch -v videotestsrc ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false

use this to open  debug message for syslink (load-hd-firmware.sh)
modprobe syslink TRACE=1 TRACEFAILURE=1 TRACECLASS=1 #TRACEENTER=1

encountering the message below,
0:00:13.230602041 388 0x150a0 INFO GST_PADS gstutils.c:1468:prepare_link_maybe_ghosting: omxbasectrl0 and omxvideosink0 in same bin, no need for ghost pads
0:00:13.230792191 388 0x150a0 INFO GST_PADS gstpad.c:1941:gst_pad_link_prepare: trying to link omxbasectrl0:src and omxvideosink0:sink
0:00:13.234757041 388 0x150a0 INFO omx gstomx_base_sink.c:504:pad_sink_link:<omxvideosink0> link
[t=0x00000004] [tid=0x4008e000] ti.sdo.xdcruntime.linux.ThreadSupport: ERROR: line 235: E_POSIX_Error: a POSIX function returned failure, errno is 0ti.sdo.xdcruntime.linux.ThreadSupport: line 235: E_POSIX_Error: a POSIX function returned failure, errno is 0


following the clues...
./gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.c
./gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.c:
./gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.c:g_omx_request_imp
./omx_05_02_00_26/./src/ti/omx/omxcore/src/omx_core.c:OMX_Init
./omx_05_02_00_26/./src/ti/omx/domx/DomxCore.c:DomxInit
./omx_05_02_00_26/src/ti/omx/domx/domx_util.h:ENABLE_LINUX_LOGGING <- open dbg message
./omx_05_02_00_26/src/ti/omx/domx/OmxRpc.c:OmxRpc_moduleInitServer
./framework_components_3_21_02_32/packages/ti/sdo/rcm/RcmServer.c:Int RcmServer_create
./framework_components_3_21_02_32/packages/ti/sdo/rcm/RcmServer.c:Int RcmServer_Instance_init_P <- could not create server thread
./osal_1_21_01_08/packages/ti/sdo/xdcruntime/linux/ThreadSupport.c:ThreadSupport_Instance_init
rcm server thread priority <- #define DOMX_OMXRPC_RCMCORESVRPRI (0xE)



follow http://processors.wiki.ti.com/index.php/Building_MFP_without_XDC,
to compile framework_components we need this command
# make -f makefile_v5T

My debug message:
Module<ti.omx> Entering<OmxRpc_moduleInitServer> @line<793>
Module<ti.omx> Entering<omxrpc_rcm_server_crea Notify: Termination packet
te> @line<220>
@ omxrpc_rcm_server_create: rcmServerName OmxRpcRcmServer_3, priority 14
Module<ti.omx> @<omxrpc_rcm_server_create> @line<225> msg<Before RcmServer_Params_init>
Module<ti.omx> @<omxrpc_rcm_server_create> @line<229> msg<After RcmServer_Params_init>
Module<ti.omx> @<omxrpc_rcm_server_create> @line<232> msg<Before RcmServer_create>
--> RcmServer_create: (name=0x40c31234, params=0xbedf2d98, hP=0x40c31230)
RcmServer_create: instance create: 0x1dd908
ti_sdo_xdcruntime_linux_ThreadSupport_Instance_init__F #a
ti_sdo_xdcruntime_linux_ThreadSupport_Instance_init__F #b priority:0x0 -> 0x0
ti_sdo_xdcruntime_linux_ThreadSupport_Instance_init__F osPriority != ThreadSupport_INVALID_OS_PRIORITY
ti_sdo_xdcruntime_linux_ThreadSupport_Instance_init__F #c, retc:0x0
[t=0x00000004] [tid=0x40072000] ti.sdo.xdcruntime.linux.ThreadSupport: ERROR: line 250: E_POSIX_Error: a POSIX function returned failure, errno is 0
ti.sdo.xdcruntime.linux.ThreadSupport: line 250: E_POSIX_Error: a POSIX function returned failure, errno is 0
ti_sdo_xdcruntime_linux_ThreadSupport_Instance_init__F #3 retc:0x16
RcmServer_Instance_init_P: could not create server thread #2
<-- RcmServer_create: -1
Module<ti.omx> @<omxrpc_rcm_server_create> @line<236> msg<RcmServer_create failed>
Module<ti.omx> @<omxrpc_rcm_server_create> @line<240> msg<After RcmServer_create>
Module<ti.omx> Leaving<omxrpc_rcm_server_create> @line<241> with error<6:<unknown>>
Module<ti.omx> Entering<omxrpc_module_free_server_rsrc> @line<143>
Module<ti.omx> Leaving<omxrpc_module_free_server_rsrc> @line<153> with error<0:ErrorNone>
Module<ti.omx> Leaving<OmxRpc_moduleInitServer> @line<854> with error<6:<unknown>>
Module<ti.omx> @<DomxInit> @line<194> msg<OmxRpc_moduleInitServer failed>
Module<ti.omx> Entering<OmxRpc_moduleUnregisterMsgqHeap> @line<947>

Here comes the critical part,
in ./osal_1_21_01_08/packages/ti/sdo/xdcruntime/linux/ThreadSupport.c:ThreadSupport_Instance_init, always return 0x16 in this statement

retc |= pthread_attr_getschedparam(&pattrs, &priParam);

then found that the version of pthread between ezsdk & ubuntu are different, and ThreadSupport_module->lowestPriority and ThreadSupport_module->highestPriority are all equal to zero.

glibc-2.8:
-rwxr-xr-x 1 root root 88432 2011-12-09 14:40 /media/ROOTFS/lib/libpthread-2.8.so*
lrwxrwxrwx 1 root root 17 2011-12-21 13:32 /media/ROOTFS/lib/libpthread.so.0 -> libpthread-2.8.so*

glibc-2.11.1:
-rwxr-xr-x 1 root root 104536 2010-04-23 02:56 /media/rootfs/lib/libpthread-2.11.1.so*
lrwxrwxrwx 1 root root 20 2011-12-28 16:20 /media/rootfs/lib/libpthread.so.0 -> libpthread-2.11.1.so*

Getting glibc-2.11.1 & glibc-2.8 from http://ftp.gnu.org/gnu/glibc/ and compare the pthread difference. In pthread_attr_getschedparam(), glibc-2.11.1 add these statements below,

if (min == -1 || max == -1
|| param->sched_priority > max || param->sched_priority < min)
return EINVAL;


This is the source of error occurred!! (after all these days work, finally...)
Okay, so why max & min are all zero??
./osal_1_21_01_08/packages/ti/sdo/xdcruntime/linux/ThreadSupport.c:ThreadSupport_Module_startup

policy = sched_getscheduler(0);
max = sched_get_priority_max(policy);
min = sched_get_priority_min(policy);
interval = (max-min)/5;

ThreadSupport_module->lowestPriority = min;
ThreadSupport_module->belowNormalPriority = interval * 2;
ThreadSupport_module->normalPriority = interval * 3;
ThreadSupport_module->aboveNormalPriority = interval * 4;
ThreadSupport_module->highestPriority = max;

This policy is zero, and that means this is SCHED_OTHER,
when SCHED_OTHER, max & min all equal to zero, and result in an error returned in pthread_attr_setschedparam().

There are 2 ways to solve this problem.
1. set the priority to 0
2. set the policy to SCHED_RR or others

Due to ./osal_1_21_01_08/packages/ti/sdo/xdcruntime/linux/ThreadSupport.c set the policy to SCHED_OTHER, so the priority

#define DOMX_OMXRPC_RCMCORESVRPRI (0xE)

would means nothing here.
So I choose 1'st solution to solve this (ThreadSupport.c),

//priParam.sched_priority = params->osPriority;
priParam.sched_priority = 0;

and the testvideosrc would show up after your command.

沒有留言:

張貼留言