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.

cannot do V4L2 video capture after applying patches

Other Parts Discussed in Thread: TVP7002

Greetings,

I have a custom board with a ITE HDMI receiver. My sdk is latest one v5.03.01

I am trying to the video capture with v4l2 drivers.

What I have did is:

(1) Applying sub_devices_calls_removed.patch and make_select_decoder.patch

(2) comment following codes in ti81xxin_main.c

/*
    for (i = 0; i < 1; i++) {
        subdevdata = &config->subdev_info[i];
        ti81xxvin_obj.sd[i] =
            v4l2_i2c_new_subdev_board(&ti81xxvin_obj.v4l2_dev,
                          i2c_adap,
                          &subdevdata->board_info,
                          NULL, 0);

        //if (!ti81xxvin_obj.sd[i]) {
        
            //ti81xxvin_err("Error registering test v4l2 subdevice\n");
            //goto probe_subdev_out;
    //    }
        
        if (subdevdata->ti81xxvin_select_decoder)
            err = subdevdata->ti81xxvin_select_decoder(
                subdevdata->decoder_id);
        if (err < 0) {
            ti81xxvin_err("Error selecting decoder\n");
            goto probe_subdev_out;
        }
        if (subdevdata->ti81xxvin_set_mode)
            err = subdevdata->ti81xxvin_set_mode(
                    FVID2_STD_1080P_60);
        if (err < 0) {
            ti81xxvin_err("Error setting mode on decoder\n");
            goto probe_subdev_out;
        }

        v4l2_info(&ti81xxvin_obj.v4l2_dev, "registered sub device %s\n",
              subdevdata->name);

        if (ti81xxvin_obj.sd[i])
            ti81xxvin_obj.sd[i]->grp_id = 1 << i;
    }

*/

(3) change the bus width of original codes the bus width. (ti81xxin_main.c)

I changed as following:

    mbus_framefmt.width = 1920;
    mbus_framefmt.height = 1080;
    mbus_framefmt.code = V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE;//V4L2_MBUS_FMT_YUYV8_2X8;
    mbus_framefmt.field = V4L2_FIELD_NONE;
    mbus_framefmt.colorspace = V4L2_COLORSPACE_REC709;

(4) change the ti81xx_fb.c to let the chip working the discrete sync;

static struct ti81xxvin_subdev_info hdvpss_capture_sdev_info[] = {
    {
        .name    = TVP7002_INST0,
        .board_info = {
            /* TODO Find the correct address
                of the TVP7002 connected */
            I2C_BOARD_INFO("tvp7002", 0x5d),
            .platform_data = &tvp7002_pdata,
        },
        
        
        .vip_port_cfg = {
            .ctrlChanSel = VPS_VIP_CTRL_CHAN_DONT_CARE, //VPS_VIP_CTRL_CHAN_SEL_15_8,
    //        .ctrlChanSel = VPS_VIP_CTRL_CHAN_SEL_15_8,
            .ancChSel8b = VPS_VIP_ANC_CH_SEL_DONT_CARE,
            .pixClkEdgePol = VPS_VIP_PIX_CLK_EDGE_POL_RISING,
            .invertFidPol = 0,
            .embConfig = {
                .errCorrEnable = 1,
                .srcNumPos = VPS_VIP_SRC_NUM_POS_DONT_CARE,
                .isMaxChan3Bits = 0,
            },
            .disConfig = {
                .fidSkewPostCnt = 0,
                .fidSkewPreCnt = 0,
                .lineCaptureStyle =VPS_VIP_LINE_CAPTURE_STYLE_ACTVID,
//                .lineCaptureStyle =
//                    VPS_VIP_LINE_CAPTURE_STYLE_ACTVID,//VPS_VIP_LINE_CAPTURE_STYLE_HSYNC, //VPS_VIP_LINE_CAPTURE_STYLE_DONT_CARE,
                .fidDetectMode =VPS_VIP_FID_DETECT_MODE_DONT_CARE,
                    //VPS_VIP_FID_DETECT_MODE_PIN,//VPS_VIP_FID_DETECT_MODE_DONT_CARE,
                .actvidPol = VPS_VIP_POLARITY_HIGH , //VPS_VIP_POLARITY_DONT_CARE,
                .vsyncPol =  VPS_VIP_POLARITY_HIGH, //VPS_VIP_POLARITY_DONT_CARE,
                .hsyncPol = VPS_VIP_POLARITY_HIGH, //VPS_VIP_POLARITY_DONT_CARE,
            }
        },
        .video_capture_mode =
        //VPS_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_EMBEDDED_SYNC,
        VPS_CAPT_VIDEO_CAPTURE_MODE_SINGLE_CH_NON_MUX_DISCRETE_SYNC_HSYNC_VSYNC,

        .video_if_mode = VPS_CAPT_VIDEO_IF_MODE_24BIT,
        .input_data_format = FVID2_DF_RGB24_888,
    },

(3) load v4l2 firmwares and make new modules like vpss.ko ti81xxvin.ko and ti81xxfb.ko

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

Then I tried some examples /sa-examples/video/ and the only one I can let it work is saLoopBackFbdev.

I tested my hdmi rx, everything is fine and I can detect the sync and de sginals. I feed the board with 1080P source and H+V+

Problems: (1)  capt.dv_preset.preset cannot detect the source, the return value is always 0.

                   (2) saLoopBackFbdev can always capture one frame for me. However, when I replayed it, the image is 1080i and color space is BGR instead of RGB

                   (3) Gstreamer v4l2 capture does not work.

What I am missing?

Regards,

Jun

  • Update:

    Now I can capture video frames (by writing raw RGB data them into a file) based on the saLoopBackFbdev

    However Still

      (1)ioctl(capt.fd, VIDIOC_QUERY_DV_PRESET, &capt.dv_preset) this function cannot return the right value, and I have to hardcoded it as 1080P

      (2) saLoopBackFbdev can always capture one frame for me. However, when I replayed it, the image is 1080i and color space is BGR instead of RGB

      (3) Gstreamer v4l2src capture does not work.

    What changes should I do to let ioctl(capt.fd, VIDIOC_QUERY_DV_PRESET, &capt.dv_preset) return the right value?

    Regards,

    Jun

  • Hi,

    Jun Zhang@CA said:
    ioctl(capt.fd, VIDIOC_QUERY_DV_PRESET, &capt.dv_preset) this function cannot return the right value, and I have to hardcoded it as 1080P

    This ioctls calls the subdevice function to get the preset and based on preset it decides the resolution. So in your case either you will have to implement the sub-device driver for your decoder. or you have to hardcode the values as how you have done now. You can take example of TVP7002 for implementing sub-device driver.

    Jun Zhang@CA said:
    (2) saLoopBackFbdev can always capture one frame for me.

    I saw in your earlier thread that you are using your decoder in discrete sync mode. You will have to take care of errata point number 1.1.10 for ES1.1 silicon. Else you may get the results as above. ES2.0 silicon is not having limitation as mentioned in Errata 1.1.10 point.

    Jun Zhang@CA said:
    when I replayed it, the image is 1080i and color space is BGR instead of RGB

    Please make sure that RGB channels from output of decoder is matching with RGB channels as how HDVPSS is expecting.

    Jun Zhang@CA said:
    Gstreamer v4l2src capture does not work.

    This doesn't work because of the one 1 frame getting captured I guess.

    Regards,

    Hardik Shah

  • Hi Hardik,

     

    Thanks for your quick reply. Really appriciate that.

    1. Now I can capture mutliple frames with saLoopBackFbdev, although some frames are missing during the capture.

    2. That RGB issue: I have checked the datasheet of my hdmi rx and Dm814x and their connection is fine.

    I am planning to let the other side to replay my captured video file to see whether it can be played proprely.

    3. In our case, the HDMI Rx is controlled by an externel Microcontroller. It seems that I have to write a HDMI subdevie driver anyway.

  • Hi Hardik,
    A little update regarding my issue.
    I checked my chip and it is es2.0, so I guess I do not have to take care of that ACTIVD errra.
    Right now I can get  RGB raw data of multiple video frames using saLoopBackFbdev.
    I am trying to begin from here to do video streaming over network and when I copy the data from framebuffer and connect to the omx_h264enc, I got following errors.

    ========================================
    April 18, 2012 5:39 PM
    (<unknown>:1212): GStreamer-CRITICAL **: passed '0' as denominator for `GstFrac'
    /GstPipeline:server/GstOmxH264Enc:omx_h264enc.GstPad:src: caps = video/x-h264, 8
    unrecoverable error: One or more parameters were not valid (0x80001005)        
    Error: GStreamer encountered a general stream error.                           
    Debug details: gstomx_base_filter.c(657): pad_chain (): /GstPipeline:server/Gst:
    Error from OpenMAX component                                                   
    Returned, stopping playback                                                    
    /GstPipeline:server/GstOmxH264Enc:omx_h264enc.GstPad:src: caps = NULL          
    Deleting pipeline     
    ================================================
    Anyone knows why?
    Thanks,
    Jun
  • Hi,

    RGB data cant be encode. You can encode YUV data only. I think you are trying to encode RGB data.

    Regards,

    Hardik Shah