Show a patch.

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

{
    "id": 14363,
    "url": "https://patchwork.libcamera.org/api/patches/14363/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14363/",
    "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": "<20211027092803.3671096-10-naush@raspberrypi.com>",
    "date": "2021-10-27T09:28:03",
    "name": "[libcamera-devel,v3,9/9] pipeline: raspberrypi: Apply sensor flips at the start of configure()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f37c4dbe3157eaf8baf617eaa1974a48136d1012",
    "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/14363/mbox/",
    "series": [
        {
            "id": 2660,
            "url": "https://patchwork.libcamera.org/api/series/2660/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2660",
            "date": "2021-10-27T09:27:54",
            "name": "Raspberry Pi: Conversion to media controller",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2660/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14363/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14363/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 56F23BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 09:28:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1584B64881;\n\tWed, 27 Oct 2021 11:28:24 +0200 (CEST)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 26CC564889\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 11:28:15 +0200 (CEST)",
            "by mail-wr1-x42d.google.com with SMTP id e12so2992432wra.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 02:28:15 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:6561:eb24:3f00:ce98])\n\tby smtp.gmail.com with ESMTPSA id\n\tx2sm2861360wmj.3.2021.10.27.02.28.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Oct 2021 02:28:14 -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=\"H6AnylAL\"; 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=6LOw+Zj1HQnnnUcZtvYdwAlLCTY3R/hzuHOJJbbu6C8=;\n\tb=H6AnylALFo+q7m9N+myw/rQIeuKraUCiBdbeVyZBOMdX3SmLkGSziIuoEEl5IUIOwd\n\tsgzlqe1Sq53TtnsOl0g8XlmrCnaD4z5tL2CsbWBIRGgs9tyoGEgArld1te6jqohCzpob\n\tYyek1pm0IidB4XcjtrWBW1oJYzjrHtquRkW8BK0gA7vvm9OeivbP5R5yeodZqQZHNsye\n\tkbrcqjpDl+pUB0Iq78kHrYPk0WA67LlgGpyZDMYfYynbOmCqMtApe/2Cu4YEwzT9F/kM\n\t60nFB04jOTqc7cZhm9EjwuKmssHsFrndbiv+8ITwg5EegQDHIXUmsaMI0f7rH/awWxQX\n\tubzg==",
        "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=6LOw+Zj1HQnnnUcZtvYdwAlLCTY3R/hzuHOJJbbu6C8=;\n\tb=HThzubZ8N3U97sBBrihLLBlPCUH0rTTkvHRV7LXOLEkSVU9JpOpLC9P1aP+lwjC6/G\n\timWwDDVEcGej2TzP9ngu7ixuF/EDH7RYzPG5lnkM4Q0rJJcuqZG24ouS/w9DzKfaUFAs\n\tPdj4cvTuzQ/+rJlqpEK5Nhvr5zXkHi5D4smXYtQddsfC2YmdBt2AE1JTkqAIHTLXw5WE\n\tUd9tGJZz6H7l1ksrHUwrrfVJxOuMEp2/XUCAqutDFQR2ywBfi9Ba+CLg2l6XV9eYgBNM\n\tOBYoiv9HRr9TfAqnLkRiJ009zOQFUdCs6S9RHDa3qaO53u+FEpSGuoO7a3rziqgB8dTd\n\teOmg==",
        "X-Gm-Message-State": "AOAM530ik+FLH+9Q2ITgriuthvhJTuD15zPSbABzF3GH7HmFKyVuh659\n\tcvFQ7CbMwmNocwGinI8LXOLJIRflViWuXGqI",
        "X-Google-Smtp-Source": "ABdhPJy1OG0eRYP7Qeeq8jLLY4l4n8kExE/Z/AU2v18sf3tx2nQfd1pd7VcrtI2Ql8y0HRdINi+IEA==",
        "X-Received": "by 2002:a5d:40c9:: with SMTP id b9mr4813997wrq.409.1635326894644;\n\tWed, 27 Oct 2021 02:28:14 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 27 Oct 2021 10:28:03 +0100",
        "Message-Id": "<20211027092803.3671096-10-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211027092803.3671096-1-naush@raspberrypi.com>",
        "References": "<20211027092803.3671096-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 9/9] 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>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 56 ++++++-------------\n 1 file changed, 16 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 52521857b61c..eaa2676b891e 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -657,16 +657,28 @@ 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 \tV4L2SubdeviceFormat sensorFormat = findBestFormat(data->sensorFormats_, rawStream ? sensorSize : maxSize);\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 */\n \tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat, packing);\n \tret = data->unicam_[Unicam::Image].dev()->setFormat(&unicamFormat);\n \tif (ret)\n@@ -676,10 +688,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t       << \" - Selected sensor format: \" << sensorFormat.toString()\n \t\t       << \" - Selected unicam format: \" << 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@@ -902,23 +910,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 = mbusCodeToBayerFormat(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@@ -1332,10 +1323,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@@ -1386,17 +1373,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",
        "v3",
        "9/9"
    ]
}