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.

v4l2 capture example (saLoopBack) question

Other Parts Discussed in Thread: TVP7002, TLC59108

Hello

I have compiled saLoopBack and saLoopBackFbdev examples.

When try to run, get messages :

VPSS_GRPX : please stop grpx0 before continue.
Driver Name: ti81xxvin
Driver bus info: TI81xx Platform
DriverVPSS_DCTRL: failed to disable the venc.
 is capable of dVPSS_DCTRL: failed to disable hdmi venc
oing capture
saLoopBack:
 Mode set is 0
Setting DV Preset failed, err -1

EZSDK 5.03.1.15, PSP 04.00.1.13.patch2

What I should to do for this examples works correctly?

Thanks.

  • I am also facing the same problem. :(

    Can somebody help to resolve this?

    Regards,

    Krunal patil

  • Hi Satish,

    Thanks for the information.

    I visited this link and it explains how application works. I am trying to run TI demo but no luck. I am facing following errors:

    =========================================================

    root@dm816x-evm:/home# ./saLoopBack
    VPSS_GRPX : please stop grpx0 before continue.
    Driver Name: ti81xxvin
    Driver bus info: TI81xx Platform
    Driver is capable of dVPSS_DCTRL: failed to disable the venc.
    oing capture
    VPSS_DCTRL: failed to disable hdmi venc
    saLoopBack:
     Mode set is 0
    Setting DV Preset failed

    =========================================================

    Regards,

    Krunal

  • Yes, I discovered there are some bugs in saLoopBack.c and saLoopBackFbdev.c.  It makes me wonder if they even tested these programs before they made them available.

    At any rate grpx0 refers to the graphics frame buffer 0 (/dev/fb0).  You need to disable it before you can run saLoopBack.  You do this by executing the command

    # echo 0 >/sys/devices/platform/vpss/graphics0/enabled

    then execute ./saLoopBack.  It should work fine after that.

    I had to change saLoopBackFbdev.c to get it to work.  The problem is that it needs grpx0 disabled while it initializes the capture device, but it needs grpx0 enabled when it does everything else.  So in the app_main routine I added the line:

    system ("echo 0 > /sys/devices/platform/vpss/graphics0/enabled");

    immediately before the line

    system ("echo 1:hdmi > /sys/devices/platform/vpss/graphics0/nodes");

    and added the line:

    system ("echo 1 > /sys/devices/platform/vpss/graphics0/enabled");

    immediately before the line

    /* Open the Display driver. */

    After recompiling it ran just fine.

    Hope this helps.

    Carl

     

  • Hi,

    For most of the people saLoopBack and saLoopBackfbdev worked and they confirmed on community threads. I am not sure why its not working for few of you. I will look at it once more and let you know if its any bug. All the applications are test thoroughly before released.

    Regards,

    Hardik Shah

  • Hi Hardik,

    For your reference, I am using prebuilt binaries(kernel and filesystem) from EZSDK 5_03_01_15 and applications from DM816x Linux PSP - 04.00.02.14 since I was unable to locate "saLoopBack " inside EZSDK 5_03_01_15.

    Regards,

    Krunal

  • Hi,

    Video examples are packages under PSP release at http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/DM816x_04_00/

    Regards,

    Hardik Shah

  • Hi, Carl.

    Thanks for you message.

    Unfortunately, it did not help - problems with VIDIOC_QUERY_DV_PRESET ioctl() call still remains.

    Just a question - what version PSP are you using? I have downloaded PSP 04.00.02.14, but did not try it yet.

    It is written in "DM816x AM389x PSP 04.00.02.14 Release Notes.pdf"  (if  I understud correctly) that there are not changes in v4l2 fuctionality since 04.00.02.13patch2 release.

    And another - do you use HDVPSS Binary v 01.00.01.33 or defaul SDK binaries for v4l2 capturing?

    Sorry for inconvenience, but I'm a beginner in Linuх.

    Regards

    Gregory.


  • Hi,

    I am also facing the same issue mentioned in the thread.

    Let me provide you the exact steps I followed.


    Firmware details
    EZSDK 5_03_01_15
    psp examples (tar ball downloaed from DM816x Linux PSP - 04.00.01.13.patch2 from http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/DM816x_04_00/04_00_01_13/index_FDS.html)
    HDVPSS firmware is available as part of pre-built file system (ezsdk-dm816x-evm-rootfs.tar.gz) of EZSDK 5_03_01_15

    Steps we followed
    - Extract file system ezsdk-dm816x-evm-rootfs.tar.gz

    - Since we need to use V4L2 capture driver, we are using load-hd-v4l2-firmware.sh to load driver modules and V4L2 based HDVPSS firmware.
    cp usr/share/ti/ti-media-controller-utils/load-hd-v4l2-firmware.sh etc/init.d/load-hd-firmware.sh

    - Boot arguments
    setenv bootargs 'console=ttyO2,115200n8 root=/dev/nfs nfsroot=10.100.2.241:/home/sweta/ezsdk_filesys,nolock rw mem=169M notifyk.vpssm3_sva=0xBF900000 ip=dhcp'

    Errors

    root@dm816x-evm:/home# ./saLoopBack
    VPSS_GRPX : please stop grpx0 before continue.
    Driver Name: ti81xxvin
    Driver bus info: TI81xx Platform
    Driver is capable of dVPSS_DCTRL: failed to disable the venc.
    oing capture
    VPSS_DCTRL: failed to disable hdmi venc
    saLoopBack:
     Mode set is 0
    Setting DV Preset failed


    We also tried the HDVPSS firmware from http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/DM816x_04_00/04_00_01_13/index_FDS.html instead of the pre-built firmware from ezsdk file system.

    With this firmware, we are not able to get login console and it hangs in loading the firmware binaries.

    Please provide us exact firmware dependencies to run the example demos (especially video capture example).

    Thanks,
    Sweta

  • For those who have problem to run the saLoopBack or saLoopbackFbdev, did you use the EZSDK file systm?

    My suspicion is that EZSDK has the Matrix(QT) running whenever kernel is up, which use /dev/fb0 to display.

    So when trying to use the saLoopBack or saLoopBackFbdev, it reports since the v4l2 captue example required /dev/fb0 as well 

    VPSS_GRPX : please stop grpx0 before continue.

    The saLoopback and saLoopbackFbdev assume that /dev/fb0 is not used.

    before running the saLoopback or saLoopbackFbdev, please do the below command to check wether /dev/fb0 is on:

    cat /sys/devices/platform/vpss/graphics0/enabled.

    Also, please be sure that component cable is plugged into the IO expansion board and the DVD player or source is turned on.

    Otherwisethe sample could return error on VIDIOC_QUERY_DV_PRESET .

    Regards,

    yihe

  • All,

    Please use PSP deliverables for all the standalone V4L2 and fbdev examples. V4L2, fbdev and OMX applications cant co-exists as they use the same hardware but with different interfaces.

    Regards,

    Hardik Shah

  • Hi Yihe,

    Yes, we do use ezsdk file system tar ball.

    Further experiments to my last observation -

    1) We have permanently removed matrix launcher from /etc/init.d to ensure that it doesn't use /dev/fb0.

    2) echo 0 > /sys/devices/platform/vpss/graphics0/enabled

    3) cat /sys/devices/platform/vpss/graphics0/enabled shows value 0.

    4) Component input is already connected to EIO board. Video source (720P_60 component) is powered on before turning the board ON.

    5) Still it is so strange that saLoopback gives error in query standard.

    root@dm816x-evm:/home# ./saLoopBack
    Driver Name: ti81xxvin
    Driver bus info: TI81xx Platform
    Driver is capable of doing capture
    saLoopBack:
     Mode set is 0
    Setting DV Preset failed

    Is there any step which we have missed ? 

    As quick resolution to this issue, I will appreciate if you can help us with the exact dependencies (uImage, file system and steps we need to perform) to get this example working.

    Thanks a lot and Warm Regards,
    Sweta

  • Hi Hardik,

    We do use examples from PSP release of DM816x Linux PSP - 04.00.01.13.patch (http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/psp/LinuxPSP/DM816x_04_00/04_00_01_13/index_FDS.html) and ezsdk_5_03_01_15 (for uImage and file system with pre-built firmware binaries, we don't run matrix demo and ensure that /sys/devices/platform/vpss/graphics0/enabled is 0 before running the app).

    Please help us understand which PSP deliverables you are referring to ?

    Specifically, it will be helpful to all if you can provide the details of the complete firmware dependencies with which these sample applications are tested. (uImage, file system, V4L2 firmware and any other dependency (if any)).

    Thanks,
    Sweta

  • Hi,

    Please check IO expansion board is connected properly. And also make sure that Y, Pb and Pr of component in are connected in respective pins. Because setting/querying of DV preset fails means its not able to detect the input resolution.

    Regards,

    Hardik Shah

  • Gregory,

    The DV Preset error message means that there isn't a valid video signal to the TVP7002 ADC.  The video signals you can use are 1080P and 720P.  You can't use 1080I and the video signal must be YPbPr.  You should be using the green, blue, and red RCA jacks on the EIO board.

    I'm using the example code from the 04.00.01.13patch2 release.  I'm  not using any of the kernel modules or HDVPSS firmware from that release, I'm just using the load-hd-v4l2-firmware.sh for /etc/init.d/load-hd-firmware.sh that can be found in /usr/share/ti/ti-media-controller-utils for EZSDK 05.03.01.15.

    Carl

  • I'm seeing some rather alarming output on the console the first time I run the saLoopBack program after a power cycle. Despite the rather frightening looking info dump, the demo appears to work and I don't see it again when re-running the program.

    I'm working with the rootfs provided in the EZSDK 05.03.01.15, and the load-hd-v4l2-firmware.sh setup described by the folks in this thread. Additionally,  I have already run  "/usr/share/ti/ti-media-controller-utils/change_display.sh hdmi" because I see that I get a "region out of frame" error when displaying to the 800x480 LCD.  I'm bringing in a 720p video from a DVD player on the component video inputs.

    Any idea as to what's going on here, and if I should be concerned?


    Here's the log:

    # Stop the Matrix GUI so we can use /dev/fb0
    root@dm814x-evm:~# /etc/init.d/matrix-gui-e stop
    Stopping Matrix GUI application.

    # Disable graphics0 and double check that it is indeed disabled
    root@dm814x-evm:~# echo 0 > /sys/devices/platform/vpss/graphics0/enabled
    root@dm814x-evm:~# cat /sys/devices/platform/vpss/graphics0/enabled
    0

    # Now go run the saLoopBack example we fetched from http://software-dl.ti.com/dsps/dsps_public_sw/psp/LinuxPSP/DM814x_04_01/04_01_00_06/exports/examples.tar.gz
    root@dm814x-evm:~# cd /home/root/video_psp_examples
    root@dm814x-evm:~/video_psp_examples# ./saLoopBack
    Driver Name: ti81xxvin
    Driver bus info: TI81xx Platform
    Driver is capable of doing capture
    saLoopBack:
     Mode set is 720P60
    Timing Info:
      pixel_clk = 74250
      x_res  = 1280
      y_res  = 720
      hfp      = 110
      hsw      = 40
      hbp      = 220
      vfp      = 5
      vsw      = 5
      vbp      = 20
    Driver Name:
    Driver bus info: �Г@@`
    =============================================================
    Capture Format:
    =============================================================
    fmt.type                 = 1
    fmt.width                = 1280
    fmt.height               = 720
    fmt.pixelformat  = 1448695129
    fmt.bytesperline         = 2560
    fmt.sizeimage    = 1843200
    =============================================================
    =============================================================
    Display Format:
    =============================================================
    fmt.type                 = 2
    fmt.width                = 1280
    fmt.height               = 720
    fmt.pixelformat  = 1448695129
    fmt.bytesperline         = 2560
    fmt.sizeimage    = 1843200
    =============================================================
    ------------[ cut here ]------------
    WARNING: at kernel/softirq.c:159 local_bh_enable+0x54/0xc4()
    Modules linked in: bufferclass_ti omaplfb pvrsrvkm tlc59108 ti81xxhdmi ti81xxvin tvp7002 ti81xxvo ti81xxfb vpss syslink ipv6
    Backtrace:
    [<c0048b70>] (dump_backtrace+0x0/0x110) from [<c039dd84>] (dump_stack+0x18/0x1c)
     r7:00000000 r6:c0070d4c r5:c046d208 r4:0000009f
    [<c039dd6c>] (dump_stack+0x0/0x1c) from [<c006b7b4>] (warn_slowpath_common+0x54/0x6c)
    [<c006b760>] (warn_slowpath_common+0x0/0x6c) from [<c006b7f0>] (warn_slowpath_null+0x24/0x2c)
     r9:c051e2ac r8:d088c800 r7:0000000e r6:cca50200 r5:c04f73b4
    r4:c0549700
    [<c006b7cc>] (warn_slowpath_null+0x0/0x2c) from [<c0070d4c>] (local_bh_enable+0x54/0xc4)
    [<c0070cf8>] (local_bh_enable+0x0/0xc4) from [<c0065638>] (omap_mbox_msg_send+0xcc/0xdc)
     r5:c04f73b4 r4:00000000
    [<c006556c>] (omap_mbox_msg_send+0x0/0xdc) from [<c02d57f4>] (notify_shm_drv_send_event+0x1c8/0x208)
     r5:00000001 r4:00000000
    [<c02d562c>] (notify_shm_drv_send_event+0x0/0x208) from [<c02d2f84>] (notify_send_event+0x114/0x26c)
    [<c02d2e70>] (notify_send_event+0x0/0x26c) from [<bf18c610>] (vps_fvid2_queue+0x94/0x1cc [vpss])
    [<bf18c57c>] (vps_fvid2_queue+0x0/0x1cc [vpss]) from [<bf195588>] (capture_queue+0x50/0x64 [vpss])
     r8:bf1cc454 r7:60000013 r6:cb3dda80 r5:00000000 r4:ccb37400
    [<bf195538>] (capture_queue+0x0/0x64 [vpss]) from [<bf1cb204>] (ti81xxvin_buffer_queue+0x9c/0xe8 [ti81xxvin])
     r5:cb354000 r4:ccb37400
    [<bf1cb168>] (ti81xxvin_buffer_queue+0x0/0xe8 [ti81xxvin]) from [<c02ac7c8>] (videobuf_streamon+0x80/0xd0)
     r7:60000013 r6:cb3541c4 r5:cb354104 r4:cb3dda80
    [<c02ac748>] (videobuf_streamon+0x0/0xd0) from [<bf1cac7c>] (vidioc_streamon+0x244/0x400 [ti81xxvin])
     r7:cb2e3600 r6:00000001 r5:cb354000 r4:cb354104
    [<bf1caa38>] (vidioc_streamon+0x0/0x400 [ti81xxvin]) from [<c02a20d0>] (__video_do_ioctl+0x1618/0x3f34)
     r6:40045612 r5:00000000 r4:00000001
    [<c02a0ab8>] (__video_do_ioctl+0x0/0x3f34) from [<c02a08a8>] (__video_usercopy+0x2e4/0x428)
    [<c02a05c4>] (__video_usercopy+0x0/0x428) from [<c02a0a1c>] (video_ioctl2+0x30/0x38)
    [<c02a09ec>] (video_ioctl2+0x0/0x38) from [<c029fa5c>] (v4l2_ioctl+0xe8/0x11c)
     r5:cb2e3600 r4:cb3dd600
    [<c029f974>] (v4l2_ioctl+0x0/0x11c) from [<c00d2514>] (vfs_ioctl+0x28/0x44)
     r9:c7c40000 r8:beeaec84 r7:00000003 r6:00000003 r5:cb3dd600
    r4:00000000
    [<c00d24ec>] (vfs_ioctl+0x0/0x44) from [<c00d2c24>] (do_vfs_ioctl+0x500/0x540)
    [<c00d2724>] (do_vfs_ioctl+0x0/0x540) from [<c00d2cbc>] (sys_ioctl+0x58/0x7c)
    [<c00d2c64>] (sys_ioctl+0x0/0x7c) from [<c0044da0>] (ret_fast_syscall+0x0/0x30)
     r8:c0044f48 r7:00000036 r6:000124d0 r5:0001215c r4:beeaec84
    ---[ end trace 0f8f21a2c804131d ]---
    Count=0
    Frame rate = 62
    Timing Info:
      pixel_clk = 148500
      x_res  = 1920
      y_res  = 1080
      hfp      = 88
      hsw      = 44
      hbp      = 148
      vfp      = 4
      vsw      = 5
      vbp      = 36
    root@dm814x-evm:~/video_psp_examples#

  • Hi,

    This is a known issue with V4L2 capture driver. What is happening is that we are calling spinlock_irq_save inside a loop which sleeps. So you are seeing this input. It doesn't look to be harmful. It will come only first time you run this.

    Regards,

    Hardik Shah

  • Hi Hardik,

    Thank you for the quick reply! I'll keep an eye out for that in future release notes then. I have a bit of a more fundamental question about this saLookBack demo and the capture buffers (please let me know if I should move this to a different thread).

    As documented in the PSP user guides and source code, I see this demo makes use of the FBdev memory as scratch buffers (please correct me if I'm wrong). In the future, I am planning to use all 3 of the /dev/fbX devices (vram=0:16M,1:16M,2:16M -- downscaling fb's to display resolutions) for GUI data,  and will use the color keying transparency to overlay the GUI on top of live video captured and displayed via V4L2.  In short, I won't have these buffers available to me for V4L2 capture/display operations.

    (1) Are the FBDev buffers used just for convenience and simplicity (we know that memory is always available, assuming that we don't have something like the Matrix GUI accessing /dev/fb0)? Or are there some special requirements for the capture buffers that neccesitates the use of the FBDev buffers? 

    (2) Is there any reason a memory allocation from userspace application (e.g., malloc(), calloc()) won't suffice? Granted, I haven't dug deeply into ti81xx_ram.c and ti81xxfb_main.c yet to determine if there are any caveats/performance considerations I should be conscious of...

    Thank you again for your time and help!
    Jon

  • Hi,

    You are correct we are using framebuffers for getting memroy,

    1. FBDEV buffers are used for convenience and simplicity. Capture driver doesn't support mmapped buffer because hardware requires physically contiguous buffers and its nearly impossible to allocate HD size buffers from kernel and that to contiguous. So we have made use of fbdev buffers.

    2. Userspace memory allocation tools like malloc, calloc give you virtually contiguous memory but it may be physically non-contiguous, so this cant be used to give to V4L2 capture driver.  Best way is to use memroy using cmem kernel module provided by TI, details could be found at http://processors.wiki.ti.com/index.php/CMEM_Overview

    Second method is to allocate buffers from display driver and use it as userPtr for capture driver. But first method of using cmem is best.

    Regards,

    Hardik Shah