Show a patch.

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

{
    "id": 738,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/738/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/738/",
    "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": "<20190314155106.30106-4-jacopo@jmondi.org>",
    "date": "2019-03-14T15:51:05",
    "name": "[libcamera-devel,v3,3/4] libcamera: ipu3: Make sure sensor provides a compatible format",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "503b38cdeb27b7f686782487c6a8380414ef62d7",
    "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/738/mbox/",
    "series": [
        {
            "id": 207,
            "url": "https://patchwork.libcamera.org/api/1.1/series/207/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=207",
            "date": "2019-03-14T15:51:02",
            "name": "libcamera: ipu3: Pre-ImgU support",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/207/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/738/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/738/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E70E9610C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Mar 2019 16:50:38 +0100 (CET)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 7F7A5100002;\n\tThu, 14 Mar 2019 15:50:38 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 14 Mar 2019 16:51:05 +0100",
        "Message-Id": "<20190314155106.30106-4-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190314155106.30106-1-jacopo@jmondi.org>",
        "References": "<20190314155106.30106-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 3/4] libcamera: ipu3: Make sure sensor\n\tprovides a compatible format",
        "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": "Thu, 14 Mar 2019 15:50:39 -0000"
    },
    "content": "When creating a camera, make sure a the image sensor provides images in\na format compatible with IPU3 CIO2 unit requirements.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 58 +++++++++++++++++++++++++++-\n 1 file changed, 56 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 55489c31df2d..90faef1bdece 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@@ -78,6 +80,8 @@ private:\n \t\t\tPipelineHandler::cameraData(camera));\n \t}\n \n+\tint mediaBusToCIO2Format(unsigned int code);\n+\n \tvoid registerCameras();\n \n \tstd::shared_ptr<MediaDevice> cio2_;\n@@ -327,6 +331,38 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n \treturn true;\n }\n \n+int PipelineHandlerIPU3::mediaBusToCIO2Format(unsigned int code)\n+{\n+\tswitch(code) {\n+\tcase MEDIA_BUS_FMT_SBGGR8_1X8:\n+\tcase MEDIA_BUS_FMT_SBGGR10_1X10:\n+\tcase MEDIA_BUS_FMT_SBGGR12_1X12:\n+\tcase MEDIA_BUS_FMT_SBGGR14_1X14:\n+\tcase MEDIA_BUS_FMT_SBGGR16_1X16:\n+\t\treturn V4L2_PIX_FMT_IPU3_SBGGR10;\n+\tcase MEDIA_BUS_FMT_SGBRG8_1X8:\n+\tcase MEDIA_BUS_FMT_SGBRG10_1X10:\n+\tcase MEDIA_BUS_FMT_SGBRG12_1X12:\n+\tcase MEDIA_BUS_FMT_SGBRG14_1X14:\n+\tcase MEDIA_BUS_FMT_SGBRG16_1X16:\n+\t\treturn V4L2_PIX_FMT_IPU3_SGBRG10;\n+\tcase MEDIA_BUS_FMT_SGRBG8_1X8:\n+\tcase MEDIA_BUS_FMT_SGRBG10_1X10:\n+\tcase MEDIA_BUS_FMT_SGRBG12_1X12:\n+\tcase MEDIA_BUS_FMT_SGRBG14_1X14:\n+\tcase MEDIA_BUS_FMT_SGRBG16_1X16:\n+\t\treturn V4L2_PIX_FMT_IPU3_SGRBG10;\n+\tcase MEDIA_BUS_FMT_SRGGB8_1X8:\n+\tcase MEDIA_BUS_FMT_SRGGB10_1X10:\n+\tcase MEDIA_BUS_FMT_SRGGB12_1X12:\n+\tcase MEDIA_BUS_FMT_SRGGB14_1X14:\n+\tcase MEDIA_BUS_FMT_SRGGB16_1X16:\n+\t\treturn V4L2_PIX_FMT_IPU3_SRGGB10;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+}\n+\n /*\n  * Cameras are created associating an image sensor (represented by a\n  * media entity with function MEDIA_ENT_F_CAM_SENSOR) to one of the four\n@@ -404,18 +440,36 @@ void PipelineHandlerIPU3::registerCameras()\n \t\tif (ret)\n \t\t\tcontinue;\n \n-\t\tdata->cio2_->bufferReady.connect(data.get(), &IPU3CameraData::bufferReady);\n-\n+\t\t/*\n+\t\t * Make sure the sensor produces at least one image format\n+\t\t * compatible with IPU3 CIO2 requirements.\n+\t\t */\n \t\tdata->sensor_ = new V4L2Subdevice(sensor);\n \t\tret = data->sensor_->open();\n \t\tif (ret)\n \t\t\tcontinue;\n \n+\t\tconst FormatEnum formats = data->sensor_->formats(0);\n+\t\tauto it = formats.begin();\n+\t\tfor (; it != formats.end(); ++it) {\n+\t\t\tif (mediaBusToCIO2Format(it->first) != -EINVAL)\n+\t\t\t\tbreak;\n+\t\t}\n+\t\tif (it == formats.end()) {\n+\t\tLOG(IPU3, Info) << \"Sensor '\" << data->sensor_->deviceName()\n+\t\t\t\t<< \"' detected, but no supported image format \"\n+\t\t\t\t<< \" found: skip camera creation\";\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tdata->csi2_ = new V4L2Subdevice(csi2);\n \t\tret = data->csi2_->open();\n \t\tif (ret)\n \t\t\tcontinue;\n \n+\t\tdata->cio2_->bufferReady.connect(data.get(),\n+\t\t\t\t\t\t&IPU3CameraData::bufferReady);\n+\n \t\tregisterCamera(std::move(camera), std::move(data));\n \n \t\tLOG(IPU3, Info)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "3/4"
    ]
}