Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1314655imw; Tue, 5 Jul 2022 07:24:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u7vHWO98vzqPZLd6FK7RVzx0Y7mrTIsvnthI8DaU/auJRrkhgTEUydLB7jOPyfRSJDJ8hQ X-Received: by 2002:a17:90b:e95:b0:1ef:825f:cb40 with SMTP id fv21-20020a17090b0e9500b001ef825fcb40mr16179980pjb.29.1657031072769; Tue, 05 Jul 2022 07:24:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657031072; cv=none; d=google.com; s=arc-20160816; b=TDoKD1vpvSO3opcqbglgVL8reQ0kprsh9twRdL75+N+deO/focwnvpSHYu3o74Upyd 2nWIrcpmYXg3HXHqoVZUGCa2a8RKZRqV37IkHt3fWX89/uVLSLb8ErF38DzHPWQj+jFf QYO3jwVPZq1DxaW11qIyYcSeu9nCxYwazE52y6IDZqNbgyI0T3Jm4TJuTIVejMLY5BC9 V1VnhC2QCDcBDqkKFTex9IwtA/5HDNpD45qFikGd+ybhOATeS5hcJTMTqAtVNBaSOS+f sWK6EGsWa0266lu+WeQBhsb3N9p0BRgy3Egyd7lfP3C15FqGdv9sqLxsd1vPjFqIPFkA rXXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=OcCzp3/I2S1Lj2WiWjf+IVXJz5y+wSXmaCXx6oy51R4=; b=XyWBDOW1uOuYZc2n9igqrF4UVx138aTbYJarDgtXMkcuvMcfxVx2bcwfyFI39zPYVy svMrNf9x2Q81joIEiBdXafxW/d443LjY8aVbGIUlBOpBOQQWfNXar8nrUmNLRO1i+wxE yMg2aInAC4hLPPHBhUpN58309l/0vMrbJsLSVvrTjHBXk0Z+mKP1yXUX9Hyk7VPwv3vW aooaR7Pu3+P2XHgTL3zkiqxhBn4eLiRnz8NcWF6fq+AkOw1p7bARHUQTkXIDYSvzWIeC m5/4zhXu4/bP3E023tXXjns2p/MDT8Xg8bMkN4Q0FB4qktbTaqOjbaeL9ZW6WXLlLLjf UjPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20210112.gappssmtp.com header.s=20210112 header.b="MujJyB/2"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a056a00159400b0051bbac76b99si28587290pfk.195.2022.07.05.07.24.20; Tue, 05 Jul 2022 07:24:32 -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=@ndufresne-ca.20210112.gappssmtp.com header.s=20210112 header.b="MujJyB/2"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbiGENiM (ORCPT + 99 others); Tue, 5 Jul 2022 09:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232533AbiGENh4 (ORCPT ); Tue, 5 Jul 2022 09:37:56 -0400 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3FEA7BD00 for ; Tue, 5 Jul 2022 05:59:17 -0700 (PDT) Received: by mail-qt1-x832.google.com with SMTP id x1so13463946qtv.8 for ; Tue, 05 Jul 2022 05:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-transfer-encoding:user-agent:mime-version; bh=OcCzp3/I2S1Lj2WiWjf+IVXJz5y+wSXmaCXx6oy51R4=; b=MujJyB/23qhfekOKjeLTm4xManAfIMczJHZUilG6Po9qwwvUJlx/wEkIj0+1LWks1C L8xPcDXK47Mro267I/Ry0acKOUHrC5G+9s3uKojLwv0sambB5WtEwE2oHdB20wFycoc9 wfFcZUS0RDpodCtOLLdghxBHBUpfbMFueJUbFgcjoVk0PfeeuZlv/fHooeWdIYy70TEa pUJ+k4eGBC/RnP+nTAnPjmSGaz0BhkgertJK/Ko7SKyOFrJJARCBXTKhQ9F1JIyE85dS wQdTmc1o2HVc+fA3SJvx3cHCIw+7mENH5TG/U3i8ZPYuEf7wZS1e6btK62DWMB9bC7C+ KN8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=OcCzp3/I2S1Lj2WiWjf+IVXJz5y+wSXmaCXx6oy51R4=; b=zFMT02HWk+bHvvUHNvYsVe+4ANBQeHD+NUfd52AIp3XVqRfmbrrfv3VWXSA06GgUqV wByuJQ87TQKO+jUi0UzdFpANtz3MiRNzXojaGrkwz4rAqbNTva9CWbgbY+Kt2/RKh07R yc+OXQ5yVzuUPQ523O5AP19l1AedK/QoyGBW6IOmlAg9tJpy8JM+tVffU1r9vsFK0cki kGt58i2KAqBPQu8JP8zr+iQvNKOON2HzY6pk8ygHvUp5jswQrmbH8B3Ce7r+qawBw80x G5h4FL/ozQd7ZYdqduUfGN+cGSyrUhKBcAEOBML/rebdj9v9Qc5L0rwnVXQVZIVQj4hC k9aw== X-Gm-Message-State: AJIora+pBFylT1oPB3ZP1M72wOUZbEBnaRUzhJA1IilParOKZ9RpXbv5 G7oC3TYalrFx7EGvvSlTfetOWA== X-Received: by 2002:a05:6214:c22:b0:472:f86e:47b2 with SMTP id a2-20020a0562140c2200b00472f86e47b2mr7376314qvd.102.1657025953568; Tue, 05 Jul 2022 05:59:13 -0700 (PDT) Received: from nicolas-tpx395.localdomain (mtl.collabora.ca. [66.171.169.34]) by smtp.gmail.com with ESMTPSA id bp13-20020a05620a458d00b006af10bd3635sm21454592qkb.57.2022.07.05.05.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 05:59:12 -0700 (PDT) Message-ID: <42ba6a9516f4359b757d2f94b16c1bb23cc41cb2.camel@ndufresne.ca> Subject: Re: [EXT] Re: [PATCH] media: amphion: only insert the first sequence startcode for vc1l format From: Nicolas Dufresne To: Ming Qian , "mchehab@kernel.org" , "hverkuil-cisco@xs4all.nl" Cc: "shawnguo@kernel.org" , "robh+dt@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , dl-linux-imx , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Date: Tue, 05 Jul 2022 08:59:11 -0400 In-Reply-To: References: <20220628052017.26979-1-ming.qian@nxp.com> <6e54af5243d324c5df1c9ec18d4b091fbd52150f.camel@ndufresne.ca> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, 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 Le mardi 05 juillet 2022 =C3=A0 11:27 +0000, Ming Qian a =C3=A9crit=C2=A0: > > > From: Ming Qian > > > Sent: 2022=E5=B9=B47=E6=9C=885=E6=97=A5 10:00 > > > To: Nicolas Dufresne ; mchehab@kernel.org; > > > hverkuil-cisco@xs4all.nl > > > Cc: shawnguo@kernel.org; robh+dt@kernel.org; s.hauer@pengutronix.de; > > > kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx > > > ; linux-media@vger.kernel.org; > > > linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org > > > Subject: RE: [EXT] Re: [PATCH] media: amphion: only insert the first > > > sequence > > > startcode for vc1l format > > >=20 > > > > From: Nicolas Dufresne > > > > Sent: 2022=E5=B9=B47=E6=9C=885=E6=97=A5 0:06 > > > > To: Ming Qian ; mchehab@kernel.org; > > > > hverkuil-cisco@xs4all.nl > > > > Cc: shawnguo@kernel.org; robh+dt@kernel.org; s.hauer@pengutronix.de= ; > > > > kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx > > > > ; linux-media@vger.kernel.org; > > > > linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org > > > > Subject: [EXT] Re: [PATCH] media: amphion: only insert the first > > > > sequence startcode for vc1l format > > > >=20 > > > > Caution: EXT Email > > > >=20 > > > > Hi Ming, > > > >=20 > > > > Le mardi 28 juin 2022 =C3=A0 13:20 +0800, Ming Qian a =C3=A9crit : > > > > > For some formats, the amphion vpu requires startcode before seque= nce > > > > > and frame, such as vc1, vp8. > > > >=20 > > > > I'm not sure why VP8 is being mentioned here. There is no specified > > > > sartcode for VP8, and no split of headers either. > > > >=20 > > >=20 > > > Hi Nicolas, > > > =C2=A0=C2=A0=C2=A0This patch has nothing to do with vp8, and indeed t= here is no specified > > > startcode for VP8. > > > But amphion vpu requires driver to help insert some custom startcode = for > > > vp8 > > > and vc1. > > > It's custom behavior. > > >=20 > > Instead of exposing the custom format, you should use data_offset like = VENUS > > driver do. They vp8/9 codec in VENUS have the frame prefixed with an I= VF > > header, the data_offset let the userland skip it. >=20 > Hi Nicolas, > =C2=A0=C2=A0=C2=A0=C2=A0There is a stream buffer, and driver will copy th= e coded frame data to the > stream buffer, driver can decide to insert custom startcode or not, userl= and > won't know about it, so I don't think it's necessary to use data_offset t= o let > userland skip something. > =C2=A0=C2=A0=C2=A0=C2=A0Currently , driver will insert startcode for form= at vp8 and vc1. This is > transparent to the user. Can't you save the slow copy by using data_offset then ? I think most of th= e confusion comes from this commit message, someone else then you should be a= ble to understand what it means. regards, Nicolas >=20 > Ming >=20 > > > =C2=A0=C2=A0=C2=A0I'm sorry that my description include some confusio= n > > >=20 > > > Ming > > >=20 > > > > >=20 > > > > > But for V4L2_PIX_FMT_VC1_ANNEX_L, only the first sequence startco= de > > > > > is needed, the extra startcode will cause decoding error. > > > > > So after seek, we don't need to insert the sequence startcode. > > > > >=20 > > > > > In other words, for V4L2_PIX_FMT_VC1_ANNEX_L, the vpu doesn't > > > > > support dynamic resolution change. > > > > >=20 > > > > > Fixes: 145e936380edb ("media: amphion: implement malone decoder r= pc > > > > > interface") > > > > > Signed-off-by: Ming Qian > > > > > --- > > > > > =C2=A0drivers/media/platform/amphion/vdec.c | 1 + > > > > > =C2=A0drivers/media/platform/amphion/vpu.h | 1 + > > > > > =C2=A0drivers/media/platform/amphion/vpu_malone.c | 2 ++ > > > > > =C2=A0drivers/media/platform/amphion/vpu_rpc.h | 7 ++++++- > > > > > =C2=A04 files changed, 10 insertions(+), 1 deletion(-) > > > > >=20 > > > > > diff --git a/drivers/media/platform/amphion/vdec.c > > > > > b/drivers/media/platform/amphion/vdec.c > > > > > index 09d4f27970ec..51218a41a5ac 100644 > > > > > --- a/drivers/media/platform/amphion/vdec.c > > > > > +++ b/drivers/media/platform/amphion/vdec.c > > > > > @@ -731,6 +731,7 @@ static void vdec_stop_done(struct vpu_inst *i= nst) > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0vdec->eos_received =3D 0; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0vdec->is_source_changed =3D f= alse; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0vdec->source_change =3D 0; > > > > > + inst->total_input_count =3D 0; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0vpu_inst_unlock(inst); > > > > > =C2=A0} > > > > >=20 > > > > > diff --git a/drivers/media/platform/amphion/vpu.h > > > > > b/drivers/media/platform/amphion/vpu.h > > > > > index e56b96a7e5d3..f914de6ed81e 100644 > > > > > --- a/drivers/media/platform/amphion/vpu.h > > > > > +++ b/drivers/media/platform/amphion/vpu.h > > > > > @@ -258,6 +258,7 @@ struct vpu_inst { > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct vpu_format cap_format; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 min_buffer_cap; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 min_buffer_out; > > > > > + u32 total_input_count; > > > > >=20 > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct v4l2_rect crop; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u32 colorspace; > > > > > diff --git a/drivers/media/platform/amphion/vpu_malone.c > > > > > b/drivers/media/platform/amphion/vpu_malone.c > > > > > index c62b49e85060..f4a488bf9880 100644 > > > > > --- a/drivers/media/platform/amphion/vpu_malone.c > > > > > +++ b/drivers/media/platform/amphion/vpu_malone.c > > > > > @@ -1314,6 +1314,8 @@ static int > > > > vpu_malone_insert_scode_vc1_l_seq(struct malone_scode_t *scode) > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0int size =3D 0; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0u8 rcv_seqhdr[MALONE_VC1_RCV_= SEQ_HEADER_LEN]; > > > > >=20 > > > > > + if (scode->inst->total_input_count) > > > > > + return 0; > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0scode->need_data =3D 0; > > > > >=20 > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ret =3D vpu_malone_insert_sco= de_seq(scode, > > > > > MALONE_CODEC_ID_VC1_SIMPLE, sizeof(rcv_seqhdr)); diff --git > > > > > a/drivers/media/platform/amphion/vpu_rpc.h > > > > > b/drivers/media/platform/amphion/vpu_rpc.h > > > > > index 25119e5e807e..7eb6f01e6ab5 100644 > > > > > --- a/drivers/media/platform/amphion/vpu_rpc.h > > > > > +++ b/drivers/media/platform/amphion/vpu_rpc.h > > > > > @@ -312,11 +312,16 @@ static inline int vpu_iface_input_frame(str= uct > > > > vpu_inst *inst, > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0struct vb2_buffer *vb) { > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct vpu_iface_ops *ops =3D= vpu_core_get_iface(inst->core); > > > > > + int ret; > > > > >=20 > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!ops || !ops->input_frame= ) > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return -EINVAL; > > > > >=20 > > > > > - return ops->input_frame(inst->core->iface, inst, vb); > > > > > + ret =3D ops->input_frame(inst->core->iface, inst, vb); > > > > > + if (ret < 0) > > > > > + return ret; > > > > > + inst->total_input_count++; > > > > > + return ret; > > > > > =C2=A0} > > > > >=20 > > > > > =C2=A0static inline int vpu_iface_config_memory_resource(struct v= pu_inst > > > > > *inst, >=20