diff options
Diffstat (limited to 'drivers/media/video/omap3isp/ispvideo.c')
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index bd3aebafafa0..b02070057724 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -211,14 +211,14 @@ static void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix, | |||
211 | mbus->width = pix->width; | 211 | mbus->width = pix->width; |
212 | mbus->height = pix->height; | 212 | mbus->height = pix->height; |
213 | 213 | ||
214 | for (i = 0; i < ARRAY_SIZE(formats); ++i) { | 214 | /* Skip the last format in the loop so that it will be selected if no |
215 | * match is found. | ||
216 | */ | ||
217 | for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { | ||
215 | if (formats[i].pixelformat == pix->pixelformat) | 218 | if (formats[i].pixelformat == pix->pixelformat) |
216 | break; | 219 | break; |
217 | } | 220 | } |
218 | 221 | ||
219 | if (WARN_ON(i == ARRAY_SIZE(formats))) | ||
220 | return; | ||
221 | |||
222 | mbus->code = formats[i].code; | 222 | mbus->code = formats[i].code; |
223 | mbus->colorspace = pix->colorspace; | 223 | mbus->colorspace = pix->colorspace; |
224 | mbus->field = pix->field; | 224 | mbus->field = pix->field; |
@@ -581,21 +581,20 @@ static const struct isp_video_queue_operations isp_video_queue_ops = { | |||
581 | /* | 581 | /* |
582 | * omap3isp_video_buffer_next - Complete the current buffer and return the next | 582 | * omap3isp_video_buffer_next - Complete the current buffer and return the next |
583 | * @video: ISP video object | 583 | * @video: ISP video object |
584 | * @error: Whether an error occurred during capture | ||
585 | * | 584 | * |
586 | * Remove the current video buffer from the DMA queue and fill its timestamp, | 585 | * Remove the current video buffer from the DMA queue and fill its timestamp, |
587 | * field count and state fields before waking up its completion handler. | 586 | * field count and state fields before waking up its completion handler. |
588 | * | 587 | * |
589 | * The buffer state is set to VIDEOBUF_DONE if no error occurred (@error is 0) | 588 | * For capture video nodes the buffer state is set to ISP_BUF_STATE_DONE if no |
590 | * or VIDEOBUF_ERROR otherwise (@error is non-zero). | 589 | * error has been flagged in the pipeline, or to ISP_BUF_STATE_ERROR otherwise. |
590 | * For video output nodes the buffer state is always set to ISP_BUF_STATE_DONE. | ||
591 | * | 591 | * |
592 | * The DMA queue is expected to contain at least one buffer. | 592 | * The DMA queue is expected to contain at least one buffer. |
593 | * | 593 | * |
594 | * Return a pointer to the next buffer in the DMA queue, or NULL if the queue is | 594 | * Return a pointer to the next buffer in the DMA queue, or NULL if the queue is |
595 | * empty. | 595 | * empty. |
596 | */ | 596 | */ |
597 | struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video, | 597 | struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) |
598 | unsigned int error) | ||
599 | { | 598 | { |
600 | struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); | 599 | struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); |
601 | struct isp_video_queue *queue = video->queue; | 600 | struct isp_video_queue *queue = video->queue; |
@@ -630,7 +629,13 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video, | |||
630 | else | 629 | else |
631 | buf->vbuf.sequence = atomic_read(&pipe->frame_number); | 630 | buf->vbuf.sequence = atomic_read(&pipe->frame_number); |
632 | 631 | ||
633 | buf->state = error ? ISP_BUF_STATE_ERROR : ISP_BUF_STATE_DONE; | 632 | /* Report pipeline errors to userspace on the capture device side. */ |
633 | if (queue->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { | ||
634 | buf->state = ISP_BUF_STATE_ERROR; | ||
635 | pipe->error = false; | ||
636 | } else { | ||
637 | buf->state = ISP_BUF_STATE_DONE; | ||
638 | } | ||
634 | 639 | ||
635 | wake_up(&buf->wait); | 640 | wake_up(&buf->wait); |
636 | 641 | ||
@@ -1016,6 +1021,8 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) | |||
1016 | if (ret < 0) | 1021 | if (ret < 0) |
1017 | goto error; | 1022 | goto error; |
1018 | 1023 | ||
1024 | pipe->error = false; | ||
1025 | |||
1019 | spin_lock_irqsave(&pipe->lock, flags); | 1026 | spin_lock_irqsave(&pipe->lock, flags); |
1020 | pipe->state &= ~ISP_PIPELINE_STREAM; | 1027 | pipe->state &= ~ISP_PIPELINE_STREAM; |
1021 | pipe->state |= state; | 1028 | pipe->state |= state; |