Show a patch.

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

{
    "id": 14383,
    "url": "https://patchwork.libcamera.org/api/patches/14383/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14383/",
    "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": "<20211028084646.453775-8-naush@raspberrypi.com>",
    "date": "2021-10-28T08:46:43",
    "name": "[libcamera-devel,v4,07/10] pipeline: raspberrypi: Apply sensor flips at the start of configure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9fbd2d7455b0802d088291e6eec5d1f5702eb353",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14383/mbox/",
    "series": [
        {
            "id": 2671,
            "url": "https://patchwork.libcamera.org/api/series/2671/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2671",
            "date": "2021-10-28T08:46:36",
            "name": "Raspberry Pi: Conversion to media controller",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/2671/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14383/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14383/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 39AE0C324F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Oct 2021 08:47:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E3772600C9;\n\tThu, 28 Oct 2021 10:47:04 +0200 (CEST)",
            "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5103F600C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 10:46:58 +0200 (CEST)",
            "by mail-wm1-x32b.google.com with SMTP id\n\tb82-20020a1c8055000000b0032ccc728d63so4445294wmd.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Oct 2021 01:46:58 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:b894:feb0:b828:13b])\n\tby smtp.gmail.com with ESMTPSA id\n\tz2sm1955281wmk.19.2021.10.28.01.46.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 28 Oct 2021 01:46:57 -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=\"H4oPzJA4\"; 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=MDGjX4NwGmjiRyxQlWwLzmvPyGow8IaUSTGp2CloHE0=;\n\tb=H4oPzJA4al6m7a3gdf4qFKx7KIgcRE/MAD5bXaiIyErXerMUomjkyBUhBfrXFkXOZM\n\tF4pq05fFj9tpWnvEIzZdGu/+wOy12VODmeC81Gy58gnVMne8NzMoP6wYbz9DVw3pnD88\n\tE0Nj98+WNArzcayA7/56Nr2Ki5YjQvEO3Gtw1yRCjvXeewJrpLWL+X4/D/Aj7dv3xIlb\n\tPhzsPFM1+BYYACKD4SAqOzocXCEtfbjPSTHbW7Zqq1cMP2gIkkJN5WabVUwg8tbzBHGa\n\tVjXrpxUPlAvBUEv02S2trbqLtwisWhm+XsJcneCUtaOt6khFjOVFZpF/KT5Bd0euPK6+\n\tXhAg==",
        "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=MDGjX4NwGmjiRyxQlWwLzmvPyGow8IaUSTGp2CloHE0=;\n\tb=je4Bq6M0bhPoU0bsARDnWBWVjIHrHaKGG1swSyKNkPo5wyKvcLaUVfsZ6KKV3uuiMe\n\tyN/Nag3CEa81tP/q+wJstP8EMX75i1RKCRgrbqYMCNnsfFgiMIr4WIKpxidJlbERmoEm\n\t+qysFEY/zOdH0TBnabNyT56TUORWfRGGlFn7cdUSNEREQmXsp8XmIFZB7hLcBWPy/TiT\n\tVbgnmFVtjusZbd58Ed2nxFdYwXPtBZ/jBKMrYXOpHg79Co7wAj7PQicJXBFE4d1Afafo\n\tcJplcuNjq5xWvKBto5ieYpx9ZNNCz6rvst0essP62c4eC0xPavV2zTyyIJhCUozzG4uG\n\tHhtA==",
        "X-Gm-Message-State": "AOAM530RRjzazQA4ziEC0PISHsX3kMGAV97XD9I15tkgRPoxUWT1jB6x\n\tDW79jGCbj1BN5GJN/Mn6W8YKI7KehhpRCA6z",
        "X-Google-Smtp-Source": "ABdhPJwnTaWauGrhNFByVmTZKfh0CFlDoyfaG0GbguenngzgVaNzpFrT0PIgfiuhpA9NidpuLvWF7A==",
        "X-Received": "by 2002:a1c:f601:: with SMTP id\n\tw1mr10940512wmc.112.1635410817753; \n\tThu, 28 Oct 2021 01:46:57 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 28 Oct 2021 09:46:43 +0100",
        "Message-Id": "<20211028084646.453775-8-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211028084646.453775-1-naush@raspberrypi.com>",
        "References": "<20211028084646.453775-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 07/10] 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 before 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>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 51 ++++++-------------\n 1 file changed, 16 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 1634ca98f481..e078b8b9a811 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -598,14 +598,26 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t}\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 (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+\t}\n+\n \t/* First calculate the best sensor mode we can use based on the user request. */\n \tV4L2VideoDevice::Formats fmts = data->unicam_[Unicam::Image].dev()->formats();\n \tV4L2DeviceFormat sensorFormat = findBestMode(fmts, rawStream ? sensorSize : maxSize);\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 */\n \tret = data->unicam_[Unicam::Image].dev()->setFormat(&sensorFormat);\n \tif (ret)\n \t\treturn ret;\n@@ -620,10 +632,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tLOG(RPI, Info) << \"Sensor: \" << camera->id()\n \t\t       << \" - Selected mode: \" << sensorFormat.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(&sensorFormat);\n \tif (ret)\n \t\treturn ret;\n@@ -843,18 +851,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-\tV4L2DeviceFormat sensorFormat;\n-\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n-\tret = data->isp_[Isp::Input].dev()->setFormat(&sensorFormat);\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@@ -1253,10 +1249,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@@ -1307,17 +1299,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",
        "v4",
        "07/10"
    ]
}