Show a patch.

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

{
    "id": 3822,
    "url": "https://patchwork.libcamera.org/api/patches/3822/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3822/",
    "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": "<20200519165543.30465-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-05-19T16:55:41",
    "name": "[libcamera-devel,v2,1/3] libcamera: pipeline: simple: Add stride support",
    "commit_ref": "5331051c35fe5412901435d81b4153d307c04a49",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "595b72a00e39962d4c51128158a8c7a61743fcca",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3822/mbox/",
    "series": [
        {
            "id": 915,
            "url": "https://patchwork.libcamera.org/api/series/915/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=915",
            "date": "2020-05-19T16:55:41",
            "name": "[libcamera-devel,v2,1/3] libcamera: pipeline: simple: Add stride support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/915/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3822/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3822/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C264C603DA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 18:55:57 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 280C230C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 18:55:57 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"DdCi33me\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589907357;\n\tbh=YKKB8tqYb6shN8PKwNsZe7H9E3mCT+v/KmyajrpYwuk=;\n\th=From:To:Subject:Date:From;\n\tb=DdCi33meQnJRHDjgIt70UwWrFUK4aLrk1pOGoR3+QJ4skOU1uLYayL/kcc84C6EMy\n\tDkMfaV1M05Jn/ZoMNHvhpWQHM9EY/qjjqL/IEXs74TuqDc+rW7x/DYP288c9fxtO3G\n\t5MOs1nYD396BJ35oaR7XlthAi2jjaXFULUPNfreE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 19 May 2020 19:55:41 +0300",
        "Message-Id": "<20200519165543.30465-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 1/3] libcamera: pipeline: simple: Add\n\tstride support",
        "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>",
        "X-List-Received-Date": "Tue, 19 May 2020 16:55:58 -0000"
    },
    "content": "Report the stride when configuring the camera. The stride is retrieved\nfrom the capture device first, and overridden by the converter if used.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/converter.cpp | 13 ++++++++-----\n src/libcamera/pipeline/simple/converter.h   |  4 ++--\n src/libcamera/pipeline/simple/simple.cpp    |  5 +++--\n 3 files changed, 13 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp\nindex 02443e7f78ed..7a9d67b37624 100644\n--- a/src/libcamera/pipeline/simple/converter.cpp\n+++ b/src/libcamera/pipeline/simple/converter.cpp\n@@ -12,6 +12,7 @@\n #include <libcamera/buffer.h>\n #include <libcamera/geometry.h>\n #include <libcamera/signal.h>\n+#include <libcamera/stream.h>\n \n #include \"libcamera/internal/log.h\"\n #include \"libcamera/internal/media_device.h\"\n@@ -93,14 +94,14 @@ std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input)\n }\n \n int SimpleConverter::configure(PixelFormat inputFormat,\n-\t\t\t       PixelFormat outputFormat, const Size &size)\n+\t\t\t       StreamConfiguration *cfg)\n {\n \tV4L2DeviceFormat format;\n \tint ret;\n \n \tV4L2PixelFormat videoFormat = m2m_->output()->toV4L2PixelFormat(inputFormat);\n \tformat.fourcc = videoFormat;\n-\tformat.size = size;\n+\tformat.size = cfg->size;\n \n \tret = m2m_->output()->setFormat(&format);\n \tif (ret < 0) {\n@@ -109,7 +110,7 @@ int SimpleConverter::configure(PixelFormat inputFormat,\n \t\treturn ret;\n \t}\n \n-\tif (format.fourcc != videoFormat || format.size != size) {\n+\tif (format.fourcc != videoFormat || format.size != cfg->size) {\n \t\tLOG(SimplePipeline, Error)\n \t\t\t<< \"Input format not supported\";\n \t\treturn -EINVAL;\n@@ -119,7 +120,7 @@ int SimpleConverter::configure(PixelFormat inputFormat,\n \t * Set the pixel format on the output, the size is identical to the\n \t * input as we don't support scaling.\n \t */\n-\tvideoFormat = m2m_->capture()->toV4L2PixelFormat(outputFormat);\n+\tvideoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat);\n \tformat.fourcc = videoFormat;\n \n \tret = m2m_->capture()->setFormat(&format);\n@@ -129,12 +130,14 @@ int SimpleConverter::configure(PixelFormat inputFormat,\n \t\treturn ret;\n \t}\n \n-\tif (format.fourcc != videoFormat || format.size != size) {\n+\tif (format.fourcc != videoFormat || format.size != cfg->size) {\n \t\tLOG(SimplePipeline, Error)\n \t\t\t<< \"Output format not supported\";\n \t\treturn -EINVAL;\n \t}\n \n+\tcfg->stride = format.planes[0].bpl;\n+\n \treturn 0;\n }\n \ndiff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h\nindex a33071fa8578..0beb96a55d5b 100644\n--- a/src/libcamera/pipeline/simple/converter.h\n+++ b/src/libcamera/pipeline/simple/converter.h\n@@ -20,6 +20,7 @@ namespace libcamera {\n class FrameBuffer;\n class MediaDevice;\n struct Size;\n+struct StreamConfiguration;\n class V4L2M2MDevice;\n \n class SimpleConverter\n@@ -33,8 +34,7 @@ public:\n \n \tstd::vector<PixelFormat> formats(PixelFormat input);\n \n-\tint configure(PixelFormat inputFormat, PixelFormat outputFormat,\n-\t\t      const Size &size);\n+\tint configure(PixelFormat inputFormat, StreamConfiguration *cfg);\n \tint exportBuffers(unsigned int count,\n \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n \ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 2565190082c8..68595bc29726 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -549,12 +549,13 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \t\treturn -EINVAL;\n \t}\n \n+\tcfg.stride = captureFormat.planes[0].bpl;\n+\n \t/* Configure the converter if required. */\n \tuseConverter_ = config->needConversion();\n \n \tif (useConverter_) {\n-\t\tint ret = converter_->configure(pipeConfig.pixelFormat,\n-\t\t\t\t\t\tcfg.pixelFormat, cfg.size);\n+\t\tint ret = converter_->configure(pipeConfig.pixelFormat, &cfg);\n \t\tif (ret < 0) {\n \t\t\tLOG(SimplePipeline, Error)\n \t\t\t\t<< \"Unable to configure converter\";\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/3"
    ]
}