v4l: fixed issue of the visiable get fail. [1/1]
authorNanxin Qin <nanxin.qin@amlogic.com>
Mon, 1 Jun 2020 05:50:35 +0000 (13:50 +0800)
committerNanxin Qin <nanxin.qin@amlogic.com>
Mon, 1 Jun 2020 05:59:20 +0000 (13:59 +0800)
PD#SWPL-27086

Problem:
GStreamer's V4L2 decoder reports wrong buffer resolution.

Solution:
the interface of get selection need be invoked on mplane as well.

Verify:
w200

Change-Id: I2a04be6c8066fda781518d8be72356c4438dd70d
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
drivers/amvdec_ports/aml_vcodec_dec.c

index fb88ce51c77a207425170cd166d8aec4d04148e9..bf600ca23bdf56fb87c7ff0c5e6baf80a1529d5c 100644 (file)
@@ -1588,24 +1588,14 @@ static int vidioc_vdec_g_selection(struct file *file, void *priv,
        struct aml_vcodec_ctx *ctx = fh_to_ctx(priv);
        struct aml_q_data *q_data;
 
-       if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+       if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
+               (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE))
                return -EINVAL;
 
        q_data = &ctx->q_data[AML_Q_DATA_DST];
 
        switch (s->target) {
        case V4L2_SEL_TGT_COMPOSE_DEFAULT:
-               s->r.left = 0;
-               s->r.top = 0;
-               s->r.width = ctx->picinfo.visible_width;
-               s->r.height = ctx->picinfo.visible_height;
-               break;
-       case V4L2_SEL_TGT_COMPOSE_BOUNDS:
-               s->r.left = 0;
-               s->r.top = 0;
-               s->r.width = ctx->picinfo.coded_width;
-               s->r.height = ctx->picinfo.coded_height;
-               break;
        case V4L2_SEL_TGT_COMPOSE:
                if (vdec_if_get_param(ctx, GET_PARAM_CROP_INFO, &(s->r))) {
                        /* set to default value if header info not ready yet*/
@@ -1615,6 +1605,12 @@ static int vidioc_vdec_g_selection(struct file *file, void *priv,
                        s->r.height = q_data->visible_height;
                }
                break;
+       case V4L2_SEL_TGT_COMPOSE_BOUNDS:
+               s->r.left = 0;
+               s->r.top = 0;
+               s->r.width = ctx->picinfo.coded_width;
+               s->r.height = ctx->picinfo.coded_height;
+               break;
        default:
                return -EINVAL;
        }