Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3135699iog; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7yqMPJr+rte6+koQIEEM+jaGjIvw/4RqmmtcXKaAuBrZH6jXAjD6vYVytxM97QYtaBKpu X-Received: by 2002:a17:902:f804:b0:16a:da1:1ef7 with SMTP id ix4-20020a170902f80400b0016a0da11ef7mr15426321plb.17.1656348681639; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656348681; cv=none; d=google.com; s=arc-20160816; b=oEsRar2Q6HumYwfSdOnbGsEp1W5vA1VdFXIzOAiz9hgYSkFrWf0oJdSFbGSvsFhkvE PSIQfr08/qA9tuQ7g1Hgnx3sISSf2+PLrgXRF4WADesUrfTZdsUnW0Tr+2936bNh8Ixn Lt1HiSX+M/JInl1Kk6LL1cvimx4V95jV3BAl2GpgZl1PMSpGJTmjkGXpPhicX3sK9Fk0 ZD5sLFAlT1kUv6CAMsb4j7N0eHyWd01JWCX8xpoEs7996Kq987nRbVjCIhbvdp+lbvZC QxoZ96eMNqnmsVMHnUwm8p0ZvYLWbHLDhDWILS3NCfCmXEcqw+czCr0eNAOTjozXR10S +8FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=YSimcfIaUu8P8Zd0kHKcHjUirkPTuMp+KjnpxJVA5io=; b=XLgOzBpCxLnp7Mlwn6OEKcC+DvcoP0JQbIUdfJ97Bolmkex0JM90ur+kHvvREWw9W7 DwWD533s2ITkErxobfDoiouvohJ2U1IpJume7gERHb8ZwDfxdsg1sg6UQO1Gxc+9ZEG0 eiK/arMf8AwqDW+VHDRoAIsT24Y1sQGB7c8NmMHYLNR1edV9h60cEpcPAsGftBQabGcf mUHNaNH3lz3QHiTWhoT5ncWqIoGr+SUQbntMymzoUIXZ4dWkGWLLJfmzroQlEs3/jIC0 MjXg7Q7PXBYRsiWawJ5+1PDpN3inY90ZTLVMzB8usqyYxKYUc7cDhNOqFlboYPshYegv jvdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NOr80kIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a63bc11000000b003ffafbc0463si14598543pge.369.2022.06.27.09.51.09; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NOr80kIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239135AbiF0QNm (ORCPT + 99 others); Mon, 27 Jun 2022 12:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239139AbiF0QNj (ORCPT ); Mon, 27 Jun 2022 12:13:39 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE0A186FD for ; Mon, 27 Jun 2022 09:13:37 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id ay16so20225642ejb.6 for ; Mon, 27 Jun 2022 09:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=YSimcfIaUu8P8Zd0kHKcHjUirkPTuMp+KjnpxJVA5io=; b=NOr80kINOxbn9hWrJtWZUy0A7Z5bnVxhfzNk7yGXC9cX2y5Is9kq5gu7JXvFN2fKFO Wkyx/XoC6NxV63yEjFUm+CKEDH8bzoDu0gT9Dha0paYgM87Rncz+9YnPlG/fcD+ak9Db R7vWps1VSNAgUGBxVJVHDYadM4SEd0ThYN40Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YSimcfIaUu8P8Zd0kHKcHjUirkPTuMp+KjnpxJVA5io=; b=SmPvqEiZUq+VPJ7z/GKvPQjAIexmHqtTOdwJT+75Vfu29uwbE2dmX5Im8eXjolZMhB saD0tiU5AGFpSbU3xohEMktSUoA8hgRD2Utw4qgrlj54WoHzvEFTTjnRU/EPSWIePCsL 18IT3SD1vnOYnj0EZKiwh0VgHIyddfn/1mfEHeKpKUsW3OfHy70YuMMOczmdRbzk8snS srsMSvaG1zgozlJw+nKN1OJXVgCtfibUNHFUe5WR369SOQ1H3ufRgON3a7hNPfN+/PTq XpRPvEkzuTrpnWGRm8aFgI1XfNU9SDchQZou5QIw/w62wzGiHXP87wS0TGkWmFH6+i7w 6vdQ== X-Gm-Message-State: AJIora/SMjvyDnc0i28LheHOQgqA7Ld/q67h9s8d8y8DSkpM1JL/1/e9 801whPkDyo06mHRSMfeDx389pYXNy/WQSpGhFv8fXg== X-Received: by 2002:a17:906:f84:b0:711:eda5:db31 with SMTP id q4-20020a1709060f8400b00711eda5db31mr13441225ejj.397.1656346416538; Mon, 27 Jun 2022 09:13:36 -0700 (PDT) MIME-Version: 1.0 References: <20220627112402.2332046-1-wenst@chromium.org> <20220627112402.2332046-2-wenst@chromium.org> <43f393d2dcdd0bfac66bfc420e9261d31b3ceedc.camel@collabora.com> In-Reply-To: <43f393d2dcdd0bfac66bfc420e9261d31b3ceedc.camel@collabora.com> From: Chen-Yu Tsai Date: Tue, 28 Jun 2022 00:13:25 +0800 Message-ID: Subject: Re: [PATCH 1/4] media: mediatek: vcodec: dec: Fix 4K frame size enumeration To: Nicolas Dufresne Cc: Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , Yunfei Dong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 11:33 PM Nicolas Dufresne wrote: > > Le lundi 27 juin 2022 =C3=A0 19:23 +0800, Chen-Yu Tsai a =C3=A9crit : > > This partially reverts commit b018be06f3c7 ("media: mediatek: vcodec: > > Read max resolution from dec_capability"). In this commit, the maximum > > resolution ended up being a function of both the firmware capability an= d > > the current set format. > > > > However, frame size enumeration for output (coded) formats should not > > depend on the format set, but should return supported resolutions for > > the format requested by userspace. > > > > Fix this so that the driver returns the supported resolutions correctly= , > > even if the instance only has default settings, or if the output format > > is currently set to VP8F, which does not support 4K. > > > > Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from= dec_capability") > > Signed-off-by: Chen-Yu Tsai > > --- > > drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 2 -- > > .../platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c | 7 +++++++ > > 2 files changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/= drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c > > index 5d6fdf18c3a6..fcb4b8131c49 100644 > > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c > > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c > > @@ -595,8 +595,6 @@ static int vidioc_enum_framesizes(struct file *file= , void *priv, > > fsize->type =3D V4L2_FRMSIZE_TYPE_STEPWISE; > > fsize->stepwise =3D dec_pdata->vdec_framesizes[i].stepwis= e; > > > > - fsize->stepwise.max_width =3D ctx->max_width; > > - fsize->stepwise.max_height =3D ctx->max_height; > > mtk_v4l2_debug(1, "%x, %d %d %d %d %d %d", > > ctx->dev->dec_capability, > > fsize->stepwise.min_width, > > diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stat= eless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c > > index 16d55785d84b..9a4d3e3658aa 100644 > > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c > > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c > > @@ -360,6 +360,13 @@ static void mtk_vcodec_add_formats(unsigned int fo= urcc, > > > > mtk_vdec_framesizes[count_framesizes].fourcc =3D fourcc; > > mtk_vdec_framesizes[count_framesizes].stepwise =3D stepwi= se_fhd; > > While at it, can you constify stepwise_fhd, it is scary to think that som= eone > could modify it and cause big headache. I noticed that as well, but since a planned refactoring would get rid of it= , I didn't fix it in this series. I can add a patch for that. ChenYu > > + if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DIS= ABLED) && > > + fourcc !=3D V4L2_PIX_FMT_VP8_FRAME) { > > + mtk_vdec_framesizes[count_framesizes].stepwise.ma= x_width =3D > > + VCODEC_DEC_4K_CODED_WIDTH; > > + mtk_vdec_framesizes[count_framesizes].stepwise.ma= x_height =3D > > + VCODEC_DEC_4K_CODED_HEIGHT; > > + } > > num_framesizes++; > > break; > > case V4L2_PIX_FMT_MM21: >