From patchwork Fri Oct 14 13:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17603 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 B342BC3287 for ; Fri, 14 Oct 2022 13:19:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A61E62DCF; Fri, 14 Oct 2022 15:19:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665753543; bh=yPJ3S5ePksDxI13TuKjRrYLoz3QD65zs4J/EG6QH2Gs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=C+tb0tOlNM8bj54ceSui2bjiriZE16hp1M7p7uxP/Sn51MyksHwcFjiG+VuDqNUZC 4EIqx2G7QbPQlEGUf9qcQVEAsldSDKE2ULVlWhGgARltmVHe3C41KsMiS1f+k/2V27 5esbEBXMOjg2iA0VEmq7vv85HkV3Jh5P7H8uz8Rc4kVVMpElinL+5PjnaK/TQVmccg FneYi7L4UXPXCGKQb9rMEDBe5DU59YbUn7QrzGRGZugAsj3Qe0SsWVMw+GdncMRSLV rIBo63I0XNouiawTEzqfHmv2e/AwjRJ6qujuTBCDdxlCQSqtKjHsgjcKYfLmj+F9Gn 3QYp3u/D6tnoA== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 79FAC62DC2 for ; Fri, 14 Oct 2022 15:18:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="VyxR7uBG"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so3489844wmb.3 for ; Fri, 14 Oct 2022 06:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9MEcdherGyKKJA3fExM5ot5SzxT8Cp9XWWgwst113Kw=; b=VyxR7uBGRO8lL5b6ag4t5alQSKYqGVPjk0f78Yw5bgHYIf0JQ70o9Zg9VmuDsmO0Vc U1xY2E+SEx1seCUXgFOElUfrZpKM39MJnirZKLrA9jd5sHIB0EQ+O5KDEbabXfwGOmHg U26OcH/7taul+B7rdLfpkJpoKkxBut9EeNawcxVS9ep3O3LHz5GylFCMTAGp4vN6cwIA 0/UtYfruVcPxvfvnXtnFxisws0BIFilnAF8p0tV9AnxmgZL/4zUvQjICejB+4ydufJ9i z5LbDIm4zX8GNJM8BUvyeGDmbF99IEV1jBmi9FxyZQ2u7XsAEK554WC5SJxZAwEYs6ui Sthw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9MEcdherGyKKJA3fExM5ot5SzxT8Cp9XWWgwst113Kw=; b=Z0PKZTF9O0ljjZ/K2ot3adWMxQVs0zpO+BZZ1vY70CT9Bc8UA1Fk7KwffyXIKR1I+N GZXATHIPl17i7QBRyjcI0IW2AawjyG7LCbSmWLZX/v/HSf3xbLgP7cfaWvginM3GpkkJ me/Z3qeWtgdFOkiU2zxtGKrCRTOj/qQ2N5Ku0b6y+kinYg3clYMrpKeOY+EQvgRCaZ48 kc+S2JqjndNGTa2V/uAqms4otbSN3XR4H1Is+dSrMoccjQTsROjPi4UjCAN8wBqqCtmn o67XC3l6aC6+gNQSCF9WHVJXZ8n/SohopOCG1LmHAa8qPYwqnjjr3WNSDv/au1ks/1N6 onrg== X-Gm-Message-State: ACrzQf038OxLiN2vcxBLsUDdmEvuG43LwO7vx/gP8rV3onTOcZe90ElC CCWPPSY+4ARuV6Npyb91T+lfJvHsLxfydg== X-Google-Smtp-Source: AMsMyM6lSi/aojev0iSoDyNQTEZsodhslEC/3GJCJQsULQ2vwYWYbC5fZodCGeRa9wS2kPcJsQIprg== X-Received: by 2002:a05:600c:3147:b0:3c6:d28e:4440 with SMTP id h7-20020a05600c314700b003c6d28e4440mr9280868wmo.68.1665753536853; Fri, 14 Oct 2022 06:18:56 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id g17-20020a05600c001100b003c6bbe910fdsm8282458wmc.9.2022.10.14.06.18.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 06:18:56 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 14 Oct 2022 14:18:43 +0100 Message-Id: <20221014131846.27169-8-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014131846.27169-1-naush@raspberrypi.com> References: <20221014131846.27169-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 07/10] pipeline: raspberrypi: Add a parameter to disable startup drop frames 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a new pipeline config parameter "disable_startup_frame_drops" to disable any startup drop frames, overriding the IPA request. When this parameter is set, it allows the pipeline handler to run with no internally allocated Unicam buffers ("min_unicam_buffers"). Add a validation to ensure if "disable_startup_frame_drops" is false, at least one internal Unicam buffer is allocated, possibly overriding the "min_unicam_buffers" parameter. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/raspberrypi/data/default.json | 7 +++++-- .../pipeline/raspberrypi/raspberrypi.cpp | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/data/default.json b/src/libcamera/pipeline/raspberrypi/data/default.json index a7ea735c87f4..707414bcc5c5 100644 --- a/src/libcamera/pipeline/raspberrypi/data/default.json +++ b/src/libcamera/pipeline/raspberrypi/data/default.json @@ -5,7 +5,7 @@ "pipeline_handler": { # The minimum number of internal buffers to be allocated for Unicam. - # This value must be greater than 0, but less than or equal to min_total_unicam_buffers. + # This value must less than or equal to min_total_unicam_buffers. "min_unicam_buffers": 2, # The minimum total (internal + external) buffer count used for Unicam. @@ -15,6 +15,9 @@ "min_total_unicam_buffers": 4, # The number of internal buffers used for ISP Output0. - "num_output0_buffers": 1 + "num_output0_buffers": 1, + + # Override any request from the IPA to drop a number of startup frames. + "disable_startup_frame_drops": false } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 2aba0430c02e..135948d82f41 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -300,6 +300,7 @@ public: unsigned int minUnicamBuffers; unsigned int minTotalUnicamBuffers; unsigned int numOutput0Buffers; + bool disableStartupFrameDrops; }; Config config_; @@ -1044,7 +1045,7 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) data->setSensorControls(startConfig.controls); /* Configure the number of dropped frames required on startup. */ - data->dropFrameCount_ = startConfig.dropFrameCount; + data->dropFrameCount_ = data->config_.disableStartupFrameDrops ? 0 : startConfig.dropFrameCount; for (auto const stream : data->streams_) stream->resetBuffers(); @@ -1430,6 +1431,7 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data) .minUnicamBuffers = 2, .minTotalUnicamBuffers = 4, .numOutput0Buffers = 1, + .disableStartupFrameDrops = false, }; char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RPI_CONFIG_FILE"); @@ -1464,6 +1466,8 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data) phConfig["min_total_unicam_buffers"].get(config.minTotalUnicamBuffers); config.numOutput0Buffers = phConfig["num_output0_buffers"].get(config.numOutput0Buffers); + config.disableStartupFrameDrops = + phConfig["disable_startup_frame_drops"].get(config.disableStartupFrameDrops); if (config.minTotalUnicamBuffers < config.minUnicamBuffers || config.minTotalUnicamBuffers < 1) { LOG(RPI, Error) << "Invalid Unicam buffer configuration used!"; @@ -1543,6 +1547,15 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) */ numBuffers = std::max(data->config_.minUnicamBuffers, minBuffers - numRawBuffers); + + if (numBuffers == 0 && data->dropFrameCount_) { + LOG(RPI, Warning) + << "Configured with no Unicam buffers," + " but the IPA requested startup frame drops." + " Increasing to one buffer."; + numBuffers = 1; + } + data->numUnicamBuffers = numBuffers; } else if (stream == &data->isp_[Isp::Input]) { /*