Show a patch.

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

{
    "id": 8686,
    "url": "https://patchwork.libcamera.org/api/patches/8686/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8686/",
    "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": "<20200708134417.67747-18-paul.elder@ideasonboard.com>",
    "date": "2020-07-08T13:44:13",
    "name": "[libcamera-devel,v4,17/21] libcamera: simple: Fill stride and frameSize at config validation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d14800b77ff206bc94bc808e3eab127b47898c63",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8686/mbox/",
    "series": [
        {
            "id": 1090,
            "url": "https://patchwork.libcamera.org/api/series/1090/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1090",
            "date": "2020-07-08T13:43:56",
            "name": "Clean up formats in v4l2-compat and pipeline handlers",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1090/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8686/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8686/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 752CBBD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2020 13:45:07 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4214F6114D;\n\tWed,  8 Jul 2020 15:45:07 +0200 (CEST)",
            "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 2AE7A6112A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2020 15:45:06 +0200 (CEST)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 61A0D51B;\n\tWed,  8 Jul 2020 15:45:04 +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=\"OqNp1CER\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594215905;\n\tbh=r+Gazo8Aa1EouROuMjbG2l644fm1YCr6uy/wMMySwj0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=OqNp1CER/T/DDJZyqDPgDGR6OMYu59t9cMG8cbVqKDB35ydJqBNxyqzDbFA16LdH6\n\tx42KdQJF2e4HfvQqF+dL2IayfoF21f9F2hbXVxN4rMsmj6/ZOeWL3GXzMx6pX95cNx\n\tGX4/eM8RgvLD7KK5vH9CqoSApX4RzvG2WpuweILc=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  8 Jul 2020 22:44:13 +0900",
        "Message-Id": "<20200708134417.67747-18-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200708134417.67747-1-paul.elder@ideasonboard.com>",
        "References": "<20200708134417.67747-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 17/21] libcamera: simple: Fill stride\n\tand frameSize at config validation",
        "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>",
        "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": "Fill the stride and frameSize fields of the StreamConfiguration at\nconfiguration validation time instead of at camera configuration time.\nThis allows applications to get the stride when trying a configuration\nwithout modifying the active configuration of the camera.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v4:\n- fix converter's stride and frameSize (get it via tryFormat instead of\n  calculation)\n- merge converter's stride and frameSize to one function\n- return error if tryFormat fails\n- mention motivation in commit message\n\nNew in v3\n---\n src/libcamera/pipeline/simple/converter.cpp | 19 +++++++++++++++\n src/libcamera/pipeline/simple/converter.h   |  4 +++\n src/libcamera/pipeline/simple/simple.cpp    | 27 +++++++++++++++++++--\n 3 files changed, 48 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp\nindex e5e2f0f..cef1503 100644\n--- a/src/libcamera/pipeline/simple/converter.cpp\n+++ b/src/libcamera/pipeline/simple/converter.cpp\n@@ -261,4 +261,23 @@ void SimpleConverter::outputBufferReady(FrameBuffer *buffer)\n \t}\n }\n \n+int SimpleConverter::strideAndFrameSize(const Size &size,\n+\t\t\t\t\tconst PixelFormat &pixelFormat,\n+\t\t\t\t\tunsigned int *strideOut,\n+\t\t\t\t\tunsigned int *frameSizeOut)\n+{\n+\tV4L2DeviceFormat format = {};\n+\tformat.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat);\n+\tformat.size = size;\n+\n+\tint ret = m2m_->capture()->tryFormat(&format);\n+\tif (ret < 0)\n+\t\treturn -1;\n+\n+\t*strideOut = format.planes[0].bpl;\n+\t*frameSizeOut = format.planes[0].size;\n+\n+\treturn 0;\n+}\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h\nindex ef18cf7..3e46988 100644\n--- a/src/libcamera/pipeline/simple/converter.h\n+++ b/src/libcamera/pipeline/simple/converter.h\n@@ -46,6 +46,10 @@ public:\n \n \tint queueBuffers(FrameBuffer *input, FrameBuffer *output);\n \n+\tint strideAndFrameSize(const Size &size, const PixelFormat &pixelFormat,\n+\t\t\t       unsigned int *strideOut,\n+\t\t\t       unsigned int *frameSizeOut);\n+\n \tSignal<FrameBuffer *, FrameBuffer *> bufferReady;\n \n private:\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 1ec8d0f..0c52b47 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -457,6 +457,31 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \n \tcfg.bufferCount = 3;\n \n+\n+\t/* Set the stride and frameSize. */\n+\tif (!needConversion_) {\n+\t\tV4L2DeviceFormat format = {};\n+\t\tformat.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat);\n+\t\tformat.size = cfg.size;\n+\n+\t\tint ret = data_->video_->tryFormat(&format);\n+\t\tif (ret < 0)\n+\t\t\treturn Invalid;\n+\n+\t\tcfg.stride = format.planes[0].bpl;\n+\t\tcfg.frameSize = format.planes[0].size;\n+\n+\t\treturn status;\n+\t}\n+\n+\tSimplePipelineHandler *pipe = static_cast<SimplePipelineHandler *>(data_->pipe_);\n+\tSimpleConverter *converter = pipe->converter();\n+\n+\tint ret = converter->strideAndFrameSize(cfg.size, cfg.pixelFormat,\n+\t\t\t\t\t\t&cfg.stride, &cfg.frameSize);\n+\tif (ret < 0)\n+\t\treturn Invalid;\n+\n \treturn status;\n }\n \n@@ -557,8 +582,6 @@ 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",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "17/21"
    ]
}