• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » DaVinci™ Video Processors » DM816x, C6A816x and AM389x Processors Forum » Netra Scaler to V4L2 Display Driver Buffer Compatibility
Share
DaVinci™ Video Processors
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Netra Scaler to V4L2 Display Driver Buffer Compatibility

Netra Scaler to V4L2 Display Driver Buffer Compatibility

This question is answered
Dave Helsley1
Posted by Dave Helsley1
on Aug 02 2012 14:06 PM
Prodigy150 points
Hello,

I am building a video decoding program similar to the decode_display demo program, only with the V4L2 driver at the back end.

The video chain is:



Buffer sets 1 and 2 in the figure above are allocated with calls to OMX_AllocateBuffer when initializing the IL client for the H.264 Decoder OMX module. The Scaler OMX module's client calls OMX_UseBuffer with buffer set 2. The problem I am having is what to do with buffer set 3.

If I allocate the V4L2 Display's buffers with VIDIOC_REQBUFS and OMX Scaler's output buffers with OMX_AllocateBuffer  all is good. Unfortunately, I must copy the 1920x1080x2 bytes per frame and this is hampering performance. I have done this, and I do see the video on the display.

If I allocate the V4L2 Display's buffers with VIDIOC_REQBUFS and then try to use them when initialing OMX Scaler's buffers with a call to OMX_UseBuffer, I get a segfault inside OMX_UseBuffer. It seems that OMX_UseBuffer only works on buffers that have been allocated with OMX_AllocateBuffer.
Has anyone else tried to hook this up before?
8168
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 02 2012 15:11 PM
    Prodigy150 points

    More info:

    It seems I was actually getting a NULL pointer back for the OMX_BUFFERHEADERTYPE which caused the segfault. OMX_UseBuffer returns the error OMX_ErrorUndefined.

    The underlying problem remains, however, on how to get OMX_UseBuffer to accept a foreign buffer allocated by the V4L2 driver.

    Attaching log file in case there's useful info there.

    6153.log.txt

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • HardikShah
    Posted by HardikShah
    on Aug 03 2012 00:49 AM
    Verified Answer
    Verified by Dave Helsley1
    Mastermind20155 points

    Hi,

    You should be allocating buffers from openmax using shared region and passing those buffers as userPtr buffer to V4L2 display. This will be much simpler to do.

    Regards,

    Hardik Shah

    Regards,

    Hardik Shah




    Please mark this post as answered via the Verify Answer button below if you think it answers your question.  Thanks!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Krunal Patil
    Posted by Krunal Patil
    on Aug 03 2012 13:37 PM
    Expert2840 points

    Hi,

    As Hardik said, Shared Memory (from Region #2) is the solution in this case.

    If you need any reference check this thread http://e2e.ti.com/support/embedded/linux/f/354/p/202453/723882.aspx#723883

    Regards,

    Krunal


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 03 2012 13:44 PM
    Prodigy150 points

    Krunal & Hardik,

    Thank you very much for your responses. I allocate the display buffers using OMX_AllocateBuffers. How can I be assured that they are from Shared Memory Region #2?

    I have done as you suggested and managed to get video output to work, with some stability issues to be resolved. I'm wondering if the instability could be due to being in the wrong region.

    Regards,

    Dave

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • HardikShah
    Posted by HardikShah
    on Aug 05 2012 22:35 PM
    Mastermind20155 points

    Hi,

    What type of stability issue are you facing. Are you seeing some sort of crashes or hangs.

    Regards,

    Hardik Shah

    Regards,

    Hardik Shah




    Please mark this post as answered via the Verify Answer button below if you think it answers your question.  Thanks!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 06 2012 10:53 AM
    Prodigy150 points

    All of the above. I am attempting to ascertain the cause.

    If there are any known issues re: the stability of either the V4L2 display driver or the ALSA audio playback driver, please let me know.

    I did notice an apparent improvement in display stability if I paced out the video; i.e., not play it back at maximum speed, almost as if the display module could not handle it if the video was being passed in too fast.

    The audio driver seems like it may be hanging in an underflow condition; if there is insufficient data in the ring buffers, it's almost like it hangs and must be reset to work properly again.

    These are all preliminary observations at this point, yet to be proven out.

    On the video side, I see this sometimes:

    VPSS_FVID2: contrl event 0x6 timeout
    VPSS_FVID2: contrl event 0x10040018 timeout
    VPSS_DCTRL: failed to get node input status

    On the audio side, I get the "Could not write to audio device" failure, possibly indicating a buffer overrun.

    Thanks,

    Dave

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 06 2012 12:12 PM
    Prodigy150 points

    I neglected to mention that at first I get the message:

    VPSS_FVID2: queue timeout

    Followed by

    VPSS_FVID2: contrl event 0x6 timeout
    VPSS_FVID2: contrl event 0x10040018 timeout
    VPSS_DCTRL: failed to get node input status

    after a while when the video part locks up.

    Does this offer any clues?

    Thanks,
    Dave 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Krunal Patil
    Posted by Krunal Patil
    on Aug 06 2012 12:24 PM
    Expert2840 points

    Hi,

    Let me guess, you might be using ezsdk version 5.03. This is the know issue in the VPSS driver.

    You can use patches available on this thread on top of ezsdk kernel: http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/186865/675787.aspx

    Check if it works for you as well.!

    Regards,

    Krunal


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 06 2012 13:02 PM
    Prodigy150 points

    Hi Krunal,

    Actually, I have transitioned to 5.04, but I will look into the link you provided. At first glance, it seems to be intended for the V4L2 capture driver.

    Thanks,

    Dave

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • HardikShah
    Posted by HardikShah
    on Aug 06 2012 22:49 PM
    Mastermind20155 points

    Hi,

    Yes, if you are getting this from display than those patches won't help. But we have never seen such issue. What are you exactly trying to do. Are you doing some run time parameter update on Grpx(fbdev) and you see this.

    Regards,

    Hardik Shah

    Regards,

    Hardik Shah




    Please mark this post as answered via the Verify Answer button below if you think it answers your question.  Thanks!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dave Helsley1
    Posted by Dave Helsley1
    on Aug 07 2012 11:41 AM
    Prodigy150 points

    Hi Hardik,

    It looks like the stability may have been related to the number of buffers I was using, but it's difficult to be sure. When I reduce the number of buffers between the scaler and the display module from 8 down to 3, stability seemed to improve. Is this expected?

    At run-time in the core loop, it's nothing fancy. Not sure what Grpx(fbdev) is. If it's Gstreamer, we're not using it.

                // Pull element out of the display queue

                if (ioctl(disp->fd, VIDIOC_DQBUF, &disp->bufs[i]) < 0)
                {
                   DBGPRINTEX(g_hDbg, DBG_LEVEL_ERROR, "VIDIOC_DQBUF failed\n");
                }
                // Apply video frame pacing...
                
                // Put it back in
                disp->bufs[i].length = element->nFilledLen;
                if (ioctl(disp->fd, VIDIOC_QBUF, &disp->bufs[i]) < 0) 
                {
                   DBGPRINTEX(g_hDbg, DBG_LEVEL_ERROR, "VIDIOC_QBUF failed\n");
                }
    Dave
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • HardikShah
    Posted by HardikShah
    on Aug 07 2012 23:33 PM
    Mastermind20155 points

    Hi,

    I think stability issues will be because you may  not be queuing buffers with proper index. You may  be queuing same buffers twice or thrice. Please check code for that. Stability should not be because of more number of buffers. With 3 buffers you may not get 60FPS, if you are pumping data at 60FPS you frame will reduce to 30 or 45 with less buffers. Check display FPS as done in sample code to make sure FPS is not getting dropped because of less buffers.

    Regards,

    Hardik Shah

    Regards,

    Hardik Shah




    Please mark this post as answered via the Verify Answer button below if you think it answers your question.  Thanks!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use