From patchwork Wed Jul 5 12:10:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 116104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1825619vqx; Wed, 5 Jul 2023 05:19:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7N6jbsbepBAh0CCaDsdQT6qVFowqsJ6MDixBdmxEs0HkAjXItKQtIrgZq9wqHTMJLPOXK4 X-Received: by 2002:a05:6808:1983:b0:3a1:dac8:9c1f with SMTP id bj3-20020a056808198300b003a1dac89c1fmr18511460oib.29.1688559594364; Wed, 05 Jul 2023 05:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688559594; cv=none; d=google.com; s=arc-20160816; b=KFUIkWIN8QjkrUFzgiYH78abaORPOqB8vk3LEkYlmXFP8yX76NCIEHiUcO9gdlWmaC 8TvJO3MiEUg9J0erchdRN1shu32i0hUa0yDGsOdKkWepIe0ZH5NmySQ4Iy7kKYcrffkC BMKGqweaYD283oD62DEimDlO4BWiTp2pDtyFfRcNqgiMwwPb/cbS4If0l8sVn6uBqheS ttXjyRtCUXn+PXG6Fg4bNJxa0kvLH65s+l1CflJbFGhfwlKSLzujQsO+qVzB50m0XBcn kZoXb7twJBEcVwrdM5zDemoS6P7xijOkUciYUi4OlwtoFejNKhX8cBucB6t11gV9Trau G3mw== 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=75OqJdnqFcFkk1H+2oD/B2SYLKrDWN0P7uqeZzvrDAA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=VY4e12/RAjkCs+lEQoajYMBVITHwrebps1oLXI2UzUN8B7aq5fZt6FL+iYmH+YOXvj cZSrV5gQ5DWplkcER6wXNOdGY1OvaSCFDdFI0hv/3NKg0JtqKVenNVYOWpN2emXFZ2rh rksz7HmZCdZihdRh8N23JNWLyj25l4RL6pt6muGcqyLwNItnY+D7cjCcQsWY/B6e6zHi G3PSRM/osi6djx4eV63K3masIbfxCtJpkIGICUvMMqIS24QdlptgAHulKSZ/JA53CfWU OIWqc+0OgFw6AhESyLhHGDaz1z08d24rdMWS/hWw8zEF1ipBpUuehWXmafAHzUKQNrxR GUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=i++OqS1j; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq26-20020a056a000e1a00b0068285516e43si8123886pfb.321.2023.07.05.05.19.41; Wed, 05 Jul 2023 05:19:54 -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=@collabora.com header.s=mail header.b=i++OqS1j; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbjGEML3 (ORCPT + 99 others); Wed, 5 Jul 2023 08:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbjGEMLJ (ORCPT ); Wed, 5 Jul 2023 08:11:09 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8D78E7B; Wed, 5 Jul 2023 05:11:08 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:cbfb:e358:222c:d8c1]) (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 640276606FC2; Wed, 5 Jul 2023 13:11:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1688559067; bh=qPKJihG3orIdVMsqR90N9HYDaPyPEtPiNABAk02YL94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i++OqS1jLkzEHawT6hdcgt7sFMn0re/rSA0lcoGb0NGpRDWEbNFHwMNBpDSukda2V qFDkBKKjfLxrDeyWIQ+LPsA4kvPJDPPEE/QLJ4QCqSs73dy/e4JxUKnG1exAj9jm6s GCnMjv5oX1eRlPbmdK8e2+YI7XwHXMlzovfu7NwsoWCv4ny+zkwcANmp07ZZlpBgWN iB4CVdRUYmiTA5Bgu/VglM/h/bS/yLqLlFXF42r6ziE9UPzShl4o46u/JsAfFC5ZHo gZRP9KWpM5DCVBalmS5HvzK72Wqm9d5BHAq7Jkf3yEk8hdUJOohLHTJ6xqhTC+KNQp spSoiNfyQOSHQ== 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 v4 08/10] media: verisilicon: vp9: Allow to change resolution while streaming Date: Wed, 5 Jul 2023 14:10:54 +0200 Message-Id: <20230705121056.37017-9-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230705121056.37017-1-benjamin.gaignard@collabora.com> References: <20230705121056.37017-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, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770583064926914461?= X-GMAIL-MSGID: =?utf-8?q?1770583064926914461?= 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 898e8763d63a..08ec5e9cc739 100644 --- a/drivers/media/platform/verisilicon/hantro_v4l2.c +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c @@ -480,25 +480,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 @@ -541,15 +530,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;