Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3512359pxb; Wed, 13 Oct 2021 07:30:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrKLQLU/AfZDV++AhoagLxr3LP7xQuybxON8bx+2nmQ30xGD0DV66+ReQXdFRKadMMhd6C X-Received: by 2002:a17:907:1119:: with SMTP id qu25mr20096430ejb.245.1634135423857; Wed, 13 Oct 2021 07:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634135423; cv=none; d=google.com; s=arc-20160816; b=NBlUSupRgY093cUShx5tPRlaiCtMlP9lCYILj4ukdWLhh8z+V7lYdnPymDXH4JhrVU TeD4UMa+2S0ShG50xlLKO36BfVnZYgdxGDarO+2dnmlMqf0Q3JiAN+3vjzXAd1eVk/Xc h5yYDA1BAxfwXX/kVlYKcmB+ucKwxNWfkf9TvbZXkVljKxAEqkafKIjYCd4M+h8x/YY6 sjcBHac1+fEZh69P98DeReAKM8G/xbHwaszTgR7qLx2MmkOxXEcUJOdLLJwN7mKsBsJH gZl6E4kZ8ibVtXj0/rhgNlUbkvoZrJgogSoxYpYInZ+96WS+NuLzhy0AeCML6kO/17HT 2n8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Bj1qNEG+5FP9GKXBmM4kufW+uVF44PKuB8CVz9DjaKc=; b=D4+Ll8z+/fTlFon9dnZXv9oYrJv5Cm1uqmXXARvRZAUMgmqfRyaBbN9fBUyiC+0oSF svA+PrW8bm5KlzuRKPy9ntP+Dhxnx5LjwySns35VJmiHSAglExxOnMskQcRbqn8mdyq4 OppRWgQeV186nnkYxHvmVOtYKePecoQo7pZrRdT5G0cOl9TOu0ZQEkNb/nl41xWyhvvI qlsRFX2H9s4Sm/LJmc5jMTIi1y8+6RDGpfGkEm0guzq5oyv2y6UKmoqmeaXb/j1sXhVp nnlRggwFZCLDo630P0sWvwPHTWyfy1818CBNliu5Nw5OzJ1ghDJLgu3/8xRsJR3zGhN/ XBsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20210112.gappssmtp.com header.s=20210112 header.b=gRlcFYjD; 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 t20si20120471ejd.528.2021.10.13.07.29.50; Wed, 13 Oct 2021 07:30:23 -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; dkim=pass header.i=@vanguardiasur-com-ar.20210112.gappssmtp.com header.s=20210112 header.b=gRlcFYjD; 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 S234081AbhJMO3z (ORCPT + 99 others); Wed, 13 Oct 2021 10:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235412AbhJMO3y (ORCPT ); Wed, 13 Oct 2021 10:29:54 -0400 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEDDFC061746 for ; Wed, 13 Oct 2021 07:27:50 -0700 (PDT) Received: by mail-ua1-x931.google.com with SMTP id e10so243755uab.3 for ; Wed, 13 Oct 2021 07:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Bj1qNEG+5FP9GKXBmM4kufW+uVF44PKuB8CVz9DjaKc=; b=gRlcFYjDdxION0Qyby/akwGm75WSXINStyTQHZZuBBF2RIGoipgwpbONDCZzUuhSr+ 1CtJI5NfddIfHkuRkTJ3QSLnJFns92TUxaOOXLQRCrS8PCV/mAopiiz1ktRZN4hiMhHL ONOGYv4jqBzR9hcQiavr5d1cIRmjA/7PfIKjm84KYRf8FgXSwuuGS/J/UNfs9bbDoeI1 9c5cEUkU+uYHFms0MChAkU9AMdC8bbSkYsLM30Empx/KBSV9vdpQSDGxK9mI8n0YeSfB gqi7v/FIqH0F3J7NkhSw2VpGE2QAAVTPg41ty5iHRUfQbYMqFzQeM6LXfO3d/zjG7mK8 getA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Bj1qNEG+5FP9GKXBmM4kufW+uVF44PKuB8CVz9DjaKc=; b=iiYE6HUYa4IqriMck9+pOZ4nT36kZYL1/ZKnGwcr0Ry5s++/2QmkE7c1tKK3W+EWBu xjOVb3jBxS/TsjBJftx2Toj5+Ze94Ww5cjEc4yT5EX7peeZdPJLKiQqSJdjmUN8mPCmu G/jv+n9ZeJyidg/sqnfCEJ4wtxSUtLYZzAm1k+DSW+WNMehoNRR/vvx0JR/FUQxwTlWT LzeleeSdPtq1vuH+v9EEjtiIrdoHdmh/X1JK3ngh0vbGF+fSrd00W7Sm1dx0FkUcFLpc TLkMyB0ydqNlp8VA+skARcQBsyrJEs190v9FQiEu6Rjj9ybE3VB5UiLPQcbRjkj6+xKS xfjA== X-Gm-Message-State: AOAM533+tymzTx+xV4A6qkHiLB87NS8BrEbJNlzCNfLdLCv5SoG8oCiG 7nl73GD7Qo4MSeqfdWcoZ903YQ== X-Received: by 2002:ab0:7a50:: with SMTP id a16mr29932206uat.92.1634135270072; Wed, 13 Oct 2021 07:27:50 -0700 (PDT) Received: from fedora ([196.32.91.248]) by smtp.gmail.com with ESMTPSA id j11sm5825138uaa.6.2021.10.13.07.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 07:27:49 -0700 (PDT) Date: Wed, 13 Oct 2021 11:27:44 -0300 From: Ezequiel Garcia To: Chen-Yu Tsai Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Andrzej Pietrasiewicz , stable@vger.kernel.org Subject: Re: [PATCH 2/2] media: rkvdec: Support dynamic resolution changes Message-ID: References: <20211008100423.739462-1-wenst@chromium.org> <20211008100423.739462-3-wenst@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211008100423.739462-3-wenst@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chen-Yu, On Fri, Oct 08, 2021 at 06:04:23PM +0800, Chen-Yu Tsai wrote: > The mem-to-mem stateless decoder API specifies support for dynamic > resolution changes. In particular, the decoder should accept format > changes on the OUTPUT queue even when buffers have been allocated, > as long as it is not streaming. > > Relax restrictions for S_FMT as described in the previous paragraph, > and as long as the codec format remains the same. This aligns it with > the Hantro and Cedrus decoders. This change was mostly based on commit > ae02d49493b5 ("media: hantro: Fix s_fmt for dynamic resolution changes"). > > Since rkvdec_s_fmt() is now just a wrapper around the output/capture > variants without any additional shared functionality, drop the wrapper > and call the respective functions directly. > > Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver") > Cc: > Signed-off-by: Chen-Yu Tsai Reviewed-by: Ezequiel Garcia Seems we forgot to port Hantro changes over here, so thanks a lot for picking this up. Ezequiel > --- > drivers/staging/media/rkvdec/rkvdec.c | 40 +++++++++++++-------------- > 1 file changed, 20 insertions(+), 20 deletions(-) > > diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c > index 7131156c1f2c..3f3f96488d74 100644 > --- a/drivers/staging/media/rkvdec/rkvdec.c > +++ b/drivers/staging/media/rkvdec/rkvdec.c > @@ -280,31 +280,20 @@ static int rkvdec_try_output_fmt(struct file *file, void *priv, > return 0; > } > > -static int rkvdec_s_fmt(struct file *file, void *priv, > - struct v4l2_format *f, > - int (*try_fmt)(struct file *, void *, > - struct v4l2_format *)) > +static int rkvdec_s_capture_fmt(struct file *file, void *priv, > + struct v4l2_format *f) > { > struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); > struct vb2_queue *vq; > + int ret; > > - if (!try_fmt) > - return -EINVAL; > - > - vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); > + /* Change not allowed if queue is busy */ > + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, > + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); > if (vb2_is_busy(vq)) > return -EBUSY; > > - return try_fmt(file, priv, f); > -} > - > -static int rkvdec_s_capture_fmt(struct file *file, void *priv, > - struct v4l2_format *f) > -{ > - struct rkvdec_ctx *ctx = fh_to_rkvdec_ctx(priv); > - int ret; > - > - ret = rkvdec_s_fmt(file, priv, f, rkvdec_try_capture_fmt); > + ret = rkvdec_try_capture_fmt(file, priv, f); > if (ret) > return ret; > > @@ -319,9 +308,20 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv, > struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; > const struct rkvdec_coded_fmt_desc *desc; > struct v4l2_format *cap_fmt; > - struct vb2_queue *peer_vq; > + struct vb2_queue *peer_vq, *vq; > int ret; > > + /* > + * In order to support dynamic resolution change, the decoder admits > + * a resolution change, as long as the pixelformat remains. Can't be > + * done if streaming. > + */ > + vq = v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); > + if (vb2_is_streaming(vq) || > + (vb2_is_busy(vq) && > + f->fmt.pix_mp.pixelformat != ctx->coded_fmt.fmt.pix_mp.pixelformat)) > + return -EBUSY; > + > /* > * Since format change on the OUTPUT queue will reset the CAPTURE > * queue, we can't allow doing so when the CAPTURE queue has buffers > @@ -331,7 +331,7 @@ static int rkvdec_s_output_fmt(struct file *file, void *priv, > if (vb2_is_busy(peer_vq)) > return -EBUSY; > > - ret = rkvdec_s_fmt(file, priv, f, rkvdec_try_output_fmt); > + ret = rkvdec_try_output_fmt(file, priv, f); > if (ret) > return ret; > > -- > 2.33.0.882.g93a45727a2-goog >