Patch Detail
Show a patch.
GET /api/1.1/patches/10598/?format=api
{ "id": 10598, "url": "https://patchwork.libcamera.org/api/1.1/patches/10598/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10598/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201207180121.6374-2-david.plowman@raspberrypi.com>", "date": "2020-12-07T18:01:16", "name": "[libcamera-devel,v2,1/6] src: raspberrypi: Pass the drop frame count in start, not configure", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5b2b3207558efab3f182ce598fd384ecceab5a80", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10598/mbox/", "series": [ { "id": 1511, "url": "https://patchwork.libcamera.org/api/1.1/series/1511/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1511", "date": "2020-12-07T18:01:15", "name": "Raspberry Pi AGC: initial frame drop count", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1511/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10598/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10598/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7FFDFBDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 7 Dec 2020 18:01:57 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49CCA67E6A;\n\tMon, 7 Dec 2020 19:01:57 +0100 (CET)", "from mail-ej1-x632.google.com (mail-ej1-x632.google.com\n\t[IPv6:2a00:1450:4864:20::632])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 58FB0635A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 7 Dec 2020 19:01:55 +0100 (CET)", "by mail-ej1-x632.google.com with SMTP id d17so20761022ejy.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 07 Dec 2020 10:01:55 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe6sm14657977edb.29.2020.12.07.10.01.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 07 Dec 2020 10:01:49 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"mHrEhWOa\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=DH+SHOeKlT6c2ZRs8mi0dfzgwQzv992L13kp55/VB20=;\n\tb=mHrEhWOaW/D6Y6X/RnSZ3ESMMQNgUKNQGYNso0a71bebfmZkhU9YSbexLn+JzpAgMm\n\tzCGdCAPBqfEMCnzcH6Iy+mVHPQ4Nzw44vh2EZD7Nq8xaUkntKQhJ+FvvTq0/qNkKk3RS\n\tQaTGmoe5l051ZdBw9w5Ax9HSsJ3zyc7h6huNE4rUJJTY/VI5x7iWrmv8o6GoWKaW4O26\n\tMgY6eBCW1+EpkgoEc12h2IBpYUZzspY9iluP6P/ZCMGG0zKNn67JJHUURL71lP6iXFkC\n\tRjPG8UQueZijX7JVx908zxKuXpSiD1YJfANEL5iY+EhmF/48uwXgpEeh7HxORTBXeiks\n\tz/fQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=DH+SHOeKlT6c2ZRs8mi0dfzgwQzv992L13kp55/VB20=;\n\tb=o71K4eQ7v1GZvWDjZKmwM7Rw/asuRl1/dMv9BQW0s2UM6CkEWV+7nrClWHGBuOfLAw\n\tXGAb2u/S1LE4d1X9UnwzDarvVeIvmSCZRH2TECe5bN8TtLMwYzMVrwQqf92xBbm96/Id\n\tZNsQe2R2HXYM+2cQJfrJ8O1QD13jLAXitJzoaurHbgH3vozW5Kxc4yAPIPhdvyac0xoh\n\tVyOMZTPwWywukfNBKu5PMkWbIFxV1Y/JhmwnOCCwR6kKKCmQpek8fH2ZcDlVZodmFFKY\n\tdxo1IVqiqPji3N3tDF/X6EvCGHzhp8UGBykXPZ2JIxtfeKDw8ey4WcSxqXgQSJ18DL7K\n\tHOKg==", "X-Gm-Message-State": "AOAM531kNCOvDjmT5SAeDU3q2c9r5/argThk1FeC8fyzGQh8zu4fvkWP\n\t0UMeaOnmjrF8upxrTKMh9hCW0jAXQ8/AsIJw", "X-Google-Smtp-Source": "ABdhPJxC/iSWV9H3llOx0xgCAxWEtaZ1jb9VHfY6JmSMP5BfaFahj6IARYSn80HlDZWvxh1JMG9O6Q==", "X-Received": "by 2002:a17:906:6091:: with SMTP id\n\tt17mr20418739ejj.476.1607364114686; \n\tMon, 07 Dec 2020 10:01:54 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 7 Dec 2020 18:01:16 +0000", "Message-Id": "<20201207180121.6374-2-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20201207180121.6374-1-david.plowman@raspberrypi.com>", "References": "<20201207180121.6374-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 1/6] src: raspberrypi: Pass the drop\n\tframe count in start, not configure", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The number of frames to drop (not display) is passed back now from the\nstart method, not configure. This means applications have a chance to\nset fixed exposure/gain before starting the camera and this can affect\nthe frame drop count that is returned.\n\nNote how we need to be able to tell the very first time we start the\ncamera from subsequent restarts, hence addition of the \"firstStart_\"\nflag.\n\nBoth the IPA implementation file and the pipeline handler need\nmatching modifications.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 45 ++++++++++---------\n .../pipeline/raspberrypi/raspberrypi.cpp | 25 ++++++-----\n 2 files changed, 38 insertions(+), 32 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 2027f1c0..0e89af00 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -67,7 +67,7 @@ public:\n \tIPARPi()\n \t\t: lastMode_({}), controller_(), controllerInit_(false),\n \t\t frameCount_(0), checkCount_(0), mistrustCount_(0),\n-\t\t lsTable_(nullptr)\n+\t\t lsTable_(nullptr), firstStart_(true)\n \t{\n \t}\n \n@@ -145,6 +145,9 @@ private:\n \t/* LS table allocation passed in from the pipeline handler. */\n \tFileDescriptor lsTableHandle_;\n \tvoid *lsTable_;\n+\n+\t/* Distinguish the first camera start from others. */\n+\tbool firstStart_;\n };\n \n int IPARPi::init(const IPASettings &settings)\n@@ -179,6 +182,27 @@ int IPARPi::start(const IPAOperationData &ipaConfig, IPAOperationData *result)\n \t\tresult->operation |= RPi::IPA_CONFIG_SENSOR;\n \t}\n \n+\t/*\n+\t * Initialise frame counts, and decide how many frames must be hidden or\n+\t *\"mistrusted\", which depends on whether this is a startup from cold,\n+\t * or merely a mode switch in a running system.\n+\t */\n+\tframeCount_ = 0;\n+\tcheckCount_ = 0;\n+\tunsigned int dropFrame = 0;\n+\tif (firstStart_) {\n+\t\tdropFrame = helper_->HideFramesStartup();\n+\t\tmistrustCount_ = helper_->MistrustFramesStartup();\n+\t} else {\n+\t\tdropFrame = helper_->HideFramesModeSwitch();\n+\t\tmistrustCount_ = helper_->MistrustFramesModeSwitch();\n+\t}\n+\n+\tresult->data.push_back(dropFrame);\n+\tresult->operation |= RPi::IPA_CONFIG_DROP_FRAMES;\n+\n+\tfirstStart_ = false;\n+\n \treturn 0;\n }\n \n@@ -293,25 +317,6 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t/* Pass the camera mode to the CamHelper to setup algorithms. */\n \thelper_->SetCameraMode(mode_);\n \n-\t/*\n-\t * Initialise frame counts, and decide how many frames must be hidden or\n-\t *\"mistrusted\", which depends on whether this is a startup from cold,\n-\t * or merely a mode switch in a running system.\n-\t */\n-\tframeCount_ = 0;\n-\tcheckCount_ = 0;\n-\tunsigned int dropFrame = 0;\n-\tif (controllerInit_) {\n-\t\tdropFrame = helper_->HideFramesModeSwitch();\n-\t\tmistrustCount_ = helper_->MistrustFramesModeSwitch();\n-\t} else {\n-\t\tdropFrame = helper_->HideFramesStartup();\n-\t\tmistrustCount_ = helper_->MistrustFramesStartup();\n-\t}\n-\n-\tresult->data.push_back(dropFrame);\n-\tresult->operation |= RPi::IPA_CONFIG_DROP_FRAMES;\n-\n \tif (!controllerInit_) {\n \t\t/* Load the tuning file for this sensor. */\n \t\tcontroller_.Read(tuningFile_.c_str());\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 89a44763..5ae56628 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -745,13 +745,6 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t\treturn ret;\n \t}\n \n-\tret = queueAllBuffers(camera);\n-\tif (ret) {\n-\t\tLOG(RPI, Error) << \"Failed to queue buffers\";\n-\t\tstop(camera);\n-\t\treturn ret;\n-\t}\n-\n \t/* Check if a ScalerCrop control was specified. */\n \tif (controls)\n \t\tdata->applyScalerCrop(*controls);\n@@ -778,6 +771,19 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n \t}\n \n+\tif (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {\n+\t\t/* Configure the number of dropped frames required on startup. */\n+\t\tdata->dropFrameCount_ = result.data[0];\n+\t}\n+\n+\t/* We need to set the dropFrameCount_ before queueing buffers. */\n+\tret = queueAllBuffers(camera);\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Failed to queue buffers\";\n+\t\tstop(camera);\n+\t\treturn ret;\n+\t}\n+\n \t/*\n \t * IPA configure may have changed the sensor flips - hence the bayer\n \t * order. Get the sensor format and set the ISP input now.\n@@ -1231,11 +1237,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n \t}\n \n-\tif (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {\n-\t\t/* Configure the number of dropped frames required on startup. */\n-\t\tdropFrameCount_ = result.data[resultIdx++];\n-\t}\n-\n \t/*\n \t * Configure the H/V flip controls based on the combination of\n \t * the sensor and user transform.\n", "prefixes": [ "libcamera-devel", "v2", "1/6" ] }