Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4522132ybz; Tue, 21 Apr 2020 02:05:43 -0700 (PDT) X-Google-Smtp-Source: APiQypIAX8Ts/FEeY5nUvQcL6pY1kFS7m0qMhBS1pzIH74BwzeLnBnLIxbDlRqlHLCO0JwXTmGLp X-Received: by 2002:a50:af02:: with SMTP id g2mr18239484edd.69.1587459943402; Tue, 21 Apr 2020 02:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587459943; cv=none; d=google.com; s=arc-20160816; b=YC4ZM3E8BeOY9O2OoxHjBuh134dg+tqB9o1TlfyDRFwgaNZxX5q+lELaCKeCWU8ge8 6Bsw456QuyvQr709ERhG8H9xDWpVImjfdHHAwBTJzizp0fqBr4bbX93BpGOnLudZaB/V zLTzh+wqGr+RdWuIN48ZnS1dugtCMjKU7QbVkSu+xiyJzrhnm3x6RqwdTgFA8H56dGwU wDet+YQz93iUh/gQTuyuUM9Zi2CBWF98eaMVsn2EN7eEGXaTiAfNBbF29sfkl2gTiGnc 57eMycyNfCg3zoVQRiwKMYSO12qqZZfgl8K/ko53Wn9z/60cimPpda2r+5zTu0RqeJV5 /H+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Gia+MiooatIoHpzFyjh6vDn5qqUT2+FOS/eyw7CBpPM=; b=UEjL9ITrNaVwMI7KSTeeA13Kd3tyv2xf1NCjED0EH40cdDEGIwaw+MM+vT2wYX/rS1 zLLisxN2y1nIxZfkQLIAYXcV73Q1CS0uoYTrSLTU40tkbNjfaBzyUBiWi26WKketmLly oe0S4MhKHrqy5qet2YkIVEic0wti4KknMoepY9VXL8yiI/Fnz2daBDPmx+WFKp/lhh+H zPwPZ2xN2FY9Uf5YhrTYMmrzEy86v3EPPWmdu2FzgA/F7KIiJwPueJnfz8iizTnkQarL d5gqU12gNnuQxJwo4w8KxXN8FcgTs+jJMfU3/PM1qlSkHJBHs9dPkp9WH2b01vt+IEAz jzdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si1368486edi.509.2020.04.21.02.05.19; Tue, 21 Apr 2020 02:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727120AbgDUJBp (ORCPT + 99 others); Tue, 21 Apr 2020 05:01:45 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:43571 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgDUJBp (ORCPT ); Tue, 21 Apr 2020 05:01:45 -0400 X-Originating-IP: 93.29.109.196 Received: from aptenodytes (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E13916001C; Tue, 21 Apr 2020 09:01:39 +0000 (UTC) Date: Tue, 21 Apr 2020 11:01:39 +0200 From: Paul Kocialkowski To: Ezequiel Garcia Cc: jernej.skrabec@gmail.com, Samuel Holland , linux-sunxi@googlegroups.com, Maxime Ripard , Chen-Yu Tsai , Mauro Carvalho Chehab , Greg Kroah-Hartman , linux-arm-kernel , Linux Kernel Mailing List , linux-media Subject: Re: [linux-sunxi] [PATCH] media: cedrus: Implement runtime PM Message-ID: <20200421090139.GC610776@aptenodytes> References: <20200408010232.48432-1-samuel@sholland.org> <244922ec-ed3a-eca7-6640-49de7ad9c605@sholland.org> <20200420151010.GL125838@aptenodytes> <5590139.lOV4Wx5bFT@jernej-laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5QAgd0e35j3NYeGe" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --5QAgd0e35j3NYeGe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ezequiel, On Tue 21 Apr 20, 00:51, Ezequiel Garcia wrote: > Hi Jernej, Paul: >=20 > On Mon, 20 Apr 2020 at 13:41, Jernej =C5=A0krabec wrote: > > > > Dne ponedeljek, 20. april 2020 ob 17:10:10 CEST je Paul Kocialkowski > > napisal(a): > > > Hi, > > > > > > On Sun 19 Apr 20, 15:28, Samuel Holland wrote: > > > > On 4/8/20 11:01 AM, Jernej =C5=A0krabec wrote: > > > > > Hi Samuel! > > > > > > > > > > Dne sreda, 08. april 2020 ob 03:02:32 CEST je Samuel Holland napi= sal(a): > > > > >> This allows the VE clocks and PLL_VE to be disabled most of the = time. > > > > >> > > > > >> Since the device is stateless, each frame gets a separate runtim= e PM > > > > >> reference. Enable autosuspend so the PM callbacks are not run be= fore > > > > >> and > > > > >> after every frame. > > > > >> > > > > >> Signed-off-by: Samuel Holland > > > > >> --- > > > > >> > > > > >> I tested this with v4l2-request-test. I don't have the setup to = do > > > > >> anything more complicated at the moment. > > > > >> > > > > >> --- > > > > >> > > > > >> drivers/staging/media/sunxi/cedrus/cedrus.c | 7 ++ > > > > >> .../staging/media/sunxi/cedrus/cedrus_hw.c | 115 +++++++++++= +------ > > > > >> .../staging/media/sunxi/cedrus/cedrus_hw.h | 3 + > > > > >> 3 files changed, 88 insertions(+), 37 deletions(-) > > > > > > > > [snip] > > > > > > > > > Reset above causes problem. When format is set in cedrus_s_fmt_vi= d_cap() > > > > > a > > > > > function is called, which sets few registers in HW. Of course, th= ere is > > > > > no > > > > > guarantee that someone will start decoding immediately after capt= ure > > > > > format is set. So, if the driver puts VPU to sleep in the mean ti= me, > > > > > reset will clear those registers and decoded video will be in dif= ferent > > > > > format than expected. It could be even argued that registers shou= ld not > > > > > be set in that function and that this is design issue or bug in d= river. > > > > > > > > You're right. I didn't see that cedrus_dst_format_set() was called = outside > > > > cedrus_engine_enable/disable(). > > > > > > This might indeed be an issue with multiple decoding contexts in para= llel, > > > with potentially different formats. For that reason, it looks like the > > > right thing to do would be to set the format at each decoding run bas= ed on > > > the format set in the context by s_fmt. > > > > So you are suggesting that cedrus_dst_format_set() should be moved to > > cedrus_device_run(), right? This way all registers are set at each run,= which > > is then truly stateless. > > >=20 > BTW, this is how the Hantro and Rockchip's Rkvdec > drivers are implemented. One of the main reasons is > to have simultaneous decoding support. That's a wise decision :) I had actually tested that cedrus can decode multiple streams in parallel, = but I must have used the same format settings for both and didn't notice the is= sue then. Good that we are fixing it now! Cheers, Paul --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --5QAgd0e35j3NYeGe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAl6etnMACgkQ3cLmz3+f v9ESAgf+JF43Flex0ZzI560R3iFiOKh0qptQg+PzMUxxWUm8DffID3NoERvbt4n7 ceoOqXP9t2kUPBsYZpvXStydgxHHvp+Gk4z5fKRhv4bH3MZu+FVdhLZwrclpq1qC /IO9T4LwvBqamcgR9fNhIy5j6kb+lMUYp8VBYpd5NskxMbUyDboFJaUONdgB2+cr YlflGNy7qgvY/MfM/3P49x/HtLRbDWBCY0R8Xti6OLvfQcvme/hS1eAtpHpfAYeL 1n5XqbfL0AQr7But5vVkBFvUD/cMrlwYiwN8YidW17r28wJGvn9b7eGahbcQKxwS 0f823/RMeZHpQlq/+/zoj2rL3iryMg== =GrkF -----END PGP SIGNATURE----- --5QAgd0e35j3NYeGe--