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: 12785206 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6B0C433FE for ; Fri, 18 Mar 2022 12:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236196AbiCRMUR (ORCPT ); Fri, 18 Mar 2022 08:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236177AbiCRMUP (ORCPT ); Fri, 18 Mar 2022 08:20:15 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A582E1AA0 for ; Fri, 18 Mar 2022 05:18:56 -0700 (PDT) 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= From: Umang Jain To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, sakari.ailus@linux.intel.com, libcamera-devel@lists.libcamera.org, Umang Jain Subject: [PATCH 1/2] media: staging/intel-ipu3: Reset imgu_video_device sequence 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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: 12785207 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE77C433FE for ; Fri, 18 Mar 2022 12:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236217AbiCRMUT (ORCPT ); Fri, 18 Mar 2022 08:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236205AbiCRMUS (ORCPT ); Fri, 18 Mar 2022 08:20:18 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9042D27CE22 for ; Fri, 18 Mar 2022 05:18:58 -0700 (PDT) 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= From: Umang Jain To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, sakari.ailus@linux.intel.com, libcamera-devel@lists.libcamera.org, Umang Jain Subject: [PATCH 2/2] media: staging/intel-ipu3: Cleanup dummy buffers via helper 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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)