]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: cedrus: Program output format during each run
authorSamuel Holland <samuel@sholland.org>
Sat, 9 May 2020 20:06:42 +0000 (22:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:31:18 +0000 (09:31 +0200)
commit a8876c22eab9a871834f85de83e98bbf7e6e264d upstream.

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: <stable@vger.kernel.org>
Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
Suggested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Suggested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/sunxi/cedrus/cedrus_dec.c
drivers/staging/media/sunxi/cedrus/cedrus_video.c

index 56ca4c9ad01c0dcf14d556de30dcc9423d54d705..47940f02457bb38c73a471b315682fec4400bdb8 100644 (file)
@@ -65,6 +65,8 @@ void cedrus_device_run(void *priv)
 
        v4l2_m2m_buf_copy_metadata(run.src, run.dst, true);
 
+       cedrus_dst_format_set(dev, &ctx->dst_fmt);
+
        dev->dec_ops[ctx->current_codec]->setup(ctx, &run);
 
        /* Complete request(s) controls if needed. */
index eeee3efd247b323a5599dd3ae827b83d46217096..966f9f3ed9d3a0e7b1dac422c668930900437d56 100644 (file)
@@ -286,7 +286,6 @@ static int cedrus_s_fmt_vid_cap(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
        struct cedrus_ctx *ctx = cedrus_file2ctx(file);
-       struct cedrus_dev *dev = ctx->dev;
        struct vb2_queue *vq;
        int ret;
 
@@ -300,8 +299,6 @@ static int cedrus_s_fmt_vid_cap(struct file *file, void *priv,
 
        ctx->dst_fmt = f->fmt.pix;
 
-       cedrus_dst_format_set(dev, &ctx->dst_fmt);
-
        return 0;
 }