Skip to content

Commit

Permalink
staging: bcm2835-codec: Format changed should trigger drain
Browse files Browse the repository at this point in the history
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 <dave.stevenson@raspberrypi.com>
  • Loading branch information
6by9 authored and pelwell committed Sep 23, 2021
1 parent 63ac2c7 commit b7e6b49
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit b7e6b49

Please sign in to comment.