Show a patch.

GET /api/patches/23850/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 23850,
    "url": "https://patchwork.libcamera.org/api/patches/23850/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23850/",
    "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": "<20250718104404.1284865-1-naush@raspberrypi.com>",
    "date": "2025-07-18T10:43:46",
    "name": "ipa: rpi: Fix static initialisation order bug in the Controller",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "2d85ebd720ad29032f0c339077ae5ce747a36d44",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23850/mbox/",
    "series": [
        {
            "id": 5298,
            "url": "https://patchwork.libcamera.org/api/series/5298/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5298",
            "date": "2025-07-18T10:43:46",
            "name": "ipa: rpi: Fix static initialisation order bug in the Controller",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5298/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23850/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23850/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 4BC73C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jul 2025 10:44:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8421568F99;\n\tFri, 18 Jul 2025 12:44:09 +0200 (CEST)",
            "from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D43D26150F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jul 2025 12:44:07 +0200 (CEST)",
            "by mail-wr1-x435.google.com with SMTP id\n\tffacd0b85a97d-3a577ab8c34so233146f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jul 2025 03:44:07 -0700 (PDT)",
            "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3b61ca254f4sm1490907f8f.2.2025.07.18.03.44.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 18 Jul 2025 03:44:06 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"oTwJn1rW\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1752835447; x=1753440247;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=5uUZjSAS3sSznM4zC21zCFrGDZXcqkoHXc5Yx1SKlO4=;\n\tb=oTwJn1rWT55ITF1fuf2EcjNox2Tk6I7Kh08YfeAmCmsy5Q9GYUtybBy+nfejbL0/Bo\n\tEPHSxHN+s2KG1Igpi6noyzvQec775ufvecXcO838bMje/jqZ/oCBpUs95PxlZI0FkO+U\n\tTt138PgwQDeCIpNW3R6sEPZPjzGJ8HxsGkBkaCuYEG0gFVg196oGiD+9H1lPit7BLy9R\n\t0DlnOkrH4BUzS8tS91EoTmoeb5leD/jENGdCKaKtHPtI/mHMbn1+xcb2YR+KX+7QCuEp\n\tae7FXMeFvyghooGirRtB16aMjaIc0N1G2htoaffUo/vra7stTGLnXMkD+FhNsSCyAc/8\n\tmfKw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1752835447; x=1753440247;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=5uUZjSAS3sSznM4zC21zCFrGDZXcqkoHXc5Yx1SKlO4=;\n\tb=v5mOqQ7CnAH+cd6btkgxKKT6/4woKbkelIQFURx/ybLorAyPRCF0+T2FfRoIseKrvz\n\tL4lTe863GGmNnitR9+PIADYwPvIspbhkJMzNxtkrCIgxQl9SIGIRZCfyYTNRhlqJk6pA\n\t8e05dhRru3MgtvqaQB0TRO18DaIdzyHUkOkPYDFYlfuXvpI30TO0LAce3NupQH6vCMi/\n\tj0nnobLNBIHXQemYLfNlaWwr8HrfDSYwJpYmMHYdxqrlPPMOfxEAtXGDHEyyn22watny\n\tkFfhuVdbPRFc7dPZIcn3z0fp1wNiJ/CnUbQU9JHPneO3m7u4iQMR+4vRoiWxyMRUNWgD\n\t8vJw==",
        "X-Gm-Message-State": "AOJu0YyOp7y7QsO6KXFRBPkhEqx4RhfHQSy+jhrRGYcd83NdzyrTSJyd\n\t+g4K2jgXboHC8p/3LgOQG+Hy0s9sr19IUpeOL3yvllNjWrlDJjMfvq378PUV3oWvevZ9xWUwPhb\n\tahXXm0r0=",
        "X-Gm-Gg": "ASbGncuGV93PjFQsh6aRADrPKbLVhWw+zhTzkj2NIzGeFg0W3t39oov7FqNNshvXjXF\n\tBpUaI+0v/aSg4tnvCE7XY63+90pQkZyRSPkwJ1qt71a6dkWDbR6aY865/IYnT9bMwwgBH7Y5/NV\n\thsVkVxcXOiqCUvX18QSoNi49c87Fa1HQUnAeB0b5zH+o8XAlJBX8kzo2KeixvFa9PYPwcRTvihq\n\twMiteQeth+Bnwpq6dTM6aCOxUBEH2Da32Nvp2c+c4uUjMkyFrjGrZOQG4gowAhtg7Lyc3wI1rd9\n\tqJkvkQrg7vFEpU23dn8FmxxdI90CECYaJyebKevfPdhba2VJLQGUqOWB8t2JpMDR2KQEWV2FcWW\n\t4LJneZ3qcd+Ghe1Xnj7ppb8lwVTBap0jerb1KXVLabU3GrkKJUFqA",
        "X-Google-Smtp-Source": "AGHT+IG3+IYzgigiBoncwHqSm5KatSXj8GWSAmEKsnXkS6vXlstcT5aZZFxLJhNvhFeAp+4+0OGVgw==",
        "X-Received": "by 2002:a05:6000:40c7:b0:3b6:18c4:e5af with SMTP id\n\tffacd0b85a97d-3b618c4e70bmr1294939f8f.10.1752835446912; \n\tFri, 18 Jul 2025 03:44:06 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Naushir Patuck <naush@raspberrypi.com>",
        "Subject": "[PATCH] ipa: rpi: Fix static initialisation order bug in the\n\tController",
        "Date": "Fri, 18 Jul 2025 11:43:46 +0100",
        "Message-ID": "<20250718104404.1284865-1-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20250718082402.1207460-1-naush@raspberrypi.com>",
        "References": "<20250718082402.1207460-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "There is a possible static initialisation issue with accessing the\nHardwareConfigMap static object through Controller::getHardwareConfig().\nFix this by providing a static function hardwareConfigMap() to access\nthe object.\n\nThough not proven, this is possibly the cause of a very infrequent\nlockup in https://github.com/raspberrypi/rpicam-apps/issues/799.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/controller.cpp | 119 ++++++++++++++------------\n 1 file changed, 64 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp\nindex 651fff632400..df45dcd345b7 100644\n--- a/src/ipa/rpi/controller/controller.cpp\n+++ b/src/ipa/rpi/controller/controller.cpp\n@@ -21,61 +21,70 @@ using namespace std::literals::chrono_literals;\n \n LOG_DEFINE_CATEGORY(RPiController)\n \n-static const std::map<std::string, Controller::HardwareConfig> HardwareConfigMap = {\n-\t{\n-\t\t\"bcm2835\",\n+namespace {\n+\n+const std::map<std::string, Controller::HardwareConfig> &hardwareConfigMap()\n+{\n+\tstatic const std::map<std::string, Controller::HardwareConfig> map = {\n \t\t{\n-\t\t\t/*\n-\t\t\t * There are only ever 15 AGC regions computed by the firmware\n-\t\t\t * due to zoning, but the HW defines AGC_REGIONS == 16!\n-\t\t\t */\n-\t\t\t.agcRegions = { 15 , 1 },\n-\t\t\t.agcZoneWeights = { 15 , 1 },\n-\t\t\t.awbRegions = { 16, 12 },\n-\t\t\t.cacRegions = { 0, 0 },\n-\t\t\t.focusRegions = { 4, 3 },\n-\t\t\t.numHistogramBins = 128,\n-\t\t\t.numGammaPoints = 33,\n-\t\t\t.pipelineWidth = 13,\n-\t\t\t.statsInline = false,\n-\t\t\t.minPixelProcessingTime = 0s,\n-\t\t\t.dataBufferStrided = true,\n-\t\t}\n-\t},\n-\t{\n-\t\t\"pisp\",\n+\t\t\t\"bcm2835\",\n+\t\t\t{\n+\t\t\t\t/*\n+\t\t\t\t* There are only ever 15 AGC regions computed by the firmware\n+\t\t\t\t* due to zoning, but the HW defines AGC_REGIONS == 16!\n+\t\t\t\t*/\n+\t\t\t\t.agcRegions = { 15 , 1 },\n+\t\t\t\t.agcZoneWeights = { 15 , 1 },\n+\t\t\t\t.awbRegions = { 16, 12 },\n+\t\t\t\t.cacRegions = { 0, 0 },\n+\t\t\t\t.focusRegions = { 4, 3 },\n+\t\t\t\t.numHistogramBins = 128,\n+\t\t\t\t.numGammaPoints = 33,\n+\t\t\t\t.pipelineWidth = 13,\n+\t\t\t\t.statsInline = false,\n+\t\t\t\t.minPixelProcessingTime = 0s,\n+\t\t\t\t.dataBufferStrided = true,\n+\t\t\t}\n+\t\t},\n \t\t{\n-\t\t\t.agcRegions = { 0, 0 },\n-\t\t\t.agcZoneWeights = { 15, 15 },\n-\t\t\t.awbRegions = { 32, 32 },\n-\t\t\t.cacRegions = { 8, 8 },\n-\t\t\t.focusRegions = { 8, 8 },\n-\t\t\t.numHistogramBins = 1024,\n-\t\t\t.numGammaPoints = 64,\n-\t\t\t.pipelineWidth = 16,\n-\t\t\t.statsInline = true,\n-\n-\t\t\t/*\n-\t\t\t * The constraint below is on the rate of pixels going\n-\t\t\t * from CSI2 peripheral to ISP-FE (400Mpix/s, plus tiny\n-\t\t\t * overheads per scanline, for which 380Mpix/s is a\n-\t\t\t * conservative bound).\n-\t\t\t *\n-\t\t\t * There is a 64kbit data FIFO before the bottleneck,\n-\t\t\t * which means that in all reasonable cases the\n-\t\t\t * constraint applies at a timescale >= 1 scanline, so\n-\t\t\t * adding horizontal blanking can prevent loss.\n-\t\t\t *\n-\t\t\t * If the backlog were to grow beyond 64kbit during a\n-\t\t\t * single scanline, there could still be loss. This\n-\t\t\t * could happen using 4 lanes at 1.5Gbps at 10bpp with\n-\t\t\t * frames wider than ~16,000 pixels.\n-\t\t\t */\n-\t\t\t.minPixelProcessingTime = 1.0us / 380,\n-\t\t\t.dataBufferStrided = false,\n-\t\t}\n-\t},\n-};\n+\t\t\t\"pisp\",\n+\t\t\t{\n+\t\t\t\t.agcRegions = { 0, 0 },\n+\t\t\t\t.agcZoneWeights = { 15, 15 },\n+\t\t\t\t.awbRegions = { 32, 32 },\n+\t\t\t\t.cacRegions = { 8, 8 },\n+\t\t\t\t.focusRegions = { 8, 8 },\n+\t\t\t\t.numHistogramBins = 1024,\n+\t\t\t\t.numGammaPoints = 64,\n+\t\t\t\t.pipelineWidth = 16,\n+\t\t\t\t.statsInline = true,\n+\n+\t\t\t\t/*\n+\t\t\t\t* The constraint below is on the rate of pixels going\n+\t\t\t\t* from CSI2 peripheral to ISP-FE (400Mpix/s, plus tiny\n+\t\t\t\t* overheads per scanline, for which 380Mpix/s is a\n+\t\t\t\t* conservative bound).\n+\t\t\t\t*\n+\t\t\t\t* There is a 64kbit data FIFO before the bottleneck,\n+\t\t\t\t* which means that in all reasonable cases the\n+\t\t\t\t* constraint applies at a timescale >= 1 scanline, so\n+\t\t\t\t* adding horizontal blanking can prevent loss.\n+\t\t\t\t*\n+\t\t\t\t* If the backlog were to grow beyond 64kbit during a\n+\t\t\t\t* single scanline, there could still be loss. This\n+\t\t\t\t* could happen using 4 lanes at 1.5Gbps at 10bpp with\n+\t\t\t\t* frames wider than ~16,000 pixels.\n+\t\t\t\t*/\n+\t\t\t\t.minPixelProcessingTime = 1.0us / 380,\n+\t\t\t\t.dataBufferStrided = false,\n+\t\t\t}\n+\t\t},\n+\t};\n+\n+\treturn map;\n+}\n+\n+} /* namespace */\n \n Controller::Controller()\n \t: switchModeCalled_(false)\n@@ -211,12 +220,12 @@ const std::string &Controller::getTarget() const\n \n const Controller::HardwareConfig &Controller::getHardwareConfig() const\n {\n-\tauto cfg = HardwareConfigMap.find(getTarget());\n+\tauto cfg = hardwareConfigMap().find(getTarget());\n \n \t/*\n \t * This really should not happen, the IPA ought to validate the target\n \t * on initialisation.\n \t */\n-\tASSERT(cfg != HardwareConfigMap.end());\n+\tASSERT(cfg != hardwareConfigMap().end());\n \treturn cfg->second;\n }\n",
    "prefixes": []
}