This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

gstreamer-ti using fbdev/v4l2 on dm3730

Other Parts Discussed in Thread: TPS65951, DM3730, OMAP3530

Dear TI - experts, 

We are trying to play video on our custom board. The custom board is derived from the Beagleboard. Our custom board includes a DM3730 CPU with the TPS65951 PMIC. 

We are using kernel version: 3.2.18

We have connected our platform to a 7 inch LCD display (800x480 resolution)

We are able to to run the SGX demos and touchscreen test application. The framebuffer is good. Now we want to play video on that target. There lies our problem. 

Since we are using Open Embedded, the following packages are added to our "console-image": 

TI_DSP_INSTALL = " \
dsp-tools \
gstreamer-ti \
ti-codec-engine \
ti-dmai \
ti-dmai-apps \
ti-cmem-module \
ti-dspbios \
ti-dsplink \
gst-ffmpeg \
gst-openmax \
gst-plugins-bad \
gst-plugins-base \
gst-plugins-ugly \
gst-plugins-good \
gst-meta-base \
gst-meta-debug \
gst-meta-video \
gst-omapfb \
ti-codecs-omap3530 \
"

The Gstreamer TI - package uses the TI-DMAI package to access the linux framebuffer or the v4l2 drivers. This is place where it goes wrong. 

The bootargs: 

[ 0.000000] Kernel command line: console=ttyO2,115200n8 mpurate=auto camera= vram=12M mem=96M@0x80000000 mem=128M@0x88000000 omapfb.mode=lcd:800x480MR-16@60 omapdss.def_disp=lcd rootwait=1 rw ubi.mtd=5,2048 rootfstype=ubifs root=ubi0:ame-stum-rootfs

FBDEV

In the kernel config the number of framebuffers is set to 3. 

After startup there are 3 framebuffers created on /dev/fb* (fb0, fb1 and fb2)

After the kernel is booted, the following sh script is executed: 

sh /usr/share/ti/gst/omap3530/loadmodules.sh

#!/bin/sh
#
# CMEM Allocation
# 1x5250000 Circular buffer
# 6x829440,1x691200 Video buffers (max D1 PAL)
# 1x345600 Underlying software components (codecs, etc.)
# 1x1 Dummy buffer used during final flush

rmmod cmemk 2>/dev/null

modprobe cmemk allowOverlap=1 phys_start=0x86300000 phys_end=0x87300000 \
pools=1x5250000,6x829440,1x345600,1x691200,1x1

# insert DSP/BIOS Link driver
modprobe dsplinkk

# insert Local Power Manager driver
modprobe lpm_omap3530

# insert SDMA driver
modprobe sdmak

Afterwards the debug variables of DMAI and Gstreamer are set: 

export DMAI_DEBUG=2
export GST_DEBUG=3

The gstreamer test src is executed using the command: 

gst-launch -v videotestsrc pattern=snow ! TIDmaiVideoSink displayStd=fbdev displayDevice=/dev/fb0 videoStd=VGA videoOutput=LCD accelFrameCopy=FALSE sync=false 

The following error is reported: 

0:00:00.959930420 296 0x16b5988 ERROR TIDmaiVideoSink gsttidmaivideosink.c:1987:gst_tidmaivideosink_alloc_display_buffers: useUserptrBufs=TRUE can only be used with V4L2 displays
0:00:00.960144043 296 0x16b5988 ERROR TIDmaiVideoSink gsttidmaivideosink.c:744:gst_tidmaivideosink_buffer_alloc: Failed to allocate display buffers

Even when the useUserptrBufs is set to false the same error is reported: 

gst-launch -v videotestsrc pattern=snow ! TIDmaiVideoSink useUserptrBufs=FALSE displayStd=fbdev displayDevice=/dev/fb0 videoStd=VGA videoOutput=LCD accelFrameCopy=FALSE sync=false 

When we look in the function gst_tidmaivideosink_buffer_alloc of  gsttidmaivideosink.c, it makes sense


if (!dmaisink->useUserptrBufs && dmaisink->hDisplay) {
GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
("Cannot use pad buffer allocation after mmap buffers already "
"in use\n"), (NULL));
return GST_FLOW_UNEXPECTED;
}
else {
 dmaisink->useUserptrBufs = TRUE;
}

Or we will get an error in the if statement or the useUserptrBufs is set to true and afterwards in the code the error is reported that only useUserptrBufs can be set for v4l2 displays. Or I will get an error or my variable is overwritten on which afterwards I will get an error. 

Any ideas about how to solve this??

V4L2

The number of framebuffers is set in the kernel config to 1.

This will create 1 framebuffer(/dev/fb0) and 2 video entries (/dev/video0 and /dev/video1)

The same boot args as described above are applied to this kernel. 

After start up the same variables/start up scripts are executed. 

sh /usr/share/ti/gst/omap3530/loadmodules.sh (see content above)

export DMAI_DEBUG=2
export GST_DEBUG=3

The v4l2 devices are proberly created: 

[ 4.789550] omap_vout omap_vout: Buffer Size = 3686400
[ 4.795837] omap_vout omap_vout: : registered and initialized video device 0
[ 4.803222] omap_vout omap_vout: Buffer Size = 3686400
[ 4.809448] omap_vout omap_vout: : registered and initialized video device 1

Now I want to play video using the following command: 

gst-launch -v videotestsrc pattern=snow ! TIDmaiVideoSink videoStd=VGA videoOutput=LCD accelFrameCopy=FALSE sync=false

The following error is reported: 

ti.sdo.dmai - [Display] VIDIOC_DQBUF failed (Invalid argument)
WARN TIDmaiVideoSink gsttidmaivideosink.c:1705:gst_tidmaivideosink_render:<tidmaivideosink0> error: Failed to get display buffer

This seems to be something between my kernel and gstreamer-ti. 

Any ideas about how to solve this??

We don't require explicitly the v4l2 drivers since we don't need to capture images on our platform. The goal is to play video in H264 format on the LCD display using the onboard DSP. 

Any help would be appreciated. 

Thanks

Erwin

  • Hello,

    Erwin Groenendaal said:
    if (!dmaisink->useUserptrBufs && dmaisink->hDisplay) {
    GST_ELEMENT_ERROR(dmaisink, RESOURCE, FAILED,
    ("Cannot use pad buffer allocation after mmap buffers already "
    "in use\n"), (NULL));
    return GST_FLOW_UNEXPECTED;
    }
    else {
     dmaisink->useUserptrBufs = TRUE;
    }

    This is correct.

    Erwin Groenendaal said:
    gst-launch -v videotestsrc pattern=snow ! TIDmaiVideoSink useUserptrBufs=FALSE displayStd=fbdev displayDevice=/dev/fb0 videoStd=VGA videoOutput=LCD accelFrameCopy=FALSE sync=false 

    as the error message says "useUserptrBufs=TRUE can only be used with V4L2 displays" and you are using fbdev .

    http://processors.wiki.ti.com/index.php/GstTIPlugin_Elements#TIDmaiVideoSink

    Example pipelines:

    This pipeline decodes 720P MPEG-4 video:

    gst-launch filesrc location=/usr/share/ti/data/videos/davincieffect.mpeg4 \
    ! typefind ! mpeg4videoparse ! TIViddec2 padAllocOutbufs=TRUE ! queue ! tidisplaysink2
    -v


    This pipeline decodes 720P H.264 video:
     gst-launch filesrc location=/usr/share/ti/data/videos/davincieffect.264 \
    ! typefind ! h264parse ! TIViddec2 padAllocOutbufs=TRUE ! queue ! tidisplaysink2 -v


    This pipeline decodes 720P MPEG-2 video:
     gst-launch filesrc location=/usr/share/ti/data/videos/davincieffect.m2v \
    ! typefind ! mpegvideoparse ! TIViddec2 padAllocOutbufs=TRUE ! queue ! tidisplaysink2 -v


    This pipeline decodes 720P MP4 video :
     gst-launch filesrc location=/usr/share/ti/data/videos/davincieffect_h264_aac.mp4 \
    ! qtdemux name=demux demux.audio_00 ! queue max-size-buffers=8000 max-size-time=0 \
    max-size-bytes=0 ! TIAuddec1 ! alsasink demux.video_00 ! queue \
    ! TIViddec2 padAllocOutbufs=TRUE ! queue ! tidisplaysink2 -v


    This pipeline encodes 720P video color pattern generated by videotestsrc in MPEG-4:
     gst-launch videotestsrc num-buffers=100 ! \
    'video/x-raw-yuv,width=1280,height=720,format=(fourcc)UYVY' ! TIVidenc1 codecName=mpeg4enc \
    engineName=codecServer ! filesink location=sample.m4v

    You could check here too:

    processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines

    Best Regards,

    Margarita

  • Dear Margarita,

    Thanks for the reply.

    My point was that even when I explicitly set the useUserptrBufs to FALSE, I still get the error that  "useUserptrBufs=TRUE can only be used with V4L2 displays".

    That also complies with the c code, because the useUserptrBufs variable is always set to true.

    Can we not use the TIDmaiVideoSink as we are using fbdev? Our TIDmaiVideoSink cannot use the v4L2, since we also get an error with that one. See my previous post.

    Your suggestion is to use the tidisplaysink2? Does this sink output using a fbdev or an v4l2 device?

    Thanks

    Kind regards,

    Erwin