Show a patch.

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

{
    "id": 17825,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17825/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17825/",
    "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": "<20221121154421.11732-4-david.plowman@raspberrypi.com>",
    "date": "2022-11-21T15:44:19",
    "name": "[libcamera-devel,v2,3/5] libcamera: v4l2_device: Add setTransform method to set a device's flip controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6728a89f7a5e72e2b1fcf0bb54a9531f6f945d1f",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17825/mbox/",
    "series": [
        {
            "id": 3625,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3625/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3625",
            "date": "2022-11-21T15:44:16",
            "name": "Resolve invalid attempts to set sensor flip controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3625/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17825/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17825/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 6EB9ABE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Nov 2022 15:44:32 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3509B63325;\n\tMon, 21 Nov 2022 16:44:31 +0100 (CET)",
            "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9023E6331C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Nov 2022 16:44:29 +0100 (CET)",
            "by mail-wm1-x330.google.com with SMTP id\n\tj5-20020a05600c410500b003cfa9c0ea76so9304606wmi.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Nov 2022 07:44:29 -0800 (PST)",
            "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\tt11-20020adff60b000000b0022e035a4e93sm11742257wrp.87.2022.11.21.07.44.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 21 Nov 2022 07:44:28 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669045471;\n\tbh=/xob/2lXFWXaYu+2N0ziwYBo59RWstBN6r3+VQ2RiU8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=BBRwieOI2Y4AGOhT3KbTy/he0qwmEfbiLm3kdOlF+WPCBLXc8Iw9VgWEHCYpbLtdE\n\thHp3XGdpJjgjcDeWDFeDoVwksiSxruDkoKF51B87/ABG/upMoKb1RAvKuCp4PUHeUE\n\tQde1SETPITAJqm/eCr4VBXMWf/2VQnXVRGu/cQUch+NBWfwbxGbrrSrBPfjOte7BdE\n\tvfRhU80hX5fJO1bF7olJ1gT0PchzMWFzJS2d4vTvQCvtNMfhw8iLDZB41u2kBlQrgu\n\thc8r26yPdHRFiUa4HvysBzkeLAzvXU8EHTmMfRlMJcV3QigAfXcodKrrcCPRWX1czI\n\tak0ULu6BjNNlg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=UblEo6hJaTrKvOBggprdXkJpOr0kkAuYVeBqmTZc4r0=;\n\tb=GR9SnSoqTTEueipSYNwDD3IRVz6ZDcqLdbpv0GmQXQMMJjREGfjNL2Y+9H57h4okCI\n\txM8Wc5ItmCXpS+oQ6ns9ZPBtE4kviE9Zm/dxgDr0VjzlD5AFE/yaYK8T5tjH5/0lvd3G\n\tTx17X4vUkrDoslb3mXD3HNBk7z0ELQ2lhfa9iyqScOTI9Z+SS9x9nMedm4QEOaJailIs\n\tMGQk5G2OOYtgUYGM0kns+yVNMSt6n2huvc7eCAch0cQURXRh7SIwZp1sjubquOmdckqN\n\tQonklYSJCOf4b4gM4HXlFIr9nXViTGA2m2P5z6eMS/X7CuHcUZhlm3u3in6eX8p14oJa\n\t8dZw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"GR9SnSoq\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=UblEo6hJaTrKvOBggprdXkJpOr0kkAuYVeBqmTZc4r0=;\n\tb=LkJ5XcB8En2+/9MEcczQbnr92361aAuMriuuVSKYC90O+Ioek29aSQzdtAU5PYxw1y\n\thFcesmLAAhU4FzLrdNHNEqYpipnllXwi0lXLMRsqZNidgr7V46VLBn8cNEuEeAvt8E8f\n\tdfDmjPIUpkbCfYMuILc23ysvr7L35bTQIUPT1vG4ykr39QccOP+l8AMEgOW/ahTT/iJ0\n\tXGq4l0G1dsZTJWlm1JD9vUnQPuYhXtvMQeDGSb3saGdpb6rakoYBPdq2jcJCk3jOvzhs\n\tK4rDqmDSrhRQ4nn7w9oGwAqKARak6nrbPV0vKTo4NYnUnuIDj5+T11OpuSGn2dh34YJs\n\tBI9A==",
        "X-Gm-Message-State": "ANoB5plWcZfX7R+AX2QjC/DMBmgb+jQRgd6gUgxws+v8fpFJL++ivJpc\n\t1ClnBjtFKhsOT/eUtutx4Icb931Yko36Jg==",
        "X-Google-Smtp-Source": "AA0mqf7GBBb1B/gIxZzMsSuMu/dnZOYlyDlRGTVhW0l/doCF91l8XvhlhEQtEPpw/Ayj4nukbDPxFA==",
        "X-Received": "by 2002:a7b:c4d8:0:b0:3cf:9bcd:5009 with SMTP id\n\tg24-20020a7bc4d8000000b003cf9bcd5009mr4565495wmk.196.1669045468844; \n\tMon, 21 Nov 2022 07:44:28 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 21 Nov 2022 15:44:19 +0000",
        "Message-Id": "<20221121154421.11732-4-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20221121154421.11732-1-david.plowman@raspberrypi.com>",
        "References": "<20221121154421.11732-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/5] libcamera: v4l2_device: Add\n\tsetTransform method to set a device's flip controls",
        "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>",
        "From": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "David Plowman <david.plowman@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The setTransform method provides a convenient way of setting the V4L2\ndevice's horizontal and vertical flip controls (where these are\navailable) according to a libcamera Transform. Additionally, the\ncaller can ask not to set the controls but merely find out whether\nthe transform is supported by the device.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/v4l2_device.h |  3 ++\n src/libcamera/v4l2_device.cpp            | 37 ++++++++++++++++++++++++\n 2 files changed, 40 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex 75304be1..09f627de 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -21,6 +21,7 @@\n \n #include <libcamera/color_space.h>\n #include <libcamera/controls.h>\n+#include <libcamera/transform.h>\n \n #include \"libcamera/internal/formats.h\"\n \n@@ -49,6 +50,8 @@ public:\n \n \tvoid updateControlInfo();\n \n+\tTransform setTransform(Transform transform, bool test = false);\n+\n protected:\n \tV4L2Device(const std::string &deviceNode);\n \t~V4L2Device();\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex c17b323f..34b17079 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -674,6 +674,43 @@ void V4L2Device::updateControlInfo()\n \t}\n }\n \n+/*\n+ * \\brief Set or test setting the device's flip controls according to \\a transform\n+ * \\param[in] transform Transform to request\n+ * \\param[in] test If true, merely test what would be set, otherwise actually set it\n+ *\n+ * This function checks whether a given \\a transform is supported by the device's\n+ * V4L2_CID_HFLIP and V4L2_CID_VFLIP controls and optionally sets them.\n+ *\n+ * If \\a test is true, it merely checks what the device can accept and returns what\n+ * would be programmed into the device. If \\a test is false, then the device is\n+ * actually programmed with updated flip values too.\n+ *\n+ * \\return The transform that has been or would be set\n+ */\n+Transform V4L2Device::setTransform(Transform transform, bool test)\n+{\n+\tTransform actualTransform = Transform::Identity;\n+\tControlList controls;\n+\n+\tif (controlInfo(V4L2_CID_HFLIP)) {\n+\t\tTransform hflip = transform & Transform::HFlip;\n+\t\tactualTransform |= hflip;\n+\t\tcontrols.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!hflip));\n+\t}\n+\n+\tif (controlInfo(V4L2_CID_VFLIP)) {\n+\t\tTransform vflip = transform & Transform::VFlip;\n+\t\tactualTransform |= vflip;\n+\t\tcontrols.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!vflip));\n+\t}\n+\n+\tif (!test)\n+\t\tsetControls(&controls);\n+\n+\treturn actualTransform;\n+}\n+\n /*\n  * \\brief Update the value of the first \\a count V4L2 controls in \\a ctrls using\n  * values in \\a v4l2Ctrls\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/5"
    ]
}