From b7e6b495eff31298ba4665f71b2414cc9a8f99c2 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 16 Sep 2021 16:32:53 +0100 Subject: [PATCH] staging: bcm2835-codec: Format changed should trigger drain When a format changed event occurs, the spec says that it triggers an implicit drain, and that needs to be signalled via -EPIPE. For BCM2835, the format changed event happens at the point the format change occurs, so no further buffers exist from before the resolution changed point. We therefore signal the last buffer immediately. We don't have a V4L2 available to us at this point, so set the videobuf2 queue last_buffer_dequeued flag directly. Signed-off-by: Dave Stevenson --- drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c index 4156018..73afe99 100644 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c @@ -1005,6 +1005,7 @@ static void handle_fmt_changed(struct bcm2835_codec_ctx *ctx, (struct mmal_msg_event_format_changed *)mmal_buf->buffer; struct mmal_parameter_video_interlace_type interlace; int interlace_size = sizeof(interlace); + struct vb2_queue *vq; int ret; v4l2_dbg(1, debug, &ctx->dev->v4l2_dev, "%s: Format changed: buff size min %u, rec %u, buff num min %u, rec %u\n", @@ -1074,6 +1075,10 @@ static void handle_fmt_changed(struct bcm2835_codec_ctx *ctx, q_data->field = V4L2_FIELD_NONE; } + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + if (vq->streaming) + vq->last_buffer_dequeued = true; + queue_res_chg_event(ctx); } -- 2.7.4