Show a patch.

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

{
    "id": 14265,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14265/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14265/",
    "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": "<20211022143907.3089419-7-naush@raspberrypi.com>",
    "date": "2021-10-22T14:39:07",
    "name": "[libcamera-devel,v2,6/6] pipeline: raspberrypi: Apply sensor flips at the start of configure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "14e63500963e3e19ebf93fcd7cd46d6f3afeb0ca",
    "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/14265/mbox/",
    "series": [
        {
            "id": 2650,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2650/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2650",
            "date": "2021-10-22T14:39:01",
            "name": "Raspberry Pi: Conversion to media controller",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2650/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14265/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14265/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 44476BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 14:40:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 07AF268F5C;\n\tFri, 22 Oct 2021 16:40:24 +0200 (CEST)",
            "from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3EFD968F5C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 16:40:18 +0200 (CEST)",
            "by mail-wr1-x435.google.com with SMTP id d13so628087wrf.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 07:40:18 -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\tr205sm8577878wma.3.2021.10.22.07.40.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Oct 2021 07:40:16 -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=\"ol88NpK6\"; 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=rS8souYoYk4gsvn/YKRYkOCcLKCa7xP51raLarZqbo4=;\n\tb=ol88NpK6Ey5/Okp8QARlt78mRmmJMXUgV+amxGlHTmLYOFo2+mGvln4OG+2bV9De/0\n\tT8ELAwmOPKvijfKvNGAkQNoQMOEDApPLP9HWo96AkpeVH/Twe8ngiRBrnav6dwwF3EBM\n\ttkcZ1VEYFGr21wZ+UEJloPzKn97b0i2ZsdxawcvNwr+wzAhWs7zhGlvqiTmwFmats6/s\n\tHHsu0cHImga/nJreJwp/vQXEXZk1tfAR7+yCBbvmtZmPb0LNnDC1RqJfWCD3byDFr2pE\n\tmEBUgyW75CZqxcl9OVYs74g66w0AXbFPXhk3dTFh8xtX5q0Wstzef/R456BW2wnIXBen\n\tJVxw==",
        "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=rS8souYoYk4gsvn/YKRYkOCcLKCa7xP51raLarZqbo4=;\n\tb=Rgj+3QHTKQqF0S7KEsiUVAKqfyvsV3Jmn2HpyU6e2g/XpYrvsACb7hVrov2Atd/5Hp\n\tlafq7TlaleE1y5DFPMEg/BcTnefD4pSxlUvI33BJHm/eBcTayP61sOu5Jc3I9F8SUAaU\n\tTlwpsrVAQb88b7/2ZGb3pax/bUyoCAHFCQ5Dd9fsp+0IFmjWVQfFsTNifp8Pi2FNn9fc\n\t5sz9XhbAK5pudysmUspLtbrfjHf+EGQuq/TntsOAHtYiqQAX8/Kh988xDhz9aLctnH3Y\n\tthDVyMJK3Q0KRQtyg8s7/BoHKCxpM2/CVDv6c206nsWb2Us/JnUPXnHlRl0OYGm5edDW\n\tqxwg==",
        "X-Gm-Message-State": "AOAM533Fi7ltb8p414V0po3vVJd8eXStrZZCN0Cj+ydPsiH9YPz1tXfC\n\tAxLmKKP3XJTzn2KROX41z6/UPl2GtwnXnfec",
        "X-Google-Smtp-Source": "ABdhPJzl6sbD06rcbkqF5xcv33M7elMJNUXvLDXpz9008h8GPX4+9lZFpSm8JyArskhIK0XQYxsipw==",
        "X-Received": "by 2002:adf:e689:: with SMTP id r9mr320484wrm.426.1634913617698; \n\tFri, 22 Oct 2021 07:40:17 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 22 Oct 2021 15:39:07 +0100",
        "Message-Id": "<20211022143907.3089419-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211022143907.3089419-1-naush@raspberrypi.com>",
        "References": "<20211022143907.3089419-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 6/6] pipeline: raspberrypi: Apply\n\tsensor flips 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>\nReview-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 60 +++++++------------\n 1 file changed, 21 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex c5e9607c7d95..ad6f1231bbf6 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -627,16 +627,34 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \n \t/* First calculate the best sensor mode we can use based on the user request. */\n \tV4L2SubdeviceFormat sensorFormat = findBestMode(data->sensorFormats_, rawStream ? sensorSize : maxSize);\n-\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat, unpacked);\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}\n+\n+\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat, unpacked);\n \tret = data->unicam_[Unicam::Image].dev()->setFormat(&unicamFormat);\n \tif (ret)\n \t\treturn ret;\n@@ -645,10 +663,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@@ -871,23 +885,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@@ -1301,10 +1298,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@@ -1355,17 +1348,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",
        "v2",
        "6/6"
    ]
}