Show a patch.

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

{
    "id": 19617,
    "url": "https://patchwork.libcamera.org/api/patches/19617/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19617/",
    "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": "<20240301212121.9072-27-laurent.pinchart@ideasonboard.com>",
    "date": "2024-03-01T21:21:15",
    "name": "[PATCH/RFC,26/32] pipeline: raspberrypi: vc4: Reorganize platformConfigure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": false,
    "hash": "989ab1307aea74ff0f45555734f414fd70175a09",
    "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/19617/mbox/",
    "series": [
        {
            "id": 4197,
            "url": "https://patchwork.libcamera.org/api/series/4197/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4197",
            "date": "2024-03-01T21:20:49",
            "name": "libcamera: Support the upstream Unicam driver",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4197/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19617/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19617/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 90729C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Mar 2024 21:22:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5361962C81;\n\tFri,  1 Mar 2024 22:22:00 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0FF2C62875\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Mar 2024 22:21:58 +0100 (CET)",
            "from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi\n\t[89.27.53.110])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8AED9673;\n\tFri,  1 Mar 2024 22:21:43 +0100 (CET)"
        ],
        "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=\"Ojn4z83s\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1709328103;\n\tbh=rnP4WtpVm9uyZJAE8BdIHDQAzE4/weqNrq9j1uWqKmI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ojn4z83sxubcu8IUsfM/D8NL+1efc5rNkqyE0zzl4OE6izN3JrefHWnsLSrGpq0Fu\n\thvJXlG0D0rgeI4Y3HmoEO9nP9UGCjNLmWynOM2SP/LQn3yRG7XroiZgaO+qXG0IxhN\n\t79iBK/zE1L0etqb9/B9Z3pg2OmypfF7Cwaqqzjbw=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH/RFC 26/32] pipeline: raspberrypi: vc4: Reorganize\n\tplatformConfigure()",
        "Date": "Fri,  1 Mar 2024 23:21:15 +0200",
        "Message-ID": "<20240301212121.9072-27-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20240301212121.9072-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Cc": "Sakari Ailus <sakari.ailus@iki.fi>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The Vc4CameraData::platformConfigure() function configures inicam and\nthe ISP. The corresponding configuration steps are interleaved, making\nit more difficult to read the code and follow the flow. Reorganize the\nfunction to improve readability.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rpi/vc4/vc4.cpp | 65 ++++++++++++++------------\n 1 file changed, 36 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 4b0eb93745cf..3c3c1b30f9e3 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -537,9 +537,9 @@ int Vc4CameraData::platformPipelineConfigure(const std::unique_ptr<YamlObject> &\n \n int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfig)\n {\n-\tconst std::vector<StreamParams> &rawStreams = rpiConfig->rawStreams_;\n-\tconst std::vector<StreamParams> &outStreams = rpiConfig->outStreams_;\n-\tint ret;\n+\t/*\n+\t * 1. Configure the Unicam video devices.\n+\t */\n \n \tV4L2VideoDevice *unicam = unicam_[Unicam::Image].dev();\n \tV4L2DeviceFormat unicamFormat;\n@@ -548,6 +548,8 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi\n \t * See which streams are requested, and route the user\n \t * StreamConfiguration appropriately.\n \t */\n+\tconst std::vector<StreamParams> &rawStreams = rpiConfig->rawStreams_;\n+\n \tif (!rawStreams.empty()) {\n \t\trawStreams[0].cfg->setStream(&unicam_[Unicam::Image]);\n \t\tunicam_[Unicam::Image].setFlags(StreamFlag::External);\n@@ -559,11 +561,7 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi\n \t\t\t\t\t\t\t\t     BayerFormat::Packing::CSI2);\n \t}\n \n-\tret = unicam->setFormat(&unicamFormat);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = isp_[Isp::Input].dev()->setFormat(&unicamFormat);\n+\tint ret = unicam->setFormat(&unicamFormat);\n \tif (ret)\n \t\treturn ret;\n \n@@ -571,7 +569,37 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi\n \t\t       << \" - Selected sensor format: \" << rpiConfig->sensorFormat_\n \t\t       << \" - Selected unicam format: \" << unicamFormat;\n \n+\t/*\n+\t * Configure the Unicam embedded data output format only if the sensor\n+\t * supports it.\n+\t */\n+\tif (sensorMetadata_) {\n+\t\tV4L2SubdeviceFormat embeddedFormat;\n+\n+\t\tsensor_->device()->getFormat(1, &embeddedFormat);\n+\t\tV4L2DeviceFormat format{};\n+\t\tformat.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);\n+\t\tformat.planes[0].size = embeddedFormat.size.width * embeddedFormat.size.height;\n+\n+\t\tLOG(RPI, Debug) << \"Setting embedded data format \" << format;\n+\t\tret = unicam_[Unicam::Embedded].dev()->setFormat(&format);\n+\t\tif (ret) {\n+\t\t\tLOG(RPI, Error) << \"Failed to set format on Unicam embedded: \"\n+\t\t\t\t\t<< format;\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\t/*\n+\t * 2. Configure the ISP.\n+\t */\n+\n+\tret = isp_[Isp::Input].dev()->setFormat(&unicamFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n \t/* Use a sensible small default size if no output streams are configured. */\n+\tconst std::vector<StreamParams> &outStreams = rpiConfig->outStreams_;\n \tSize maxSize = outStreams.empty() ? Size(320, 240) : outStreams[0].cfg->size;\n \tV4L2DeviceFormat format;\n \n@@ -678,27 +706,6 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi\n \n \tispOutputTotal_++;\n \n-\t/*\n-\t * Configure the Unicam embedded data output format only if the sensor\n-\t * supports it.\n-\t */\n-\tif (sensorMetadata_) {\n-\t\tV4L2SubdeviceFormat embeddedFormat;\n-\n-\t\tsensor_->device()->getFormat(1, &embeddedFormat);\n-\t\tformat = {};\n-\t\tformat.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);\n-\t\tformat.planes[0].size = embeddedFormat.size.width * embeddedFormat.size.height;\n-\n-\t\tLOG(RPI, Debug) << \"Setting embedded data format \" << format;\n-\t\tret = unicam_[Unicam::Embedded].dev()->setFormat(&format);\n-\t\tif (ret) {\n-\t\t\tLOG(RPI, Error) << \"Failed to set format on Unicam embedded: \"\n-\t\t\t\t\t<< format;\n-\t\t\treturn ret;\n-\t\t}\n-\t}\n-\n \t/* Figure out the smallest selection the ISP will allow. */\n \tRectangle testCrop(0, 0, 1, 1);\n \tisp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &testCrop);\n",
    "prefixes": [
        "PATCH/RFC",
        "26/32"
    ]
}