From patchwork Thu Nov 9 16:35:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 163508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp561188vqs; Thu, 9 Nov 2023 08:43:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFH0rUQnrDxWofnFIq4clnfhIl5F5fVPN5fHwSKEk2rYV5Ky2xWgYsF/2mpAFi0EEHW6fQc X-Received: by 2002:a17:90b:38c5:b0:27c:fe72:6e9 with SMTP id nn5-20020a17090b38c500b0027cfe7206e9mr2157961pjb.27.1699548180088; Thu, 09 Nov 2023 08:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699548180; cv=none; d=google.com; s=arc-20160816; b=Q2nZZ2auVt36Ddp3O5mNJaSSKZZRpdWRUfUE76ApQkInB+VY8Nw+ZJZXkyOAncMYEx /0aDY07nocvlRKgBWx2nPxuM+4ayerrK79+PGXBqsRHvneQAAjrJO0xk3Q+PaqWvdxds zJUVUOqVcy0Ny7jvAr7zN62GO/fwtG+h5L7Yv6zbaIOKjK9yGDTMsnbN7I6XYyJKWYKz esI50/WcGv106fie7r3tXa4wvwGQ5CDZ96wQxnKtQzyB1NaWTMcHsklNGeOAN/jYWYrg tPB6k9agVcmM9xrBtbzdJCtcyBqVwUPBtblk+MCtF3ZwUF5N4DtgmD6p4LtFphJNsVGD cfHw== 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=xAXTVeKAliUG+rfZD4/d6jtx7lhXJYsZ6fdEoxakH1k=; fh=t4h1l+tS8anPNnwyX0PglXAWKg/D9M9NAbc0AP3vdGI=; b=qf2PQ2TjDYOm2EJhP+ZUije/G2fAn67uxRGNOao2GEsdrsWoaGK6yWEc7b5CGH1bEn p84pd+55fw24jXi6l1OwbKSwBfRWTDurzW+K2SmzTBPvibOqIiFtpvJeWHItkdltC9o+ hmyfnM4xGc+3DxNlY2WxlIoAI3s7qe5mSP0/NMb1jvrNOQcO2wwk7ididkM1l2h6C+dv bvJUs2hGjVMNDgyt/YzBwh0wQUPfJxyqQ07VDHVDNh72QUct9d+UJwO/cnA5PivTW/Xm VwQCskhdD54DBDytpYafudYeSM+8450zlHc31KiLio+5BJmyaOszmgq6p85u1wc7QBry gL9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aYIMsT41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id a6-20020a17090a740600b0027763ca82e9si1985653pjg.91.2023.11.09.08.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:43:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aYIMsT41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 1F5F9811F927; Thu, 9 Nov 2023 08:41:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344791AbjKIQky (ORCPT + 31 others); Thu, 9 Nov 2023 11:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344798AbjKIQkO (ORCPT ); Thu, 9 Nov 2023 11:40:14 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FC23C18; Thu, 9 Nov 2023 08:38:42 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 B464F66076BA; Thu, 9 Nov 2023 16:38:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547921; bh=fFBdGWyde3CLXG2tW0S3Zg0kPe5c8iT7wqUE7Ab5G1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aYIMsT410bTadg3ob1hz9duxvKFPPXD+nnCnqKTsKrNi+Cku036TDvnIrtVtcgOXS EEMFrIg1LRl9RXoSqODRgVV/moiIkSEJinoHAmFak/0gnG0h2zLgXeUOx3qSitVFc+ fRPVEyBg+6CsDfUL2MeqiohaDyn00ev0LxLCiXTqzqPbHV50hJ4WGeiWcIrpeXBkiC DBC/9+fV35MjavmXGWO/dBCxoDtMhqyud/uR54NcEPZTyf+GwqmooyNFKjAIPuF/50 5CG4dClHC+rpUIeq3Ms454mE0HVTpHkugnkNkzWSqCtYui6hgGVtK7evPMu235fTH0 1jH+1kDqLlsNQ== 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 , Andrzej Pietrasiewicz Subject: [PATCH v15 50/56] media: verisilicon: vp9: Allow to change resolution while streaming Date: Thu, 9 Nov 2023 17:35:06 +0100 Message-Id: <20231109163512.179524-51-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163512.179524-14-benjamin.gaignard@collabora.com> References: <20231109163512.179524-14-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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]); Thu, 09 Nov 2023 08:41:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782105432463281668 X-GMAIL-MSGID: 1782105432463281668 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 Reviewed-by: Andrzej Pietrasiewicz CC: Ezequiel Garcia CC: Philipp Zabel --- .../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;