From patchwork Thu Sep 14 13:32:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp432581vqi; Thu, 14 Sep 2023 08:31:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1n2ibRzZjD+mL5GEbxP28KwzEHpzQ53NfWogBQgxcPyR8cXK/CYUwpXRm87MPSoDvfpI4 X-Received: by 2002:a17:903:22c7:b0:1c3:4073:bf80 with SMTP id y7-20020a17090322c700b001c34073bf80mr6539797plg.0.1694705477092; Thu, 14 Sep 2023 08:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694705477; cv=none; d=google.com; s=arc-20160816; b=wO8ZAip3i4f4eGgWrXaloloXEt6fQkA3kbBMyWPnjEiloJOy7pgWaFvrmpsdSdybqA s2CVntJtLxKxFGjcHoXfP+u7kil80WsGnOuwiBLReTuXMBP/nLxzbNSqAlxOtVQGjx3T Jajl8RCUv2f9eCjEDWKQj75aKhrAFlx1fqSfdcGdKkJ1gqYt+72sX/HSBAnapKOA1I2u TruXf7O4r1OV9Jo8EJnsK7j1Du0xe846xjHc04pOBQU3DFhuFWP/k28+yqKErKATPYsV tRn+s7nWIuF3k9NQBgb/xHmeLm1abni9CcJGBJlXIuZS6TVb0xApHgCVwRqzfCzJLz4n Z5MA== 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=ePs46dLM7ZRTibX6R65k4hxZdIg5GBHgbPupT1VJE4pU/5NYCAAAY2z4AYLF/cScfS K3wcFz2yNbuzzFUuzCQMlO8xVale5GCdJqJGJ40dxBhDG2i85uAZChTAzRg5na8UI93p PR2JRcD9xKu4gURYOSHH1WAlLeLDrGWolmiQ6VuCuO4JgwEO3tB/S8jdqIPWspDCO2do hYvYzzlCZ7nbaNlPjQ9jJWz6FnM83nIBjuyBdLfvULSb4P2oIrlAAmC2gQfDK8/OZKLe NW4IVnvbqKNXM/xWWbod/RHxOFSXTZFowJ3XXpCkBWy624ciB6hl59ttt5Cb83Rv5iEb x4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=G4xnHH0K; 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 s10-20020a65584a000000b0057777451a5csi1718359pgr.374.2023.09.14.08.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 08:31:17 -0700 (PDT) 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=G4xnHH0K; 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 192B481E64B7; Thu, 14 Sep 2023 06:34:34 -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 S239530AbjINNe0 (ORCPT + 35 others); Thu, 14 Sep 2023 09:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239216AbjINNdx (ORCPT ); Thu, 14 Sep 2023 09:33:53 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A0FD1FEE; Thu, 14 Sep 2023 06:33:41 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36f2:37bd:ccbb:373f]) (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 0044F660736E; Thu, 14 Sep 2023 14:33:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698420; bh=WDraZOgWi0izES0K9FdWnGrtWWF6tf7zOBBP/EoWBNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4xnHH0KcQzrC++tnJyG3so3XikK6AMopnyr12kJ1wAl7ovGny4ZMEhuefe8pv1tH 4DdUp/W7t5x3xMd+04fSvwy9n8XsNYY+dt0PnD/c8Y2QDnAC0nHQCguxOz9ZvDgZlK 3xjag9k+Y6F6gST25smLN5FawKJk6JX5CSqJt124SX2S9xCgNlE8jxnXKJf0HYey7q TlazMshotZRaBXptW8QO+fqiJw4dTFH60pdgdtlQLLMjBat/nTHqLs8nnHcdFakSh/ gxf6fVrWpSVksVC3jYOcDCSHfT96Nj2MNctttv9owfpV/YwmJ+4FU3Qml9jSWMZ012 Tcq5AJnNGkAyQ== 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 v7 17/49] media: verisilicon: vp9: Allow to change resolution while streaming Date: Thu, 14 Sep 2023 15:32:51 +0200 Message-Id: <20230914133323.198857-18-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914133323.198857-1-benjamin.gaignard@collabora.com> References: <20230914133323.198857-1-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, 14 Sep 2023 06:34:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777027489923522989 X-GMAIL-MSGID: 1777027489923522989 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;