From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7AF9C5B543 for ; Wed, 4 Jun 2025 20:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=whSD1QJgMLLTFCSxB54/oIfrtIl4eEEgAXHw5GZp2dI=; b=GrXTIdZpgVS9P5b4d4RD7Ssrb9 LWq7MGAFfqR6oMW5ewrh4USbVZPIHCWPpySxhzHxL9UpoQzPaepb2ZfDxf191SBEMWDNXKY2T4P1M 6tVNjn9+SdIC+nw1TvUl0LVi6jLRDAM+AH/X9hYyzTiozQaeqK2rN2jadukcW2W1PF+RmkIgaa/W/ fsHdtk//UU8ogZ2hBF7NKaBuK5+oVdYlr4cH9mfVBSMvTTVYAMHgWJZ+mBgvSd1ekNbd8WJilKnT0 JpE+PrUI9sAjOwB5X3Q7P3edYDJXPtoNWgHYd6NvHY8eE/xPt/9h9+ShTvxrHPZKLk57iMzyFzbCJ E5IozoLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMubG-0000000EB8e-1W6W; Wed, 04 Jun 2025 20:20:38 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMuR1-0000000E9qq-16bI; Wed, 04 Jun 2025 20:10:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1749067801; bh=WoCQoCxfZMDeUFZcKpyAMMWvReEUdUT+5X/64RM4JlQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ilFs5QbpnMIrutQuLSN44BI7zgUPkbs5Sx7c9Eor1RyEJOiBH358ItSXpcyW3inA3 ddr4l3rGqEMAUM0Kr0MwVwgrS9E5LkX3M6xPxYK3dwJnNsLxwGeBd+6OcTeekXQaX/ K387NTt86n7xBhp4fIlvvOoVug3TthVTagoPA4kZs4XUell23E7QCyqeL6MbAcTASS drsMFErFG6NU5CwgtT+hs5JoMZw4JHWVOK99xyy62GaR93KAQegiXB8+tRrDWftJC+ YCUVQYAl2KWvRonSUCxBkJpPvUJjaITy9rzdFAK+/RJu5BkCoyPN90oeeEM1x9Au2t 4e31jBYpVeW5A== Received: from [192.168.13.145] (unknown [IPv6:2606:6d00:10:5285::5ac]) (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: nicolas) by bali.collaboradmins.com (Postfix) with ESMTPSA id 11CE217E1045; Wed, 4 Jun 2025 22:09:59 +0200 (CEST) From: Nicolas Dufresne Date: Wed, 04 Jun 2025 16:09:36 -0400 Subject: [PATCH v3 2/5] media: vicodec: add support for manual completion MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250604-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v3-2-603db4749d90@collabora.com> References: <20250604-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v3-0-603db4749d90@collabora.com> In-Reply-To: <20250604-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v3-0-603db4749d90@collabora.com> To: Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, linux-media@vger.kernel.org, Sebastian Fricke , Nicolas Dufresne , Hans Verkuil X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250604_131003_452643_E8E4710E X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Hans Verkuil Manually complete the requests: this tests the manual completion code. Signed-off-by: Hans Verkuil Signed-off-by: Nicolas Dufresne --- drivers/media/test-drivers/vicodec/vicodec-core.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c index c45f5cf12ded3c8b57483b148bf7bbffb8a458c5..88cb6e6a713f08bd4f412ca2940b1309bb87513b 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -448,8 +448,10 @@ static void device_run(void *priv) ctx->comp_magic_cnt = 0; ctx->comp_has_frame = false; spin_unlock(ctx->lock); - if (ctx->is_stateless && src_req) + if (ctx->is_stateless && src_req) { v4l2_ctrl_request_complete(src_req, &ctx->hdl); + media_request_manual_complete(src_req); + } if (ctx->is_enc) v4l2_m2m_job_finish(dev->stateful_enc.m2m_dev, ctx->fh.m2m_ctx); @@ -1525,8 +1527,12 @@ static void vicodec_return_bufs(struct vb2_queue *q, u32 state) vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); if (vbuf == NULL) return; - v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req, - &ctx->hdl); + if (ctx->is_stateless && V4L2_TYPE_IS_OUTPUT(q->type)) { + struct media_request *req = vbuf->vb2_buf.req_obj.req; + + v4l2_ctrl_request_complete(req, &ctx->hdl); + media_request_manual_complete(req); + } spin_lock(ctx->lock); v4l2_m2m_buf_done(vbuf, state); spin_unlock(ctx->lock); @@ -1679,6 +1685,7 @@ static void vicodec_buf_request_complete(struct vb2_buffer *vb) struct vicodec_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); v4l2_ctrl_request_complete(vb->req_obj.req, &ctx->hdl); + media_request_manual_complete(vb->req_obj.req); } @@ -2010,6 +2017,12 @@ static int vicodec_request_validate(struct media_request *req) return vb2_request_validate(req); } +static void vicodec_request_queue(struct media_request *req) +{ + media_request_mark_manual_completion(req); + v4l2_m2m_request_queue(req); +} + static const struct v4l2_file_operations vicodec_fops = { .owner = THIS_MODULE, .open = vicodec_open, @@ -2030,7 +2043,7 @@ static const struct video_device vicodec_videodev = { static const struct media_device_ops vicodec_m2m_media_ops = { .req_validate = vicodec_request_validate, - .req_queue = v4l2_m2m_request_queue, + .req_queue = vicodec_request_queue, }; static const struct v4l2_m2m_ops m2m_ops = { -- 2.49.0