From patchwork Sat Jul 4 00:52:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8612 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 53EABBE905 for ; Sat, 4 Jul 2020 00:52:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0650E60DC9; Sat, 4 Jul 2020 02:52:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Kws3mbSC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 260B660DD5 for ; Sat, 4 Jul 2020 02:52:40 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A03B551B; Sat, 4 Jul 2020 02:52:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593823959; bh=tZYYYN9GGqLxNhRtKTABpQS2zLJTgxUqy6Y4dv2qgyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kws3mbSC3Jfi6SrNyEot8+KJHMI1KRnJNwYzIMGOKIsj+QSdaxeADZtn45S1yCgtV TRhgWaioS16bnDKExKI7acU52jDkHjUTA5Kl11Qs+Ztrr4ksE118UInG8p/Cegv10A D1v96jlyT6450zhqLIhdw4zrr0KEraEXP8jBkEBw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jul 2020 03:52:23 +0300 Message-Id: <20200704005227.21782-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704005227.21782-1-laurent.pinchart@ideasonboard.com> References: <20200704005227.21782-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 08/12] libcamera: pipeline: raspberrypi: Set sensor flip based on rotation 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Instead of receiving sensor orientation configuration from the IPA, retrieve it from the CameraSensor Rotation property, and configure the HFLIP and VFLIP controls accordingly. Signed-off-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 74bee6895dcd..fda6831e6a7e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -1174,6 +1175,13 @@ int RPiCameraData::configureIPA() ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig, nullptr); + /* Configure the H/V flip controls based on the sensor rotation. */ + ControlList ctrls(unicam_[Unicam::Image].dev()->controls()); + int32_t rotation = sensor_->properties().get(properties::Rotation); + ctrls.set(V4L2_CID_HFLIP, static_cast(!!rotation)); + ctrls.set(V4L2_CID_VFLIP, static_cast(!!rotation)); + unicam_[Unicam::Image].dev()->setControls(&ctrls); + return 0; } @@ -1202,10 +1210,6 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData { V4L2_CID_EXPOSURE, action.data[1] } }); sensorMetadata_ = action.data[2]; } - - /* Set the sensor orientation here as well. */ - ControlList controls = action.controls[0]; - unicam_[Unicam::Image].dev()->setControls(&controls); return; }