Patch Detail
Show a patch.
GET /api/1.1/patches/17768/?format=api
{ "id": 17768, "url": "https://patchwork.libcamera.org/api/1.1/patches/17768/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17768/", "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": "<20221110144556.7858-4-david.plowman@raspberrypi.com>", "date": "2022-11-10T14:45:53", "name": "[libcamera-devel,3/6] libcamera: v4l2_device: Add setTransform method to set a device's flip controls", "commit_ref": null, "pull_url": null, "state": "superseded", "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/17768/mbox/", "series": [ { "id": 3602, "url": "https://patchwork.libcamera.org/api/1.1/series/3602/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3602", "date": "2022-11-10T14:45:50", "name": "Resolve invalid attempts to set sensor flip controls", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3602/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17768/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17768/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 5B5F8BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Nov 2022 14:46:09 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1B38363094;\n\tThu, 10 Nov 2022 15:46:09 +0100 (CET)", "from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D5A7D63075\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 15:46:05 +0100 (CET)", "by mail-wr1-x42f.google.com with SMTP id h9so2637504wrt.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 06:46:05 -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\tu24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Nov 2022 06:46:04 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668091569;\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=WpeXrLD5CPm62piMs4UAwYQv+RzQ+VlQroM0ITmSKctwiM3wKv9iGpkv1j7ubswUj\n\tI/Da9h6jINB5zB1YBn79UJPD/xvP5ixX+A6iDrMA5gio7WOVicvQp7U3qxxA9bd+9U\n\t7I1qjWiY6BEG0KxgOUi5XQ5dxNqA8fVvNG5V7XcNEJkTgJIzttfuJI9VrDa2A0iBqC\n\t2qUmjzenKn55LjSHI0P5WhatY/B5pqA5SDaaf0JOu126oJBwmwm66jlFKtrI5D0gSE\n\tpRPxv/TgjTk3HV5+S2ee6qPxcNrLlAdr9t4L31MvnRTdX7G+JYcLuWy0nJ39+8x8J4\n\tyi238+POQWQUA==", "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=DaGaZgbwQo7L0PL3AIfkdqD0vlSeX3cidsIqvo4G2YXAjM0e0pc/jST/dBu9qL6uQc\n\tcDaf6hm1IHNHhx1R3ehLB5OkvnCu5uAhuzUB4DFpDEp5qoGmEcuyBvFQ8np/CuUCrfNi\n\t63oBDqnwA+EDc29aA5vDFHwGWERI1y2ht3Hak2pJfUFvTrwgdSvc741GKNUYI4Zm0exE\n\tUtZnapI9y8+KXqjEvq9q2UjwVKBQjnzlcO4cI6NTmhkV3zkeIyvBzhQrD7NYtVQ3fKLO\n\tI3FO/xZinzHxLGTxA74cFPv4jcYgl7p3wg5zGT++uKdWKILl15szUxpN+MKOyhMSj9XP\n\thAZQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"DaGaZgbw\"; 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=BoLXo/wk9nfEhO/SjFkNqJxGH14jdGzUEwqLHItQ4sMn2rKW8r+743vH1zJDkxwNP8\n\trVIrEhaNXMmb00I8EjwWM2i4YLos0x7l8vAjgs6x0HUOEQGupqVSBI2wUOW60ZZVpX0s\n\tq4TnMXsoZxNFKrgwiTDtQs5DXWH0ikpaKsREsX7BY4MvXxMmgZ9sdzv7YAkHKyANmzLB\n\tI+0EYHsiu/kDUkDN1DJbhEcp3YzVwYNZHyx4PtTvs1eDbpTX5g3yx6SRDSDfAabcItC8\n\tspNhTvXsCXdgIMEOSJXanK7zuzjVqpZwz0Dj944nck2RR5uoleYXRrg0Phs/iMrZqIUT\n\tlhAg==", "X-Gm-Message-State": "ACrzQf3GW7CbOmktlc3VhOUhqkERA4/s3Wi/MZFFbC7Or2vT48zgsNcl\n\tdAihmVgWKinAeY1ZM6IsdQwiXZUYlR8Cig==", "X-Google-Smtp-Source": "AMsMyM6LtC2baKMH+5sNxtA8LHewenjI7wZ6u2hJsdW/ggQuA98nlAx6BXjIYS40ZXlmJKRGhEzYOA==", "X-Received": "by 2002:adf:db10:0:b0:231:bcaa:313b with SMTP id\n\ts16-20020adfdb10000000b00231bcaa313bmr39191143wri.142.1668091565174; \n\tThu, 10 Nov 2022 06:46:05 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 10 Nov 2022 14:45:53 +0000", "Message-Id": "<20221110144556.7858-4-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20221110144556.7858-1-david.plowman@raspberrypi.com>", "References": "<20221110144556.7858-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/6] 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", "3/6" ] }