{"id":19116,"url":"https://patchwork.libcamera.org/api/1.1/patches/19116/?format=json","web_url":"https://patchwork.libcamera.org/patch/19116/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20231006132000.23504-15-naush@raspberrypi.com>","date":"2023-10-06T13:19:54","name":"[libcamera-devel,14/20] pipeline: rpi: Move flip handling validation code","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7c07f5964b7963f1a214192e09155e45d6f8ebf4","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19116/mbox/","series":[{"id":4047,"url":"https://patchwork.libcamera.org/api/1.1/series/4047/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4047","date":"2023-10-06T13:19:40","name":"Raspberry Pi: Preliminary PiSP support","version":1,"mbox":"https://patchwork.libcamera.org/series/4047/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19116/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19116/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 EF964C32BE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Oct 2023 13:20:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A20C762975;\n\tFri,  6 Oct 2023 15:20:17 +0200 (CEST)","from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 963E06298D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Oct 2023 15:20:14 +0200 (CEST)","by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-4060b623e64so13372705e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 06 Oct 2023 06:20:14 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tm8-20020a056000180800b00321773bb933sm1639478wrh.77.2023.10.06.06.20.13\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 06 Oct 2023 06:20:13 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1696598417;\n\tbh=lxLUS7Hgi9jrttTfv8CuhWjCTyChmx++p2Hrtu/i7/Y=;\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=M7ldXRcZJPHdQ4ArIFdrrlgDz0dcSyMb1YQXhwlr00o0pcgjbbYmOqjYYVbb7A7ap\n\t5Gv1kdpBD0OaCpMGPCNw/YiWDdXsZSlENwnr9iw1V/PeHWKWjUc3Zo71t7OdNac9jY\n\tGTjjSawUNnAuFdfvYq/+gUrDA+6hoKqA+go1oxKBJeop5Z+HEyMmTHyR3/rAE1F/92\n\tTXB9vkdTw0+D6D7EMg5FMkYCZKiYH5Up+rFcZ8gSvGUwNHDMDOG3OB6f46Dhpg0eBo\n\t0cIeUvaBpEhuFMrANuT2SVIMYgjM2CUtBXqwp1rSQi8MBeQVsMH1Owhb0GiAty3Qcq\n\ty8xzGzG0Tbe6A==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1696598414; x=1697203214;\n\tdarn=lists.libcamera.org; \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=3Ioik+ycSDe1X4mbw6aoWVc5szejZU03FQI4ZHIzFI0=;\n\tb=OiJXJ0hQETSJxjIeDd7uTs/ZZLnnHXp3ZM1KxphUGjfp0MmvDFjKWvjoRyiKFfylxI\n\teYW5EfFNc/mSx/Q0XkbxZQPPfmh4ZukSAuPjni6o7W4qNdT2HLu6F+QNr2HPHFlm200P\n\txfAMBeZ1xy9rXxrS4x7uiKhnrR+IulNUhdkzxC8x21XF1L/zNm/TOy6TQDbN/TSHCDzT\n\tP4NCLK4DU549nluBZRZ1LzZ/5LEXp20V/WS9j99IUdxMq5ROXA2kavrx0RFoGKLpN0xS\n\tOHD4VnD4NlOxhpXi6ExyCohOID0U6hyuDzEmX75oVVX2LeVaLwBWrDNvD3PsKsjB6sI8\n\tyQig=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"OiJXJ0hQ\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1696598414; x=1697203214;\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=3Ioik+ycSDe1X4mbw6aoWVc5szejZU03FQI4ZHIzFI0=;\n\tb=VwdqgE2EvlDuGq1wjF2cnoOoH3xWSC3ZLoPcJVQIMtg/lhYVm4H9nF9/iiXmBNikKj\n\tExvNYIBxaP2Wdcd+2eNXig0+UZ0yGwdQnz+B4nBRkVIYq412RxNKIpqglvz8yqYE/naD\n\tzeIY1G7AlZfk51/3/JPKAWunkjRcGi+oyEosluXwQzfa09TV+50tT5fS62dopr3PKB8u\n\tcmNqVgqI2GffUSd8aJ7M1hLhUdbjZOt9UHfJAmTfhmtQkhiNwlk5CGfJlrZ1qbCruLLZ\n\t8YoJYuFiLs489C7eQ396drT5ZhR+BngLMilMnauM8lb86BE4t2ydYJwilqmvplLUP90r\n\tDAXA==","X-Gm-Message-State":"AOJu0YwgepLJ/NrDGVyRnN+lOfKrVnF0shvFx55++zf0cdxR68pSFwXm\n\tQ+w13PEbH1yhR4Jxz/YBBoTr4OOCwumpgu/xwUJ8+Q==","X-Google-Smtp-Source":"AGHT+IEg2UTu8a7DdvyOJHd9irFWvSlNl3yK9NzyshQi95RiTq1HbOy4psOP7HgJm6T7GZ3IwtDSFA==","X-Received":"by 2002:a05:600c:3c94:b0:400:5962:6aa9 with SMTP id\n\tbg20-20020a05600c3c9400b0040059626aa9mr3873979wmb.11.1696598413951; \n\tFri, 06 Oct 2023 06:20:13 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  6 Oct 2023 14:19:54 +0100","Message-Id":"<20231006132000.23504-15-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20231006132000.23504-1-naush@raspberrypi.com>","References":"<20231006132000.23504-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 14/20] pipeline: rpi: Move flip handling\n\tvalidation code","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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Move the handling of Bayer order changes due to flips entirely into\nplatformValidate(). This removes the need for this code to be split\nbetween platformValidate() and validate() as it is right now.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/rpi/common/pipeline_base.cpp          | 14 --------------\n src/libcamera/pipeline/rpi/vc4/vc4.cpp             | 12 ++++++++++--\n 2 files changed, 10 insertions(+), 16 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 825eae80d014..7437d38dc9ba 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -242,20 +242,6 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \t\tif (ret)\n \t\t\treturn Invalid;\n \n-\t\t/*\n-\t\t * Some sensors change their Bayer order when they are h-flipped\n-\t\t * or v-flipped, according to the transform. If this one does, we\n-\t\t * must advertise the transformed Bayer order in the raw stream.\n-\t\t * Note how we must fetch the \"native\" (i.e. untransformed) Bayer\n-\t\t * order, because the sensor may currently be flipped!\n-\t\t */\n-\t\tBayerFormat bayer = BayerFormat::fromPixelFormat(raw.cfg->pixelFormat);\n-\t\tif (data_->flipsAlterBayerOrder_) {\n-\t\t\tbayer.order = data_->nativeBayerOrder_;\n-\t\t\tbayer = bayer.transform(combinedTransform_);\n-\t\t}\n-\t\traw.cfg->pixelFormat = bayer.toPixelFormat();\n-\n \t\tif (RPi::PipelineHandlerBase::updateStreamConfig(raw.cfg, raw.format))\n \t\t\tstatus = Adjusted;\n \t}\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 233473e2fe2b..4b42ddc71115 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -411,9 +411,17 @@ CameraConfiguration::Status Vc4CameraData::platformValidate(RPi::RPiCameraConfig\n \t\tStreamConfiguration *rawStream = rawStreams[0].cfg;\n \t\tBayerFormat rawBayer = BayerFormat::fromMbusCode(rpiConfig->sensorFormat_.mbus_code);\n \n-\t\t/* Handle flips to make sure to match the RAW stream format. */\n-\t\tif (flipsAlterBayerOrder_)\n+\t\t/*\n+\t\t * Some sensors change their Bayer order when they are h-flipped\n+\t\t * or v-flipped, according to the transform. If this one does, we\n+\t\t * must advertise the transformed Bayer order in the raw stream.\n+\t\t * Note how we must fetch the \"native\" (i.e. untransformed) Bayer\n+\t\t * order, because the sensor may currently be flipped!\n+\t\t */\n+\t\tif (flipsAlterBayerOrder_) {\n+\t\t\trawBayer.order = nativeBayerOrder_;\n \t\t\trawBayer = rawBayer.transform(rpiConfig->combinedTransform_);\n+\t\t}\n \n \t\t/* Apply the user requested packing. */\n \t\trawBayer.packing = BayerFormat::fromPixelFormat(rawStream->pixelFormat).packing;\n","prefixes":["libcamera-devel","14/20"]}