Show a patch.

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

{
    "id": 11889,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11889/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11889/",
    "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": "<20210412075702.9955-3-jacopo@jmondi.org>",
    "date": "2021-04-12T07:57:01",
    "name": "[libcamera-devel,v4,2/3] libcamera: camera_sensor: Register static properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6288120c11f6aad0a78f1443552c1c650e65a29f",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11889/mbox/",
    "series": [
        {
            "id": 1911,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1911/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1911",
            "date": "2021-04-12T07:56:59",
            "name": "libcamera: Introduce sensor database",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1911/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11889/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11889/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 33285BD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Apr 2021 07:56:31 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EBECF687FE;\n\tMon, 12 Apr 2021 09:56:30 +0200 (CEST)",
            "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 23347687F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Apr 2021 09:56:29 +0200 (CEST)",
            "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 704721C0007;\n\tMon, 12 Apr 2021 07:56:28 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 12 Apr 2021 09:57:01 +0200",
        "Message-Id": "<20210412075702.9955-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210412075702.9955-1-jacopo@jmondi.org>",
        "References": "<20210412075702.9955-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 2/3] libcamera: camera_sensor: Register\n\tstatic properties",
        "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>",
        "Cc": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund+renesas@ragnatech.se>",
        "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": "Register static properties, retrieved inspecting the sensor\ndatabase, in the CameraSensor class.\n\nStatic properties are overridden by properties retrieved from\nthe kernel interface at run-time if any overlap between the two\nsets occurs.\n\nReviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h |  1 +\n src/libcamera/camera_sensor.cpp            | 24 +++++++++++++++++++++-\n 2 files changed, 24 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 3e98f71b5e7f..3fa3a419f94a 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -77,6 +77,7 @@ private:\n \tint generateId();\n \tint validateSensorDriver();\n \tvoid initVimcDefaultProperties();\n+\tvoid initStaticProperties();\n \tint initProperties();\n \n \tconst MediaEntity *entity_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex f7ed91d990f7..c012385ff056 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -20,6 +20,7 @@\n \n #include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/formats.h\"\n+#include \"libcamera/internal/sensor_database.h\"\n #include \"libcamera/internal/sysfs.h\"\n #include \"libcamera/internal/utils.h\"\n \n@@ -266,6 +267,9 @@ int CameraSensor::init()\n \tif (ret)\n \t\treturn ret;\n \n+\t/* Initialize the static properties from the sensor database. */\n+\tinitStaticProperties();\n+\n \tret = initProperties();\n \tif (ret)\n \t\treturn ret;\n@@ -407,6 +411,21 @@ void CameraSensor::initVimcDefaultProperties()\n \tactiveArea_ = Rectangle(pixelArraySize_);\n }\n \n+void CameraSensor::initStaticProperties()\n+{\n+\tconst SensorInfo *info = SensorDatabase::get(model_);\n+\tif (!info) {\n+\t\tLOG(CameraSensor, Warning)\n+\t\t\t<< \"No static properties available for '\" << model_ << \"'\";\n+\t\tLOG(CameraSensor, Warning)\n+\t\t\t<< \"Please consider updating the sensor database\";\n+\t\treturn;\n+\t}\n+\n+\t/* Register the properties retrieved from the sensor database. */\n+\tproperties_.set(properties::UnitCellSize, info->unitCellSize);\n+}\n+\n int CameraSensor::initProperties()\n {\n \t/*\n@@ -444,7 +463,10 @@ int CameraSensor::initProperties()\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Retrieve and store the camera sensor properties. */\n+\t/* Initialize the static properties from the sensor database. */\n+\tinitStaticProperties();\n+\n+\t/* Retrieve and register properties from the kernel interface. */\n \tconst ControlInfoMap &controls = subdev_->controls();\n \tint32_t propertyValue;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "2/3"
    ]
}