Skip to content

Commit a8876c2

Browse files
smaeulmchehab
authored andcommitted
media: cedrus: Program output format during each run
Previously, the output format was programmed as part of the ioctl() handler. However, this has two problems: 1) If there are multiple active streams with different output formats, the hardware will use whichever format was set last for both streams. Similarly, an ioctl() done in an inactive context will wrongly affect other active contexts. 2) The registers are written while the device is not actively streaming. To enable runtime PM tied to the streaming state, all hardware access needs to be moved inside cedrus_device_run(). The call to cedrus_dst_format_set() is now placed just before the codec-specific callback that programs the hardware. Cc: <[email protected]> Fixes: 50e7615 ("media: platform: Add Cedrus VPU decoder driver") Suggested-by: Jernej Skrabec <[email protected]> Suggested-by: Paul Kocialkowski <[email protected]> Signed-off-by: Samuel Holland <[email protected]> Tested-by: Jernej Skrabec <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]> Reviewed-by: Ezequiel Garcia <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f4f90ed commit a8876c2

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

drivers/staging/media/sunxi/cedrus/cedrus_dec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ void cedrus_device_run(void *priv)
7474

7575
v4l2_m2m_buf_copy_metadata(run.src, run.dst, true);
7676

77+
cedrus_dst_format_set(dev, &ctx->dst_fmt);
78+
7779
dev->dec_ops[ctx->current_codec]->setup(ctx, &run);
7880

7981
/* Complete request(s) controls if needed. */

drivers/staging/media/sunxi/cedrus/cedrus_video.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ static int cedrus_s_fmt_vid_cap(struct file *file, void *priv,
273273
struct v4l2_format *f)
274274
{
275275
struct cedrus_ctx *ctx = cedrus_file2ctx(file);
276-
struct cedrus_dev *dev = ctx->dev;
277276
struct vb2_queue *vq;
278277
int ret;
279278

@@ -287,8 +286,6 @@ static int cedrus_s_fmt_vid_cap(struct file *file, void *priv,
287286

288287
ctx->dst_fmt = f->fmt.pix;
289288

290-
cedrus_dst_format_set(dev, &ctx->dst_fmt);
291-
292289
return 0;
293290
}
294291

0 commit comments

Comments
 (0)