From patchwork Thu Nov 10 14:45:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17766 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8736DC3285 for ; Thu, 10 Nov 2022 14:46:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E65F56307F; Thu, 10 Nov 2022 15:46:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091564; bh=7XAMEwB+kGGG0KsM65uR/xgA8tfU2IrSJ/iTMvN5CvY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SoMeucCBBjDgNfpb2J/U/M6/J8QltYcQwsj9OBvJtKY8CE4Ro4e4r+IduXnSu6WU9 oJHG/fE8CbPzMPh0xWELyjis86KN2kkKoOHbup+BMz01gS0AIZpFRTlOnwHbm2YkrZ gsNIc5iD4hSUlh5gnxYgWWc/7m9SDomaGAlAEvMLkhKFHjcakgny3w7eOts+NXwP5J az8Jl4rMrkVq4JIWEaKBHo0sSqYPtpXVGtgIMSDwq+RafzzcAFfvokVOjWvfwpjdru o1DAOBGgQW596tACFv+yFl+q3vEV9FizG64Cq0FxRrFMX19TFP2sskM43I1DDn3ww+ aL0ZQVRIUT58g== Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C90E86307B for ; Thu, 10 Nov 2022 15:46:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hmTHNnP3"; dkim-atps=neutral Received: by mail-wr1-x42d.google.com with SMTP id v1so2549349wrt.11 for ; Thu, 10 Nov 2022 06:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VyI3v9GDjJiklg6l9N/VsNz/O4lNh0mKH20mHfn4OpM=; b=hmTHNnP3jj0dzQSAVvUwxn+jvtS9sYr8O7/2BHvJyXGUFzg/SA7EglGw09cH/Zm/HK NzCv0kxpLBJf8O78V/pMZQSgdP0kcGxvKaSWr0I1csowip4Bs1fsDiKGPfajG+c4KNyl t7z5YWyZlhiSIeeRaySsrkKkc+QOucei0A8V416COZiZDlL8Mkn8Xxc3AwQ05H/HDH8/ 8JYunNHIfMnQoNNsbzVKOuQrUjZMdP4Ws8I2R3P5oGXrV68UrGe+ci6kycvPj/qPRLhA 99XJcyiEPRk114ic9UzLMT+yiIqrgb6phfYz2DNcqUEDac5HINSkYe04cKoZhVBxHzAb cNtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VyI3v9GDjJiklg6l9N/VsNz/O4lNh0mKH20mHfn4OpM=; b=UOuibCbxCc/P2JYWVkeryAgT7yW6q49nPMpb3bEiJSSoJCi+0yc4hZ7k/RViBLrHU+ PU3pZ8Du7U4necV/5dkaJCPLK4wFOvXvHwI05VevEIfvVBz7IcxrrAdMKhfyim1jAHir ItE7kPSPZmPdxZPrxJKjx2dP4vEm1EKS5aXxQIZ0p3gg52C1TpFkXI3pH4CLMka4/741 LXHh8AFLJgPgL4vN/FZyuj6tTIJnJ0m7GpiVAp8f0OVYuAogczPyKbdrEi7B36zsqxyr KIqo6NU/yKmr/i2FycoHSWfqjnXhMfMty+82/eQleWBFeYmdpB04HSAkfmv+chmPqkNp RTPg== X-Gm-Message-State: ACrzQf1FjJDmdGPEpN2Y7ZsMhhGqWojg7McHJskSetei28VU+pGDYGGa 19fyM5TAYo9PaS4gQ9KtfpJrlCNPjI98uA== X-Google-Smtp-Source: AMsMyM6uRS/3Flla60Wuoop8WRyQuDLrYOdJbgcuq44BgO+rC+hZaAdIjoVNa65xTH6mplKbulfNtQ== X-Received: by 2002:a5d:448d:0:b0:235:98b:6145 with SMTP id j13-20020a5d448d000000b00235098b6145mr41260843wrq.421.1668091563088; Thu, 10 Nov 2022 06:46:03 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:02 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:51 +0000 Message-Id: <20221110144556.7858-2-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 Subject: [libcamera-devel] [PATCH 1/6] libcamera: bayer_format: Add toMbusCode method X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This makes it easier to perform transformations on Bayer type mbus codes by converting them to a BayerFormat, doing the transform, and then converting them back again. Signed-off-by: David Plowman Reviewed-by: Jacopo Mondi --- include/libcamera/internal/bayer_format.h | 1 + src/libcamera/bayer_format.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h index 78ba3969..3601dccb 100644 --- a/include/libcamera/internal/bayer_format.h +++ b/include/libcamera/internal/bayer_format.h @@ -47,6 +47,7 @@ public: } static const BayerFormat &fromMbusCode(unsigned int mbusCode); + unsigned int toMbusCode() const; bool isValid() const { return bitDepth != 0; } std::string toString() const; diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp index f27cc166..fdbc4af1 100644 --- a/src/libcamera/bayer_format.cpp +++ b/src/libcamera/bayer_format.cpp @@ -226,6 +226,17 @@ const BayerFormat &BayerFormat::fromMbusCode(unsigned int mbusCode) return it->second; } +/** + * \brief Retrieve the media bus code corresponding this this BayerFormat + * \return The corresponding media bus code, or zero if none was found + */ +unsigned int BayerFormat::toMbusCode() const +{ + auto it = std::find_if(mbusCodeToBayer.begin(), mbusCodeToBayer.end(), + [this](const auto &i) { return i.second == *this; }); + return it != mbusCodeToBayer.end() ? it->first : 0; +} + /** * \fn BayerFormat::isValid() * \brief Return whether a BayerFormat is valid From patchwork Thu Nov 10 14:45:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17767 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B2AA5BE08B for ; Thu, 10 Nov 2022 14:46:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E5C26308B; Thu, 10 Nov 2022 15:46:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091567; bh=7grIAjYXQ3Ea0xXqemCp3t/taCJfdbnjQ0iJFL17Fas=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tUPFdeuCjYO+9Lzk2+Bem1adlel8899J+YXxNJzbZEHhWBqTCzbCo7EAadvt+PXze Cu62RKdYm1nRF5wxuENtil4gqw5VQ7vTKvcpXZANl3OTz2lUBK64Ci/2TxH4iF9hAj NaJagvVR0NRAjKfk+JIxuqlS4P3ybZlDDOt2Svp3TL5s2omrrcYKzUk6EjNPzjUDhk 39gRbw/gDHNReLjcL9BZcGPuLOiUwwtA/tPYFiWW5qNa6k7iodr71nN8bE75MIYu4H 47O0zzfvYMb5+yasQR4dbaKkNOx6aDQSg3e4/4jv8KlIGu05lK7J5D9Tt0Ql+d1Cei t6WpMUMZAsqeQ== Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 311D56308A for ; Thu, 10 Nov 2022 15:46:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="P8W9msFQ"; dkim-atps=neutral Received: by mail-wm1-x32c.google.com with SMTP id 187-20020a1c02c4000000b003cf9c3f3b80so3593223wmc.0 for ; Thu, 10 Nov 2022 06:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c/XUPzGRn61e9q+kM7sM57KDqq6wnGYdRwWL5ZbwlIY=; b=P8W9msFQGrKSoiyGovEsGCFmfbnE/ntGB+H0J4SBjooOBV3qS1FYINY5Scz5R2fA3Q ly3Q/T1k2ldz1WjhO9X3QTsZf3B239cge1nQvPbOiccwwMJSguWrtLNH8XltFtW9rTh2 rEokQD3rq5gunaIZEonKDTpcmxMKBMK/m+beRMwejgx3F8Hdw+zvw8yQRQb0vQ02cEF5 4rt/tDmDNZ5R8GyMxSdBpxX0a1JmLcC19p0nqGAw6+oVljhGsy9ksGj5HIkuwhe6bCMK 37ppJbQZ1OHFNUqbTi2DNZAhGsPP5nBWoVXqdcacRMH9XSrK9Vxh2590JhJTXyJLVgd5 CudA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c/XUPzGRn61e9q+kM7sM57KDqq6wnGYdRwWL5ZbwlIY=; b=dWz+HtOU/AaNDgcVLUK4J7/ira5EHBzamNAqPD0bvv0dakQGMNZlbhOJIlERUAodtc tx4cxjM4gmJFphqH13vY0zldu3fjlRJv7XYzRaKXUI0E6WXiICx0PRwJUZ0C9A/ewKHv h9HWuK4B0xPYTvE+Zq7rv2J3Hs/Uj6DWArJDRI9f4BkrCh23ZLKjBRDJbhnKPyaYGVpe Ph4DQtFwN2nGq9rgzA6w5N/bhYRUbgGH11LOqTBV8YRltxyO8A7SP6CdJljgHxMFr/kM QieAZFy2iiN0URpanuyjfqWdRUddD/QKd2GEuSN67pgwCpIslGXW59MT+NpQgaGKUN6t iRJA== X-Gm-Message-State: ACrzQf0RGVttUbHXtxzbipvL1XKLIXYl1cJPKxq0p+G2blwG/D3T29CQ qpRd+M1+R+CjDOgIfMCn1XW2Ux7tnxMjHQ== X-Google-Smtp-Source: AMsMyM52jYe7srS8FbqHHdc0I8/1eNJVDQuMSjhcPZ5iJ8tl+whpLiJLlDysPc0grjvtW0wuCkO9LQ== X-Received: by 2002:a1c:6a17:0:b0:3cf:9d32:db2e with SMTP id f23-20020a1c6a17000000b003cf9d32db2emr19514721wmc.62.1668091564034; Thu, 10 Nov 2022 06:46:04 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:03 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:52 +0000 Message-Id: <20221110144556.7858-3-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 Subject: [libcamera-devel] [PATCH 2/6] libcamera: camera_sensor: Do not clear camera flips when listing formats X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Previously the code used to clear the camnera's h and v flip bits when enumerating the supported formats so as to obtain any Bayer formats in the sensor's native (untransformed) orientation. However this fails when the camera is already in use elsewhere. Instead, we query the current state of the flip bits and transform the formats - which we obtain in their flipped orientation - back into their native orientation to be stored. Signed-off-by: David Plowman Reviewed-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 49 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 572a313a..cbac9e78 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -19,6 +19,8 @@ #include +#include + #include "libcamera/internal/bayer_format.h" #include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor_properties.h" @@ -108,18 +110,45 @@ int CameraSensor::init() return ret; /* - * Clear any flips to be sure we get the "native" Bayer order. This is - * harmless for sensors where the flips don't affect the Bayer order. + * We want to get the native mbus codes for the sensor, without any flips. + * We can't clear any flips here, so we have to read the current values + * (if the flip controls exist), decide whether they actually modify any + * output Bayer pattern, and finally undo their effect on the formats. + * + * First, check if the flip controls exist and if so read them. */ - ControlList ctrls(subdev_->controls()); - if (subdev_->controls().find(V4L2_CID_HFLIP) != subdev_->controls().end()) - ctrls.set(V4L2_CID_HFLIP, 0); - if (subdev_->controls().find(V4L2_CID_VFLIP) != subdev_->controls().end()) - ctrls.set(V4L2_CID_VFLIP, 0); - subdev_->setControls(&ctrls); + std::vector flipCtrlIds; + const struct v4l2_query_ext_ctrl *hflipInfo = subdev_->controlInfo(V4L2_CID_HFLIP); + const struct v4l2_query_ext_ctrl *vflipInfo = subdev_->controlInfo(V4L2_CID_VFLIP); + if (hflipInfo) + flipCtrlIds.push_back(V4L2_CID_HFLIP); + if (vflipInfo) + flipCtrlIds.push_back(V4L2_CID_VFLIP); + ControlList flipCtrls = subdev_->getControls(flipCtrlIds); + + /* Now construct a transform that would undo any flips. */ + Transform transform = Transform::Identity; + if (hflipInfo && flipCtrls.get(V4L2_CID_HFLIP).get() && + (hflipInfo->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT)) + transform |= Transform::HFlip; + if (vflipInfo && flipCtrls.get(V4L2_CID_VFLIP).get() && + (vflipInfo->flags & V4L2_CTRL_FLAG_MODIFY_LAYOUT)) + transform |= Transform::VFlip; + + /* Finally get the formats, and apply the transform to the mbus codes. */ + auto formats = subdev_->formats(pad_); + for (const auto &format : formats) { + unsigned int mbusCode = format.first; + BayerFormat bayerFormat = BayerFormat::fromMbusCode(mbusCode); + + if (bayerFormat.isValid()) + mbusCode = bayerFormat.transform(transform).toMbusCode(); + + if (mbusCode) + formats_[mbusCode] = std::move(format.second); + } /* Enumerate, sort and cache media bus codes and sizes. */ - formats_ = subdev_->formats(pad_); if (formats_.empty()) { LOG(CameraSensor, Error) << "No image format found"; return -EINVAL; @@ -189,7 +218,7 @@ int CameraSensor::init() * \todo The control API ought to have a flag to specify if a control * is read-only which could be used below. */ - const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK); + const ControlInfo hblank = subdev_->controls().at(V4L2_CID_HBLANK); const int32_t hblankMin = hblank.min().get(); const int32_t hblankMax = hblank.max().get(); From patchwork Thu Nov 10 14:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17768 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5B5F8BE08B for ; Thu, 10 Nov 2022 14:46:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1B38363094; Thu, 10 Nov 2022 15:46:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091569; bh=/xob/2lXFWXaYu+2N0ziwYBo59RWstBN6r3+VQ2RiU8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WpeXrLD5CPm62piMs4UAwYQv+RzQ+VlQroM0ITmSKctwiM3wKv9iGpkv1j7ubswUj I/Da9h6jINB5zB1YBn79UJPD/xvP5ixX+A6iDrMA5gio7WOVicvQp7U3qxxA9bd+9U 7I1qjWiY6BEG0KxgOUi5XQ5dxNqA8fVvNG5V7XcNEJkTgJIzttfuJI9VrDa2A0iBqC 2qUmjzenKn55LjSHI0P5WhatY/B5pqA5SDaaf0JOu126oJBwmwm66jlFKtrI5D0gSE pRPxv/TgjTk3HV5+S2ee6qPxcNrLlAdr9t4L31MvnRTdX7G+JYcLuWy0nJ39+8x8J4 yi238+POQWQUA== Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D5A7D63075 for ; Thu, 10 Nov 2022 15:46:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="DaGaZgbw"; dkim-atps=neutral Received: by mail-wr1-x42f.google.com with SMTP id h9so2637504wrt.0 for ; Thu, 10 Nov 2022 06:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UblEo6hJaTrKvOBggprdXkJpOr0kkAuYVeBqmTZc4r0=; b=DaGaZgbwQo7L0PL3AIfkdqD0vlSeX3cidsIqvo4G2YXAjM0e0pc/jST/dBu9qL6uQc cDaf6hm1IHNHhx1R3ehLB5OkvnCu5uAhuzUB4DFpDEp5qoGmEcuyBvFQ8np/CuUCrfNi 63oBDqnwA+EDc29aA5vDFHwGWERI1y2ht3Hak2pJfUFvTrwgdSvc741GKNUYI4Zm0exE UtZnapI9y8+KXqjEvq9q2UjwVKBQjnzlcO4cI6NTmhkV3zkeIyvBzhQrD7NYtVQ3fKLO I3FO/xZinzHxLGTxA74cFPv4jcYgl7p3wg5zGT++uKdWKILl15szUxpN+MKOyhMSj9XP hAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UblEo6hJaTrKvOBggprdXkJpOr0kkAuYVeBqmTZc4r0=; b=BoLXo/wk9nfEhO/SjFkNqJxGH14jdGzUEwqLHItQ4sMn2rKW8r+743vH1zJDkxwNP8 rVIrEhaNXMmb00I8EjwWM2i4YLos0x7l8vAjgs6x0HUOEQGupqVSBI2wUOW60ZZVpX0s q4TnMXsoZxNFKrgwiTDtQs5DXWH0ikpaKsREsX7BY4MvXxMmgZ9sdzv7YAkHKyANmzLB I+0EYHsiu/kDUkDN1DJbhEcp3YzVwYNZHyx4PtTvs1eDbpTX5g3yx6SRDSDfAabcItC8 spNhTvXsCXdgIMEOSJXanK7zuzjVqpZwz0Dj944nck2RR5uoleYXRrg0Phs/iMrZqIUT lhAg== X-Gm-Message-State: ACrzQf3GW7CbOmktlc3VhOUhqkERA4/s3Wi/MZFFbC7Or2vT48zgsNcl dAihmVgWKinAeY1ZM6IsdQwiXZUYlR8Cig== X-Google-Smtp-Source: AMsMyM6LtC2baKMH+5sNxtA8LHewenjI7wZ6u2hJsdW/ggQuA98nlAx6BXjIYS40ZXlmJKRGhEzYOA== X-Received: by 2002:adf:db10:0:b0:231:bcaa:313b with SMTP id s16-20020adfdb10000000b00231bcaa313bmr39191143wri.142.1668091565174; Thu, 10 Nov 2022 06:46:05 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:04 -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 Subject: [libcamera-devel] [PATCH 3/6] libcamera: v4l2_device: Add setTransform 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The setTransform method provides a convenient way of setting the V4L2 device's horizontal and vertical flip controls (where these are available) according to a libcamera Transform. Additionally, the caller can ask not to set the controls but merely find out whether the transform is supported by the device. Signed-off-by: David Plowman --- include/libcamera/internal/v4l2_device.h | 3 ++ src/libcamera/v4l2_device.cpp | 37 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index 75304be1..09f627de 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -21,6 +21,7 @@ #include #include +#include #include "libcamera/internal/formats.h" @@ -49,6 +50,8 @@ public: void updateControlInfo(); + Transform setTransform(Transform transform, bool test = false); + protected: V4L2Device(const std::string &deviceNode); ~V4L2Device(); diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index c17b323f..34b17079 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -674,6 +674,43 @@ void V4L2Device::updateControlInfo() } } +/* + * \brief Set or test setting the device's flip controls according to \a transform + * \param[in] transform Transform to request + * \param[in] test If true, merely test what would be set, otherwise actually set it + * + * This function checks whether a given \a transform is supported by the device's + * V4L2_CID_HFLIP and V4L2_CID_VFLIP controls and optionally sets them. + * + * If \a test is true, it merely checks what the device can accept and returns what + * would be programmed into the device. If \a test is false, then the device is + * actually programmed with updated flip values too. + * + * \return The transform that has been or would be set + */ +Transform V4L2Device::setTransform(Transform transform, bool test) +{ + Transform actualTransform = Transform::Identity; + ControlList controls; + + if (controlInfo(V4L2_CID_HFLIP)) { + Transform hflip = transform & Transform::HFlip; + actualTransform |= hflip; + controls.set(V4L2_CID_HFLIP, static_cast(!!hflip)); + } + + if (controlInfo(V4L2_CID_VFLIP)) { + Transform vflip = transform & Transform::VFlip; + actualTransform |= vflip; + controls.set(V4L2_CID_HFLIP, static_cast(!!vflip)); + } + + if (!test) + setControls(&controls); + + return actualTransform; +} + /* * \brief Update the value of the first \a count V4L2 controls in \a ctrls using * values in \a v4l2Ctrls From patchwork Thu Nov 10 14:45:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17769 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DAD7CC3285 for ; Thu, 10 Nov 2022 14:46:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 81FA463095; Thu, 10 Nov 2022 15:46:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091569; bh=e5cWW4cvf5Nxfg5oOAVrMT/Yb+FcJFD5zlWOs2WGIvg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=mVEjDIoJOR7xP70hmJyfY7CFTtdBFcGqaBQiI5a2wEWf4VGC4g9NMjvzaa3mpJyNQ LJqYIK5FrGovnlQYPoJ//xMFyryGJyOr/9aiWv4fdl9FP2oQR6wgPCVUIqvgWF4KnV ZqD1BpMPmOXBX52aF0MksrK7MCWA7Rrfuhs5Dz5Is1hUvtuH30JY4oBrrBX0lP2EqK hvOoOs2aIBFn5FCiQDaNwBu3bFmqY1m/8cXYLYtrfUYmFqSW9VJSIIDdKmyKutcrlL /zp1VHVcY6GDEQrVAFT1MVtMKJqmAiruBbCVkAVBHUyPXCEh9BC0Qb2PIM0/DV5rk1 6DbOChuGZSHYg== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA8D363083 for ; Thu, 10 Nov 2022 15:46:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="eb3ObKIj"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id m7-20020a05600c090700b003cf8a105d9eso1281844wmp.5 for ; Thu, 10 Nov 2022 06:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WSJzl7kxIvYV64/0iXvdPD4pm/+rRQJ7WgzAhvrgZIE=; b=eb3ObKIjBxrNa0WVsF94I+v1Ik6ADd1HzjMRkfRvKhvOsXKawZMwNvBAMvwTkGWy6C C1N8eG/6kUYJR+cNIFowXgX9NTU+uFcjMQliqyDX9md/J02Y1g4UBiVoziSfFyMGyaTX i3YR+My8lFWYlr6eLJJ4mola/DQv9+VHcQ0063VHlncO4X9gijc9kE2/9GdKv2aoxSoT 6ubRX6yJJoBBz95RwmN7Js6SwT9Z8+GKgZoI+BD7NyV4nD1ja5dVD8gUafE5YWQFimV+ z2bnbjXm2n05Rp2p3DncRFXx6imZw8vbuoEJz2fJsJ4nBTyo84d60LBNj9s3mOb6WZ+5 X9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WSJzl7kxIvYV64/0iXvdPD4pm/+rRQJ7WgzAhvrgZIE=; b=It31/4j0HbjJ9JehdULwAHx+o6M5j6YDNOeXEia44X9C95IkA38F55CnCxzlddMra2 E+tfJZaEgGzwO9yx/0z90EDHOTpfyz3GItmKEaVKLfey7T5O6fGNjOPdZAczbbJVtFmp CYzb2AfQ+/S33zkLilpQbyV2e28AD4OdwiFNdmK22CZT+UY+fgjdyoI91NcnjhqG1k6N YtcLuYQMJF1rK4EDMnP+LFKXhHYMfziF/QfGv+MIOW7dyQV/AA1l5v+vTE2UkmF36yj3 VBJcJw4s/nNLFe2Tanu5T9po5gyNZfk75P93lzPpRsmOdxynKBcBhaq0xygGCHn/DCsh /V/Q== X-Gm-Message-State: ACrzQf2vOmuSJk49vTUZE2VhKdJ2r90b9A7HVTGkqXulTX2RXHD0wZ2P nnedrpDzTGqYErH4SeTq0zfppbyhLzYwmw== X-Google-Smtp-Source: AMsMyM71bGGOu5A9NOXlLEPk/OWC3mS9+IswaYvkfB1qhtFZwr2LQ5nKMVuGEPE+I/Hg9K7umpupzw== X-Received: by 2002:a05:600c:28ce:b0:3cf:6e78:e335 with SMTP id h14-20020a05600c28ce00b003cf6e78e335mr38288108wmd.142.1668091566136; Thu, 10 Nov 2022 06:46:06 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:05 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:54 +0000 Message-Id: <20221110144556.7858-5-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 Subject: [libcamera-devel] [PATCH 4/6] libcamera: pipeline: uvcvideo: Set device's flip controls correctly X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Set the horizontal and vertical flip controls correctly by calling the device's setTransform method now that this no longer happens in CameraSensor::init(). Signed-off-by: David Plowman --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 277465b7..4a891c23 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -209,6 +209,9 @@ int PipelineHandlerUVC::configure(Camera *camera, CameraConfiguration *config) StreamConfiguration &cfg = config->at(0); int ret; + /* Set up the video device's horizontal and vertical flips. */ + data->video_->setTransform(config->transform); + V4L2DeviceFormat format; format.fourcc = data->video_->toV4L2PixelFormat(cfg.pixelFormat); format.size = cfg.size; From patchwork Thu Nov 10 14:45:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17770 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id ABDA9BE08B for ; Thu, 10 Nov 2022 14:46:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 345D463092; Thu, 10 Nov 2022 15:46:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091570; bh=zWRYYLYyqkOrcUocBsRP/3O4I7Cm39CYCiABM+o6Pq4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jzlEqyy5BnaE1ssuurCHIEwrQLbK2Nm83l4NkEZmTtFY0IV5C9D/e+IYCdTlKOmVf sJLDMJNBKhmRJuGPPGYIg33LPtiyU+tUjYrnj6q9xPNnN7F0hdKS6okfNa4Sz91aCv 263S/z4W9yttYl3rWL0AGlYTuedzPk6wI6hqOpAoVL76vPTszxEft+CgyiUbvUALf9 rGSyJRP0X1iALi/JjI8bNiml/w3+k/+s72xPU4NWjRYq3huDtDcJxDYym/iJr1D5Aq uyloTx38gYhPhy0bD5LIuec+G9zznG7HB/Vh0ibbj15H6Puv8FynDQmjbnVdTclQCA yy7vGkJ/zSv2A== Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 04BDD63087 for ; Thu, 10 Nov 2022 15:46:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Y5Ew5Rwb"; dkim-atps=neutral Received: by mail-wr1-x432.google.com with SMTP id a14so2582976wru.5 for ; Thu, 10 Nov 2022 06:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5CHKPCI01VxfTyHQ2vD5oSpDPSjSR2dmaNqS2b4P9oQ=; b=Y5Ew5RwbsFuh1nbumC2JmL8tM3gbRXirtEirBXq/K/BrA0CSbU1ZIEPqPEk7FSPKzH Fp66cSQ1VymKWsBzoSMQhwk14FjHcf67cvyOnqKyBuYm6hZj0jUcsHX+bVlAhxmt0Xc4 UHaQ4vvq5uxXJvMRaV/xwPpzmH6Pa0FG0PtRm1Xhzmxg7l7mLeH9w47nf5GsJE9XaIp2 c3OHYJIZ4sWOBNDuvtvzSfYCgRT9f5P8lp1PDeF9PAvXAspXLBGSJ0QzRD38DxwMG1Qi vkuUROvSaa8P/WJicHcs9gghQCqHfVRtcMAbLdwdUZMDp9TyUUDX2IJd7jzgt5f8bZJI 9gUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5CHKPCI01VxfTyHQ2vD5oSpDPSjSR2dmaNqS2b4P9oQ=; b=WZmXyUcoJXyzc4ZpDsCukduJ5POkEqzvU1/BgpnneEyVSopTV64RRu9wANXkAbkjQH ioetjaSIw+U3FuJqVmv/2JzZuBYnC7D/6whgxE3L6XX8E2TA9gkWq842Fg2vsaaXSFBx 4tFq8ay9D6SPNj3vjuzgAYdNlBoaMAn23xIN0NZ8DjXS1SEqL25tiP5ERJuDikHzLeSZ E3zbVy3qGYpM+f7wM3QB8Kfrmnh6Wm8q8Sg/Kn28pxTNORu1/bDfReGDY7KlZn6SL8+h GnwM1mONjjDTJj0kIjJ+Yv3cMdyuVT9YNYuMoNjuJB7fcCajyiWY/5GpFnyg8R+7gHQV 5ULQ== X-Gm-Message-State: ACrzQf0U4FEXb2LoRuj8ai0UlgYiL/EfKV17B5UsgqCxAtxUQqGSg+Mw nyEyb/LzXYf5AebYEJCxSvZaKdeePHdcNw== X-Google-Smtp-Source: AMsMyM4Xjg8p/Hj53VmmZ/d4jdMlTPfR1qFf6J60Yjs48hretzQn/ZO6FSYupQjorE1YDEmluc5ubA== X-Received: by 2002:adf:f84c:0:b0:236:6e52:504 with SMTP id d12-20020adff84c000000b002366e520504mr40182904wrq.564.1668091567061; Thu, 10 Nov 2022 06:46:07 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:06 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:55 +0000 Message-Id: <20221110144556.7858-6-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 Subject: [libcamera-devel] [PATCH 5/6] libcamera: pipeline: simple: Set device's flip controls correctly X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Set the horizontal and vertical flip controls correctly by calling the device's setTransform method now that this no longer happens in CameraSensor::init(). Signed-off-by: David Plowman --- src/libcamera/pipeline/simple/simple.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index a32de7f3..f25a8cc1 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1120,6 +1120,9 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) if (ret < 0) return ret; + /* Set up the video device's horizontal and vertical flips. */ + video->setTransform(c->transform); + /* Configure the video node. */ V4L2PixelFormat videoFormat = video->toV4L2PixelFormat(pipeConfig->captureFormat); From patchwork Thu Nov 10 14:45:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17771 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BC4A0C3285 for ; Thu, 10 Nov 2022 14:46:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5F58B63094; Thu, 10 Nov 2022 15:46:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091572; bh=e014DPz7b+gu0htAFFlrLVkAeoe1Cr35f4gHPj5FQA4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CtsY5AQ9KPyY4zOo9BO6UjZAdWXMr4FyrniyfdQ1z64EKWVS6yq9JFD6ctzx4wHbm C077XsznQuqG8+Nqe3yXfSTDEuUCxbRN1khvpnYVoouD8gCFptmyrEESG9CgQGaZxQ 7eiy+HX0x5OhDhc4L7ieNY5qn8cRE2ZnSDgdZ7Xhz9ReIclog2dapfXliwHy2ElzY4 c76RNYrPSnvq6G/vVPaC/lfY+PiULYr0QCw8xDeBdjreofy9C7Ifw3z4HZrzsXkTzi HnPjBj0FrGWdHaZcq/5RrZvh8QQYlOA4KH05Ni9O9BnXtSwlYeS7OwYN+TcUi1u7fG f2DJSB9U+42Kw== Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DF8F76308E for ; Thu, 10 Nov 2022 15:46:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="enilVswc"; dkim-atps=neutral Received: by mail-wr1-x432.google.com with SMTP id a14so2583040wru.5 for ; Thu, 10 Nov 2022 06:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0Nfmi/nEOx3ooNie+tWuNhTkC5Tqi83bho3W9L7OElg=; b=enilVswcQWriDcReCuw6UbePBQuSxnyGVRxuB0z20UbPSrrOTIZ0lxFGhjAT0pGff2 1rcVbUdI4k7JSi8NG95bdnNnotibNYbVc2kGyOYNTBeuPta/xGRfhUBaRMfHuRVWWouk 71mZuvJ5wt8IEYVJS5UCbHYo3RBbTY5kYp0wPo/RV3P2xt89+Jz0IcMg29TnL07/ViWm WG/Hywh9EnWPsPOTAyryk3LZntxNon901lPJsSTdKHPUIWOyaP3HHQ7w5IFUxYFP3j/O 4Nv3wWQ+vmqFJOl+0MwXL25L7FE9Y880DN7NK34vsiB2XyY0zTn+7/gTQa7w7cntWp9G YbvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Nfmi/nEOx3ooNie+tWuNhTkC5Tqi83bho3W9L7OElg=; b=yadRydw7C8tbBYd/EYow3yQUEEzl47QjWbQLu3rq2w4KY73JY12Ge4RVmr5x3O4ZKI EbP5ZkMsmvxUQIZYfV1nng7+/KoeeMOkso4OLtDnRpm5r5mb8Zc6yGiunuOIe/ZbVTZV wIINoVR11rW/rlE8ZUxw/NwQm6RYyQ+YT8VKmsHSFezqT+/8sGbH6hnBQeogjDYifx/w +o2ktD1AH5HnfAO0B0t4zr6O4uy15iojXl4hC702o8nA28KgambZKiNvxLD1ukBAm+dX mnianUDePZn6/k3nF319/xGemDb2w7l7WBPdFM/OVH8CVkFZr1lEjjG5MzadgiSmUtgz ANXA== X-Gm-Message-State: ACrzQf2PqTyxd4XtJAi3/6jrrS+4HIwLSFUmATov9jTzbHLG8JDKNzCj +zdNP0vqKcWLvOESjAMFkYliDy0WsLSDCg== X-Google-Smtp-Source: AMsMyM7NJO8Z88OfZnH1mh890ZEG9/onvog2zCUzNwKycj63xO8F672cgf/c7VtqWTAJ4r3BcXTnVQ== X-Received: by 2002:a5d:434b:0:b0:236:c7c2:f7fc with SMTP id u11-20020a5d434b000000b00236c7c2f7fcmr37764706wrr.685.1668091568202; Thu, 10 Nov 2022 06:46:08 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:07 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:56 +0000 Message-Id: <20221110144556.7858-7-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 Subject: [libcamera-devel] [PATCH 6/6] libcamera: pipeline: rkisp1: Set device's flip controls correctly X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Set the horizontal and vertical flip controls correctly by calling the device's setTransform method now that this no longer happens in CameraSensor::init(). Signed-off-by: David Plowman --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 3d3a7086..f144fabd 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -632,6 +632,9 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; + /* Set up the device's horizontal and vertical flips. */ + sensor->device()->setTransform(c->transform); + /* * Configure the format on the sensor output and propagate it through * the pipeline.