Patch Detail
Show a patch.
GET /api/patches/10879/?format=api
{ "id": 10879, "url": "https://patchwork.libcamera.org/api/patches/10879/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10879/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20210116114805.905397-7-niklas.soderlund@ragnatech.se>", "date": "2021-01-16T11:48:03", "name": "[libcamera-devel,v5,6/8] libcamera: pipeline: rkisp1: Use delayed controls", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "105ad16b41ab02b7d0d7018ec651e74051edf626", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": { "id": 16, "url": "https://patchwork.libcamera.org/api/users/16/?format=api", "username": "neg", "first_name": "Niklas", "last_name": "Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "mbox": "https://patchwork.libcamera.org/patch/10879/mbox/", "series": [ { "id": 1579, "url": "https://patchwork.libcamera.org/api/series/1579/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1579", "date": "2021-01-16T11:47:57", "name": "libcamera: Add helper for controls that take effect with a delay", "version": 5, "mbox": "https://patchwork.libcamera.org/series/1579/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10879/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10879/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 47709BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 16 Jan 2021 11:48:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AD2468115;\n\tSat, 16 Jan 2021 12:48:25 +0100 (CET)", "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F06D6810C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 16 Jan 2021 12:48:22 +0100 (CET)", "from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de\n\t[79.202.36.88])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid bb3f8c42-57f0-11eb-a076-005056917f90;\n\tSat, 16 Jan 2021 12:48:21 +0100 (CET)" ], "X-Halon-ID": "bb3f8c42-57f0-11eb-a076-005056917f90", "Authorized-sender": "niklas.soderlund@fsdn.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 16 Jan 2021 12:48:03 +0100", "Message-Id": "<20210116114805.905397-7-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.30.0", "In-Reply-To": "<20210116114805.905397-1-niklas.soderlund@ragnatech.se>", "References": "<20210116114805.905397-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v5 6/8] libcamera: pipeline: rkisp1: Use\n\tdelayed controls", "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=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Instead of setting controls using the RkISP1 local Timeline helper use\nthe DelayedControls. The result is the same, the controls are applied\nwith a delay.\n\nThe values of the delays are however different between the two methods.\nThe values used in the Timeline solution were chosen after some\nexperimentation and the values used in DelayedControls are taken from a\ngeneric sensor. None of the two are a perfect match as the delays can be\ndifferent for different sensors used with the pipeline.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n* Changes since v3\n- Rewrite to not use CameraSensor.\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 43 +++++++++++++-----------\n 1 file changed, 23 insertions(+), 20 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 5ce37febc1d7c11c..116d205b85cc146c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -23,6 +23,7 @@\n #include <libcamera/stream.h>\n \n #include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/ipa_manager.h\"\n #include \"libcamera/internal/log.h\"\n@@ -131,6 +132,7 @@ public:\n \tStream mainPathStream_;\n \tStream selfPathStream_;\n \tstd::unique_ptr<CameraSensor> sensor_;\n+\tstd::unique_ptr<DelayedControls> delayedCtrls_;\n \tunsigned int frame_;\n \tstd::vector<IPABuffer> ipaBuffers_;\n \tRkISP1Frames frameInfo_;\n@@ -340,23 +342,6 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)\n \treturn nullptr;\n }\n \n-class RkISP1ActionSetSensor : public FrameAction\n-{\n-public:\n-\tRkISP1ActionSetSensor(unsigned int frame, CameraSensor *sensor, const ControlList &controls)\n-\t\t: FrameAction(frame, SetSensor), sensor_(sensor), controls_(controls) {}\n-\n-protected:\n-\tvoid run() override\n-\t{\n-\t\tsensor_->setControls(&controls_);\n-\t}\n-\n-private:\n-\tCameraSensor *sensor_;\n-\tControlList controls_;\n-};\n-\n class RkISP1ActionQueueBuffers : public FrameAction\n {\n public:\n@@ -424,9 +409,7 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n \tswitch (action.operation) {\n \tcase RKISP1_IPA_ACTION_V4L2_SET: {\n \t\tconst ControlList &controls = action.controls[0];\n-\t\ttimeline_.scheduleAction(std::make_unique<RkISP1ActionSetSensor>(frame,\n-\t\t\t\t\t\t\t\t\t\t sensor_.get(),\n-\t\t\t\t\t\t\t\t\t\t controls));\n+\t\tdelayedCtrls_->push(controls);\n \t\tbreak;\n \t}\n \tcase RKISP1_IPA_ACTION_PARAM_FILLED: {\n@@ -893,6 +876,8 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n \t\t};\n \t}\n \n+\tisp_->setFrameStartEnabled(true);\n+\n \tactiveCamera_ = camera;\n \n \t/* Inform IPA of stream configuration and sensor controls. */\n@@ -920,6 +905,8 @@ void PipelineHandlerRkISP1::stop(Camera *camera)\n \tRkISP1CameraData *data = cameraData(camera);\n \tint ret;\n \n+\tisp_->setFrameStartEnabled(false);\n+\n \tselfPath_.stop();\n \tmainPath_.stop();\n \n@@ -1038,6 +1025,22 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \t/* Initialize the camera properties. */\n \tdata->properties_ = data->sensor_->properties();\n \n+\t/*\n+\t * \\todo Read dealy values from the sensor itself or from a\n+\t * a sensor database. For now use generic values taken from\n+\t * the Raspberry Pi and listed as generic values.\n+\t */\n+\tstd::unordered_map<uint32_t, unsigned int> delays = {\n+\t\t{ V4L2_CID_ANALOGUE_GAIN, 1 },\n+\t\t{ V4L2_CID_EXPOSURE, 2 },\n+\t};\n+\n+\tdata->delayedCtrls_ =\n+\t\tstd::make_unique<DelayedControls>(data->sensor_->device(),\n+\t\t\t\t\t\t delays);\n+\tisp_->frameStart.connect(data->delayedCtrls_.get(),\n+\t\t\t\t &DelayedControls::applyControls);\n+\n \tret = data->loadIPA();\n \tif (ret)\n \t\treturn ret;\n", "prefixes": [ "libcamera-devel", "v5", "6/8" ] }