{"id":15261,"url":"https://patchwork.libcamera.org/api/1.1/patches/15261/?format=json","web_url":"https://patchwork.libcamera.org/patch/15261/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<E1n5wCX-0004MQ-3t@mail-02.1984.is>","date":"2022-01-07T20:51:05","name":"[libcamera-devel] (no subject)","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bff5ca65beb4ec6dd4cb3d2b02fc479788c9ccd6","submitter":{"id":112,"url":"https://patchwork.libcamera.org/api/1.1/people/112/?format=json","name":"Victor Westerhuis","email":"victor@westerhu.is"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15261/mbox/","series":[{"id":2883,"url":"https://patchwork.libcamera.org/api/1.1/series/2883/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2883","date":"2022-01-07T20:51:05","name":"[libcamera-devel] (no subject)","version":1,"mbox":"https://patchwork.libcamera.org/series/2883/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15261/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15261/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 B7EFFBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  7 Jan 2022 21:14:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A8FA60932;\n\tFri,  7 Jan 2022 22:14:00 +0100 (CET)","from mail-02.1984.is (mail-02.1984.is [185.112.145.70])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D720604F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  7 Jan 2022 21:53:27 +0100 (CET)","from localhost by mail-02.1984.is with esmtpsa\n\t(TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)\n\t(Exim 4.92) (envelope-from <victor@westerhu.is>) id 1n5wCX-0004MQ-3t\n\tfor libcamera-devel@lists.libcamera.org;\n\tFri, 07 Jan 2022 20:51:05 +0000"],"Message-Id":"<E1n5wCX-0004MQ-3t@mail-02.1984.is>","From":"victor@westerhu.is","Date":"Fri, 07 Jan 2022 20:51:05 +0000","X-Mailman-Approved-At":"Fri, 07 Jan 2022 22:13:59 +0100","Subject":"[libcamera-devel] (no subject)","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From 4f419bd0310462616a107c89510a4864a3b8db31 Mon Sep 17 00:00:00 2001\nFrom: Victor Westerhuis <victor@westerhu.is>\nDate: Fri, 7 Jan 2022 17:10:53 +0100\nSubject: [PATCH] Fix build with LTO enabled\n\nlibcamera::RPi::Controls in raspberrypi.h depends on\nlibcamera::controls::controls in control_ids.cpp, instantiated\nfrom control_ids.cpp.in.\n\nThe order of initialization is not defined between these two\nnamespace scope objects. This patch changes RPi::Controls to a\nfunction-level static, initialized on first use and therefore\nsafe to use.\n\nThis leads to warnings about getControls not being used in\nsrc/ipa/raspberrypi/raspberrypi.cpp and\nsrc/libcamera/pipeline/raspberrypi/rpi_stream.cpp\n(through src/libcamera/pipeline/raspberrypi/rpi_stream.h).\nThis patch therefore drops the include without ill effects.\n\nSigned-off-by: Victor Westerhuis <victor@westerhu.is>\n---\nThis patch fixes https://bugs.libcamera.org/show_bug.cgi?id=83\n\nPerhaps this data should not be in a header at all?\n\nPlease CC me when responding, since I'm not subscribed to this mailing\nlist.\n\n include/libcamera/ipa/raspberrypi.h           | 42 ++++++++++---------\n src/ipa/raspberrypi/raspberrypi.cpp           |  1 -\n .../pipeline/raspberrypi/raspberrypi.cpp      |  2 +-\n .../pipeline/raspberrypi/rpi_stream.h         |  1 -\n 4 files changed, 24 insertions(+), 22 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 7f705e49..545df355 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -27,26 +27,30 @@ namespace RPi {\n  * and the pipeline handler may be reverted so that it aborts when an\n  * unsupported control is encountered.\n  */\n-static const ControlInfoMap Controls({\n-\t\t{ &controls::AeEnable, ControlInfo(false, true) },\n-\t\t{ &controls::ExposureTime, ControlInfo(0, 999999) },\n-\t\t{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },\n-\t\t{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },\n-\t\t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n-\t\t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n-\t\t{ &controls::ExposureValue, ControlInfo(0.0f, 16.0f) },\n-\t\t{ &controls::AwbEnable, ControlInfo(false, true) },\n-\t\t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n-\t\t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n-\t\t{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },\n-\t\t{ &controls::Contrast, ControlInfo(0.0f, 32.0f) },\n-\t\t{ &controls::Saturation, ControlInfo(0.0f, 32.0f) },\n-\t\t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n-\t\t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n-\t\t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n-\t\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n-\t\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n+static const ControlInfoMap &getControls()\n+{\n+\tstatic const ControlInfoMap controls({\n+\t\t\t{ &controls::AeEnable, ControlInfo(false, true) },\n+\t\t\t{ &controls::ExposureTime, ControlInfo(0, 999999) },\n+\t\t\t{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },\n+\t\t\t{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },\n+\t\t\t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n+\t\t\t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n+\t\t\t{ &controls::ExposureValue, ControlInfo(0.0f, 16.0f) },\n+\t\t\t{ &controls::AwbEnable, ControlInfo(false, true) },\n+\t\t\t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n+\t\t\t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n+\t\t\t{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },\n+\t\t\t{ &controls::Contrast, ControlInfo(0.0f, 32.0f) },\n+\t\t\t{ &controls::Saturation, ControlInfo(0.0f, 32.0f) },\n+\t\t\t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n+\t\t\t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n+\t\t\t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n+\t\t\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n+\t\t\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n \t}, controls::controls);\n+\treturn controls;\n+}\n \n } /* namespace RPi */\n \ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 0ed41385..b2717dfc 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -24,7 +24,6 @@\n #include <libcamera/framebuffer.h>\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n-#include <libcamera/ipa/raspberrypi.h>\n #include <libcamera/ipa/raspberrypi_ipa_interface.h>\n #include <libcamera/request.h>\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 168bbcef..a48f1130 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1244,7 +1244,7 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \tdata->sensorMetadata_ = sensorConfig.sensorMetadata;\n \n \t/* Register the controls that the Raspberry Pi IPA can handle. */\n-\tdata->controlInfo_ = RPi::Controls;\n+\tdata->controlInfo_ = RPi::getControls();\n \t/* Initialize the camera properties. */\n \tdata->properties_ = data->sensor_->properties();\n \ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\nindex d6f49d34..b0fc1119 100644\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n@@ -12,7 +12,6 @@\n #include <unordered_map>\n #include <vector>\n \n-#include <libcamera/ipa/raspberrypi.h>\n #include <libcamera/ipa/raspberrypi_ipa_interface.h>\n #include <libcamera/stream.h>\n \n","prefixes":["libcamera-devel"]}