Show a patch.

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

{
    "id": 860,
    "url": "https://patchwork.libcamera.org/api/patches/860/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/860/",
    "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": "<20190402171309.6447-5-jacopo@jmondi.org>",
    "date": "2019-04-02T17:13:00",
    "name": "[libcamera-devel,v7,04/13] libcamera: ipu3: Cache the sensor sizes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c311c75c7e2f559aa1faf22f7477faee471a86c3",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/860/mbox/",
    "series": [
        {
            "id": 231,
            "url": "https://patchwork.libcamera.org/api/series/231/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=231",
            "date": "2019-04-02T17:12:56",
            "name": "libcamera: ipu3: Add ImgU support",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/231/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/860/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/860/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CE188610C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 19:12:32 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 6114AFF80A;\n\tTue,  2 Apr 2019 17:12:32 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  2 Apr 2019 19:13:00 +0200",
        "Message-Id": "<20190402171309.6447-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190402171309.6447-1-jacopo@jmondi.org>",
        "References": "<20190402171309.6447-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 04/13] libcamera: ipu3: Cache the\n\tsensor sizes",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Tue, 02 Apr 2019 17:12:33 -0000"
    },
    "content": "Cache the sensor maximum size and the media bus code used to produce\nit.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 47 ++++++++++++++++++++++++++++\n 1 file changed, 47 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex a870b325f4b3..1e315048738b 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -8,6 +8,8 @@\n #include <memory>\n #include <vector>\n \n+#include <linux/media-bus-format.h>\n+\n #include <libcamera/camera.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n@@ -24,6 +26,22 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPU3)\n \n+static int mediaBusToCIO2Format(unsigned int code)\n+{\n+\tswitch (code) {\n+\tcase MEDIA_BUS_FMT_SBGGR10_1X10:\n+\t\treturn V4L2_PIX_FMT_IPU3_SBGGR10;\n+\tcase MEDIA_BUS_FMT_SGBRG10_1X10:\n+\t\treturn V4L2_PIX_FMT_IPU3_SGBRG10;\n+\tcase MEDIA_BUS_FMT_SGRBG10_1X10:\n+\t\treturn V4L2_PIX_FMT_IPU3_SGRBG10;\n+\tcase MEDIA_BUS_FMT_SRGGB10_1X10:\n+\t\treturn V4L2_PIX_FMT_IPU3_SRGGB10;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+}\n+\n class CIO2Device\n {\n public:\n@@ -44,6 +62,10 @@ public:\n \tV4L2Device *output_;\n \tV4L2Subdevice *csi2_;\n \tV4L2Subdevice *sensor_;\n+\n+\t/* Maximum sizes and the mbus code used to produce them. */\n+\tunsigned int mbusCode_;\n+\tSize maxSize_;\n };\n \n class PipelineHandlerIPU3 : public PipelineHandler\n@@ -442,6 +464,10 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \t\treturn ret;\n \n \t/*\n+\t * Now that we're sure a sensor subdevice is connected, make sure it\n+\t * produces at least one image format compatible with CIO2 requirements\n+\t * and cache the camera maximum size.\n+\t *\n \t * \\todo Define when to open and close video device nodes, as they\n \t * might impact on power consumption.\n \t */\n@@ -450,6 +476,27 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)\n \tif (ret)\n \t\treturn ret;\n \n+\tfor (auto it : sensor_->formats(0)) {\n+\t\tint mbusCode = mediaBusToCIO2Format(it.first);\n+\t\tif (mbusCode < 0)\n+\t\t\tcontinue;\n+\n+\t\tfor (const SizeRange &size : it.second) {\n+\t\t\tif (maxSize_.width < size.maxWidth &&\n+\t\t\t    maxSize_.height < size.maxHeight) {\n+\t\t\t\tmaxSize_.width = size.maxWidth;\n+\t\t\t\tmaxSize_.height = size.maxHeight;\n+\t\t\t\tmbusCode_ = mbusCode;\n+\t\t\t}\n+\t\t}\n+\t}\n+\tif (maxSize_.width == 0) {\n+\t\tLOG(IPU3, Info) << \"Sensor '\" << sensor_->entityName()\n+\t\t\t\t<< \"' detected, but no supported image format \"\n+\t\t\t\t<< \" found: skip camera creation\";\n+\t\treturn -ENODEV;\n+\t}\n+\n \tcsi2_ = new V4L2Subdevice(csi2Entity);\n \tret = csi2_->open();\n \tif (ret)\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "04/13"
    ]
}