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 and the video layers on a DM3730

Other Parts Discussed in Thread: DM3730

I am using DVSDK/PSP linux kernel 2.6.32 on a DM3730.  I am trying to do a loopback application using V4L2 to display YUV data captured using the ISP one of the video layers of the DSS.  The video size is 828x828.  I open /dev/video1 and when I try to change the video format of the DSS layer using VIDIOC_S_FMT ioctrl in the following code and then perform the VIDIOC_G_FMT, the height always comes back as 720.  THe DM3730 TRM appears to state that the height of the layer can be 0-2048, so I am unsure why this fails.  Does anyone know of a fix for this?

code:

int display_fd0 = open("/dev/video1", O_RDWR);
struct v4l2_format fmt;

fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
    if (ioctl(display_fd0, VIDIOC_G_FMT, &fmt) < 0) {
        printf ("%s %d: Failed to perform VIDIOC_G_FMT\n", __FILE__, __LINE__);
        return -1;
    }

    fmt.fmt.pix.height = 828;
    fmt.fmt.pix.width = 828;

    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; 

 if (ioctl(display_fd0, VIDIOC_S_FMT, &fmt) < 0)
 {
        printf ("%s %d: Failed to perform VIDIOC_S_FMT\n", __FILE__, __LINE__);
  return -1;
 }

  
 if (ioctl(display_fd0, VIDIOC_G_FMT, &fmt) < 0)
 {
        printf ("%s %d: Failed to perform VIDIOC_G_FMT\n", __FILE__, __LINE__);
  return -1;
 }

  • HI

    I also do  the same experience as you

    have you  coped with this question?

  • I found the source of the problem, but not necessarily a complete solution.  In the file: dvsdk\psp\linux-2.6.32-BSP-1.0\drivers\media\video\ti-media\omap_vout.c  there are two #defines that define the max resolution:

    /* Max Resolution supported by the driver */
    #define VID_MAX_WIDTH  1280 /* Largest width */
    #define VID_MAX_HEIGHT  720 /* Largest height */

    I have found that you can change the VID_MAX_HEIGHT to 768 with no problems, but when I tried to go higher the DSS driver would fail to load on boot.  Please give it a try and let me know if you have any luck making it bigger.

  • Hi Jeffrey

    I am also working on video streaming with a camera 640x512 in Y12 ans I am interested in the way you do 
    this loopback application. I am also using V4L2 to capture the data captured using the ISP but the display
    was directly to the framebuffer , then I was using OpenCV and now Qt to get some sort of GUI. If there a
    way to display on one of the video layers of the DSS at no CPU cost ? With Qt I am using full CPU load 
    (Gumstix Overo) and get 23 fps max, when my camera generate a fixed 30 fps. Any suggestion or code
    would be helpful.

    Thank you very much in advance for your time and help  

    Brahim 

  • Here is basic pseudo code for the loop back process that I use in its own thread:

    open video layer (/dev/video1 or /dev/video2)
    set output format with VIDIOC_S_FMT
    request MMAP buffers with VIDIOC_REQBUFS
    VIDIOC_QUERYBUF and mmap the buffers

    open capture device (/dev/video4)
    set input format with VIDIOC_S_FMT
    request USERPTR buffers with VIDIOC_REQBUFS
    give capture the buffers from the DSS as USERPTR with VIDIOC_QUERYBUF

    Queue up all the buffers in both DSS and ISP with VIDIOC_QBUF
    start stream on of both
    loop consisting of VIDIOC_DQBUF for both and then VIDIOC_QBUF for both

    I am not sure if this is the best way, but it does not require any frame copying and uses very little CPU. 

  • Thank you for your help.

    Do you have some code for share ? How do you deal with the different

    VIDIOC_S_FMT for output and input format ? It is unlikely that camera

    output format (typically YUV) can be directly mapped to RGB for LCD ?!

    Brahim


  • Sorry, I do not have code to share.

    As for the format, if you are capturing YUV data you set the DSS video layer to that same YUV format in the VIDIOC_S_FMT call.  VIDIOC_S_FMT is telling the DSS what format to expect in the buffers and it does the proper conversion to RGB.

  • Thank you very much for your help. Working on a solution based on your suggestions.

    Brahim