Show a patch.

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

{
    "id": 11095,
    "url": "https://patchwork.libcamera.org/api/patches/11095/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11095/",
    "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": "<20210131224702.8838-17-laurent.pinchart@ideasonboard.com>",
    "date": "2021-01-31T22:46:58",
    "name": "[libcamera-devel,16/20] libcamera: pipeline: simple: Move converter data to camera data",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e32a11934cbeff6128de72300599fd0f2c9fb78a",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/11095/mbox/",
    "series": [
        {
            "id": 1633,
            "url": "https://patchwork.libcamera.org/api/series/1633/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1633",
            "date": "2021-01-31T22:46:42",
            "name": "[libcamera-devel,01/20] libcamera: pipeline: simple: Manage converter with std::unique_ptr<>",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1633/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11095/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11095/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 A0C63BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 31 Jan 2021 22:47:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 64E5D683F0;\n\tSun, 31 Jan 2021 23:47:44 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 68D8E683E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 31 Jan 2021 23:47:34 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E6832E04;\n\tSun, 31 Jan 2021 23:47:33 +0100 (CET)"
        ],
        "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=\"DnljjMWc\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1612133254;\n\tbh=68rngc+q0/iNYmw88fLcyYaXd5/7OCNEnogt2/chMEo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DnljjMWcOg8kGWeJfD6fkiE9TD4060iLCTWptBuiDGaCadrJ4iHh+QQBnnMzkpK/v\n\tw8FqNwwEFc9zL8HHQXRdJNG1TSHWpmzgHsI9DKaAzMj8HRNOSvNHrSf8dsVEtgliEy\n\t2wOEbckMPd3Hz/l4YDw1hvTxHGwncEl8R97e+8Ao=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  1 Feb 2021 00:46:58 +0200",
        "Message-Id": "<20210131224702.8838-17-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.28.0",
        "In-Reply-To": "<20210131224702.8838-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210131224702.8838-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 16/20] libcamera: pipeline: simple: Move\n\tconverter data to camera data",
        "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": "Phi-Bang Nguyen <pnguyen@baylibre.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": "Converter usage is a per-camera property, move its data to the\nSimpleCameraData class.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 46 ++++++++++++------------\n 1 file changed, 23 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 6a8253101a61..9dffe64ee870 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -170,6 +170,10 @@ public:\n \n \tstd::vector<Configuration> configs_;\n \tstd::map<PixelFormat, const Configuration *> formats_;\n+\n+\tstd::vector<std::unique_ptr<FrameBuffer>> converterBuffers_;\n+\tbool useConverter_;\n+\tstd::queue<FrameBuffer *> converterQueue_;\n };\n \n class SimpleCameraConfiguration : public CameraConfiguration\n@@ -239,9 +243,6 @@ private:\n \tstd::map<const MediaEntity *, V4L2Subdevice> subdevs_;\n \n \tstd::unique_ptr<SimpleConverter> converter_;\n-\tbool useConverter_;\n-\tstd::vector<std::unique_ptr<FrameBuffer>> converterBuffers_;\n-\tstd::queue<FrameBuffer *> converterQueue_;\n \n \tCamera *activeCamera_;\n };\n@@ -692,9 +693,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \t}\n \n \t/* Configure the converter if required. */\n-\tuseConverter_ = config->needConversion();\n-\n-\tif (useConverter_) {\n+\tdata->useConverter_ = config->needConversion();\n+\tif (data->useConverter_) {\n \t\tStreamConfiguration inputCfg;\n \t\tinputCfg.pixelFormat = pipeConfig->captureFormat;\n \t\tinputCfg.size = pipeConfig->captureSize;\n@@ -726,7 +726,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,\n \t * Export buffers on the converter or capture video node, depending on\n \t * whether the converter is used or not.\n \t */\n-\tif (useConverter_)\n+\tif (data->useConverter_)\n \t\treturn converter_->exportBuffers(0, count, buffers);\n \telse\n \t\treturn data->video_->exportBuffers(count, buffers);\n@@ -739,8 +739,8 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *c\n \tunsigned int count = data->streams_[0].configuration().bufferCount;\n \tint ret;\n \n-\tif (useConverter_)\n-\t\tret = video->allocateBuffers(count, &converterBuffers_);\n+\tif (data->useConverter_)\n+\t\tret = video->allocateBuffers(count, &data->converterBuffers_);\n \telse\n \t\tret = video->importBuffers(count);\n \tif (ret < 0)\n@@ -752,7 +752,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *c\n \t\treturn ret;\n \t}\n \n-\tif (useConverter_) {\n+\tif (data->useConverter_) {\n \t\tret = converter_->start();\n \t\tif (ret < 0) {\n \t\t\tstop(camera);\n@@ -760,7 +760,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *c\n \t\t}\n \n \t\t/* Queue all internal buffers for capture. */\n-\t\tfor (std::unique_ptr<FrameBuffer> &buffer : converterBuffers_)\n+\t\tfor (std::unique_ptr<FrameBuffer> &buffer : data->converterBuffers_)\n \t\t\tvideo->queueBuffer(buffer.get());\n \t}\n \n@@ -774,13 +774,13 @@ void SimplePipelineHandler::stop(Camera *camera)\n \tSimpleCameraData *data = cameraData(camera);\n \tV4L2VideoDevice *video = data->video_;\n \n-\tif (useConverter_)\n+\tif (data->useConverter_)\n \t\tconverter_->stop();\n \n \tvideo->streamOff();\n \tvideo->releaseBuffers();\n \n-\tconverterBuffers_.clear();\n+\tdata->converterBuffers_.clear();\n \tactiveCamera_ = nullptr;\n }\n \n@@ -800,8 +800,8 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n \t * If conversion is needed, push the buffer to the converter queue, it\n \t * will be handed to the converter in the capture completion handler.\n \t */\n-\tif (useConverter_) {\n-\t\tconverterQueue_.push(buffer);\n+\tif (data->useConverter_) {\n+\t\tdata->converterQueue_.push(buffer);\n \t\treturn 0;\n \t}\n \n@@ -977,7 +977,7 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n \t * point converting an erroneous buffer.\n \t */\n \tif (buffer->metadata().status != FrameMetadata::FrameSuccess) {\n-\t\tif (useConverter_) {\n+\t\tif (data->useConverter_) {\n \t\t\t/* Requeue the buffer for capture. */\n \t\t\tdata->video_->queueBuffer(buffer);\n \n@@ -985,11 +985,11 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n \t\t\t * Get the next user-facing buffer to complete the\n \t\t\t * request.\n \t\t\t */\n-\t\t\tif (converterQueue_.empty())\n+\t\t\tif (data->converterQueue_.empty())\n \t\t\t\treturn;\n \n-\t\t\tbuffer = converterQueue_.front();\n-\t\t\tconverterQueue_.pop();\n+\t\t\tbuffer = data->converterQueue_.front();\n+\t\t\tdata->converterQueue_.pop();\n \t\t}\n \n \t\tRequest *request = buffer->request();\n@@ -1003,14 +1003,14 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n \t * conversion is needed. If there's no queued request, just requeue the\n \t * captured buffer for capture.\n \t */\n-\tif (useConverter_) {\n-\t\tif (converterQueue_.empty()) {\n+\tif (data->useConverter_) {\n+\t\tif (data->converterQueue_.empty()) {\n \t\t\tdata->video_->queueBuffer(buffer);\n \t\t\treturn;\n \t\t}\n \n-\t\tFrameBuffer *output = converterQueue_.front();\n-\t\tconverterQueue_.pop();\n+\t\tFrameBuffer *output = data->converterQueue_.front();\n+\t\tdata->converterQueue_.pop();\n \n \t\tconverter_->queueBuffers(buffer, { { 0, output } });\n \t\treturn;\n",
    "prefixes": [
        "libcamera-devel",
        "16/20"
    ]
}