Show a patch.

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

{
    "id": 15776,
    "url": "https://patchwork.libcamera.org/api/patches/15776/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15776/",
    "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": "<20220504132154.9681-4-laurent.pinchart@ideasonboard.com>",
    "date": "2022-05-04T13:21:52",
    "name": "[libcamera-devel,3/5] libcamera: pipeline: simple: Factor out format test to separate function",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4c9702c48ba45d0e3505f395acfc6835f69fc973",
    "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/15776/mbox/",
    "series": [
        {
            "id": 3090,
            "url": "https://patchwork.libcamera.org/api/series/3090/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3090",
            "date": "2022-05-04T13:21:49",
            "name": "libcamera: pipeline: simple: Support scaling on the camea sensor",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3090/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15776/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15776/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 6643CC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 May 2022 13:22:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D969A65656;\n\tWed,  4 May 2022 15:22:03 +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 AEDFD65641\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 May 2022 15:22:00 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 59AF4835\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 May 2022 15:22:00 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651670523;\n\tbh=hE0Dr1CqY/aox8FLLWv/Lak0S2JJYop4QweVrZJxg1A=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=WCWiLxnouxs/lDFHQYvvQj6HtIFV+Ju2xf3EE/zWhBOLUx1VXDupVXR8F5/G+fSOx\n\tN01Y4NffMjDoKYeQ2aYyEe4A5u0sCTwIbAlGA2tk3W5Nlx7+JgcKZHoz12hOsS3qFm\n\tkINZ0LUxNNRvl75S1AfT6/EDoBTihN5QUDFJilcG1ekO5axT6gJ5hkjl8G/SL6jZJ6\n\tzJWbxpWnEN+xcGXUu9+WgwiW/0R88aP+nW7RfAO5vRoTB/G55dIgq9Y3ahcSdMOISp\n\t/dLfO4uqtdHAW48lk4vsNFHzvYM0sF2MFqVprCXKYPhO2JLh1v56y254vvvRiIj3mF\n\tCrfHOo9BNbLNw==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651670520;\n\tbh=hE0Dr1CqY/aox8FLLWv/Lak0S2JJYop4QweVrZJxg1A=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Ctr296pKSEBjuTRe39rO0gzC8U7JmzTuu7LoSzcntofNzRYIeOO3hq0hqnPyQ70kS\n\tx4SVDE952NE0sBi3Kh/wOEHXhkJxuC6YdH5zszOwbQi3aTXIumUy/nd4lQxmRRKsu9\n\t3cri87eRVFl5Y/RuYXPDmjYAGZJZMqbsB2w1zFCw="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ctr296pK\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  4 May 2022 16:21:52 +0300",
        "Message-Id": "<20220504132154.9681-4-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "In-Reply-To": "<20220504132154.9681-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20220504132154.9681-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 3/5] libcamera: pipeline: simple: Factor\n\tout format test to separate function",
        "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>",
        "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "To prepare for the implementation of a more complex format discovery\nmethod, factor out code that tries a pipeline configuration to a\nseparate function. No functional change intended.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 110 ++++++++++++-----------\n 1 file changed, 59 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 4f963df16315..19deb9447c96 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -250,6 +250,9 @@ public:\n \tstd::queue<std::map<unsigned int, FrameBuffer *>> converterQueue_;\n \n private:\n+\tvoid tryPipeline(unsigned int code, const Size &size);\n+\tstatic std::vector<const MediaPad *> routedSourcePads(MediaPad *sink);\n+\n \tvoid converterInputDone(FrameBuffer *buffer);\n \tvoid converterOutputDone(FrameBuffer *buffer);\n };\n@@ -466,58 +469,11 @@ int SimpleCameraData::init()\n \t\treturn ret;\n \n \t/*\n-\t * Enumerate the possible pipeline configurations. For each media bus\n-\t * format supported by the sensor, propagate the formats through the\n-\t * pipeline, and enumerate the corresponding possible V4L2 pixel\n-\t * formats on the video node.\n+\t * Generate the list of possible pipeline configurations by trying each\n+\t * media bus format supported by the sensor.\n \t */\n-\tfor (unsigned int code : sensor_->mbusCodes()) {\n-\t\tV4L2SubdeviceFormat format{};\n-\t\tformat.mbus_code = code;\n-\t\tformat.size = sensor_->resolution();\n-\n-\t\tret = setupFormats(&format, V4L2Subdevice::TryFormat);\n-\t\tif (ret < 0) {\n-\t\t\tLOG(SimplePipeline, Debug)\n-\t\t\t\t<< \"Media bus code \" << utils::hex(code, 4)\n-\t\t\t\t<< \" not supported for this pipeline\";\n-\t\t\t/* Try next mbus_code supported by the sensor */\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tV4L2VideoDevice::Formats videoFormats =\n-\t\t\tvideo_->formats(format.mbus_code);\n-\n-\t\tLOG(SimplePipeline, Debug)\n-\t\t\t<< \"Adding configuration for \" << format.size\n-\t\t\t<< \" in pixel formats [ \"\n-\t\t\t<< utils::join(videoFormats, \", \",\n-\t\t\t\t       [](const auto &f) {\n-\t\t\t\t\t       return f.first.toString();\n-\t\t\t\t       })\n-\t\t\t<< \" ]\";\n-\n-\t\tfor (const auto &videoFormat : videoFormats) {\n-\t\t\tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n-\t\t\tif (!pixelFormat)\n-\t\t\t\tcontinue;\n-\n-\t\t\tConfiguration config;\n-\t\t\tconfig.code = code;\n-\t\t\tconfig.captureFormat = pixelFormat;\n-\t\t\tconfig.captureSize = format.size;\n-\n-\t\t\tif (!converter_) {\n-\t\t\t\tconfig.outputFormats = { pixelFormat };\n-\t\t\t\tconfig.outputSizes = config.captureSize;\n-\t\t\t} else {\n-\t\t\t\tconfig.outputFormats = converter_->formats(pixelFormat);\n-\t\t\t\tconfig.outputSizes = converter_->sizes(format.size);\n-\t\t\t}\n-\n-\t\t\tconfigs_.push_back(config);\n-\t\t}\n-\t}\n+\tfor (unsigned int code : sensor_->mbusCodes())\n+\t\ttryPipeline(code, sensor_->resolution());\n \n \tif (configs_.empty()) {\n \t\tLOG(SimplePipeline, Error) << \"No valid configuration found\";\n@@ -541,6 +497,58 @@ int SimpleCameraData::init()\n \treturn 0;\n }\n \n+void SimpleCameraData::tryPipeline(unsigned int code, const Size &size)\n+{\n+\t/*\n+\t * Propagate the format through the pipeline, and enumerate the\n+\t * corresponding possible V4L2 pixel formats on the video node.\n+\t */\n+\tV4L2SubdeviceFormat format{};\n+\tformat.mbus_code = code;\n+\tformat.size = size;\n+\n+\tint ret = setupFormats(&format, V4L2Subdevice::TryFormat);\n+\tif (ret < 0) {\n+\t\t/* Pipeline configuration failed, skip this configuration. */\n+\t\tLOG(SimplePipeline, Debug)\n+\t\t\t<< \"Media bus code \" << utils::hex(code, 4)\n+\t\t\t<< \" not supported for this pipeline\";\n+\t\treturn;\n+\t}\n+\n+\tV4L2VideoDevice::Formats videoFormats = video_->formats(format.mbus_code);\n+\n+\tLOG(SimplePipeline, Debug)\n+\t\t<< \"Adding configuration for \" << format.size\n+\t\t<< \" in pixel formats [ \"\n+\t\t<< utils::join(videoFormats, \", \",\n+\t\t\t       [](const auto &f) {\n+\t\t\t\t       return f.first.toString();\n+\t\t\t       })\n+\t\t<< \" ]\";\n+\n+\tfor (const auto &videoFormat : videoFormats) {\n+\t\tPixelFormat pixelFormat = videoFormat.first.toPixelFormat();\n+\t\tif (!pixelFormat)\n+\t\t\tcontinue;\n+\n+\t\tConfiguration config;\n+\t\tconfig.code = code;\n+\t\tconfig.captureFormat = pixelFormat;\n+\t\tconfig.captureSize = format.size;\n+\n+\t\tif (!converter_) {\n+\t\t\tconfig.outputFormats = { pixelFormat };\n+\t\t\tconfig.outputSizes = config.captureSize;\n+\t\t} else {\n+\t\t\tconfig.outputFormats = converter_->formats(pixelFormat);\n+\t\t\tconfig.outputSizes = converter_->sizes(format.size);\n+\t\t}\n+\n+\t\tconfigs_.push_back(config);\n+\t}\n+}\n+\n int SimpleCameraData::setupLinks()\n {\n \tint ret;\n",
    "prefixes": [
        "libcamera-devel",
        "3/5"
    ]
}