From patchwork Tue Oct 31 16:30:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 160233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp371000vqg; Tue, 31 Oct 2023 09:46:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyqm/IXWLi6qaXwqqN6Uy+Tt0axNbuQ3Ha6WmFtCtKSIWJqBRUI0qfpuZsIJJhlxlaabJ6 X-Received: by 2002:a05:6a00:1401:b0:68a:586a:f62 with SMTP id l1-20020a056a00140100b0068a586a0f62mr12352165pfu.4.1698770772246; Tue, 31 Oct 2023 09:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770772; cv=none; d=google.com; s=arc-20160816; b=q0Zzn4CZZ6+Qmpk7jd8xjzP/Yl/rQ+XOFIruTdZwjjxoa0ykLLdX0XkQDDh33L14jf cnf8pID0efx3DSeSF/1VNYBvxRV8O5yKaK6Zw4NUj5n7XKLc8o1VOCuChviccCDtL13I 2poLhO3H4Y1ZP0QmTL3Ibb6XcOgvhoWoU7vz69thRPcdjFZOOlHAyFQut57A7WtaePzg n9HmiBast3MFonGqC/tt4tMPC/8ShW3NhVXO9MVDmJpJwLGY0e5xke4v6Wfpu5fh0Nae UCRv/wGvC2IAEYHH9eRoSOXecuYe7PuM9zwwccGg0k/TN+3oT1/EXrFqzQh4TqXonxE0 Qacw== 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=nr1KYax36VZZBnabbjIyUGPTkvQFXV8YfPxk2A654tA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=ZWmVV9+QlUUeso210dVXAXBRRlzhYG4lhFGS2bl1YX/A1a0AzeVVP/pEwm5r7GzqTu PgCZ0kQfT45kNOsT0VNekRd/PIoh9w7lTPpKt/Z8t+KGVcfi5ktSaWfhJmVPMvJyl+mv Gh3KKQjA1Zp9zAp0cAKIGL6gUPv3dSYioDMlH1G0lZLhoSRYXblnKpjK66Beyw6PIz+R hl2k1kmur67pSyGJ8Tg+OKGp9A5Uy0U0Zp/WH6p6/pxQTJjtFzvmbOjOZ92/2bJSrDDW 91vBRVu5kkQ2MXF2nQuPzqiWxxEaWlcL1pz/v6dHFfNk+lfCcG4qmC59AQp5EJfm9MrD rulA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bDrdWx4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id v7-20020a056a00148700b00690d8c05582si1212173pfu.372.2023.10.31.09.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bDrdWx4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id E5DA78077803; Tue, 31 Oct 2023 09:46:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346372AbjJaQqE (ORCPT + 33 others); Tue, 31 Oct 2023 12:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236408AbjJaQpp (ORCPT ); Tue, 31 Oct 2023 12:45:45 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A744AD58; Tue, 31 Oct 2023 09:32:55 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 5C99B66073AD; Tue, 31 Oct 2023 16:32:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769973; bh=dg5TyqcXTbK8D5lR679m2t1zA3rG8sR+3z3V0ZimwSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDrdWx4efH37rJSlkeFye4v379tuTaO4V2WMmpMdSX//lkNPUzP27j5OV3n6pBl9v AVtYuEUSx8TjXRvVUzmgD553tvcrhk5erTfgYvMYW9OzZIXWL5bbhb8Sm/0Kn0j3yb q8b+qB1d5zZ/iLmYXHXpbzaND2cAlDYp9tuhCWZvARMY3Q2ozb57XBJVgO6/T/35xl PYKgsc6Hv0fpU4qIwBfQWJpRtNNOUiYB9KzZ9K9Wozst5L1JrLn4myNsTWnR1Mum8b hDuilQX+WcT2kmUqTndFGG/qNWf1dRdESQFyHVAZ3w8zCZqHVa2Ok6VpgZYCZuRHfy 4O6LJTOUJGBKg== 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 v14 50/56] media: verisilicon: vp9: Allow to change resolution while streaming Date: Tue, 31 Oct 2023 17:30:58 +0100 Message-Id: <20231031163104.112469-51-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:46:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781290261230440840 X-GMAIL-MSGID: 1781290261230440840 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 CC: Ezequiel Garcia CC: Philipp Zabel Reviewed-by: Andrzej Pietrasiewicz --- .../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;