{"id":9417,"url":"https://patchwork.libcamera.org/api/patches/9417/?format=json","web_url":"https://patchwork.libcamera.org/patch/9417/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200828144110.17303-3-david.plowman@raspberrypi.com>","date":"2020-08-28T14:41:05","name":"[libcamera-devel,v4,2/7] libcamera: pipeline: raspberrypi: Set sensor orientation during validate","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a98925db723d1760ed8e4f2409359ab5a08ac2c9","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9417/mbox/","series":[{"id":1250,"url":"https://patchwork.libcamera.org/api/series/1250/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1250","date":"2020-08-28T14:41:03","name":"2D transforms","version":4,"mbox":"https://patchwork.libcamera.org/series/1250/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9417/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9417/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 EE865BF019\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Aug 2020 14:41:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD946628EE;\n\tFri, 28 Aug 2020 16:41:21 +0200 (CEST)","from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 844EE6291F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Aug 2020 16:41:18 +0200 (CEST)","by mail-wm1-x332.google.com with SMTP id s13so1152463wmh.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Aug 2020 07:41:18 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\ts12sm2493724wmj.26.2020.08.28.07.41.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 28 Aug 2020 07:41:17 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"jR73RrRH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=P2K+eKX7FaaNcA/AksWwAKgH6mqYW8ujEtMVhB6/Uqs=;\n\tb=jR73RrRHXamnBVtjRDEBSPg8GTGV/n+OZRLcBWPGaZYnu6rsQEOTHtKUPEthJv5s+B\n\txmC60fgypjVkvQCdB/wNTC1A9YRBR///Hgy346ob/ArHZZ6h6j/QEBzZKVpbIyN2U0oX\n\t4I4T8t18Fj1EoIw8k0ZPrOb0YZbrVlvbosIQW/TWYDZd4mvVPbFJF/rG1iC5fezI/wXD\n\tMRaVkfBgOgeMuarveKNQoQNKXTBdQOoBHy7x31LhLWNZ78fwprV083VPJFo7arkqeTJk\n\t2yOEJejWDcIGqxDx6/NEbb1ebMKmvloVlPrjQ0dmNm3UiDUdJ+dDiE/p/N7HPl6tPyFW\n\tn8Kw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=P2K+eKX7FaaNcA/AksWwAKgH6mqYW8ujEtMVhB6/Uqs=;\n\tb=T1AeU/FwoSL0M8x49xb29eYd3BMQdMW+UlHIAUhlM8pAdY0p+vopjrFbUmAp6L8Bmq\n\tXx0459Ac6EOPay/xBZj+nQruBVQ/ECNb4Mn7u2Mq1e6Cj0j1LLhcBEibyucD79xu84K1\n\tCoDLc4/dHLjWWEQ4g+33SbYSs5rLCVVzBEnRiOWLVvgrzpU3yxBwH1lS4MTUVMRUu28j\n\tpH8rgqx6JIe/0klqC/QZO/YadG/KVlZtdnZfErZfmJ/TLMWguD4DFPZoS6z7FRzJ6MQ3\n\tfupUNecGjliTx/GRWZxHrvjr2NQK0QoonzPBR3knYNcsYbu8WYFKLPIH5uenrpFHNNg5\n\tbFrQ==","X-Gm-Message-State":"AOAM530COpVC2trnr1fpHWpj9hw3urJlB3k22Ktjs5af3BTsr28dWrCm\n\tSrRC8iwtNtwFSGH62cIivfuGAZFO4B4jgQ==","X-Google-Smtp-Source":"ABdhPJzNJkE2+QRHwN2O0QNLGN9LtY5gMk5aa5p1/x4MFOKRzdg5pzd4UXv1LzQVLljlxIS8vQpbRA==","X-Received":"by 2002:a7b:cf3a:: with SMTP id m26mr2065040wmg.25.1598625677736;\n\tFri, 28 Aug 2020 07:41:17 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","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:\n\tSet sensor orientation during validate","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"We set the sensor orientation (h and v flips) during validate as this\nwill in general affect the Bayer order output by the sensor. Doing it\nhere means that the correct raw format gets advertised in any raw\nstreams that the application requested.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp       | 18 +++++++++++-------\n 1 file changed, 11 insertions(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 42c9caa..7aace71 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -400,6 +400,17 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \tif (config_.empty())\n \t\treturn Invalid;\n \n+\t/*\n+\t * Configure the H/V flip controls based on the sensor rotation. We do\n+\t * this here so that the sensor has the correct Bayer format that will\n+\t * get advertised in the configuration of any raw streams.\n+\t */\n+\tControlList ctrls(data_->unicam_[Unicam::Image].dev()->controls());\n+\tint32_t rotation = data_->sensor_->properties().get(properties::Rotation);\n+\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!rotation));\n+\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!rotation));\n+\tdata_->unicam_[Unicam::Image].dev()->setControls(&ctrls);\n+\n \tunsigned int rawCount = 0, outCount = 0, count = 0, maxIndex = 0;\n \tstd::pair<int, Size> outSize[2];\n \tSize maxSize;\n@@ -1164,13 +1175,6 @@ int RPiCameraData::configureIPA()\n \t\t\t\t\t      { V4L2_CID_EXPOSURE, result.data[1] } });\n \t\t\tsensorMetadata_ = result.data[2];\n \t\t}\n-\n-\t\t/* Configure the H/V flip controls based on the sensor rotation. */\n-\t\tControlList ctrls(unicam_[Unicam::Image].dev()->controls());\n-\t\tint32_t rotation = sensor_->properties().get(properties::Rotation);\n-\t\tctrls.set(V4L2_CID_HFLIP, static_cast<int32_t>(!!rotation));\n-\t\tctrls.set(V4L2_CID_VFLIP, static_cast<int32_t>(!!rotation));\n-\t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n \t}\n \n \tif (result.operation & RPI_IPA_CONFIG_SENSOR) {\n","prefixes":["libcamera-devel","v4","2/7"]}