From patchwork Fri Aug 28 14:41:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 9417 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 EE865BF019 for ; Fri, 28 Aug 2020 14:41:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BD946628EE; Fri, 28 Aug 2020 16:41:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="jR73RrRH"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 844EE6291F for ; Fri, 28 Aug 2020 16:41:18 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id s13so1152463wmh.4 for ; Fri, 28 Aug 2020 07:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P2K+eKX7FaaNcA/AksWwAKgH6mqYW8ujEtMVhB6/Uqs=; b=jR73RrRHXamnBVtjRDEBSPg8GTGV/n+OZRLcBWPGaZYnu6rsQEOTHtKUPEthJv5s+B xmC60fgypjVkvQCdB/wNTC1A9YRBR///Hgy346ob/ArHZZ6h6j/QEBzZKVpbIyN2U0oX 4I4T8t18Fj1EoIw8k0ZPrOb0YZbrVlvbosIQW/TWYDZd4mvVPbFJF/rG1iC5fezI/wXD MRaVkfBgOgeMuarveKNQoQNKXTBdQOoBHy7x31LhLWNZ78fwprV083VPJFo7arkqeTJk 2yOEJejWDcIGqxDx6/NEbb1ebMKmvloVlPrjQ0dmNm3UiDUdJ+dDiE/p/N7HPl6tPyFW n8Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P2K+eKX7FaaNcA/AksWwAKgH6mqYW8ujEtMVhB6/Uqs=; b=T1AeU/FwoSL0M8x49xb29eYd3BMQdMW+UlHIAUhlM8pAdY0p+vopjrFbUmAp6L8Bmq Xx0459Ac6EOPay/xBZj+nQruBVQ/ECNb4Mn7u2Mq1e6Cj0j1LLhcBEibyucD79xu84K1 CoDLc4/dHLjWWEQ4g+33SbYSs5rLCVVzBEnRiOWLVvgrzpU3yxBwH1lS4MTUVMRUu28j pH8rgqx6JIe/0klqC/QZO/YadG/KVlZtdnZfErZfmJ/TLMWguD4DFPZoS6z7FRzJ6MQ3 fupUNecGjliTx/GRWZxHrvjr2NQK0QoonzPBR3knYNcsYbu8WYFKLPIH5uenrpFHNNg5 bFrQ== X-Gm-Message-State: AOAM530COpVC2trnr1fpHWpj9hw3urJlB3k22Ktjs5af3BTsr28dWrCm SrRC8iwtNtwFSGH62cIivfuGAZFO4B4jgQ== X-Google-Smtp-Source: ABdhPJzNJkE2+QRHwN2O0QNLGN9LtY5gMk5aa5p1/x4MFOKRzdg5pzd4UXv1LzQVLljlxIS8vQpbRA== X-Received: by 2002:a7b:cf3a:: with SMTP id m26mr2065040wmg.25.1598625677736; Fri, 28 Aug 2020 07:41:17 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id s12sm2493724wmj.26.2020.08.28.07.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:41:17 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Fri, 28 Aug 2020 15:41:05 +0100 Message-Id: <20200828144110.17303-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200828144110.17303-1-david.plowman@raspberrypi.com> References: <20200828144110.17303-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/7] libcamera: pipeline: raspberrypi: Set sensor orientation during validate 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" We set the sensor orientation (h and v flips) during validate as this will in general affect the Bayer order output by the sensor. Doing it here means that the correct raw format gets advertised in any raw streams that the application requested. Signed-off-by: David Plowman --- .../pipeline/raspberrypi/raspberrypi.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 42c9caa..7aace71 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -400,6 +400,17 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() if (config_.empty()) return Invalid; + /* + * Configure the H/V flip controls based on the sensor rotation. We do + * this here so that the sensor has the correct Bayer format that will + * get advertised in the configuration of any raw streams. + */ + ControlList ctrls(data_->unicam_[Unicam::Image].dev()->controls()); + int32_t rotation = data_->sensor_->properties().get(properties::Rotation); + ctrls.set(V4L2_CID_HFLIP, static_cast(!!rotation)); + ctrls.set(V4L2_CID_VFLIP, static_cast(!!rotation)); + data_->unicam_[Unicam::Image].dev()->setControls(&ctrls); + unsigned int rawCount = 0, outCount = 0, count = 0, maxIndex = 0; std::pair outSize[2]; Size maxSize; @@ -1164,13 +1175,6 @@ int RPiCameraData::configureIPA() { V4L2_CID_EXPOSURE, result.data[1] } }); sensorMetadata_ = result.data[2]; } - - /* 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); } if (result.operation & RPI_IPA_CONFIG_SENSOR) {