From patchwork Mon Oct 2 12:05:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1393734vqb; Mon, 2 Oct 2023 05:35:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4J3BCPjpoynhV/sadiinnDS3+oKxlgqpXG+T51drMvhAieNU6WXLDXhJ99MvtGzAxQZzw X-Received: by 2002:a05:6a20:734c:b0:140:f6c4:aa71 with SMTP id v12-20020a056a20734c00b00140f6c4aa71mr13335143pzc.8.1696250101004; Mon, 02 Oct 2023 05:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696250100; cv=none; d=google.com; s=arc-20160816; b=wpr30m2ZYIH/i6amq1iae1fO6m5Ub4GsGHGV3fsr+pq6GdQjEHrpUQ1GLnOlKwl3jp 22y6zXGL394YU5H/6+lfNF7Ic8Eaue4gNI8Av3W6MPB5WoTgcO91AmZTObMTwLIEu3nw ig0wKxuzEY6TXLbEvYPi0e8vnd+Fmi3Fj1XLN6q7Lx/jAx8M57hv0gne/VdfF17+WRGI jqM3HPClf2EwBeOPAPBm26CedEpIaIggXLtEXxde/koGmau3pRV40e7sjrZqoxMJbjhn Zesy5xxx6II4+YeCRDEuBFceakI2Yjfl+3Pu9MULekWksTpZi9Mc6/CN8lCvZm9McT76 23pQ== 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=nNZLftESyK2Yl5EGYzMYucLaDJiAJWfL5TqC/YKkuGlWd+1OxXHRr4xR7+QdGdUHBj HsFu2tXYVRQQAOI6AvsMXEvBQA/aaaXJsv69rsRPLMMZaLBgAQ5ctgFT+mr7FUwsEtZw rskFThuRe3sIU7hO7NnT+g+JiDCpzl071zmlqQs+nsSmWSPogvZ/FUCno6mYdAtbA+Mv CLYFpkl+qKpTCFL1ns5grqiL0QB9x6k0tRYrPCBCDdHt6xOfc4hkL3C70ZzhZdOuyoLk r1fgx6hxpca/0GvOCkKizBzDYMBN4CeCTe+WFa8qZ6KBZbnb4gzRd3A1xxrmPAdvzA6L /HDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LQEteHMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bx20-20020a056a00429400b00687427c1ac1si27256908pfb.25.2023.10.02.05.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 05:35:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LQEteHMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 4F9008131A9C; Mon, 2 Oct 2023 05:08:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237313AbjJBMHq (ORCPT + 18 others); Mon, 2 Oct 2023 08:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236908AbjJBMGl (ORCPT ); Mon, 2 Oct 2023 08:06:41 -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 1F54EA6; Mon, 2 Oct 2023 05:06:36 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (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 8FA80660734B; Mon, 2 Oct 2023 13:06:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248395; bh=WDraZOgWi0izES0K9FdWnGrtWWF6tf7zOBBP/EoWBNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQEteHMIkZCtjWFTNIQ0k4H/AachktNnK0S+WLsSD9+PjIZrM/RgvBpZ6pW7D4tKc ZTZamUAjJtskatClyAhVOJMoQNQnXQE99AheAtzko/rtBf2+66M8/0QYir18Coqgic KCGGyfjNlujWXsGXIGjIMtLUFg7IbWzfY/B4F7R7tvRrqGVFsNDfUx4w+bZJ3uhK4P 6hnBDIExscVxErpgbDt9xSmdPTiArA/AGe08s6ixS0WFyg36GEQqHW6y3YxlJ8CV6V Ygj/3c3jQVzwPDYYpmTVUyZf9jYEgVZSBta4t6xmmaHRUVhcH4NijBrnFKIe0pv5i9 vTG4ycsSHBdkg== 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 v9 19/53] media: verisilicon: vp9: Allow to change resolution while streaming Date: Mon, 2 Oct 2023 14:05:43 +0200 Message-Id: <20231002120617.119602-20-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-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,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 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:08:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778647145801364116 X-GMAIL-MSGID: 1778647145801364116 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;