Show a patch.

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

{
    "id": 19331,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19331/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19331/",
    "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": "<20231219125749.14362-1-naush@raspberrypi.com>",
    "date": "2023-12-19T12:57:49",
    "name": "[libcamera-devel] ipa: rpi: Add hardware line rate constraints",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "84babb164d4c41707993644c6e80785adcdc0f64",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19331/mbox/",
    "series": [
        {
            "id": 4122,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4122/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4122",
            "date": "2023-12-19T12:57:49",
            "name": "[libcamera-devel] ipa: rpi: Add hardware line rate constraints",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4122/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19331/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19331/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 634CBC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Dec 2023 12:57:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 889BD62B40;\n\tTue, 19 Dec 2023 13:57:48 +0100 (CET)",
            "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 15FA161D92\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Dec 2023 13:57:46 +0100 (CET)",
            "by mail-wr1-x435.google.com with SMTP id\n\tffacd0b85a97d-336746a545fso297992f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Dec 2023 04:57:46 -0800 (PST)",
            "from localhost.localdomain ([188.39.149.98])\n\tby smtp.gmail.com with ESMTPSA id\n\tp16-20020a5d48d0000000b0033616ea5a0fsm26241297wrs.45.2023.12.19.04.57.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 19 Dec 2023 04:57:44 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1702990668;\n\tbh=2muJviFFwC86J2o8vkxSurEXIPvqnkATbtdsU3FV030=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=poNDuNUA1xCSrZjuZ+CrfizQ4x0k1C2l67oGa7k6XJt6Gww9QG7cI/riNyiMKuqUx\n\tUCHBfPsIe2Dg3CbcBz4HMMChrfvdlMuJ5p8M+PIX39ZzwxcL3xgCQyWs8bf0rRWIa4\n\tMNCLr/YRmqPV5z1Gcn8Qzro48Q6utbehFvo4iaCHU9gJCad1hL1pY2oR0Huf16pGxe\n\ty1wvSpqO15HqqhJ8cesaJOQ6P0BYsOGNdIprb/3X/9qLqq/EVy3wTDeWj6/4oZg4i0\n\taZKusxwn+iP3DxJXguZNix6fQ0hKioktva24ox7J3DFWV3tAvxJ7hInOugHqJ1/2ge\n\tENj6Uhkd37EJg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1702990665; x=1703595465;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=gezPCwisSNY45pW6B+HxcM1fy76Yf4nX1BMlf0ge7jc=;\n\tb=GxvzSA8L3MEEJkx9BhBQ7mXa2+5+vKVh73QFTrKoTIai5fBkkodZ1thVTF7u2Q8MGf\n\tpRo6KfITbF2LWKVjK9KAHyuJotllb6kLQRYfELnPPvwOyA0oz2qFZxV31Z5YChwiAqTJ\n\tRgoMBEi+HBAWuo+Oll4nYsfZyyhPKgvsRZYIKPXOrmqVfVV3U3CPWgUrup7JZmQmQzsr\n\tCzGS+B82GgfVf5Cke+olIGAyW4ukpyW6LPp7yf0Z9LjPt5ZCAd9wl10TOK8V2u3YWQ4q\n\tC8Q6ifvgc6OcEMQgS+z/k6KlEPMkI4EmlRi84K2EdZB9StbD8avCiroY1LWKEFtYrDL1\n\tH05Q=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"GxvzSA8L\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1702990665; x=1703595465;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=gezPCwisSNY45pW6B+HxcM1fy76Yf4nX1BMlf0ge7jc=;\n\tb=MfJA/zE4J9nc4P+raK15ot+cLbsaNORt1nhqKkxbtXr2HckjT9FYMFra+thH98lxMW\n\t4eVGD+/vH30pHx6xxhllOvGzAQ/OBvc7nAveEal3t6bMu+vAkIdawjylQ+INf4h6eTGc\n\tT8VWouy8s5pCG2h8gZDGpfhtAqpIw7bZWvKEfuUonWw4EVXrV9Ot8NJcc4m/zpHpGcNw\n\tOYN8CFJTFW5YXgtymzzSP9xXdgswIO0ZrnI/752D7BaP0x9T162FzKMF5MQN2t86fB1K\n\tI4nBnoSN4aimumj2pRRCuxF8esD+dz5aaZcDN6keeir6Wigyj0lAxwOny2hoqMRkX5xh\n\twKkQ==",
        "X-Gm-Message-State": "AOJu0Ywl1Df8pKcdAgd+7b3UHeEeaUNQti8p0vH4oCiRTLXrqXA7k+M4\n\to/+rs/IE6pviOvIt8UYiJEQ6lAbIzzHNBRHubIg=",
        "X-Google-Smtp-Source": "AGHT+IFx9XuYnifU+TvuhNyVumUh1JShocHzEwH6eirRahiiNXyrvVVHaFN2nbzSpyxrZTM5hgH1IA==",
        "X-Received": "by 2002:adf:f58d:0:b0:336:68c1:36fa with SMTP id\n\tf13-20020adff58d000000b0033668c136famr598687wro.5.1702990665248; \n\tTue, 19 Dec 2023 04:57:45 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 19 Dec 2023 12:57:49 +0000",
        "Message-Id": "<20231219125749.14362-1-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] ipa: rpi: Add hardware line rate\n\tconstraints",
        "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>",
        "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Advertise hardware constraints on the pixel processing rate through the\nController::HardwareConfig structure. When calculating the minimum line\nlength during a configure() operation, ensure that we don't exceed this\nconstraint.\n\nIf we do exceed the hardware constraints, increase the modes's minimum\nline length so the pixel processing rate falls below the hardware limit.\nIf this is not possible, throw a loud error message in the logs.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp       | 26 ++++++++++++++++++++++++++\n src/ipa/rpi/controller/controller.cpp |  3 +++\n src/ipa/rpi/controller/controller.h   |  2 ++\n 3 files changed, 31 insertions(+)",
    "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 6ac9d5de2f88..419f19f120da 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -531,6 +531,32 @@ void IpaBase::setMode(const IPACameraSensorInfo &sensorInfo)\n \tmode_.minLineLength = sensorInfo.minLineLength * (1.0s / sensorInfo.pixelRate);\n \tmode_.maxLineLength = sensorInfo.maxLineLength * (1.0s / sensorInfo.pixelRate);\n \n+\t/*\n+\t * Ensure that the maximum pixel processing rate does not exceed the ISP\n+\t * hardware capabilities. If it does, try adjusting the minimum line\n+\t * length to compensate if possible.\n+\t */\n+\tDuration minPixelTime = controller_.getHardwareConfig().minPixelProcessingTime;\n+\tDuration pixelTime = mode_.minLineLength / mode_.width;\n+\tif (minPixelTime && pixelTime < minPixelTime) {\n+\t\tDuration adjustedLineLength = minPixelTime * mode_.width;\n+\t\tif (adjustedLineLength <= mode_.maxLineLength) {\n+\t\t\tLOG(IPARPI, Info)\n+\t\t\t\t<< \"Adjusting mode minimum line length from \" << mode_.minLineLength\n+\t\t\t\t<< \" to \" << adjustedLineLength << \" because of HW constraints.\";\n+\t\t\tmode_.minLineLength = adjustedLineLength;\n+\t\t} else {\n+\t\t\tLOG(IPARPI, Error)\n+\t\t\t\t<< \"Sensor minimum line length of \" << pixelTime * mode_.width\n+\t\t\t\t<< \" (\" << 1us / pixelTime << \" MPix/s)\"\n+\t\t\t\t<< \" is below the minimum allowable HW limit of \" << minPixelTime * mode_.width\n+\t\t\t\t<< \" (\" << 1us / minPixelTime << \" MPix/s) \";\n+\t\t\tLOG(IPARPI, Error)\n+\t\t\t\t<< \"THIS WILL CAUSE IMAGE CORRUPTION!!! \"\n+\t\t\t\t<< \"Please update the driver to allow more horizontal blanking control.\";\n+\t\t}\n+\t}\n+\n \t/*\n \t * Set the frame length limits for the mode to ensure exposure and\n \t * framerate calculations are clipped appropriately.\ndiff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp\nindex e62becd87e85..f81edf769736 100644\n--- a/src/ipa/rpi/controller/controller.cpp\n+++ b/src/ipa/rpi/controller/controller.cpp\n@@ -17,6 +17,7 @@\n \n using namespace RPiController;\n using namespace libcamera;\n+using namespace std::literals::chrono_literals;\n \n LOG_DEFINE_CATEGORY(RPiController)\n \n@@ -37,6 +38,7 @@ static const std::map<std::string, Controller::HardwareConfig> HardwareConfigMap\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}\n \t},\n \t{\n@@ -51,6 +53,7 @@ static const std::map<std::string, Controller::HardwareConfig> HardwareConfigMap\n \t\t\t.numGammaPoints = 64,\n \t\t\t.pipelineWidth = 16,\n \t\t\t.statsInline = true,\n+\t\t\t.minPixelProcessingTime = 1.0us / 380, /* 380 MPix/s */\n \t\t}\n \t},\n };\ndiff --git a/src/ipa/rpi/controller/controller.h b/src/ipa/rpi/controller/controller.h\nindex 6e5f595284fd..170aea740789 100644\n--- a/src/ipa/rpi/controller/controller.h\n+++ b/src/ipa/rpi/controller/controller.h\n@@ -15,6 +15,7 @@\n #include <vector>\n #include <string>\n \n+#include <libcamera/base/utils.h>\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"camera_mode.h\"\n@@ -47,6 +48,7 @@ public:\n \t\tunsigned int numGammaPoints;\n \t\tunsigned int pipelineWidth;\n \t\tbool statsInline;\n+\t\tlibcamera::utils::Duration minPixelProcessingTime;\n \t};\n \n \tController();\n",
    "prefixes": [
        "libcamera-devel"
    ]
}