From patchwork Thu Jun 30 00:02:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16437 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 54EBDBD808 for ; Thu, 30 Jun 2022 00:03:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7906D6563A; Thu, 30 Jun 2022 02:03:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656547396; bh=yonNPQNM2/4igsNp+6bqM1tZ+CXM4KyZoUINzJPMXmI=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=vOprCBJ83hPygBhlJuxvFByMBlQlErQJDstPNhF/5+GsWr29JCpFX4HcpJhuv1fsI Sz/PHtATScYOcW7up5VGyNEcdaRLZHXOo1uDWi3g25VuUt5wcBochnxIEb0F8vpW3C VrcVZj5QoGVzjFUYzgyA+HXksEj5CibqKJ66T+/JFwuKem9y+ZlfteQBKDyxa8qKes O/m8wIdYPOkX9AaEzlLFMTV/icLd1gN2AbdCr1647nrPemyGjKwINo3NlAzymQgXEm 05hGgQkfTO3lWQ9g9gGRnZ9oxSvF+pnsDfSjumWNblHrcX+3O0fzWUtuUdP76/aGfN TdNpM7f5e3EZg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2832E6059D for ; Thu, 30 Jun 2022 02:03:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RTNzzDDq"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E72459D; Thu, 30 Jun 2022 02:03:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656547394; bh=yonNPQNM2/4igsNp+6bqM1tZ+CXM4KyZoUINzJPMXmI=; h=From:To:Cc:Subject:Date:From; b=RTNzzDDqYEjlpMu75ALxNeNvXenGt2oOy/zS1bB0kAgUE9lCerPKc/yEzwHgjkr00 2ofNcQVqN08OSyixgZzwv0Yq3qPVT+k78wF/W7p84Sd2h3hpwVhkXBROuAY6HkPXJz pwpqW/57aFNAk3yjox2YL43/OdkzLSUjdwgSHW8A= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 03:02:39 +0300 Message-Id: <20220630000251.31295-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 00/12] gstreamer: Queue multiple requests 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: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Nicolas Dufresne Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch series fixes a long-standing issue in the libcamerasrc element, namely the fact that it never queues more than one request at a time. Many thanks to Nicolas and Umang for reviewing v1. This version takes all review comments into account, save for the inverted logic in patch 12/12 as the result didn't seem to me that it would match what Nicolas intended. It took me quite a while to grasp the implementation of libcamerasrc, and this probably shows through the patch series. I don't claim any of this is particularly great, only that it enables libcamerasrc usage with rkisp1 and vimc, which isn't possible today, and that it didn't introduce any regression I could notice. I've also performed additional performance testing. With a sensor frame rate of 30fps, the libcamerasrc task runs ~80 times / second, is resumed ~55 times / second, and paused ~26 times / second. This can most likely be improved by peeking into the available buffer pools to avoid running the task another time if not enough buffers are available to queue a request, but I don't know if it's worth it. In any case, I believe improvements can be made incrementally. Nicolas, only patches 04/12, 06/12 and 12/12 are missing a review from you. I would be very grateful for your help there. Please see individual patches for changes compared to v1. Laurent Pinchart (12): gstreamer: Use gst_task_resume() when available gstreamer: Move variable to loop scope gstreamer: Pass Stream to RequestWrap::addBuffer() gstreamer: Move timestamp calculation out of pad loop gstreamer: Rename queued requests queue to queuedRequests_ gstreamer: Handle completed requests in the libcamerasrc task gstreamer: Combine the two pad loops in the task run handler gstreamer: Use dedicated lock for request queues gstreamer: Fix pads locking gstreamer: Split request creation to a separate function gstreamer: Split completed request processing to a separate function gstreamer: Fix race conditions in task pause/resume src/gstreamer/gstlibcamera-utils.cpp | 16 +- src/gstreamer/gstlibcamera-utils.h | 4 +- src/gstreamer/gstlibcamerapad.cpp | 35 --- src/gstreamer/gstlibcamerapad.h | 6 - src/gstreamer/gstlibcamerapool.cpp | 7 - src/gstreamer/gstlibcamerapool.h | 2 - src/gstreamer/gstlibcamerasrc.cpp | 322 +++++++++++++++++++-------- 7 files changed, 238 insertions(+), 154 deletions(-) base-commit: 3fa79cc688b540e27f954f156b5ad4bb172ba222