Show a patch.

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

{
    "id": 16677,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16677/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16677/",
    "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": "<20220719073012.810184-1-paul.elder@ideasonboard.com>",
    "date": "2022-07-19T07:30:12",
    "name": "[libcamera-devel,v3] pipeline: rkisp1: Support devices without self path",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "315b8c9067faf1c9be10fb511571b3e285afa56c",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16677/mbox/",
    "series": [
        {
            "id": 3295,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3295/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3295",
            "date": "2022-07-19T07:30:12",
            "name": "[libcamera-devel,v3] pipeline: rkisp1: Support devices without self path",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3295/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16677/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16677/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 E37C6BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 07:30:29 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2B5CC63312;\n\tTue, 19 Jul 2022 09:30:29 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E4E286330D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jul 2022 09:30:26 +0200 (CEST)",
            "from pyrite.rasen.tech (softbank036240121080.bbtec.net\n\t[36.240.121.80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5A6FB6EE;\n\tTue, 19 Jul 2022 09:30:25 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658215829;\n\tbh=kxqd7uMyTOpgyxizOllZ/wV7/nsZacjfQCLCny3l7r0=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=Mgjv9hP9vmrha4i5XV//gioSUZMqr/pFGdhPlf23TGbeI5eNEI5n5zfNgzVW68Ln0\n\tCd0Xe/RCpnGL4Wg8/RroiYzeD1ZBkx9WoaqTCMXjF+t+A9xeCfthJWOPoJBZVyqrQ4\n\tA1BSqMIiv487+5+5qugPkKEDwecO1LdALVfI2yedZMDS5mCaSGjDKLaxRFNwOhRaW7\n\tcOV61KB2gWgz+CZesBW/U8UjYdkAyHZhBFKXnVt/YI9vo4dHB6j98+B+8uHbwdM0E7\n\ts6Kw/XgZou/UympIWJAnGVokdodwy8Vs7atIK2ogIgirkuPvdKMEjw5YkSslGO7OAI\n\t/6PLxx6svlEMg==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658215826;\n\tbh=kxqd7uMyTOpgyxizOllZ/wV7/nsZacjfQCLCny3l7r0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=S/KWv/yoF67jrGN7+JQ+rqh38uaGMIwCR8eBw1jyPBw2CeqE6bVIRdMf9/TuGD9Sn\n\t3k4tSeVNg6yMIO4w3o2aEETpr86mHyJl61YbSzmNtymzgQi3VNDK3LiEJ5e23eCsXq\n\tdEvbv3Hc/HznqzTI09J1hm+aWKmJhUtdGi2/NDAw="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"S/KWv/yo\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 19 Jul 2022 16:30:12 +0900",
        "Message-Id": "<20220719073012.810184-1-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3] pipeline: rkisp1: Support devices\n\twithout self path",
        "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": "Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Paul Elder <paul.elder@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Some hardware supported by the rkisp1 driver, such as the ISP in the\ni.MX8MP, don't have a self path. Although at the moment the driver still\nexposes the self path, prepare the rkisp1 pipeline handler for when the\nself path will be removed for devices that don't support it.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- add more guards\n- add pathCount guard to generateConfiguration to allow making self path\n  unavailable Just Work\n\nChanges in v2:\n- simplify matching\n- clean up self path availability in validate()\n- fix configure(), return -ENODEV if multiple roles but no self path\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 49 ++++++++++++++++--------\n 1 file changed, 32 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 212fc76a..99eecd44 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -180,6 +180,8 @@ private:\n \tstd::unique_ptr<V4L2VideoDevice> stat_;\n \tstd::unique_ptr<V4L2Subdevice> csi_;\n \n+\tbool hasSelfPath_;\n+\n \tRkISP1MainPath mainPath_;\n \tRkISP1SelfPath selfPath_;\n \n@@ -364,7 +366,7 @@ void RkISP1CameraData::paramFilled(unsigned int frame)\n \tif (info->mainPathBuffer)\n \t\tmainPath_->queueBuffer(info->mainPathBuffer);\n \n-\tif (info->selfPathBuffer)\n+\tif (selfPath_ && info->selfPathBuffer)\n \t\tselfPath_->queueBuffer(info->selfPathBuffer);\n }\n \n@@ -403,7 +405,7 @@ bool RkISP1CameraConfiguration::fitsAllPaths(const StreamConfiguration &cfg)\n \t\treturn false;\n \n \tconfig = cfg;\n-\tif (data_->selfPath_->validate(&config) != Valid)\n+\tif (data_->selfPath_ && data_->selfPath_->validate(&config) != Valid)\n \t\treturn false;\n \n \treturn true;\n@@ -412,6 +414,7 @@ bool RkISP1CameraConfiguration::fitsAllPaths(const StreamConfiguration &cfg)\n CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n {\n \tconst CameraSensor *sensor = data_->sensor_.get();\n+\tunsigned int pathCount = data_->selfPath_ ? 2 : 1;\n \tStatus status = Valid;\n \n \tif (config_.empty())\n@@ -423,8 +426,8 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \t}\n \n \t/* Cap the number of entries to the available streams. */\n-\tif (config_.size() > 2) {\n-\t\tconfig_.resize(2);\n+\tif (config_.size() > pathCount) {\n+\t\tconfig_.resize(pathCount);\n \t\tstatus = Adjusted;\n \t}\n \n@@ -441,7 +444,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \t\tstd::reverse(order.begin(), order.end());\n \n \tbool mainPathAvailable = true;\n-\tbool selfPathAvailable = true;\n+\tbool selfPathAvailable = data_->selfPath_;\n \tfor (unsigned int index : order) {\n \t\tStreamConfiguration &cfg = config_[index];\n \n@@ -520,7 +523,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n }\n \n PipelineHandlerRkISP1::PipelineHandlerRkISP1(CameraManager *manager)\n-\t: PipelineHandler(manager)\n+\t: PipelineHandler(manager), hasSelfPath_(true)\n {\n }\n \n@@ -532,12 +535,19 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera\n \tconst StreamRoles &roles)\n {\n \tRkISP1CameraData *data = cameraData(camera);\n+\n+\tunsigned int pathCount = data->selfPath_ ? 2 : 1;\n+\tif (roles.size() > pathCount) {\n+\t\tLOG(RkISP1, Error) << \"Too many stream roles requested\";\n+\t\treturn nullptr;\n+\t}\n+\n \tCameraConfiguration *config = new RkISP1CameraConfiguration(camera, data);\n \tif (roles.empty())\n \t\treturn config;\n \n \tbool mainPathAvailable = true;\n-\tbool selfPathAvailable = true;\n+\tbool selfPathAvailable = data->selfPath_;\n \tfor (const StreamRole role : roles) {\n \t\tbool useMainPath;\n \n@@ -646,10 +656,12 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \t\t\tret = mainPath_.configure(cfg, format);\n \t\t\tstreamConfig[0] = IPAStream(cfg.pixelFormat,\n \t\t\t\t\t\t    cfg.size);\n-\t\t} else {\n+\t\t} else if (hasSelfPath_) {\n \t\t\tret = selfPath_.configure(cfg, format);\n \t\t\tstreamConfig[1] = IPAStream(cfg.pixelFormat,\n \t\t\t\t\t\t    cfg.size);\n+\t\t} else {\n+\t\t\treturn -ENODEV;\n \t\t}\n \n \t\tif (ret)\n@@ -697,7 +709,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S\n \n \tif (stream == &data->mainPathStream_)\n \t\treturn mainPath_.exportBuffers(count, buffers);\n-\telse if (stream == &data->selfPathStream_)\n+\telse if (hasSelfPath_ && stream == &data->selfPathStream_)\n \t\treturn selfPath_.exportBuffers(count, buffers);\n \n \treturn -EINVAL;\n@@ -826,7 +838,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\t}\n \t}\n \n-\tif (data->selfPath_->isEnabled()) {\n+\tif (hasSelfPath_ && data->selfPath_->isEnabled()) {\n \t\tret = selfPath_.start();\n \t\tif (ret) {\n \t\t\tmainPath_.stop();\n@@ -853,7 +865,8 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera)\n \n \tdata->ipa_->stop();\n \n-\tselfPath_.stop();\n+\tif (hasSelfPath_)\n+\t\tselfPath_.stop();\n \tmainPath_.stop();\n \n \tret = stat_->streamOff();\n@@ -934,7 +947,7 @@ int PipelineHandlerRkISP1::initLinks(Camera *camera,\n \tfor (const StreamConfiguration &cfg : config) {\n \t\tif (cfg.stream() == &data->mainPathStream_)\n \t\t\tret = data->mainPath_->setEnabled(true);\n-\t\telse if (cfg.stream() == &data->selfPathStream_)\n+\t\telse if (hasSelfPath_ && cfg.stream() == &data->selfPathStream_)\n \t\t\tret = data->selfPath_->setEnabled(true);\n \t\telse\n \t\t\treturn -EINVAL;\n@@ -951,7 +964,8 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \tint ret;\n \n \tstd::unique_ptr<RkISP1CameraData> data =\n-\t\tstd::make_unique<RkISP1CameraData>(this, &mainPath_, &selfPath_);\n+\t\tstd::make_unique<RkISP1CameraData>(this, &mainPath_,\n+\t\t\t\t\t\t   hasSelfPath_ ? &selfPath_ : nullptr);\n \n \tControlInfoMap::Map ctrls;\n \tctrls.emplace(std::piecewise_construct,\n@@ -1007,9 +1021,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \n \tDeviceMatch dm(\"rkisp1\");\n \tdm.add(\"rkisp1_isp\");\n-\tdm.add(\"rkisp1_resizer_selfpath\");\n \tdm.add(\"rkisp1_resizer_mainpath\");\n-\tdm.add(\"rkisp1_selfpath\");\n \tdm.add(\"rkisp1_mainpath\");\n \tdm.add(\"rkisp1_stats\");\n \tdm.add(\"rkisp1_params\");\n@@ -1024,6 +1036,8 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \t}\n \n+\thasSelfPath_ = !!media_->getEntityByName(\"rkisp1_selfpath\");\n+\n \t/* Create the V4L2 subdevices we will need. */\n \tisp_ = V4L2Subdevice::fromEntityName(media_, \"rkisp1_isp\");\n \tif (isp_->open() < 0)\n@@ -1058,11 +1072,12 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \tif (!mainPath_.init(media_))\n \t\treturn false;\n \n-\tif (!selfPath_.init(media_))\n+\tif (hasSelfPath_ && !selfPath_.init(media_))\n \t\treturn false;\n \n \tmainPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);\n-\tselfPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);\n+\tif (hasSelfPath_)\n+\t\tselfPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);\n \tstat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statReady);\n \tparam_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3"
    ]
}