Show a patch.

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

{
    "id": 9847,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9847/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9847/",
    "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": "<20200929014334.49719-3-niklas.soderlund@ragnatech.se>",
    "date": "2020-09-29T01:43:29",
    "name": "[libcamera-devel,v4,2/7] libcamera: pipeline: rkisp1: Move path configuration to RkISP1Path",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d285c15be8fe82a4ea704be379413d1d5cb45f6c",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9847/mbox/",
    "series": [
        {
            "id": 1333,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1333/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1333",
            "date": "2020-09-29T01:43:27",
            "name": "libcamera: pipeline: rkisp1: Create RkISP1Path helper",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1333/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9847/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9847/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 2FCD8C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Sep 2020 01:43:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 09A4061FE5;\n\tTue, 29 Sep 2020 03:43:53 +0200 (CEST)",
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 017056213B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Sep 2020 03:43:50 +0200 (CEST)",
            "from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de\n\t[84.172.82.168]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 365502a1-01f5-11eb-b295-0050569116f7;\n\tTue, 29 Sep 2020 03:43:47 +0200 (CEST)"
        ],
        "X-Halon-ID": "365502a1-01f5-11eb-b295-0050569116f7",
        "Authorized-sender": "niklas.soderlund@fsdn.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 29 Sep 2020 03:43:29 +0200",
        "Message-Id": "<20200929014334.49719-3-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.28.0",
        "In-Reply-To": "<20200929014334.49719-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200929014334.49719-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 2/7] libcamera: pipeline: rkisp1: Move\n\tpath configuration to RkISP1Path",
        "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=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Move the path configuration to RkISP1Path to increase code reuse and\nmake the V4L2 subdevice resizer private to the path. There is no\nfunctional change.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 55 ++-----------------\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 55 ++++++++++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   | 10 +++-\n 3 files changed, 68 insertions(+), 52 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 84b5164bd040e617..13e0666d80050b51 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -812,60 +812,17 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tdata->mainPathActive_ = false;\n \tdata->selfPathActive_ = false;\n \tfor (const StreamConfiguration &cfg : *config) {\n-\t\tV4L2SubdeviceFormat ispFormat = format;\n-\t\tV4L2Subdevice *resizer;\n-\t\tV4L2VideoDevice *video;\n-\n \t\tif (cfg.stream() == &data->mainPathStream_) {\n-\t\t\tresizer = mainPath_.resizer_;\n-\t\t\tvideo = mainPath_.video_;\n+\t\t\tret = mainPath_.configure(cfg, format);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\tdata->mainPathActive_ = true;\n \t\t} else {\n-\t\t\tresizer = selfPath_.resizer_;\n-\t\t\tvideo = selfPath_.video_;\n+\t\t\tret = selfPath_.configure(cfg, format);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\tdata->selfPathActive_ = true;\n \t\t}\n-\n-\t\tret = resizer->setFormat(0, &ispFormat);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\n-\t\tconst char *name = resizer == mainPath_.resizer_ ? \"main\" : \"self\";\n-\n-\t\tLOG(RkISP1, Debug)\n-\t\t\t<< \"Configured \" << name << \" resizer input pad with \"\n-\t\t\t<< ispFormat.toString();\n-\n-\t\tispFormat.size = cfg.size;\n-\n-\t\tLOG(RkISP1, Debug)\n-\t\t\t<< \"Configuring \" << name << \" resizer output pad with \"\n-\t\t\t<< ispFormat.toString();\n-\n-\t\tret = resizer->setFormat(1, &ispFormat);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\n-\t\tLOG(RkISP1, Debug)\n-\t\t\t<< \"Configured \" << name << \" resizer output pad with \"\n-\t\t\t<< ispFormat.toString();\n-\n-\t\tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);\n-\t\tV4L2DeviceFormat outputFormat = {};\n-\t\toutputFormat.fourcc = video->toV4L2PixelFormat(cfg.pixelFormat);\n-\t\toutputFormat.size = cfg.size;\n-\t\toutputFormat.planesCount = info.numPlanes();\n-\n-\t\tret = video->setFormat(&outputFormat);\n-\t\tif (ret)\n-\t\t\treturn ret;\n-\n-\t\tif (outputFormat.size != cfg.size ||\n-\t\t    outputFormat.fourcc != video->toV4L2PixelFormat(cfg.pixelFormat)) {\n-\t\t\tLOG(RkISP1, Error)\n-\t\t\t\t<< \"Unable to configure capture in \" << cfg.toString();\n-\t\t\treturn -EINVAL;\n-\t\t}\n \t}\n \n \tV4L2DeviceFormat paramFormat = {};\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 2eae42340c23783c..66b5eebdcb804e24 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -7,14 +7,18 @@\n \n #include \"rkisp1_path.h\"\n \n+#include <libcamera/stream.h>\n+\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/v4l2_subdevice.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n \n namespace libcamera {\n \n+LOG_DECLARE_CATEGORY(RkISP1)\n+\n RkISP1Path::RkISP1Path(const char *name)\n-\t: resizer_(nullptr), video_(nullptr), name_(name)\n+\t: video_(nullptr), name_(name), resizer_(nullptr)\n {\n }\n \n@@ -40,6 +44,55 @@ bool RkISP1Path::init(MediaDevice *media)\n \treturn true;\n }\n \n+int RkISP1Path::configure(const StreamConfiguration &config,\n+\t\t\t  const V4L2SubdeviceFormat &inputFormat)\n+{\n+\tint ret;\n+\n+\tV4L2SubdeviceFormat ispFormat = inputFormat;\n+\n+\tret = resizer_->setFormat(0, &ispFormat);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tLOG(RkISP1, Debug)\n+\t\t<< \"Configured \" << name_ << \" resizer input pad with \"\n+\t\t<< ispFormat.toString();\n+\n+\tispFormat.size = config.size;\n+\n+\tLOG(RkISP1, Debug)\n+\t\t<< \"Configuring \" << name_ << \" resizer output pad with \"\n+\t\t<< ispFormat.toString();\n+\n+\tret = resizer_->setFormat(1, &ispFormat);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tLOG(RkISP1, Debug)\n+\t\t<< \"Configured \" << name_ << \" resizer output pad with \"\n+\t\t<< ispFormat.toString();\n+\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(config.pixelFormat);\n+\tV4L2DeviceFormat outputFormat = {};\n+\toutputFormat.fourcc = video_->toV4L2PixelFormat(config.pixelFormat);\n+\toutputFormat.size = config.size;\n+\toutputFormat.planesCount = info.numPlanes();\n+\n+\tret = video_->setFormat(&outputFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (outputFormat.size != config.size ||\n+\t    outputFormat.fourcc != video_->toV4L2PixelFormat(config.pixelFormat)) {\n+\t\tLOG(RkISP1, Error)\n+\t\t\t<< \"Unable to configure capture in \" << config.toString();\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n RkISP1MainPath::RkISP1MainPath()\n \t: RkISP1Path(\"main\")\n {\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex d3172e228a3f67bf..6eb01529d2fddb1c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -12,6 +12,8 @@ namespace libcamera {\n class MediaDevice;\n class V4L2Subdevice;\n class V4L2VideoDevice;\n+struct StreamConfiguration;\n+struct V4L2SubdeviceFormat;\n \n class RkISP1Path\n {\n@@ -21,12 +23,16 @@ public:\n \n \tbool init(MediaDevice *media);\n \n-\t/* \\todo Make resizer and video private. */\n-\tV4L2Subdevice *resizer_;\n+\tint configure(const StreamConfiguration &config,\n+\t\t      const V4L2SubdeviceFormat &inputFormat);\n+\n+\t/* \\todo Make video private. */\n \tV4L2VideoDevice *video_;\n \n private:\n \tconst char *name_;\n+\n+\tV4L2Subdevice *resizer_;\n };\n \n class RkISP1MainPath : public RkISP1Path\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "2/7"
    ]
}