From patchwork Tue Oct 3 08:06:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1929157vqb; Tue, 3 Oct 2023 01:09:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyjFxCQ6zIZKRd+NFMP48sSaZgFUoa78isb2zzdavNXAKmpHTuXO1hlQWAYRWOyJZKdug9 X-Received: by 2002:a17:903:456:b0:1c4:62a:e4a with SMTP id iw22-20020a170903045600b001c4062a0e4amr10660699plb.64.1696320593313; Tue, 03 Oct 2023 01:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696320593; cv=none; d=google.com; s=arc-20160816; b=b6lHrEPyC/kGysCWlvq4n2ntfDwY4CfZ4IONBq05LGBOHnZqGABelauwtL83e+P0hP 56z2c0ggI+0+MdTdnt7c2KCzuINSwTwBZgXPH/QamB5hNgppjG9Uf/PF/pKPnAQr7HxL x2druQE+e/D++8WlaMI+oVGFK9/Y51LczYEMeXQHX061DLPQicAoVjO+VbfZknSSnL7K vVk0mGQM+yNV+TcapLsMpqCCZddQdF/f5CkiYBmyMIzZkMbFjsa7jTgo7G78aE06uRbB FECNI2C5iWNd0IZV0nmIv5VVf8iyg7BaKVurjAzdh67cX3yMJ0xT3LgD+WCvARzC/9i8 Kjyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HeFU4iirMD/C8zAnnLuvVsqExwwX9oyU662qIGcGqiA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=kPvonKxoAhejVRgHosJDNj15diLihVmbOhKGNvcQ64Yobhu+AOsAC3CZMa98Is0ZZC U09RZXjUjwhr0cCAT8fsqNTKEubt06egBI1lAj6cNmrRSaZX1QCOjM6nwwnHLN0ljaX/ IAuQpA2JsLAI1mpC/A/7P+1YdQk4DeJV0+MidnqtJaQ3TQ9ALrEw0ema4DY1DPpCHrz1 eQqZYCFYbvMroTF8KGeysLF/Z4pso4MDBJO5bL8Pj8b8VWKrcN4D59KIB2hF+UjzgXtY LayG7C+I4sAg/y8rF9Ose6ewZH9Hn66pI4vo4p33Wh5wLOvXw6DfHzYLHYR7laZ9Hv4w TFPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AKIQaoUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a15-20020a170902710f00b001bbd0450af8si851415pll.187.2023.10.03.01.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:09:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AKIQaoUk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 52FAC8254A95; Tue, 3 Oct 2023 01:09:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjJCIJr (ORCPT + 18 others); Tue, 3 Oct 2023 04:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239317AbjJCIH1 (ORCPT ); Tue, 3 Oct 2023 04:07:27 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485FEBF; Tue, 3 Oct 2023 01:07:24 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:b6df:b784:6a0f:8451]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id BEF0C6607314; Tue, 3 Oct 2023 09:07:22 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696320443; bh=WDraZOgWi0izES0K9FdWnGrtWWF6tf7zOBBP/EoWBNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKIQaoUk2fGDLfp0rpz/XWAmOnlLOuct2tROky827WNyQ2qdU0p+WNIe2bNMaNcwW /B0Q0IgLPbIz8cZuE1Z8pFh+n3/+6vuk5P+cBFmkPTjgVXXDlM7GE5FB+lhURkmtSx cBmI1B9S8dC1u6vYJno9rXZxwuQfRDpmudYFKxUtpUQBws/x9YoAvtxHMHluxvRFaL ZnfLn4KJEKDHH3Y8F9IBO6xsG9JKWbNMJHTC2YnfaCXOsE91+1V+w/SmEVm6DRaSTP seibkyxkKQeEkL3dpSNusx8KUjJadKRt0D1afPZ0tjLpBs2Ni6pclLnh9aisk4Cpa0 GPauDQjLVd6YA== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v10 19/54] media: verisilicon: vp9: Allow to change resolution while streaming Date: Tue, 3 Oct 2023 10:06:28 +0200 Message-Id: <20231003080704.43911-20-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003080704.43911-1-benjamin.gaignard@collabora.com> References: <20231003080704.43911-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:09:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778721062359251377 X-GMAIL-MSGID: 1778721062359251377 Remove all checks that prohibit to set a new format while streaming. This allow to change dynamically the resolution if the pixel format remains the same. Signed-off-by: Benjamin Gaignard --- .../media/platform/verisilicon/hantro_v4l2.c | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c index f0d8b165abcd..27a1e77cca38 100644 --- a/drivers/media/platform/verisilicon/hantro_v4l2.c +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c @@ -514,25 +514,14 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx, return ret; if (!ctx->is_encoder) { - struct vb2_queue *peer_vq; - /* * 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. - */ - if (vb2_is_streaming(vq) || (vb2_is_busy(vq) && - pix_mp->pixelformat != ctx->src_fmt.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 allocated. + * as the pixelformat remains. */ - peer_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, - V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); - if (vb2_is_busy(peer_vq)) + if (vb2_is_streaming(vq) && pix_mp->pixelformat != ctx->src_fmt.pixelformat) { return -EBUSY; + } } else { /* * The encoder doesn't admit a format change if @@ -577,15 +566,8 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx, static int hantro_set_fmt_cap(struct hantro_ctx *ctx, struct v4l2_pix_format_mplane *pix_mp) { - struct vb2_queue *vq; int ret; - /* 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; - if (ctx->is_encoder) { struct vb2_queue *peer_vq;