Show a patch.

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

{
    "id": 10549,
    "url": "https://patchwork.libcamera.org/api/patches/10549/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10549/",
    "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": "<20201202135354.264212-3-jacopo@jmondi.org>",
    "date": "2020-12-02T13:53:52",
    "name": "[libcamera-devel,v2,2/4] libcamera: camera_sensor: Break out properties initialization",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "63a988e88a2d9b9cbcb334deac43e7e15da61beb",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": {
        "id": 15,
        "url": "https://patchwork.libcamera.org/api/users/15/?format=api",
        "username": "jmondi",
        "first_name": "Jacopo",
        "last_name": "Mondi",
        "email": "jacopo@jmondi.org"
    },
    "mbox": "https://patchwork.libcamera.org/patch/10549/mbox/",
    "series": [
        {
            "id": 1501,
            "url": "https://patchwork.libcamera.org/api/series/1501/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1501",
            "date": "2020-12-02T13:53:50",
            "name": "libcamera: Collect pixel array properties",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1501/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10549/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10549/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 A8DE3BE178\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Dec 2020 13:54:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 07ED6635AF;\n\tWed,  2 Dec 2020 14:53:59 +0100 (CET)",
            "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D0F29634A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Dec 2020 14:53:57 +0100 (CET)",
            "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 9C2F920003\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Dec 2020 13:53:57 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  2 Dec 2020 14:53:52 +0100",
        "Message-Id": "<20201202135354.264212-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.29.1",
        "In-Reply-To": "<20201202135354.264212-1-jacopo@jmondi.org>",
        "References": "<20201202135354.264212-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 2/4] libcamera: camera_sensor: Break\n\tout properties initialization",
        "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": "Break out initialization to its own function in preparation to\nadd more properties.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@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            | 79 ++++++++++++----------\n 2 files changed, 45 insertions(+), 35 deletions(-)\n\n--\n2.29.1",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex b9eba89f00fb..f80d836161a5 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -69,6 +69,7 @@ protected:\n\n private:\n \tint generateId();\n+\tint initProperties();\n\n \tconst MediaEntity *entity_;\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex c5fa89143ac8..7e6995c43010 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -172,6 +172,49 @@ int CameraSensor::init()\n \t\treturn -EINVAL;\n \t}\n\n+\t/* Create and open the subdev. */\n+\tsubdev_ = std::make_unique<V4L2Subdevice>(entity_);\n+\tint ret = subdev_->open();\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tret = initProperties();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Enumerate, sort and cache media bus codes and sizes. */\n+\tformats_ = subdev_->formats(pad_);\n+\tif (formats_.empty()) {\n+\t\tLOG(CameraSensor, Error) << \"No image format found\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmbusCodes_ = utils::map_keys(formats_);\n+\tstd::sort(mbusCodes_.begin(), mbusCodes_.end());\n+\n+\tfor (const auto &format : formats_) {\n+\t\tconst std::vector<SizeRange> &ranges = format.second;\n+\t\tstd::transform(ranges.begin(), ranges.end(), std::back_inserter(sizes_),\n+\t\t\t       [](const SizeRange &range) { return range.max; });\n+\t}\n+\n+\tstd::sort(sizes_.begin(), sizes_.end());\n+\n+\t/* Remove duplicates. */\n+\tauto last = std::unique(sizes_.begin(), sizes_.end());\n+\tsizes_.erase(last, sizes_.end());\n+\n+\t/*\n+\t * The sizes_ vector is sorted in ascending order, the resolution is\n+\t * thus the last element of the vector.\n+\t */\n+\tresolution_ = sizes_.back();\n+\n+\treturn 0;\n+}\n+\n+int CameraSensor::initProperties()\n+{\n \t/*\n \t * Extract the camera sensor model name from the media entity name.\n \t *\n@@ -202,14 +245,8 @@ int CameraSensor::init()\n\n \tproperties_.set(properties::Model, utils::toAscii(model_));\n\n-\t/* Create and open the subdev. */\n-\tsubdev_ = std::make_unique<V4L2Subdevice>(entity_);\n-\tint ret = subdev_->open();\n-\tif (ret < 0)\n-\t\treturn ret;\n-\n \t/* Generate a unique ID for the sensor. */\n-\tret = generateId();\n+\tint ret = generateId();\n \tif (ret)\n \t\treturn ret;\n\n@@ -251,34 +288,6 @@ int CameraSensor::init()\n \t\tpropertyValue = 0;\n \tproperties_.set(properties::Rotation, propertyValue);\n\n-\t/* Enumerate, sort and cache media bus codes and sizes. */\n-\tformats_ = subdev_->formats(pad_);\n-\tif (formats_.empty()) {\n-\t\tLOG(CameraSensor, Error) << \"No image format found\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tmbusCodes_ = utils::map_keys(formats_);\n-\tstd::sort(mbusCodes_.begin(), mbusCodes_.end());\n-\n-\tfor (const auto &format : formats_) {\n-\t\tconst std::vector<SizeRange> &ranges = format.second;\n-\t\tstd::transform(ranges.begin(), ranges.end(), std::back_inserter(sizes_),\n-\t\t\t       [](const SizeRange &range) { return range.max; });\n-\t}\n-\n-\tstd::sort(sizes_.begin(), sizes_.end());\n-\n-\t/* Remove duplicates. */\n-\tauto last = std::unique(sizes_.begin(), sizes_.end());\n-\tsizes_.erase(last, sizes_.end());\n-\n-\t/*\n-\t * The sizes_ vector is sorted in ascending order, the resolution is\n-\t * thus the last element of the vector.\n-\t */\n-\tresolution_ = sizes_.back();\n-\n \treturn 0;\n }\n\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/4"
    ]
}