Show a patch.

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

{
    "id": 8767,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/8767/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8767/",
    "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": "<20200713132451.2944673-7-kieran.bingham@ideasonboard.com>",
    "date": "2020-07-13T13:24:48",
    "name": "[libcamera-devel,6/9] libcamera: pipeline: vivid: Buffer handling and stream control",
    "commit_ref": null,
    "pull_url": null,
    "state": "awaiting-upstream",
    "archived": false,
    "hash": "bc8df24ff2f053fa1dc309804b697b52661900d7",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8767/mbox/",
    "series": [
        {
            "id": 1102,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1102/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1102",
            "date": "2020-07-13T13:24:42",
            "name": "Introduce a new PipelineHandler",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1102/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8767/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8767/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 CDA45BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jul 2020 13:25:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8EB4260741;\n\tMon, 13 Jul 2020 15:25:02 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BD1360732\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jul 2020 15:24:58 +0200 (CEST)",
            "from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2DF009B1;\n\tMon, 13 Jul 2020 15:24:58 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EHSK2urg\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594646698;\n\tbh=UJfH+6DXeF4Uxt8E+xopnFtk0DR0O1a8L+cOjHbVqPk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=EHSK2urgu2QKvqi9fDlglw4Zjgsw4V0SvhTFRzkxApD+ozU+UHwoXAfeXo8n2KI1X\n\t+kmFJuce91YswkvKdHeuxGvXIaRIWpMMChVGvqbfS/uidbHWD/v0AclA5U1BOW8q+Z\n\t4Pm8DHz/QjOkPFxBjRH3MDSo+fcBfNl5i7a9FJLw=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Mon, 13 Jul 2020 14:24:48 +0100",
        "Message-Id": "<20200713132451.2944673-7-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200713132451.2944673-1-kieran.bingham@ideasonboard.com>",
        "References": "<20200713132451.2944673-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 6/9] libcamera: pipeline: vivid: Buffer\n\thandling and stream control",
        "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": "Chris Ward <chris@gregariousmammal.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "We can now add buffer management, and connect up our bufferReady signal\nto a callback.\n\nNote that we provide the ability to export buffers from our capture\ndevice (data->video_) using the exportBuffers() functionality from the\nV4L2VideoDevice which allows a FrameBufferAllocater to obtain buffers\nfrom this device.\n\nWhen buffers are obtained through the exportFrameBuffers API, they are\norphaned and left unassociated with the device, and must be reimported\nat start() time anyway. This allows the same interface to be used\nwhether internal buffers, or external buffers are used for the stream.\n\nWhen a buffer completes, we call the buffer completion handler on the\npipeline handler, and because we have only a single stream, we can also\nimmediately complete the request.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/vivid/vivid.cpp | 35 ++++++++++++++++++++++++--\n 1 file changed, 33 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp\nindex dbc19424e75a..1a945a744055 100644\n--- a/src/libcamera/pipeline/vivid/vivid.cpp\n+++ b/src/libcamera/pipeline/vivid/vivid.cpp\n@@ -32,6 +32,7 @@ public:\n \t}\n \n \tint init();\n+\tvoid bufferReady(FrameBuffer *buffer);\n \n \tMediaDevice *media_;\n \tV4L2VideoDevice *video_;\n@@ -175,16 +176,36 @@ int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config)\n int PipelineHandlerVivid::exportFrameBuffers(Camera *camera, Stream *stream,\n \t\t\t\t\t     std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n {\n-\treturn -1;\n+\tVividCameraData *data = cameraData(camera);\n+\tunsigned int count = stream->configuration().bufferCount;\n+\n+\treturn data->video_->exportBuffers(count, buffers);\n }\n \n int PipelineHandlerVivid::start(Camera *camera)\n {\n-\treturn -1;\n+\tVividCameraData *data = cameraData(camera);\n+\tunsigned int count = data->stream_.configuration().bufferCount;\n+\n+\tint ret = data->video_->importBuffers(count);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tret = data->video_->streamOn();\n+\tif (ret < 0) {\n+\t\tdata->ipa_->stop();\n+\t\tdata->video_->releaseBuffers();\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n }\n \n void PipelineHandlerVivid::stop(Camera *camera)\n {\n+\tVividCameraData *data = cameraData(camera);\n+\tdata->video_->streamOff();\n+\tdata->video_->releaseBuffers();\n }\n \n int PipelineHandlerVivid::queueRequestDevice(Camera *camera, Request *request)\n@@ -221,9 +242,19 @@ int VividCameraData::init()\n \tif (video_->open())\n \t\treturn -ENODEV;\n \n+\tvideo_->bufferReady.connect(this, &VividCameraData::bufferReady);\n+\n \treturn 0;\n }\n \n+void VividCameraData::bufferReady(FrameBuffer *buffer)\n+{\n+\tRequest *request = buffer->request();\n+\n+\tpipe_->completeBuffer(camera_, request, buffer);\n+\tpipe_->completeRequest(camera_, request);\n+}\n+\n REGISTER_PIPELINE_HANDLER(PipelineHandlerVivid);\n \n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "6/9"
    ]
}