From patchwork Wed Apr 21 06:48:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12027 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 43466BDB16 for ; Wed, 21 Apr 2021 06:48:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9956368848; Wed, 21 Apr 2021 08:48:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="e+LiJN/p"; dkim-atps=neutral Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3F39C602C3 for ; Wed, 21 Apr 2021 08:48:57 +0200 (CEST) Received: by mail-pf1-x431.google.com with SMTP id y62so3964471pfg.4 for ; Tue, 20 Apr 2021 23:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kNV6qYjAU7VLtEqntOrtKziregsJiMkAO84CZN8Pklo=; b=e+LiJN/pyqzhCkiS/pD0VUcEEhsqY6dPlN2aZFE/PMdFDsXE9bIv//avCD2TN9cfYt bEZ6tZLFi6ESEeTMhB0sbxKxK1T2YKm/kEIDA/Y5kOOsCURirUhbtBQpBW2jinEZ2lsW FTECugAp0Q97lsw6K1E/XaybqAuECMPKCH4p4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kNV6qYjAU7VLtEqntOrtKziregsJiMkAO84CZN8Pklo=; b=uLlURWylqfEkeBJ3QMbVDC/spBKnebNXjjs8UedhsWDwQQf6J7D/wVorS6elsRx92u HhNGIHQlXJEA7hKqBV5hh2hH7kyODLP23+knEzqimFI7sxNKHPZFtD3gTCcBEmMLFAjL /KXKxtkUX84mj0jECtqOH8gcXKi7MAsSnpE4QFxA+kpVKMdduiIAxa1tGuyrIr5VZ2SU +XqaVbbZj0LHzmLCvT/VofHZbNP38rag/Ea0AkE3acpJMDHX1is1fFucUnYPm2Sq57Xl ze3dx9jfVjCa0fvdfK+L8ddedT3AwPQN5hRneFq11yzHNgfnGVQ+koNwRr1SWlYE+MId cbeQ== X-Gm-Message-State: AOAM530AcAa/XIXNEseminthN8JGP1uwcy7Se+MaGRRpiTN5sulVZAYC hbdP5q5Xh1w2Hi4NNt/iWgOjXUrUZ8E+6g== X-Google-Smtp-Source: ABdhPJx1aWMzP8UtOa64we3O5bO4/zUtMEUeLHBczpwXQha7WI/K0sC5SMngA7WLXPAtbvs/XNO2xg== X-Received: by 2002:a62:8c8c:0:b029:253:31e:55cb with SMTP id m134-20020a628c8c0000b0290253031e55cbmr28182804pfd.27.1618987735602; Tue, 20 Apr 2021 23:48:55 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:7aaa:cbeb:5d87:4ab6]) by smtp.gmail.com with ESMTPSA id ng6sm1021458pjb.14.2021.04.20.23.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 23:48:55 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Apr 2021 15:48:47 +0900 Message-Id: <20210421064847.324118-3-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog In-Reply-To: <20210421064847.324118-1-hiroh@chromium.org> References: <20210421064847.324118-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/2] libcamera: ipu3: Try queuing pending requests if a buffer is available 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" IPU3CameraData stores requests that have been failed due to a buffer shortage. The requests should be retried once enough buffers are available. This sets the retry function as signal to CIO2Device and IPU3Frame, and invokes it from CIO2Device::tryReturnBuffer() and IPU3Frame::remove(). Signed-off-by: Hirokazu Honda --- src/libcamera/pipeline/ipu3/cio2.cpp | 2 ++ src/libcamera/pipeline/ipu3/cio2.h | 2 ++ src/libcamera/pipeline/ipu3/frames.cpp | 2 ++ src/libcamera/pipeline/ipu3/frames.h | 4 ++++ src/libcamera/pipeline/ipu3/ipu3.cpp | 4 ++++ 5 files changed, 14 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index 8bbef174..1be2cbcd 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer) break; } } + + bufferAvailable.emit(); } void CIO2Device::freeBuffers() diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h index 5ecc4f47..d8d4a181 100644 --- a/src/libcamera/pipeline/ipu3/cio2.h +++ b/src/libcamera/pipeline/ipu3/cio2.h @@ -56,6 +56,8 @@ public: Signal &bufferReady() { return output_->bufferReady; } Signal &frameStart() { return csi2_->frameStart; } + Signal<> bufferAvailable; + private: void freeBuffers(); diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp index 2c4fe508..43cca7c8 100644 --- a/src/libcamera/pipeline/ipu3/frames.cpp +++ b/src/libcamera/pipeline/ipu3/frames.cpp @@ -103,6 +103,8 @@ bool IPU3Frames::tryComplete(IPU3Frames::Info *info) remove(info); + bufferAvailable.emit(); + return true; } diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h index 4acdf48e..59e64e81 100644 --- a/src/libcamera/pipeline/ipu3/frames.h +++ b/src/libcamera/pipeline/ipu3/frames.h @@ -12,6 +12,8 @@ #include #include +#include + namespace libcamera { class FrameBuffer; @@ -49,6 +51,8 @@ public: Info *find(unsigned int id); Info *find(FrameBuffer *buffer); + Signal<> bufferAvailable; + private: std::queue availableParamBuffers_; std::queue availableStatBuffers_; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 3f311e58..1c67c5fd 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -701,6 +701,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera) data->ipa_->mapBuffers(ipaBuffers_); data->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_); + data->frameInfos_.bufferAvailable.connect( + data, &IPU3CameraData::queuePendingRequests); return 0; } @@ -1140,6 +1142,8 @@ int PipelineHandlerIPU3::registerCameras() */ data->cio2_.bufferReady().connect(data.get(), &IPU3CameraData::cio2BufferReady); + data->cio2_.bufferAvailable.connect( + data.get(), &IPU3CameraData::queuePendingRequests); data->imgu_->input_->bufferReady.connect(&data->cio2_, &CIO2Device::tryReturnBuffer); data->imgu_->output_->bufferReady.connect(data.get(),