Skip to content

Commit b833b17

Browse files
mingqian-0Hans Verkuil
authored andcommitted
media: imx-jpeg: notify source chagne event when the first picture parsed
After gstreamer rework the dynamic resolution change handling, gstreamer stop doing capture buffer allocation based on guesses and wait for the source change event when available. It requires driver always notify source change event in the initialization, even if the size parsed is equal to the size set on capture queue. otherwise, the pipeline will be stalled. Currently driver may not notify source change event if the parsed format and size are equal to those previously established, but it may stall the gstreamer pipeline. The link of gstreamer patch is https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437 Fixes: b4e1fb8 ("media: imx-jpeg: Support dynamic resolution change") Signed-off-by: Ming Qian <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 63c5f1d commit b833b17

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,8 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx *ctx,
13481348
q_data_cap = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
13491349
if (mxc_jpeg_compare_format(q_data_cap->fmt, jpeg_src_buf->fmt))
13501350
jpeg_src_buf->fmt = q_data_cap->fmt;
1351-
if (q_data_cap->fmt != jpeg_src_buf->fmt ||
1351+
if (ctx->need_initial_source_change_evt ||
1352+
q_data_cap->fmt != jpeg_src_buf->fmt ||
13521353
q_data_cap->w != jpeg_src_buf->w ||
13531354
q_data_cap->h != jpeg_src_buf->h) {
13541355
dev_dbg(dev, "Detected jpeg res=(%dx%d)->(%dx%d), pixfmt=%c%c%c%c\n",
@@ -1392,6 +1393,7 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx *ctx,
13921393
mxc_jpeg_sizeimage(q_data_cap);
13931394
notify_src_chg(ctx);
13941395
ctx->source_change = 1;
1396+
ctx->need_initial_source_change_evt = false;
13951397
if (vb2_is_streaming(v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx)))
13961398
mxc_jpeg_set_last_buffer(ctx);
13971399
}
@@ -1611,6 +1613,9 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q,
16111613
for (i = 0; i < *nplanes; i++)
16121614
sizes[i] = mxc_jpeg_get_plane_size(q_data, i);
16131615

1616+
if (V4L2_TYPE_IS_OUTPUT(q->type))
1617+
ctx->need_initial_source_change_evt = true;
1618+
16141619
return 0;
16151620
}
16161621

drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct mxc_jpeg_ctx {
9999
enum mxc_jpeg_enc_state enc_state;
100100
int slot;
101101
unsigned int source_change;
102+
bool need_initial_source_change_evt;
102103
bool header_parsed;
103104
struct v4l2_ctrl_handler ctrl_handler;
104105
u8 jpeg_quality;

0 commit comments

Comments
 (0)