Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1294670lqs; Sat, 15 Jun 2024 02:58:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8NWsZ/gmlNnYl3b7I8pDsVuIDeMsDgbxHu+Y9aIcV3eKcPQlW1cMcg4Isey+PyIEBWWDqEp4O1R1k5SJDXoHOM0S1I/3EZo+joU7eJA== X-Google-Smtp-Source: AGHT+IGaqXC7A69pPqbmvfoscPvsZ7Kpm6hEYDR68J3RcEeRjd683dghnEJerAI5vd9uOjrSFqJ8 X-Received: by 2002:a05:6a20:9184:b0:1b5:b214:efb8 with SMTP id adf61e73a8af0-1bae7eba01fmr6144688637.34.1718445506860; Sat, 15 Jun 2024 02:58:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718445506; cv=pass; d=google.com; s=arc-20160816; b=ZSDaW17lGA6Ac3E3E6Slh+/zBb/gpyrOyaI106bUWofdXaDtlslaE8t3u55qP2kvN1 2bl0YUdpcGPfzRcroyQ1g5UMA/3URM7i4+qm49MXroHca2F80hjzssIM7KRlWfNSA9uj uD7mAO0ZgeKrGVmq0IS+9j2Bp4o7xwmQ6vUbG3v9PtOH+c0YqspvnL9W/g315DSW6qXc exsMbW1cEwX8JO+5NcFZ4twidJDaIxrVrKMYJNQVsMlEGmW7mvLtLZOOcdSKlI1BiuJ/ 4HiLR4NUxL/JXnnpqqnYCE+f2kIoY6QuQKEUFJbI5U5tb+wyiBmfueOXIqmzwNe6/bDM Tmuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=b6fQRDkFBoX4eOnaEdHypSZK013HX4GrJCXrDkP7PuU=; fh=+XIzXCW1Kux5Vzflfl/lkaOHZCVmNY2KdMn0IhPEOSo=; b=efcovafojM044UyGoEx4e/3eIUrd5ImlM+V0zIFii5DP4Qlk4p3oIPodYBxh+KalL+ ojBYRGuCK7VwBJKGUYe+d30p3JOHg5g+WtsWXzsRVRUv96rzheNAwAWG8N6ghlJmk/eW FL2FmZDKV1mPkkMFOpPD5riQ7yejVcBUWjVPs1QGk1itfpQh6Td9nJlCwbXhTfpHKv23 zd8SJ13eWS6Botj5erEhsQyiqFBPj6SIvE2k5BWs62y0fTYWxOKv2hRxgdZmOyuroN+t yKoc4wVDS7yU2QQ75qQ9rLhc4JkNKopKEnWkzMsKAMuDoo6D3gcnYi8w1+xqqurRKcPV RM6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-215820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215820-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4c4647b8dsi5556993a91.77.2024.06.15.02.58.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 02:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-215820-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215820-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 72B37283C7F for ; Sat, 15 Jun 2024 09:58:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F245E2E64C; Sat, 15 Jun 2024 09:58:18 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBF3B28684; Sat, 15 Jun 2024 09:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718445497; cv=none; b=FiTbo9FaeoL0PO7Ol0I88wKffxKW1IniQApWTBbJ8fYEBP+lYFohd8AbIjthG9ZIgcVsPan+u4//G00ZjVIcE2CkdM3ru+zOAZApK/LOM6d+GxZKGf+ChgNjpSA67EowTeAeTskC4ha9RtkrQSZ8e1YV9RX803wfOTqsMspvl98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718445497; c=relaxed/simple; bh=3WGqb4aBPqSR2WSDrDoyHZU60qN7fcJ5nthcO2D9xFQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iRfurwrw+wxg5uzG1tmkGzIkB8nKfWAxEY54xKO+DLN9apWpb/HlQRdZUiTFdqslSY+KMCSZvkv3YHaeibdcIF24iyaM8ckI5boIsOGjCKoelBFT7cfVlwgVlwBGl8acZXkJLnaNGagxjZ7c+ypUD+/qH94sjk69LDLxp7PDwVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E508BC116B1; Sat, 15 Jun 2024 09:58:13 +0000 (UTC) Message-ID: <8ba64488-6728-4779-bfee-ecc0303a02cf@xs4all.nl> Date: Sat, 15 Jun 2024 11:58:12 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 3/4] media: chips-media: wave5: Use helpers to calculate bytesperline and sizeimage. To: "jackson.lee" , "mchehab@kernel.org" , "nicolas@ndufresne.ca" , "sebastian.fricke@collabora.com" Cc: "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Nas Chung , "lafley.kim" , "b-brnich@ti.com" , Nicolas Dufresne References: <20240611071501.80-1-jackson.lee@chipsnmedia.com> <20240611071501.80-4-jackson.lee@chipsnmedia.com> <52b3f0be-6427-40b3-862b-640f378e6b02@xs4all.nl> Content-Language: en-US, nl From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B4UOle6ZHg02+I8tZicjzj5+yffv1lB5A1btG+AmoZrgf0X2O1B96fqgHx8w9PIpVERN YsmkfxvhfP3MO3oHh8UY1OLKdlKamMneCLk2up1Zlli347KMjHAVjBAiy8qOguKF9k7HOjif JCLYTkggrRiEiE1xg4tblBNj8WGyKH+u/hwwwBqCd/Px2HvhAsJ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vHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 14/06/2024 06:58, jackson.lee wrote: > Hi Hans > > >> -----Original Message----- >> From: Hans Verkuil >> Sent: Thursday, June 13, 2024 7:29 PM >> To: jackson.lee ; mchehab@kernel.org; >> nicolas@ndufresne.ca; sebastian.fricke@collabora.com >> Cc: linux-media@vger.kernel.org; linux-kernel@vger.kernel.org; Nas Chung >> ; lafley.kim ; b- >> brnich@ti.com; Nicolas Dufresne >> Subject: Re: [PATCH v5 3/4] media: chips-media: wave5: Use helpers to >> calculate bytesperline and sizeimage. >> >> On 11/06/2024 09:15, Jackson Lee wrote: >>> From: "jackson.lee" >>> >>> Use v4l2-common helper functions to calculate bytesperline and >>> sizeimage, instead of calculating in a wave5 driver directly. >>> >>> In case of raw(YUV) v4l2_pix_format, the wave5 driver updates >>> v4l2_pix_format_mplane struct through v4l2_fill_pixfmt_mp() function. >>> >>> Encoder and Decoder need same bytesperline and sizeimage values for >>> same v4l2_pix_format. >>> So, a wave5_update_pix_fmt is refactored to support both together. >>> >>> Signed-off-by: Jackson.lee >>> Signed-off-by: Nas Chung >>> Reviewed-by: Nicolas Dufresne >>> --- >>> .../platform/chips-media/wave5/wave5-helper.c | 24 ++ >>> .../platform/chips-media/wave5/wave5-helper.h | 5 + >>> .../chips-media/wave5/wave5-vpu-dec.c | 296 ++++++------------ >>> .../chips-media/wave5/wave5-vpu-enc.c | 197 +++++------- >>> .../platform/chips-media/wave5/wave5-vpu.h | 5 +- >>> .../chips-media/wave5/wave5-vpuconfig.h | 27 +- >>> 6 files changed, 235 insertions(+), 319 deletions(-) >>> >>> diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c >>> b/drivers/media/platform/chips-media/wave5/wave5-helper.c >>> index 7e0f34bfa5be..b20ab69cd341 100644 >>> --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c >>> +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c >>> @@ -7,6 +7,8 @@ >>> >>> #include "wave5-helper.h" >>> >>> +#define DEFAULT_BS_SIZE(width, height) ((width) * (height) / 8 * 3) >>> + >>> const char *state_to_str(enum vpu_instance_state state) { >>> switch (state) { >>> @@ -224,3 +226,25 @@ void wave5_return_bufs(struct vb2_queue *q, u32 state) >>> v4l2_m2m_buf_done(vbuf, state); >>> } >>> } >>> + >>> +void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, >>> + int pix_fmt_type, >>> + unsigned int width, >>> + unsigned int height, >>> + const struct v4l2_frmsize_stepwise *frmsize) { >>> + v4l2_apply_frmsize_constraints(&width, &height, frmsize); >>> + >>> + if (pix_fmt_type == VPU_FMT_TYPE_CODEC) { >>> + pix_mp->width = width; >>> + pix_mp->height = height; >>> + pix_mp->num_planes = 1; >>> + pix_mp->plane_fmt[0].bytesperline = 0; >>> + pix_mp->plane_fmt[0].sizeimage = max(DEFAULT_BS_SIZE(width, >> height), >>> + pix_mp->plane_fmt[0].sizeimage); >>> + } else { >>> + v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, width, height); >>> + } >>> + pix_mp->flags = 0; >>> + pix_mp->field = V4L2_FIELD_NONE; >>> +} >>> diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.h >>> b/drivers/media/platform/chips-media/wave5/wave5-helper.h >>> index 6cee1c14d3ce..9937fce553fc 100644 >>> --- a/drivers/media/platform/chips-media/wave5/wave5-helper.h >>> +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.h >>> @@ -28,4 +28,9 @@ const struct vpu_format >> *wave5_find_vpu_fmt_by_idx(unsigned int idx, >>> const struct vpu_format >> fmt_list[MAX_FMTS]); enum wave_std >>> wave5_to_vpu_std(unsigned int v4l2_pix_fmt, enum vpu_instance_type >>> type); void wave5_return_bufs(struct vb2_queue *q, u32 state); >>> +void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, >>> + int pix_fmt_type, >>> + unsigned int width, >>> + unsigned int height, >>> + const struct v4l2_frmsize_stepwise *frmsize); >>> #endif >>> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c >>> b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c >>> index 861a0664047c..f246c290ad6a 100644 >>> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c >>> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c >>> @@ -11,111 +11,92 @@ >>> #define VPU_DEC_DEV_NAME "C&M Wave5 VPU decoder" >>> #define VPU_DEC_DRV_NAME "wave5-dec" >>> >>> -#define DEFAULT_SRC_SIZE(width, height) ({ \ >>> - (width) * (height) / 8 * 3; \ >>> -}) >>> +static const struct v4l2_frmsize_stepwise dec_hevc_frmsize = { >>> + .min_width = W5_MIN_DEC_PIC_8_WIDTH, >>> + .max_width = W5_MAX_DEC_PIC_WIDTH, >>> + .step_width = W5_DEC_CODEC_STEP_WIDTH, >>> + .min_height = W5_MIN_DEC_PIC_8_HEIGHT, >>> + .max_height = W5_MAX_DEC_PIC_HEIGHT, >>> + .step_height = W5_DEC_CODEC_STEP_HEIGHT, }; >>> + >>> +static const struct v4l2_frmsize_stepwise dec_h264_frmsize = { >>> + .min_width = W5_MIN_DEC_PIC_32_WIDTH, >>> + .max_width = W5_MAX_DEC_PIC_WIDTH, >>> + .step_width = W5_DEC_CODEC_STEP_WIDTH, >>> + .min_height = W5_MIN_DEC_PIC_32_HEIGHT, >>> + .max_height = W5_MAX_DEC_PIC_HEIGHT, >>> + .step_height = W5_DEC_CODEC_STEP_HEIGHT, }; >>> + >>> +static const struct v4l2_frmsize_stepwise dec_raw_frmsize = { >>> + .min_width = W5_MIN_DEC_PIC_8_WIDTH, >>> + .max_width = W5_MAX_DEC_PIC_WIDTH, >>> + .step_width = W5_DEC_RAW_STEP_WIDTH, >>> + .min_height = W5_MIN_DEC_PIC_8_HEIGHT, >>> + .max_height = W5_MAX_DEC_PIC_HEIGHT, >>> + .step_height = W5_DEC_RAW_STEP_HEIGHT, }; >>> >>> static const struct vpu_format dec_fmt_list[FMT_TYPES][MAX_FMTS] = { >>> [VPU_FMT_TYPE_CODEC] = { >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_HEVC, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_hevc_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_H264, >>> - .max_width = 8192, >>> - .min_width = 32, >>> - .max_height = 4320, >>> - .min_height = 32, >>> + .v4l2_frmsize = &dec_h264_frmsize, >>> }, >>> }, >>> [VPU_FMT_TYPE_RAW] = { >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_YUV420, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV12, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV21, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_YUV422P, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV16, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV61, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_YUV420M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV12M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV21M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_YUV422M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV16M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> { >>> .v4l2_pix_fmt = V4L2_PIX_FMT_NV61M, >>> - .max_width = 8192, >>> - .min_width = 8, >>> - .max_height = 4320, >>> - .min_height = 8, >>> + .v4l2_frmsize = &dec_raw_frmsize, >>> }, >>> } >>> }; >>> @@ -234,74 +215,6 @@ static void wave5_handle_src_buffer(struct >> vpu_instance *inst, dma_addr_t rd_ptr >>> inst->remaining_consumed_bytes = consumed_bytes; } >>> >>> -static void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp, >> unsigned int width, >>> - unsigned int height) >>> -{ >>> - switch (pix_mp->pixelformat) { >>> - case V4L2_PIX_FMT_YUV420: >>> - case V4L2_PIX_FMT_NV12: >>> - case V4L2_PIX_FMT_NV21: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height * 3 / 2; >>> - break; >>> - case V4L2_PIX_FMT_YUV422P: >>> - case V4L2_PIX_FMT_NV16: >>> - case V4L2_PIX_FMT_NV61: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height * 2; >>> - break; >>> - case V4L2_PIX_FMT_YUV420M: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height; >>> - pix_mp->plane_fmt[1].bytesperline = round_up(width, 32) / 2; >>> - pix_mp->plane_fmt[1].sizeimage = width * height / 4; >>> - pix_mp->plane_fmt[2].bytesperline = round_up(width, 32) / 2; >>> - pix_mp->plane_fmt[2].sizeimage = width * height / 4; >>> - break; >>> - case V4L2_PIX_FMT_NV12M: >>> - case V4L2_PIX_FMT_NV21M: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height; >>> - pix_mp->plane_fmt[1].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[1].sizeimage = width * height / 2; >>> - break; >>> - case V4L2_PIX_FMT_YUV422M: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height; >>> - pix_mp->plane_fmt[1].bytesperline = round_up(width, 32) / 2; >>> - pix_mp->plane_fmt[1].sizeimage = width * height / 2; >>> - pix_mp->plane_fmt[2].bytesperline = round_up(width, 32) / 2; >>> - pix_mp->plane_fmt[2].sizeimage = width * height / 2; >>> - break; >>> - case V4L2_PIX_FMT_NV16M: >>> - case V4L2_PIX_FMT_NV61M: >>> - pix_mp->width = round_up(width, 32); >>> - pix_mp->height = round_up(height, 16); >>> - pix_mp->plane_fmt[0].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[0].sizeimage = width * height; >>> - pix_mp->plane_fmt[1].bytesperline = round_up(width, 32); >>> - pix_mp->plane_fmt[1].sizeimage = width * height; >>> - break; >>> - default: >>> - pix_mp->width = width; >>> - pix_mp->height = height; >>> - pix_mp->plane_fmt[0].bytesperline = 0; >>> - pix_mp->plane_fmt[0].sizeimage = max(DEFAULT_SRC_SIZE(width, >> height), >>> - pix_mp->plane_fmt[0].sizeimage); >>> - break; >>> - } >>> -} >>> - >>> static int start_decode(struct vpu_instance *inst, u32 *fail_res) { >>> struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx; @@ -389,6 >>> +302,8 @@ static int handle_dynamic_resolution_change(struct vpu_instance >> *inst) >>> } >>> >>> if (p_dec_info->initial_info_obtained) { >>> + const struct vpu_format *vpu_fmt; >>> + >>> inst->conf_win.left = initial_info->pic_crop_rect.left; >>> inst->conf_win.top = initial_info->pic_crop_rect.top; >>> inst->conf_win.width = initial_info->pic_width - @@ -396,10 >> +311,27 >>> @@ static int handle_dynamic_resolution_change(struct vpu_instance *inst) >>> inst->conf_win.height = initial_info->pic_height - >>> initial_info->pic_crop_rect.top - >>> initial_info->pic_crop_rect.bottom; >>> >>> - wave5_update_pix_fmt(&inst->src_fmt, initial_info->pic_width, >>> - initial_info->pic_height); >>> - wave5_update_pix_fmt(&inst->dst_fmt, initial_info->pic_width, >>> - initial_info->pic_height); >>> + vpu_fmt = wave5_find_vpu_fmt(inst->src_fmt.pixelformat, >>> + dec_fmt_list[VPU_FMT_TYPE_CODEC]); >>> + if (!vpu_fmt) >>> + return -EINVAL; >>> + >>> + wave5_update_pix_fmt(&inst->src_fmt, >>> + VPU_FMT_TYPE_CODEC, >>> + initial_info->pic_width, >>> + initial_info->pic_height, >>> + vpu_fmt->v4l2_frmsize); >>> + >>> + vpu_fmt = wave5_find_vpu_fmt(inst->dst_fmt.pixelformat, >>> + dec_fmt_list[VPU_FMT_TYPE_RAW]); >>> + if (!vpu_fmt) >>> + return -EINVAL; >>> + >>> + wave5_update_pix_fmt(&inst->dst_fmt, >>> + VPU_FMT_TYPE_RAW, >>> + initial_info->pic_width, >>> + initial_info->pic_height, >>> + vpu_fmt->v4l2_frmsize); >>> } >>> >>> v4l2_event_queue_fh(fh, &vpu_event_src_ch); @@ -545,15 +477,11 @@ >>> static int wave5_vpu_dec_enum_framesizes(struct file *f, void *fh, struct >> v4l2_f >>> vpu_fmt = wave5_find_vpu_fmt(fsize->pixel_format, >> dec_fmt_list[VPU_FMT_TYPE_RAW]); >>> if (!vpu_fmt) >>> return -EINVAL; >>> + return -ENOTTY; >> >> Huh? Where does this come from? It wasn't part of v4, and it doesn't make >> sense either. >> >> It looks like a spurious test line that you forgot to remove. >> >> Regards, >> >> Hans > > Sorry for the confusion. > It should be removed. > Due to this code, we have been sharing incorrect v4l2-compliance results in the cover letter. > > To pass the v4l2-compliance test correctly, Can we change the following code > to v6? I think so, yes. Regards, Hans > > >> >>> } >>> >>> fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS; >>> - fsize->stepwise.min_width = vpu_fmt->min_width; >>> - fsize->stepwise.max_width = vpu_fmt->max_width; >>> - fsize->stepwise.step_width = 1; >>> - fsize->stepwise.min_height = vpu_fmt->min_height; >>> - fsize->stepwise.max_height = vpu_fmt->max_height; >>> - fsize->stepwise.step_height = 1; >>> + fsize->stepwise = *vpu_fmt->v4l2_frmsize; > > fsize->stepwise.min_width = vpu_fmt->v4l2_frmsize->min_width; > fsize->stepwise.max_width = vpu_fmt->v4l2_frmsize->max_width; > fsize->stepwise.step_width = W5_DEC_CODEC_STEP_WIDTH; > fsize->stepwise.min_height = vpu_fmt->v4l2_frmsize->min_height; > fsize->stepwise.max_height = vpu_fmt->v4l2_frmsize->max_height; > fsize->stepwise.step_height = W5_DEC_CODEC_STEP_HEIGHT; > > > thanks > Jackson > >>> >>> return 0; >>> } >> >> Regards, >> >> Hans >