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.

OMAP3 ISP DQBUF hangs



Hello,

I'm working with an OMAP3 DM3730 processor module with a ov3640 camera module attached on parallel interface. I'm using Linux 3.5 and an application which builds the pipeline and grabs an image like the "media-ctl" and the "yavta" tools.

I configured the pipeline to:

sensor->ccdc->memory

When I call ioctl with DQBUF the calling functions are:

isp_video_dqbuf -> omap3isp_video_queue_dqbuf -> isp_video_buffer_wait -> wait_event_interruptible

The last function waits until the state of the buffer will be reseted somehow. Can someone tell my which function sets the state of the buffer? Am I missing an interrupt?

Best Regards, Tom

  • Hi Tom,

    I recommend you to add some prints of debug messages to localize the problem in the function which expect to causes the hang. It should be useful to post the log of dmesg.

    BR

    Tsvetolin Shulev

  • Hello,

    thanks for your reply. Becuase of the simplicity of the wait_event_interruptible function I didn't think that the log would be that useful. So my application creates on buffer and calls ioctl with VIDIOC_QBUF:

      memset(&cam->buf, 0, sizeof (cam->buf));
      cam->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
      cam->buf.memory = V4L2_MEMORY_MMAP;

      if (ioctl (cam->fd_v4l2, VIDIOC_QBUF, &cam->buf) < 0) {
          VS_printf(_T("VIDIOC_QBUF failed\n"));
            return ERR_ERROR;
      }

    After the queueing I use the same buffer to dequeue:

    memset(&cam->buf, 0, sizeof (cam->buf));
      cam->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
      cam->buf.memory = V4L2_MEMORY_MMAP;


      if (ioctl (cam->fd_v4l2, VIDIOC_DQBUF, &cam->buf) < 0) {
          VS_printf(_T("VIDIOC_DQBUF failed\n"));
            return ERR_ERROR;
      }

    The DQBUF hangs in the wait_event_interruptible function. I used printk within the kernel sources to localize the problem, so dmesg says:

    [   95.851226] TOM SENS ov3640_set_format 4104 ##########
    [   95.865753] TOM isp_video_get_format ##########
    [   95.872528] TOM isp_video_try_format ##########
    [   95.878448] TOM isp_video_pix_to_mbus ##########
    [   95.884002] TOM isp_video_mbus_to_pix ##########
    [   95.892181] TOM isp_video_set_format ##########
    [   95.896911] TOM isp_video_pix_to_mbus ##########
    [   95.906646] TOM isp_video_mbus_to_pix ##########
    [   95.912536] TOM isp_video_get_param ##########
    [   95.919494] TOM isp_video_set_param ##########
    [   95.980499] TOM isp_video_reqbuf ##########
    [   95.987487] TOM isp_video_reqbuf ##########
    [   95.995178] TOM isp_video_querybuf ##########
    [   96.002899] TOM isp_video_streamon ##########
    [   96.011016] TOM SENS ov3640_get_format ##########
    [   96.016845] TOM isp_video_mbus_to_pix ##########
    [   96.021911] TOM SENS ov3640_get_format ##########
    [   96.027954] TOM SENS ov3640_set_stream ##########
    [   96.033538] ov3640_configure
    [   97.062469] TOM SENS CTRL 00000002 ##########
    [   97.076049] TOM SENS CTRL 00000002 ##########
    [   97.084625] TOM SENS CTRL 00000002 ##########
    [   97.093109] TOM SENS CTRL 00000002 ##########
    [   97.100372] TOM SENS CTRL 00000002 ##########
    [   97.106964] TOM SENS CTRL 00000002 ##########
    [   97.113159] TOM SENS CTRL 00000002 ##########
    [   97.119323] TOM SENS CTRL 00000002 ##########
    [   97.131469] TOM SENS CTRL 00000002 ##########
    [   97.142089] TOM SENS CTRL 00000002 ##########
    [   97.164794] ov3640_configure: common configuration and controls set
    [   99.190155] ov3640_configure: pixel format configured
    [  101.206420] ov3640_configure: frame rate configured
    [  103.235534] ov3640_configure: frame size configured
    [  105.244934] ov3640_standby: out of standby
    [  105.319549] TOM ccdc_isr_buffer ##########
    [  129.373687] omap3isp omap3isp: CCDC stop timeout!
    [  129.378662] TOM SENS ov3640_set_stream ##########
    [  129.386047] ov3640 3-003c: Register 0x3012 written 0x000080 read 0x000000
    [  130.550048] TOM SENS ov3640_set_format 4104 ##########
    [  130.562225] TOM isp_video_get_format ##########
    [  130.571533] TOM isp_video_try_format ##########
    [  130.576477] TOM isp_video_pix_to_mbus ##########
    [  130.582580] TOM isp_video_mbus_to_pix ##########
    [  130.588134] TOM isp_video_set_format ##########
    [  130.593536] TOM isp_video_pix_to_mbus ##########
    [  130.598358] TOM isp_video_mbus_to_pix ##########
    [  130.607727] TOM isp_video_get_param ##########
    [  130.614532] TOM isp_video_set_param ##########
    [  130.671142] TOM isp_video_reqbuf ##########
    [  130.676605] TOM isp_video_reqbuf ##########
    [  130.687408] TOM isp_video_querybuf ##########
    [  130.695953] TOM isp_video_streamon ##########
    [  130.700592] TOM SENS ov3640_get_format ##########
    [  130.706756] TOM isp_video_mbus_to_pix ##########
    [  130.712341] TOM SENS ov3640_get_format ##########
    [  130.726989] TOM SENS ov3640_set_stream ##########
    [  130.731933] ov3640_configure
    [  131.765228] TOM SENS CTRL 00000002 ##########
    [  131.773742] TOM SENS CTRL 00000002 ##########
    [  131.782012] TOM SENS CTRL 00000002 ##########
    [  131.789916] TOM SENS CTRL 00000002 ##########
    [  131.798065] TOM SENS CTRL 00000002 ##########
    [  131.806854] TOM SENS CTRL 00000002 ##########
    [  131.813354] TOM SENS CTRL 00000002 ##########
    [  131.819610] TOM SENS CTRL 00000002 ##########
    [  131.830200] TOM SENS CTRL 00000002 ##########
    [  131.840026] TOM SENS CTRL 00000002 ##########
    [  131.862182] ov3640_configure: common configuration and controls set
    [  133.883880] ov3640_configure: pixel format configured
    [  135.898559] ov3640_configure: frame rate configured
    [  137.920440] ov3640_configure: frame size configured
    [  139.931304] ov3640_standby: out of standby
    [  140.006195] TOM ccdc_isr_buffer ##########
    [  152.062591] TOM isp_video_qbuf ##########
    [  152.071960] TOM isp_video_dqbuf ##########
    [  152.077392] TOM omap3isp_video_queue_dqbuf ##########
    [  152.082672] TOM omap3isp_video_queue_dqbuf temp 1 ##########
    [  152.092285] TOM omap3isp_video_queue_dqbuf temp 1,5 ##########
    [  152.098388] TOM isp_video_buffer_wait ##########
    [  152.104461] TOM isp_video_buffer_wait temp ##########

    the isp functions are:

    static int
    isp_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
    {
        printk("TOM isp_video_dqbuf ##########\n");
        struct isp_video_fh *vfh = to_isp_video_fh(fh);

        return omap3isp_video_queue_dqbuf(&vfh->queue, b,
                          file->f_flags & O_NONBLOCK);
    }

    int omap3isp_video_queue_dqbuf(struct isp_video_queue *queue,
                       struct v4l2_buffer *vbuf, int nonblocking)
    {
        printk("TOM omap3isp_video_queue_dqbuf ##########\n");
        struct isp_video_buffer *buf;
        int ret;

        if (vbuf->type != queue->type)
        {
            printk("TOM omap3isp_video_queue_dqbuf ERROR 1 ##########\n");
            return -EINVAL;
        }
        mutex_lock(&queue->lock);

        if (list_empty(&queue->queue)) {
            ret = -EINVAL;
            printk("TOM omap3isp_video_queue_dqbuf ERROR 2 ##########\n");
            goto done;
        }

        printk("TOM omap3isp_video_queue_dqbuf temp 1 ##########\n");

        buf = list_first_entry(&queue->queue, struct isp_video_buffer, stream);
        printk("TOM omap3isp_video_queue_dqbuf temp 1,5 ##########\n");
        if(buf == NULL)
        {
            printk("TOM omap3isp_video_queue_dqbuf temp 1,5 ERROR ##########\n");
        }
        ret = isp_video_buffer_wait(buf, nonblocking);
        if (ret < 0)
        {
            printk("TOM omap3isp_video_queue_dqbuf ERROR 1 ##########\n");
            goto done;
        }

        printk("TOM omap3isp_video_queue_dqbuf temp 2 ##########\n");

        list_del(&buf->stream);

        printk("TOM omap3isp_video_queue_dqbuf temp 3 ##########\n");

        isp_video_buffer_query(buf, vbuf);
        buf->state = ISP_BUF_STATE_IDLE;
        vbuf->flags &= ~V4L2_BUF_FLAG_QUEUED;

        printk("TOM omap3isp_video_queue_dqbuf END ##########\n");

    done:
        mutex_unlock(&queue->lock);
        return ret;
    }

    static int isp_video_buffer_wait(struct isp_video_buffer *buf, int nonblocking)
    {
        printk("TOM isp_video_buffer_wait ##########\n");
        if (nonblocking) {
            return (buf->state != ISP_BUF_STATE_QUEUED &&
                buf->state != ISP_BUF_STATE_ACTIVE)
                ? 0 : -EAGAIN;
        }
        printk("TOM isp_video_buffer_wait temp ##########\n");
        return wait_event_interruptible(buf->wait,
            buf->state != ISP_BUF_STATE_QUEUED &&
            buf->state != ISP_BUF_STATE_ACTIVE);
    }

    Best Regards, Tom

  • I solved the problem by myself. I needed to do ioctl STREAMON after ioctl QBUF.

    Regards, Tom