From patchwork Fri Mar 18 12:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15480 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CCFA2BDE17 for ; Fri, 18 Mar 2022 12:18:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 84374604E7; Fri, 18 Mar 2022 13:18:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647605935; bh=L89NUtuPW7aTO7Qju1xmKrCMY/rwBdY1euV75Y2YBsA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=LeWB10n5C9qRjcl/4tdve7MHcvwJnd8JykzMzg1/W98+dcbGNIs92aCMeD3Kt9l/7 9KQiSPZrSkqyIH/oovAX3SUrSNaFbo8RoYpxebrrEDKIX2izspDXUFnOEnmoqCddZH 1ji3wC/MCZunXZj9TIOg9njqBdZD4wgDQ8d9MMqgoUkDxtXizBlJx8A0YYPzFueVLa qLIVgrCdH4Z/TXl9dbUx7A2UQWmT79+2n1uqtNDgIyUv+qcNgWvy4QGKtOSHNtJB5j AjPQi5OjJlUG/irNRDfdsr1F22TyXFL35Ovk/yW5rIYulzG872s+HXY5akn4CBRECr pV8LhCHM/VVsw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3430F604DB for ; Fri, 18 Mar 2022 13:18:54 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pw3TWffQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (unknown [103.251.226.137]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EF9C42A5; Fri, 18 Mar 2022 13:18:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1647605934; bh=L89NUtuPW7aTO7Qju1xmKrCMY/rwBdY1euV75Y2YBsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pw3TWffQF6fbHEdctlvCK5D7mjM5g/1VLsYXnIhplnhlOmT3XYs7UDACiJyGhyYw2 9BZSgNkp1sYnKo63PN/vqhjk8A8yBEKIRjDTVT/U4W7Mb6OM/62wTlzvflQMYlPyQ5 MrSWlJBQHb0BkiXWQyNBdMX1dxEUtqWag9E1y1lg= To: linux-media@vger.kernel.org Date: Fri, 18 Mar 2022 17:48:25 +0530 Message-Id: <20220318121826.877187-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220318121826.877187-1-umang.jain@ideasonboard.com> References: <20220318121826.877187-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] media: staging/intel-ipu3: Reset imgu_video_device sequence X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Cc: bingbu.cao@intel.com, libcamera-devel@lists.libcamera.org, sakari.ailus@linux.intel.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Reset the sequence number of imgu_video_device on stream start. Failing to do so results in sequence number getting incremented for consecutive stream on/off cycles. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- drivers/staging/media/ipu3/ipu3-v4l2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index 0473457b4e64..d1c539cefba8 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -485,6 +485,7 @@ static int imgu_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) pipe = node->pipe; imgu_pipe = &imgu->imgu_pipe[pipe]; + atomic_set(&node->sequence, 0); r = media_pipeline_start(&node->vdev.entity, &imgu_pipe->pipeline); if (r < 0) goto fail_return_bufs; From patchwork Fri Mar 18 12:18:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15481 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 41676BDE17 for ; Fri, 18 Mar 2022 12:18:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE2EE604EA; Fri, 18 Mar 2022 13:18:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647605938; bh=KL5CdfOC2RG04Pu4/WxP5EEpFjg78Szq5z3IWkizIO8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=z/57MlLZ3S0W2ofwISmredlP5Oa+i5V0jrBRSwaPJCojW6Pvo3yVkT6ZZz9y2N0UG +9R+jh+Ond8t9PK9A/hhSa8OjIh1XcTdLi7qoEgXxAd6/KIO+uk5OS3DfMfrnXt5IH zze8kkPcZAIh5YEPUe2DCU+MCUNhRPGt5NkrdMPhvSj92+AezbNgTU8wQ3tQ3KZxSK lDmTXje/S2oLzpZzWgHc0ViPlFQ0DLE0TFQWVRTIIr/8c1kfp7nBXc3JiORgi85OXG yJOmYNzbpu+mAZZf7ehGB2GWxFv1ekVy7dz6DyLQtSbhvPW4kyM92ZMfqtH3ZZksuh SgQ9bHF0A5+Bw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7610C604EA for ; Fri, 18 Mar 2022 13:18:57 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EdUxAYbn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (unknown [103.251.226.137]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89FF32E0; Fri, 18 Mar 2022 13:18:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1647605937; bh=KL5CdfOC2RG04Pu4/WxP5EEpFjg78Szq5z3IWkizIO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdUxAYbn8078d0aSyDrE7ewXsl0nuJ5LrvbDj+QRGKxXcmjP9l+dIYdbS4T/v+54p pAonq9VrdjWPuBk3Nji6QF24honHZCn5VrKbEtfR3wjFwxVhHBFsOZqrzdbPQORxB8 Kz2/CkC1QzMgr9qg++LrEhhX/7p0S2LdMjknvVFI= To: linux-media@vger.kernel.org Date: Fri, 18 Mar 2022 17:48:26 +0530 Message-Id: <20220318121826.877187-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220318121826.877187-1-umang.jain@ideasonboard.com> References: <20220318121826.877187-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] media: staging/intel-ipu3: Cleanup dummy buffers via helper X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Cc: bingbu.cao@intel.com, libcamera-devel@lists.libcamera.org, sakari.ailus@linux.intel.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use an existing helper imgu_video_nodes_exit() on imgu-video-node initialization failure path to cleanup dummy buffers. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- drivers/staging/media/ipu3/ipu3.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c index 8e1e9e46e604..0c453b37f8c4 100644 --- a/drivers/staging/media/ipu3/ipu3.c +++ b/drivers/staging/media/ipu3/ipu3.c @@ -440,6 +440,16 @@ int imgu_s_stream(struct imgu_device *imgu, int enable) return r; } +static void imgu_video_nodes_exit(struct imgu_device *imgu) +{ + int i; + + for (i = 0; i < IMGU_MAX_PIPE_NUM; i++) + imgu_dummybufs_cleanup(imgu, i); + + imgu_v4l2_unregister(imgu); +} + static int imgu_video_nodes_init(struct imgu_device *imgu) { struct v4l2_pix_format_mplane *fmts[IPU3_CSS_QUEUES] = { NULL }; @@ -489,24 +499,11 @@ static int imgu_video_nodes_init(struct imgu_device *imgu) return 0; out_cleanup: - for (j = 0; j < IMGU_MAX_PIPE_NUM; j++) - imgu_dummybufs_cleanup(imgu, j); - - imgu_v4l2_unregister(imgu); + imgu_video_nodes_exit(imgu); return r; } -static void imgu_video_nodes_exit(struct imgu_device *imgu) -{ - int i; - - for (i = 0; i < IMGU_MAX_PIPE_NUM; i++) - imgu_dummybufs_cleanup(imgu, i); - - imgu_v4l2_unregister(imgu); -} - /**************** PCI interface ****************/ static irqreturn_t imgu_isr_threaded(int irq, void *imgu_ptr)