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.

AM62A7: Enabling Embedded Meta-data in sensor driver that don't allow to change to other resolution

Part Number: AM62A7


Tool/software:

Hi, 

SDK: 09.01.00

EVM: AM62A SK EVM

We have integrated the Image sensor with AM62A EVM and everything is working fine(able to get the stream, able to change the resolution, bit format as well). After that customer wanted to us to integrate the changes so that sensor can receive the embedded meta data. we have did below changes to integrate the embedded metadata.

static void sensor_init_formats(struct v4l2_subdev_state *state)
{
    int i;
    struct v4l2_mbus_framefmt *format;

    for (i = 0; i < 2; ++i) {
        format = v4l2_subdev_state_get_stream_format(state, 0, i);
        format->width = 1920;
        if(i == 0) {
            format->height = 1200;
            format->code = MEDIA_BUS_FMT_SRGGB10_1X10;
        }
        else {
            format->height = 5;
            format->code = MEDIA_BUS_FMT_SGRBG10_1X10;
        }
        format->field = V4L2_FIELD_NONE;
        format->colorspace = V4L2_COLORSPACE_DEFAULT;
    }
    return;
}

static int _sensor_set_routing(struct v4l2_subdev *sd,
                               struct v4l2_subdev_state *state)
{
    int ret;
    struct v4l2_subdev_route routes[] = {
        {
            .source_pad = 0,
            .source_stream = 0,
            .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
        },
        {
            .source_pad = 0,
            .source_stream = 1,
            .flags = V4L2_SUBDEV_ROUTE_FL_ACTIVE,
        },
    };

    struct v4l2_subdev_krouting routing = {
        .num_routes = ARRAY_SIZE(routes),
        .routes = routes,
    };
    struct i2c_client *client = v4l2_get_subdevdata(sd);

    dev_info(&client->dev, "--------- In %s --------\n", __func__);

    ret = v4l2_subdev_set_routing(sd, state, &routing);
    if (ret < 0)
        return ret;

    sensor_init_formats(state);

    dev_info(&client->dev, "--------- Out %s --------\n", __func__);
    return ret;
}


static int sensor_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
                                 struct v4l2_mbus_frame_desc *fd)
{
    u32 bpp;
    int ret = 0;
    unsigned int i;
    struct v4l2_subdev_state *state;
    struct v4l2_mbus_framefmt *fmt;
    struct i2c_client *client = v4l2_get_subdevdata(sd);

    dev_info(&client->dev, "--------- In %s --------\n", __func__);

    if (pad != 0)
        return -EINVAL;

    state = v4l2_subdev_lock_and_get_active_state(sd);

    memset(fd, 0, sizeof(*fd));

    fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;

    /* pixel stream - 2 virtual channels */

    bpp = 16;

    for (i = 0; i < 2; ++i) {

        fmt = v4l2_subdev_state_get_stream_format(state, 0, i);
        if (!fmt) {
            ret = -EPIPE;
            v4l2_subdev_unlock_state(state);
            return ret;
        }

        fd->entry[fd->num_entries].stream = i;
        fd->entry[fd->num_entries].flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
        fd->entry[fd->num_entries].pixelcode = fmt->code;
        fd->entry[fd->num_entries].bus.csi2.vc = 0;
        fd->entry[fd->num_entries].length = fmt->width * fmt->height * bpp / 8;

        if(i == 0) {
            fd->entry[fd->num_entries].bus.csi2.dt = 0x2b; /* RAW10 */
            dev_info(&client->dev, "width - %d, height - %d\n", fmt->width, fmt->height);
        }
        else {
            fd->entry[fd->num_entries].bus.csi2.dt = 0x12; /* RAW8 */
            dev_info(&client->dev, "width - %d, height - %d\n", fmt->width, fmt->height);
        }

        fd->num_entries++;
    }

    v4l2_subdev_unlock_state(state);
    dev_info(&client->dev, "--------- Out %s --------\n", __func__);
    return ret;
}

static int sensor_set_routing(struct v4l2_subdev *sd,
                  struct v4l2_subdev_state *state,
                  enum v4l2_subdev_format_whence which,
                  struct v4l2_subdev_krouting *routing)
{
    int ret;
    struct i2c_client *client = v4l2_get_subdevdata(sd);

    if (routing->num_routes == 0 || routing->num_routes > 2)
        return -EINVAL;

    dev_info(&client->dev, "--------- In %s --------\n", __func__);
    dev_info(&client->dev, "--------- Number of routes = %d --------\n", routing->num_routes);
    v4l2_subdev_lock_state(state);

    ret = _sensor_set_routing(sd, state);

    v4l2_subdev_unlock_state(state);

    dev_info(&client->dev, "--------- Out %s --------\n", __func__);
    return ret;
}

static int sensor_init_cfg(struct v4l2_subdev *sd,
               struct v4l2_subdev_state *state)
{
    int ret;
    struct i2c_client *client = v4l2_get_subdevdata(sd);

    dev_info(&client->dev, "--------- In %s --------\n", __func__);
    ret = _sensor_set_routing(sd, state);
    dev_info(&client->dev, "--------- Out %s --------\n", __func__);
    dev_info(&client->dev, "--------- ret %d --------\n", ret);

    return ret;
}

static const struct v4l2_subdev_pad_ops sensor_subdev_pad_ops = {
    .init_cfg = sensor_init_cfg,
    .enum_mbus_code = sensor_enum_mbus_code,
    .set_fmt = sensor_set_fmt,
    .get_fmt = sensor_get_fmt,
    .set_routing = sensor_set_routing,
    .get_frame_desc = sensor_get_frame_desc,
};

After creating the two separate stream as mention in above code, We were able to receive image data on one stream and embedded data on the other stream setting different the data type of both stream. So, there is no issues on receiving the embedded metadata and image data using above approach

Our sensor supports, 1920x1200(10bit, 8bit) and 960x600(10bit, 8bit) modes. With changes of the embedded metadata in the driver, I am not able to set the other resolution (Using media-ctl command, I am able to set the resolution but when I try to get stream with that resolution using gst-launch command, It gives the streaming error) and receive image data over that resolution. 

Is it possible that image stream format is getting fixed using the above  2 streaming configuration done in the driver and not allowing other resolution to be set?

Regards,

Jay

  • Hi Jay,

    With changes of the embedded metadata in the driver, I am not able to set the other resolution

    What did you mean exactly here?

    (Using media-ctl command, I am able to set the resolution but when I try to get stream with that resolution using gst-launch command, It gives the streaming error) and receive image data over that resolution. 

    Can you share the output of "media-ctl -p" and the command you used to change resolution and the Gst pipeline?

    Thanks,

    Jianzhong

  • Hi Jianzhong,

    output of "media-ctl -p" command for 1920x1200 (10bit) resolution is as below:

    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 2/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/1920x1200]
                    [stream:1 fmt:SGRBG10_1X10/1920x5]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1200]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    [stream:0 fmt:SGRBG10_1X10/1920x5]
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 1/1 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/1920x1204 field:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none]
                    <- "ar0235 2-0036":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1204 field:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1204 field:none colorspace:raw xfer:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none colorspace:raw xfer:none]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]

    working GST pipeline for this is as below:

    gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-bayer, width=1920, height=1200, framerate=120/1, format=rggb10  ! fakesink

    Now I want to change the resolution to 960x600, I am using below command to change the resolution.

    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/960x600 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/960x5 field:none]'

    After executing above command, output of media-ctl is as below:

    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 2/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/1920x1200]
                    [stream:1 fmt:SGRBG10_1X10/1920x5]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1200]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    [stream:0 fmt:SGRBG10_1X10/1920x5]
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 1/1 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none]
                    <- "ar0235 2-0036":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1204 field:none colorspace:raw xfer:none]
                    [stream:1 fmt:SRGGB10_1X10/1920x1204 field:none colorspace:raw xfer:none]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]

    I am using the below gst-pipeline and it is giving the error as metion below:

    gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakesink

    Error while running above gst-pipeline:

    root@am62ax:~# gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakesink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
    Additional debug info:
    ../gst-plugins-good-1.20.7/sys/v4l2/gstv4l2src.c(777): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    Buffer pool activation failed
    Execution ended after 0:00:00.047745597
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Setting pipeline to NULL ...
    Additional debug info:
    ../gstreamer-1.20.7/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Freeing pipeline ...

    Regards,

    Jay

  • Hi Jay,

    Sorry that I wasn't able to look at this today. I'll get back to you early next week.

    Thanks,

    Jianzhong

  • Hi Jianzhong,

    Thank you for your reply. Let us know if you have any findings on this.

    Regards,

    Jay

  • Hi Jay,

    Your "media-ctl -V" commands didn't configure the format as expected. That's probably why it's not working.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Your "media-ctl -V" commands didn't configure the format as expected. That's probably why it's not working.

    So, what could be the issue with "media-ctl -V" command when i uses it for 960x600 resolution.

    Below "media-ctl" commands for 1920x1200 resolution which are working fine and i get image stream on one node and embedded data on other stream.

    media-ctl -R '"cdns_csi2rx.30101000.csi-bridge" [0/0 -> 1/0 [1], 0/1 -> 1/1 [1]]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/0 [fmt:SRGGB10_1X10/1920x1200]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/1 [fmt:SGRBG10_1X10/1920x5]'
    
    # Set j721e-csi2rx routes
    media-ctl -R '"30102000.ticsi2rx" [0/0 -> 1/0 [1], 0/1 -> 2/0 [1]]'
    media-ctl -V '"30102000.ticsi2rx":0/0 [fmt:SRGGB10_1X10/1920x1200]'
    media-ctl -V '"30102000.ticsi2rx":0/1 [fmt:SGRBG10_1X10/1920x5]'
    
    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/1920x1200 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/1920x5 field:none]'

    Now I want to change resolution to 960x600, I am using below "media-ctl" commands. Note: sensor driver supports embedded data with 960x600 resolution as well.

    media-ctl -R '"cdns_csi2rx.30101000.csi-bridge" [0/0 -> 1/0 [1], 0/1 -> 1/1 [1]]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/0 [fmt:SRGGB10_1X10/960x600]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/1 [fmt:SGRBG10_1X10/960x5]'
    
    # Set j721e-csi2rx routes
    media-ctl -R '"30102000.ticsi2rx" [0/0 -> 1/0 [1], 0/1 -> 2/0 [1]]'
    media-ctl -V '"30102000.ticsi2rx":0/0 [fmt:SRGGB10_1X10/960x600]'
    media-ctl -V '"30102000.ticsi2rx":0/1 [fmt:SGRBG10_1X10/960x5]'
    
    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/960x600 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/960x5 field:none]'

    Amy of the above commands doesn't return failure and executes successfully but not able get even image data stream from video not. It returns below error if i try to stream image data:

    root@SICK:~# gst-launch-1.0 -v v4l2src device=/dev/video-rpi-cam0 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakesink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
    Additional debug info:
    ../gst-plugins-good-1.20.7/sys/v4l2/gstv4l2src.c(777): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    Buffer pool activation failed
    Execution ended after 0:00:00.056258565
    Setting pipeline to NULL ...
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Additional debug info:
    ../gstreamer-1.20.7/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Freeing pipeline ...

    So, I have doubt that image sensor driver is fixing the resolution for streams created from the driver. Can that be true?

    Regards,

    Jay

  • Amy of the above commands doesn't return failure and executes successfully but not able get even image data stream from video not

    What's the "media-ctl -p" output after you run those commands?

    Please refer to this script for configuring the video node formats: https://github.com/TexasInstruments/edgeai-gst-apps/blob/main/scripts/setup_camera_ox05b.sh

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Please refer to this script for configuring the video node formats: https://github.com/TexasInstruments/edgeai-gst-apps/blob/main/scripts/setup_camera_ox05b.sh

    I have tried the media-ctl commands and able execute commands successfully. Commands are as below.

    media-ctl -R '"cdns_csi2rx.30101000.csi-bridge" [0/0 -> 1/0 [1], 0/1 -> 1/1 [1]]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/0 [fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/1 [fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]'
    
    # Set j721e-csi2rx routes
    media-ctl -R '"30102000.ticsi2rx" [0/0 -> 1/0 [1], 0/1 -> 2/0 [1]]'
    media-ctl -V '"30102000.ticsi2rx":0/0 [fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]'
    media-ctl -V '"30102000.ticsi2rx":0/1 [fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]'
    
    # Set video node formats
    v4l2-ctl -z platform:30102000.ticsi2rx -d "30102000.ticsi2rx context 0" -v width=960,height=600,pixelformat=RG10
    v4l2-ctl -z platform:30102000.ticsi2rx -d "30102000.ticsi2rx context 1" -v width=960,height=5,pixelformat=RG10

    After executing below commands, Not able to stream the image data on the stream0. Below is the error in streaming commamd.

    root@am62axx-evm:~# gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakes
    ink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
    Additional debug info:
    ../gst-plugins-good-1.20.7/sys/v4l2/gstv4l2src.c(777): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    Buffer pool activation failed
    Execution ended after 0:00:00.052742579
    Setting pipeline to NULL ...
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Additional debug info:
    ../gstreamer-1.20.7/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Freeing pipeline ...

    Below is the output of the "media-ctl -p" command after setting up streams using "media-ctl -V" command.

    root@am62axx-evm:~# media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 2/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]
                    [stream:1 fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    [stream:0 fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 1/1 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]
                    [stream:1 fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]
                    <- "ar0235 2-0036":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:srgb]
                    [stream:1 fmt:SGRBG10_1X10/960x5 field:none colorspace:srgb]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1200 field:none colorspace:raw xfer:none
                     crop.bounds:(8,8)/1920x1200
                     crop:(0,0)/0x0]
                    [stream:1 fmt:SRGGB10_1X10/1920x1200 field:none colorspace:raw xfer:none
                     crop.bounds:(8,8)/1920x1200
                     crop:(0,0)/0x0]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]

    Let us know if anything else is required from my side.

    Regards,

    Jay

  • Hi Jay,

    Your sensor is not showing the right format:

    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/1920x1200 field:none colorspace:raw xfer:none
                     crop.bounds:(8,8)/1920x1200
                     crop:(0,0)/0x0]
                    [stream:1 fmt:SRGGB10_1X10/1920x1200 field:none colorspace:raw xfer:none
                     crop.bounds:(8,8)/1920x1200
                     crop:(0,0)/0x0]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    

    Does the sensor support SRGGB10_1X10/960x600 and SRGGB10_1X10/960x5? You'll still need to run the following commands:

    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/960x600 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/960x5 field:none]'

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Sorry for my late reply on the thread.

    Your sensor is not showing the right format

    Can you tell us what could wrong while setting the formats of streams.

    Does the sensor support SRGGB10_1X10/960x600 and SRGGB10_1X10/960x5? You'll still need to run the following commands:

    Yes, sensor does support the SRGGB10_1X10/960x600 for image/video and SRGGB10_1X10/960x5 is for metadata. 5 row is of embedded metadata in 960x5 resolution.

    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/960x600 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/960x5 field:none]'

    Yes, I am executing the these commands as well but still there is no stream when resolution is set to SRGGB10_1X10/960x600 and SRGGB10_1X10/960x5.

    I have observe one thing in the drivers where 2 streams were created using .init_cfg, .set_routing  and .get_frame_desc subdev callbacks, these driver supports the single resolution only. 

    So, would there be any limitation that while creating node from sensor driver, resolution will be fixed and can't be changed at runtime? I am not sure about this and I had this question.

    Regards,

    Jay

  • In your original post, you said:

    After creating the two separate stream as mention in above code, We were able to receive image data on one stream and embedded data on the other stream setting different the data type of both stream. So, there is no issues on receiving the embedded metadata and image data using above approach

    These two streams had different resolutions, 1920x1200 and 1920x5. Is that correct?

  • Hi Jianzhong,

    These two streams had different resolutions, 1920x1200 and 1920x5. Is that correct?

    Yes, Two stream has different resolution. 1920x1200 resolution is for image/video data and 1920x5 is for embedded metadata. 


    For 960x600 resolution, I am using below media-ctl -V commands, 

    media-ctl -R '"cdns_csi2rx.30101000.csi-bridge" [0/0 -> 1/0 [1], 0/1 -> 1/1 [1]]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/0 [fmt:SRGGB10_1X10/960x600]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0/1 [fmt:SGRBG10_1X10/960x5]'
    
    # Set j721e-csi2rx routes
    media-ctl -R '"30102000.ticsi2rx" [0/0 -> 1/0 [1], 0/1 -> 2/0 [1]]'
    media-ctl -V '"30102000.ticsi2rx":0/0 [fmt:SRGGB10_1X10/960x600]'
    media-ctl -V '"30102000.ticsi2rx":0/1 [fmt:SGRBG10_1X10/960x5]'
    
    # Set video node formats
    v4l2-ctl -z platform:30102000.ticsi2rx -d "30102000.ticsi2rx context 0" -v width=960,height=600,pixelformat=RG10
    v4l2-ctl -z platform:30102000.ticsi2rx -d "30102000.ticsi2rx context 1" -v width=960,height=5,pixelformat=RG10
    
    media-ctl -V '"ar0235 2-0036":0/0 [fmt:SRGGB10_1X10/960x600 field:none]'
    media-ctl -V '"ar0235 2-0036":0/1 [fmt:SGRBG10_1X10/960x5 field:none]'

    After executing this commands, i guess now "media-ctl -p" commands show the correct formats.

    root@am62axx-evm:~# media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 2/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    [stream:0 fmt:SGRBG10_1X10/960x5]
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 1/1 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    <- "ar0235 2-0036":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:raw xfer:none]
                    [stream:1 fmt:SRGGB10_1X10/960x600 field:none colorspace:raw xfer:none]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    

    After checking "media-ctl -p" command output in which all entity has correct format, then also stream with 960x600 resolution is not working. 

    gst pipeline command,

    gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakesink

    Error received on using above pipeline,

    root@am62axx-evm:~# gst-launch-1.0 -v v4l2src device=/dev/video3 ! video/x-bayer, width=960, height=600, framerate=120/1, format=rggb10  ! fakesink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)960, height=(int)600, framerate=(fraction)120/1, format=(string)rggb10, interlace-mode=(string)progressive, colorimetry=(string)2:4:7:1
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
    Additional debug info:
    ../gst-plugins-good-1.20.7/sys/v4l2/gstv4l2src.c(777): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    Buffer pool activation failed
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Additional debug info:
    ../gstreamer-1.20.7/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Execution ended after 0:00:00.050064391
    Setting pipeline to NULL ...
    Freeing pipeline ...

    Questions:

    1) Is there anything wrong with "media-ctl -V" commands? If yes let us know. So we can correct the commands.

    we have did below changes to integrate the embedded metadata.

    2) Is code added to sensor driver for embedded metadata integration correct? Let us know if we have to make any changes in that to receive metadata with 1920x1200 and 960x600 both resolution.

    Regards,

    Jay

  • Hi Jay,

    Pleas give me a few days to look at this deeper.

    Thanks,

    Jianzhong

  • Is it possible that image stream format is getting fixed using the above  2 streaming configuration done in the driver and not allowing other resolution to be set?

    Yes, your driver code has fixed resolution.

    2) Is code added to sensor driver for embedded metadata integration correct? Let us know if we have to make any changes in that to receive metadata with 1920x1200 and 960x600 both resolution.

    You'll need to implement an API in the sensor driver to allow resolution change. Please refer to IMX219 driver: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/media/i2c/imx219.c?h=ti-linux-6.6.y#n1087.

  • Hi Jianzhong,

    Thank you for reply. 

    As you mention that I need to implement ".set_fmtcallback/API in our driver. I have already implemented .set_fmt and .get_fmt in our driver and able to change to different resolution before implementing the embedded metadata changes. Switching to other resolution is working fine before adding the embedded metadata changes in the driver.

    After adding the metadata changes in the driver, I am not able to stream data from except 1920x1200@10bit resolution.

    So, I am facing issue in changing the format after implementing the metadata changes in driver. So, How is the embedded metadata changes affecting the resolution change? what could be wrong here?

    Regards,

    Jay 

  • Hi Jay,

    Sorry, but I'm confused. I thought the driver was working for both image and metadata at 1920x1200, as you said in your original post:

    After creating the two separate stream as mention in above code, We were able to receive image data on one stream and embedded data on the other stream setting different the data type of both stream. So, there is no issues on receiving the embedded metadata and image data using above approach

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Sorry, but I'm confused. I thought the driver was working for both image and metadata at 1920x1200, as you said in your original post:

    Yes, Image data and embedded data is working with 1920x1200 resolution. But Image sensor also supports the 960x600 resolution as well. With 960x600 resolution, I am not able to get image data or metadata after doing the changes for embedded data in driver. Before doing the changes of the embedded data in the driver, both resolution 1920x1200 and 960x600 resolution. 

    Let me know if you have any query or doubt in this.

    Can you tell us steps or way to debug this issue? So, I can debug this parallel with you. Now this has become critical issue to solve for us. We want to solve this as soon as possible. If we can arrange call to debug this issue than that is fine for us.

    Regards,

    Jay

  • Hi Jay,

    Thanks for the clarification. So,

    1. without adding embedded data support, both 1920x1200 and 960x600 resolutions work for image data

    2. for 1920x1200, both image data (1920x1200) and embedded data (1920x5) work

    3. adding 960x600, neither image data or embedded data work

    For case #3, I saw incorrect media device topology formats. Instead of adding 960x600, can you try changing 1920x1200 to 960x600 and see if that works?

    Regards,

    Jianzhong

  • Hi Jianzhong,

    1. without adding embedded data support, both 1920x1200 and 960x600 resolutions work for image data

    Yes, correct.

    2. for 1920x1200, both image data (1920x1200) and embedded data (1920x5) work

    Yes, correct.

    3. adding 960x600, neither image data or embedded data work

    Both the resolution are present in the driver. After adding code for embedded data in the driver, embedded data and image data works for 1920x1200 resolution. But neither image data or embedded are coming in 960x600 resolution.

    For case #3, I saw incorrect media device topology formats. Instead of adding 960x600, can you try changing 1920x1200 to 960x600 and see if that works?

    Registers setting in the driver for 1920x1200 and 960x600 resolution are different. So, I don't this this will work if I don't add the 960x600 resolution in the driver.

    For case #3, I saw incorrect media device topology formats.

    After correcting the media device topology, Having the same issue. Please check media-ctl -p command output for 960x600 resolution.

    root@am62axx-evm:~# media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 2/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    [stream:0 fmt:SGRBG10_1X10/960x5]
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 2 routes)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
                    0/1 -> 1/1 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    <- "ar0235 2-0036":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none]
                    [stream:1 fmt:SGRBG10_1X10/960x5]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: ar0235 2-0036 (1 pad, 1 link, 2 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            routes:
                    0/0 -> 0/0 [ACTIVE]
                    0/0 -> 0/1 [ACTIVE]
            pad0: Source
                    [stream:0 fmt:SRGGB10_1X10/960x600 field:none colorspace:raw xfer:none]
                    [stream:1 fmt:SRGGB10_1X10/960x600 field:none colorspace:raw xfer:none]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    

    Is there anything else I have to take care apart from this?

    One more observation:

    When setting 960x600 resolution, ".get_frame_desc = sensor_get_frame_desc," callback is not even getting called. So, due to this ".s_stream = sensor_set_stream," is not getting called and due to this, start_stream() function is not getting called and sensor registers are not written and eventually it will be streaming error.

    Regards,

    Jay

  • When setting 960x600 resolution, ".get_frame_desc = sensor_get_frame_desc," callback is not even getting called.

    This function should be called here: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c?h=ti-linux-6.6.y#n948.

    Please debug why this function is not called and where was the execution stuck inside this function:

    https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c?h=ti-linux-6.6.y#n964

  • Hi Jianzhong, 

    Thank you for your reply. 

    Finally, I am able to stream image data and metadata on 1920x1200 and 960x600 resolutions. There was issue with media-ctl command which was setting the format. After correcting media-ctl command, everything are working fine. You can close this issue.

    Regards,

    Jay

  • Hi Jay,

    Thanks for the update. Glad that you fixed the problem.

    Regards,

    Jianzhong