From fa7c05487366fcd7af13b12cc98f24d7a4ea814b Mon Sep 17 00:00:00 2001 From: Nanxin Qin Date: Mon, 1 Jun 2020 13:50:35 +0800 Subject: [PATCH] v4l: fixed issue of the visiable get fail. [1/1] 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 --- drivers/amvdec_ports/aml_vcodec_dec.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/amvdec_ports/aml_vcodec_dec.c b/drivers/amvdec_ports/aml_vcodec_dec.c index fb88ce5..bf600ca 100644 --- a/drivers/amvdec_ports/aml_vcodec_dec.c +++ b/drivers/amvdec_ports/aml_vcodec_dec.c @@ -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; } -- 2.20.1