vc04_services: bcm2835-codec: Set crop_height for compressed formats
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 19 May 2022 16:30:02 +0000 (17:30 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Tue, 7 Jun 2022 16:54:32 +0000 (17:54 +0100)
In particular for the encoder where the CAPTURE format dictates
the parameters given to the codec we need to be able to set the
value passed as the crop_height for the compressed format.
There's no crop available for cropped modes, so always set
crop_height to the requested height.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c

index dc7c0b9..7dcb3d5 100644 (file)
@@ -1613,7 +1613,8 @@ static int vidioc_s_fmt(struct bcm2835_codec_ctx *ctx, struct v4l2_format *f,
                                  f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
        q_data->crop_width = f->fmt.pix_mp.width;
        q_data->height = f->fmt.pix_mp.height;
-       if (!q_data->selection_set)
+       if (!q_data->selection_set ||
+           (q_data->fmt->flags & V4L2_FMT_FLAG_COMPRESSED))
                q_data->crop_height = requested_height;
 
        /*