From patchwork Thu Apr 10 15:39:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 14046959 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 9AE8BC369A2 for ; Thu, 10 Apr 2025 16:40:28 +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=yRMo7JHBYttYMbMNHl6L6s2Lyq nCuODK8vnp7heNWvQcU5AlbkBx+XzgyAIPLasMFdKvM8gmMQKy9H2cjTOxg8qrGl3FstIZ3zVR9VK id4UTmJnmHaOiLiROhNZDoGdGIkK7MAOwAQApz9IojXdvo4V/T4/ijxL5tnJhzUofGp3JDOHhscDk 4uf1vjZo+2fh6sbVM5Y+S6w6FNicToVFBWdtET1HD56vro/iYy4fyaMiWUM3dhqULp/546iNPrcdh mMV//gaT7fyh05kjdDzoBRw1GIU3ORCpfWOlJQxPEBflgGX7I6e77hwKXUkCLKzWq86k89SmzXUAy +oFy7jpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u2uwu-0000000BEwh-0bb8; Thu, 10 Apr 2025 16:40:20 +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 1u2u0d-0000000B3SI-28Hu; Thu, 10 Apr 2025 15:40:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1744299605; bh=WoCQoCxfZMDeUFZcKpyAMMWvReEUdUT+5X/64RM4JlQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=M2anSQNdnTvdjvFQtzV5H1pDPu1y66dJ1R0pEbGsNK2mIFbQTwt+jVnwFHCvksgSl X68HYfZ2TUBxJC3UXmwd31W9o4+7Wo9h53dS8iy2qxb+WjqRnCPIn6w6xoJWj5N21n q/+DlGeDUqmqces78eKorNT4O0yblJBi5iAFhnf58dIb/g6WFUySkVTEcC4RmiKE8j hsJpTvKLGvrW9an/JdwSc4HiDgsk4tXwPFPQnM4ZVCdAQDiqZzGyHG4hdcxixYKX3d DkDYBe7s0miD6J0zmwrDC14ggDsEJ1Koky8ir8rm+JcUnVwJveT/kk3w+ot28KqFno SR1AEkbh9p7uA== Received: from [192.168.13.180] (unknown [IPv6:2606:6d00:11:e976::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 1F02317E0904; Thu, 10 Apr 2025 17:40:04 +0200 (CEST) From: Nicolas Dufresne Date: Thu, 10 Apr 2025 11:39:57 -0400 Subject: [PATCH v2 2/5] media: vicodec: add support for manual completion MIME-Version: 1.0 Message-Id: <20250410-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v2-2-5b99ec0450e6@collabora.com> References: <20250410-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v2-0-5b99ec0450e6@collabora.com> In-Reply-To: <20250410-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v2-0-5b99ec0450e6@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-20250410_084007_733919_747F7335 X-CRM114-Status: GOOD ( 13.29 ) 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 = {