Patch Detail
Show a patch.
GET /api/1.1/patches/10484/?format=api
{ "id": 10484, "url": "https://patchwork.libcamera.org/api/1.1/patches/10484/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10484/", "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": "<20201123221234.485933-5-niklas.soderlund@ragnatech.se>", "date": "2020-11-23T22:12:30", "name": "[libcamera-devel,v3,4/8] libcamera: raspberrypi: Remove StaggeredCtrl", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "af2692954ccfc0dc46cfff1094214d599690c032", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": { "id": 16, "url": "https://patchwork.libcamera.org/api/1.1/users/16/?format=api", "username": "neg", "first_name": "Niklas", "last_name": "Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "mbox": "https://patchwork.libcamera.org/patch/10484/mbox/", "series": [ { "id": 1478, "url": "https://patchwork.libcamera.org/api/1.1/series/1478/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1478", "date": "2020-11-23T22:12:26", "name": "libcamera: Add helper for controls that take effect with a delay", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1478/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10484/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10484/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 B1CDFBE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Nov 2020 22:12:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 86F29633FE;\n\tMon, 23 Nov 2020 23:12:54 +0100 (CET)", "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F22F9633F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Nov 2020 23:12:49 +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 275b14ee-2dd8-11eb-a076-005056917f90;\n\tMon, 23 Nov 2020 23:06:36 +0100 (CET)" ], "X-Halon-ID": "275b14ee-2dd8-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,\n\tnaush@raspberrypi.com", "Date": "Mon, 23 Nov 2020 23:12:30 +0100", "Message-Id": "<20201123221234.485933-5-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20201123221234.485933-1-niklas.soderlund@ragnatech.se>", "References": "<20201123221234.485933-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 4/8] libcamera: raspberrypi: Remove\n\tStaggeredCtrl", "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": "There are no users left, remove it.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n .../pipeline/raspberrypi/meson.build | 1 -\n .../pipeline/raspberrypi/staggered_ctrl.cpp | 174 ------------------\n .../pipeline/raspberrypi/staggered_ctrl.h | 96 ----------\n 3 files changed, 271 deletions(-)\n delete mode 100644 src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n delete mode 100644 src/libcamera/pipeline/raspberrypi/staggered_ctrl.h", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/meson.build b/src/libcamera/pipeline/raspberrypi/meson.build\nindex 7c5b6ff73741c968..f1a2f5ee72c2a0dd 100644\n--- a/src/libcamera/pipeline/raspberrypi/meson.build\n+++ b/src/libcamera/pipeline/raspberrypi/meson.build\n@@ -4,5 +4,4 @@ libcamera_sources += files([\n 'dma_heaps.cpp',\n 'raspberrypi.cpp',\n 'rpi_stream.cpp',\n- 'staggered_ctrl.cpp',\n ])\ndiff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\ndeleted file mode 100644\nindex 62605c0fceee7d11..0000000000000000\n--- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp\n+++ /dev/null\n@@ -1,174 +0,0 @@\n-/* SPDX-License-Identifier: LGPL-2.1-or-later */\n-/*\n- * Copyright (C) 2020, Raspberry Pi (Trading) Ltd.\n- *\n- * staggered_ctrl.cpp - Helper for writing staggered ctrls to a V4L2 device.\n- */\n-\n-#include \"staggered_ctrl.h\"\n-\n-#include <algorithm>\n-\n-#include <libcamera/controls.h>\n-\n-#include \"libcamera/internal/log.h\"\n-#include \"libcamera/internal/utils.h\"\n-#include \"libcamera/internal/v4l2_videodevice.h\"\n-\n-namespace libcamera {\n-\n-LOG_DEFINE_CATEGORY(RPI_S_W)\n-\n-namespace RPi {\n-\n-void StaggeredCtrl::init(V4L2VideoDevice *dev,\n-\t std::initializer_list<std::pair<const uint32_t, uint8_t>> delayList)\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\tdev_ = dev;\n-\tdelay_ = delayList;\n-\tctrl_.clear();\n-\n-\t/* Find the largest delay across all controls. */\n-\tmaxDelay_ = 0;\n-\tfor (auto const &p : delay_) {\n-\t\tLOG(RPI_S_W, Info) << \"Init ctrl \"\n-\t\t\t\t << utils::hex(p.first) << \" with delay \"\n-\t\t\t\t << static_cast<int>(p.second);\n-\t\tmaxDelay_ = std::max(maxDelay_, p.second);\n-\t}\n-\n-\tinit_ = true;\n-}\n-\n-void StaggeredCtrl::reset()\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\tint lastSetCount = setCount_;\n-\tstd::unordered_map<uint32_t, int32_t> lastVal;\n-\n-\t/* Reset the counters. */\n-\tsetCount_ = getCount_ = 0;\n-\n-\t/* Look for the last set values. */\n-\tfor (auto const &c : ctrl_)\n-\t\tlastVal[c.first] = c.second[lastSetCount].value;\n-\n-\t/* Apply the last set values as the next to be applied. */\n-\tctrl_.clear();\n-\tfor (auto &c : lastVal)\n-\t\tctrl_[c.first][setCount_] = CtrlInfo(c.second);\n-}\n-\n-bool StaggeredCtrl::set(uint32_t ctrl, int32_t value)\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\t/* Can we find this ctrl as one that is registered? */\n-\tif (delay_.find(ctrl) == delay_.end())\n-\t\treturn false;\n-\n-\tctrl_[ctrl][setCount_].value = value;\n-\tctrl_[ctrl][setCount_].updated = true;\n-\n-\treturn true;\n-}\n-\n-bool StaggeredCtrl::set(std::initializer_list<std::pair<const uint32_t, int32_t>> ctrlList)\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\tfor (auto const &p : ctrlList) {\n-\t\t/* Can we find this ctrl? */\n-\t\tif (delay_.find(p.first) == delay_.end())\n-\t\t\treturn false;\n-\n-\t\tctrl_[p.first][setCount_] = CtrlInfo(p.second);\n-\t}\n-\n-\treturn true;\n-}\n-\n-bool StaggeredCtrl::set(const ControlList &controls)\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\tfor (auto const &p : controls) {\n-\t\t/* Can we find this ctrl? */\n-\t\tif (delay_.find(p.first) == delay_.end())\n-\t\t\treturn false;\n-\n-\t\tctrl_[p.first][setCount_] = CtrlInfo(p.second.get<int32_t>());\n-\t\tLOG(RPI_S_W, Debug) << \"Setting ctrl \"\n-\t\t\t\t << utils::hex(p.first) << \" to \"\n-\t\t\t\t << ctrl_[p.first][setCount_].value\n-\t\t\t\t << \" at index \"\n-\t\t\t\t << setCount_;\n-\t}\n-\n-\treturn true;\n-}\n-\n-int StaggeredCtrl::write()\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\tControlList controls(dev_->controls());\n-\n-\tfor (auto &p : ctrl_) {\n-\t\tint delayDiff = maxDelay_ - delay_[p.first];\n-\t\tint index = std::max<int>(0, setCount_ - delayDiff);\n-\n-\t\tif (p.second[index].updated) {\n-\t\t\t/* We need to write this value out. */\n-\t\t\tcontrols.set(p.first, p.second[index].value);\n-\t\t\tp.second[index].updated = false;\n-\t\t\tLOG(RPI_S_W, Debug) << \"Writing ctrl \"\n-\t\t\t\t\t << utils::hex(p.first) << \" to \"\n-\t\t\t\t\t << p.second[index].value\n-\t\t\t\t\t << \" at index \"\n-\t\t\t\t\t << index;\n-\t\t}\n-\t}\n-\n-\tnextFrame();\n-\treturn dev_->setControls(&controls);\n-}\n-\n-void StaggeredCtrl::get(std::unordered_map<uint32_t, int32_t> &ctrl, uint8_t offset)\n-{\n-\tstd::lock_guard<std::mutex> lock(lock_);\n-\n-\t/* Account for the offset to reset the getCounter. */\n-\tgetCount_ += offset + 1;\n-\n-\tctrl.clear();\n-\tfor (auto &p : ctrl_) {\n-\t\tint index = std::max<int>(0, getCount_ - maxDelay_);\n-\t\tctrl[p.first] = p.second[index].value;\n-\t\tLOG(RPI_S_W, Debug) << \"Getting ctrl \"\n-\t\t\t\t << utils::hex(p.first) << \" to \"\n-\t\t\t\t << p.second[index].value\n-\t\t\t\t << \" at index \"\n-\t\t\t\t << index;\n-\t}\n-}\n-\n-void StaggeredCtrl::nextFrame()\n-{\n-\t/* Advance the control history to the next frame */\n-\tint prevCount = setCount_;\n-\tsetCount_++;\n-\n-\tLOG(RPI_S_W, Debug) << \"Next frame, set index is \" << setCount_;\n-\n-\tfor (auto &p : ctrl_) {\n-\t\tp.second[setCount_].value = p.second[prevCount].value;\n-\t\tp.second[setCount_].updated = false;\n-\t}\n-}\n-\n-} /* namespace RPi */\n-\n-} /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.h b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.h\ndeleted file mode 100644\nindex 382fa31a685357f2..0000000000000000\n--- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.h\n+++ /dev/null\n@@ -1,96 +0,0 @@\n-/* SPDX-License-Identifier: LGPL-2.1-or-later */\n-/*\n- * Copyright (C) 2020, Raspberry Pi (Trading) Ltd.\n- *\n- * staggered_ctrl.h - Helper for writing staggered ctrls to a V4L2 device.\n- */\n-#ifndef __LIBCAMERA_PIPELINE_RASPBERRYPI_STAGGERED_CTRL_H__\n-#define __LIBCAMERA_PIPELINE_RASPBERRYPI_STAGGERED_CTRL_H__\n-\n-#include <array>\n-#include <initializer_list>\n-#include <mutex>\n-#include <unordered_map>\n-#include <utility>\n-\n-namespace libcamera {\n-\n-class ControlList;\n-class V4L2VideoDevice;\n-\n-namespace RPi {\n-\n-class StaggeredCtrl\n-{\n-public:\n-\tStaggeredCtrl()\n-\t\t: init_(false), setCount_(0), getCount_(0), maxDelay_(0)\n-\t{\n-\t}\n-\n-\toperator bool() const\n-\t{\n-\t\treturn init_;\n-\t}\n-\n-\tvoid init(V4L2VideoDevice *dev,\n-\t\t std::initializer_list<std::pair<const uint32_t, uint8_t>> delayList);\n-\tvoid reset();\n-\n-\tvoid get(std::unordered_map<uint32_t, int32_t> &ctrl, uint8_t offset = 0);\n-\n-\tbool set(uint32_t ctrl, int32_t value);\n-\tbool set(std::initializer_list<std::pair<const uint32_t, int32_t>> ctrlList);\n-\tbool set(const ControlList &controls);\n-\n-\tint write();\n-\n-private:\n-\tvoid nextFrame();\n-\n-\t/* listSize must be a power of 2. */\n-\tstatic constexpr int listSize = (1 << 4);\n-\tstruct CtrlInfo {\n-\t\tCtrlInfo()\n-\t\t\t: value(0), updated(false)\n-\t\t{\n-\t\t}\n-\n-\t\tCtrlInfo(int32_t value_)\n-\t\t\t: value(value_), updated(true)\n-\t\t{\n-\t\t}\n-\n-\t\tint32_t value;\n-\t\tbool updated;\n-\t};\n-\n-\tclass CircularArray : public std::array<CtrlInfo, listSize>\n-\t{\n-\tpublic:\n-\t\tCtrlInfo &operator[](int index)\n-\t\t{\n-\t\t\treturn std::array<CtrlInfo, listSize>::operator[](index & (listSize - 1));\n-\t\t}\n-\n-\t\tconst CtrlInfo &operator[](int index) const\n-\t\t{\n-\t\t\treturn std::array<CtrlInfo, listSize>::operator[](index & (listSize - 1));\n-\t\t}\n-\t};\n-\n-\tbool init_;\n-\tuint32_t setCount_;\n-\tuint32_t getCount_;\n-\tuint8_t maxDelay_;\n-\tV4L2VideoDevice *dev_;\n-\tstd::unordered_map<uint32_t, uint8_t> delay_;\n-\tstd::unordered_map<uint32_t, CircularArray> ctrl_;\n-\tstd::mutex lock_;\n-};\n-\n-} /* namespace RPi */\n-\n-} /* namespace libcamera */\n-\n-#endif /* __LIBCAMERA_PIPELINE_RASPBERRYPI_STAGGERED_CTRL_H__ */\n", "prefixes": [ "libcamera-devel", "v3", "4/8" ] }