Show a patch.

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

{
    "id": 327,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/327/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/327/",
    "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": "<20190122181225.12922-3-jacopo@jmondi.org>",
    "date": "2019-01-22T18:12:25",
    "name": "[libcamera-devel,RFC,2/2] libcamera: ipu3: Create CIO2 V4L2 devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a9aed9f2465895b13e9d2da716c66435d00b26f7",
    "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/327/mbox/",
    "series": [
        {
            "id": 114,
            "url": "https://patchwork.libcamera.org/api/1.1/series/114/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=114",
            "date": "2019-01-22T18:12:23",
            "name": "Add support for pipeline specific data to Cameras",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/114/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/327/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/327/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 4539B60C65\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jan 2019 19:12:24 +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 CE9F8100008;\n\tTue, 22 Jan 2019 18:12:23 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 22 Jan 2019 19:12:25 +0100",
        "Message-Id": "<20190122181225.12922-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190122181225.12922-1-jacopo@jmondi.org>",
        "References": "<20190122181225.12922-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC 2/2] libcamera: ipu3: Create CIO2 V4L2\n\tdevices",
        "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, 22 Jan 2019 18:12:24 -0000"
    },
    "content": "Create V4L2 devices for the CIO2 capture video nodes.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 42 ++++++++++++++++++++++++++++\n 1 file changed, 42 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 8cbc10a..58053ea 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -15,11 +15,25 @@\n #include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n+#include \"v4l2_device.h\"\n \n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPU3)\n \n+class IPU3CameraData : public CameraData\n+{\n+public:\n+\tIPU3CameraData() : dev_(nullptr) { }\n+\t~IPU3CameraData() { delete dev_; }\n+\n+\tvoid setV4L2Device(V4L2Device *dev) { dev_ = dev; }\n+\tV4L2Device *device() const { return dev_; }\n+\n+private:\n+\tV4L2Device *dev_;\n+};\n+\n class PipelineHandlerIPU3 : public PipelineHandler\n {\n public:\n@@ -32,6 +46,7 @@ private:\n \tMediaDevice *cio2_;\n \tMediaDevice *imgu_;\n \n+\tV4L2Device *createVideoDevice(unsigned int id);\n \tvoid registerCameras(CameraManager *manager);\n };\n \n@@ -122,6 +137,24 @@ error_release_mdev:\n \treturn false;\n }\n \n+/* Create video devices for the CIO2 unit associated with a camera. */\n+V4L2Device *PipelineHandlerIPU3::createVideoDevice(unsigned int id)\n+{\n+\tstd::string cio2Name = \"ipu3-cio2 \" + std::to_string(id);\n+\tMediaEntity *cio2 = cio2_->getEntityByName(cio2Name);\n+\tif (!cio2)\n+\t\treturn nullptr;\n+\n+\tV4L2Device *dev = new V4L2Device(*cio2);\n+\tif (dev->open()) {\n+\t\tdelete dev;\n+\t\treturn nullptr;\n+\t}\n+\tdev->close();\n+\n+\treturn dev;\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@@ -172,6 +205,15 @@ void PipelineHandlerIPU3::registerCameras(CameraManager *manager)\n \n \t\tstd::string cameraName = sensor->name() + \" \" + std::to_string(id);\n \t\tstd::shared_ptr<Camera> camera = Camera::create(cameraName);\n+\n+\t\t/* Store pipeline private data in the Camera object. */\n+\t\tV4L2Device *videoDev = createVideoDevice(id);\n+\t\tif (videoDev) {\n+\t\t\tIPU3CameraData *ipu3Data = new IPU3CameraData();\n+\t\t\tipu3Data->setV4L2Device(videoDev);\n+\t\t\tcamera->setCameraData(ipu3Data);\n+\t\t}\n+\n \t\tmanager->addCamera(std::move(camera));\n \n \t\tLOG(IPU3, Info)\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "2/2"
    ]
}