Show a patch.

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

{
    "id": 14258,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14258/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14258/",
    "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": "<20211022115537.2964533-7-naush@raspberrypi.com>",
    "date": "2021-10-22T11:55:37",
    "name": "[libcamera-devel,6/6] pipeline: raspberrypi: Apply sensor flips at the start of configure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "3d175d9b144e5ebe46f445e5c4ec1f82dec7fc69",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14258/mbox/",
    "series": [
        {
            "id": 2649,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2649/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2649",
            "date": "2021-10-22T11:55:31",
            "name": "Raspberry Pi: Conversion to media controller",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2649/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14258/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14258/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 69BF3BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 11:55:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EB84868F5F;\n\tFri, 22 Oct 2021 13:55:49 +0200 (CEST)",
            "from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D952568F5A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 13:55:46 +0200 (CEST)",
            "by mail-wr1-x436.google.com with SMTP id e12so3577518wra.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 04:55:46 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:f00d:ddf0:61b0:a4cd])\n\tby smtp.gmail.com with ESMTPSA id\n\tl5sm7853364wru.24.2021.10.22.04.55.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Oct 2021 04:55:45 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Q/hoYl4c\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=86xqRCs6+mA3Dlk2ANmJcOkjcIa6VXvLIhE5udLMFg4=;\n\tb=Q/hoYl4ck1jHOmE8ESc3qlpcKF3Z/zMwgEni3PXHMmVXoVNyJ/qAeAIZGVzAlac3vu\n\txDoaX42jjRl+XrSYkBpOXrA06Djj5Mt3MsTrroCEtlQ6yOBlZgT2oIugVyfBWKtUzxX4\n\t9lfKPNiYn/Y//Jk8nsmoAWBiE6/wDxVRMOuxrmQXksw6WV9kasu2RG4VhjKjvoLqqHUn\n\tUuLErgwOUU+iBoBrz6/JVqIhPPs37amucBvbGgqHvR56jZiVz069JvfQqBcqYkaEJ2X9\n\tCP5uVBVgMBfjjUspA19rarHEBth4VzvwP1oLpWsuLg4iZSiC154DdrlAwLRHv0OCUnT+\n\tTwAg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=86xqRCs6+mA3Dlk2ANmJcOkjcIa6VXvLIhE5udLMFg4=;\n\tb=OQC7ua6sbbuwI8wVZitcNjzgZImFywinbm/ItlZJO0vgNabjvTcg87eEG4oae6mshg\n\t0RQUJ3RxMDKn7oc8OUrWUCDtrgS7NjJDrWMabkYKcYfwrZ81Ha+C9wWxKEay5QNa4amh\n\tVJvbQPnpjIg9DnGCkGthy3xhMK4lcr+kO0HXIfHXzzXuLjKYD7A7NmTFOA4DmJNR8XC/\n\t7Xvgx8rSw00W13rNUKCTueGys66yCKT0u2Ff5icvgsS8ann1tB7u8yvU6ZBJa5Jkkuo2\n\t8SFuwHboe2rvWwJDR02DE/sVXWt1ZakSiBJxhYtiN+ueXI64ZZvh2JmBqqnHjMHwTVf1\n\tpgoQ==",
        "X-Gm-Message-State": "AOAM530MKexfCrRzlU9fiqrys3H4dmAUf+BHC38NUT7Hd//E0rr0ZFqL\n\t0IyDbbXoo1HIb+sL42/WF1oriHsHQ97c9/uv",
        "X-Google-Smtp-Source": "ABdhPJzOHGgJxtRB2Qymi3nZyAzpFA4HBDv1EbsQG9i3ldSd4oq2Ce9m5mjIYbyo98ClJQoeP8HZ9g==",
        "X-Received": "by 2002:adf:fa8b:: with SMTP id\n\th11mr15270659wrr.74.1634903746367; \n\tFri, 22 Oct 2021 04:55:46 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 22 Oct 2021 12:55:37 +0100",
        "Message-Id": "<20211022115537.2964533-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211022115537.2964533-1-naush@raspberrypi.com>",
        "References": "<20211022115537.2964533-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 6/6] pipeline: raspberrypi: Apply sensor\n\tflips at the start of configure()",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Sensor flips might change the Bayer order of the requested format. The existing\ncode would set a sensor format along with the appropriate Unicam and ISP input\nformats, but reset the latter two on start() once the flips had been requested.\n\nWe can now set the sensor flips just after we set the sensor mode in\nconfigure(), thereby not needing the second pair of format sets in start().\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 61 +++++++------------\n 1 file changed, 22 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 5aaf24436f27..8fb6197ec283 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -639,16 +639,35 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t/* First calculate the best sensor mode we can use based on the user request. */\n \tSensorMode sensorMode = findBestMode(data->sensorFormats_, rawStream ? sensorSize : maxSize);\n \tV4L2SubdeviceFormat sensorFormat = toV4L2SubdeviceFormat(sensorMode);\n-\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorMode);\n \n \tret = data->sensor_->setFormat(&sensorFormat);\n \tif (ret)\n \t\treturn ret;\n \n \t/*\n-\t * Unicam image output format. The ISP input format gets set at start,\n-\t * just in case we have swapped bayer orders due to flips.\n+\t * Configure the H/V flip controls based on the combination of\n+\t * the sensor and user transform.\n \t */\n+\tif (data->supportsFlips_) {\n+\t\tconst RPiCameraConfiguration *rpiConfig =\n+\t\t\tstatic_cast<const RPiCameraConfiguration *>(config);\n+\t\tControlList controls;\n+\n+\t\tcontrols.set(V4L2_CID_HFLIP,\n+\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::HFlip)));\n+\t\tcontrols.set(V4L2_CID_VFLIP,\n+\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::VFlip)));\n+\t\tdata->setSensorControls(controls);\n+\n+\t\t/*\n+\t\t * IPA configure may have changed the sensor flips - hence the bayer\n+\t\t * order. So update the sensor format now.\n+\t\t */\n+\t\tdata->sensor_->device()->getFormat(0, &sensorFormat);\n+\t\tsensorMode.first = BayerFormat::fromMbusCode(sensorFormat.mbus_code).toPixelFormat();\n+\t}\n+\n+\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorMode);\n \tret = data->unicam_[Unicam::Image].dev()->setFormat(&unicamFormat);\n \tif (ret)\n \t\treturn ret;\n@@ -657,10 +676,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t       << \" - Selected sensor mode: \" << sensorFormat.toString()\n \t\t       << \" - Selected unicam mode: \" << unicamFormat.toString();\n \n-\t/*\n-\t * This format may be reset on start() if the bayer order has changed\n-\t * because of flips in the sensor.\n-\t */\n \tret = data->isp_[Isp::Input].dev()->setFormat(&unicamFormat);\n \tif (ret)\n \t\treturn ret;\n@@ -881,23 +896,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \t\treturn ret;\n \t}\n \n-\t/*\n-\t * IPA configure may have changed the sensor flips - hence the bayer\n-\t * order. Get the sensor format and set the ISP input now.\n-\t */\n-\tV4L2SubdeviceFormat sensorFormat;\n-\tdata->sensor_->device()->getFormat(0, &sensorFormat);\n-\n-\tV4L2DeviceFormat ispFormat;\n-\tispFormat.fourcc = BayerFormat::fromMbusCode(sensorFormat.mbus_code).toV4L2PixelFormat();\n-\tispFormat.size = sensorFormat.size;\n-\n-\tret = data->isp_[Isp::Input].dev()->setFormat(&ispFormat);\n-\tif (ret) {\n-\t\tstop(camera);\n-\t\treturn ret;\n-\t}\n-\n \t/* Enable SOF event generation. */\n \tdata->unicam_[Unicam::Image].dev()->setFrameStartEnabled(true);\n \n@@ -1311,10 +1309,6 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n \n int RPiCameraData::configureIPA(const CameraConfiguration *config)\n {\n-\t/* We know config must be an RPiCameraConfiguration. */\n-\tconst RPiCameraConfiguration *rpiConfig =\n-\t\tstatic_cast<const RPiCameraConfiguration *>(config);\n-\n \tstd::map<unsigned int, IPAStream> streamConfig;\n \tstd::map<unsigned int, ControlInfoMap> entityControls;\n \tipa::RPi::IPAConfig ipaConfig;\n@@ -1365,17 +1359,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t\treturn -EPIPE;\n \t}\n \n-\t/*\n-\t * Configure the H/V flip controls based on the combination of\n-\t * the sensor and user transform.\n-\t */\n-\tif (supportsFlips_) {\n-\t\tcontrols.set(V4L2_CID_HFLIP,\n-\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::HFlip)));\n-\t\tcontrols.set(V4L2_CID_VFLIP,\n-\t\t\t     static_cast<int32_t>(!!(rpiConfig->combinedTransform_ & Transform::VFlip)));\n-\t}\n-\n \tif (!controls.empty())\n \t\tsetSensorControls(controls);\n \n",
    "prefixes": [
        "libcamera-devel",
        "6/6"
    ]
}