{"id":14360,"url":"https://patchwork.libcamera.org/api/patches/14360/?format=json","web_url":"https://patchwork.libcamera.org/patch/14360/","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":"<20211027092803.3671096-7-naush@raspberrypi.com>","date":"2021-10-27T09:28:00","name":"[libcamera-devel,v3,6/9] pipeline: raspberrypi: Set packing formats for the Unicam image node","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6c468764725a6a966bf4c9a3cda26e7df8b6d270","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14360/mbox/","series":[{"id":2660,"url":"https://patchwork.libcamera.org/api/series/2660/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2660","date":"2021-10-27T09:27:54","name":"Raspberry Pi: Conversion to media controller","version":3,"mbox":"https://patchwork.libcamera.org/series/2660/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14360/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14360/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 8FF2EBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 09:28:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C6C26488D;\n\tWed, 27 Oct 2021 11:28:18 +0200 (CEST)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D7B5F64886\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 11:28:11 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id s14so71582wrb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 02:28:11 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:6561:eb24:3f00:ce98])\n\tby smtp.gmail.com with ESMTPSA id\n\tx2sm2861360wmj.3.2021.10.27.02.28.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Oct 2021 02:28:10 -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=\"caUnQDxG\"; 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=EnUQ4idl8bJve6HakceXlG5RBJ4/vOz49Rc+AHEsMgQ=;\n\tb=caUnQDxGEOeYpGHfRYw/lwz7hwbrjPrXPI3onybog2H09/78ABitioRej3dE19JQSO\n\t3RHCY39kyYaVqtp/POJuKd1XZ/SoP7t6VcweZEa6EYY2qosekF4J1LJZXUATV/SYZBA4\n\tCllW1WuoKNiRhmk5y87smAwum+AGoMIRFOwzac0y2c865QXwvo12XWlaYclbt2U86/sy\n\tMtGtofQllknYC/7c8jSgajb4MZMawTSrrl9cz1rkmpsWdO6SqXp6bj8Z1qeC2gePPrj/\n\t/FXp9BeI6cL9LbXfgklbmZ649RjHi1Ug7CSCpcsvALafKWk3wbDAksyMM8CMYYJaCCAZ\n\tEspw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=EnUQ4idl8bJve6HakceXlG5RBJ4/vOz49Rc+AHEsMgQ=;\n\tb=mb3AX6HvcS+Vbz7BK5aaPLeOufnO3QiBIStye+rm3px9csFHT9yDC5c8X2GP4eJz+d\n\toc+HuzpSQiyb8m/lmJuZ9rIp58fQr/0ngV3GsblTXoI3CMBnQ4gUvDOlmI2ZNBoO+3OV\n\t+IUKrBxBV0XSKvkPpvCg3oHrpSPYlUr0SfCoyvB3jd4xmLwBOtpSTn427lLdSr2ql9kY\n\tsJ+kNKWzymYuQQ2gqgLcm5Xu/Rn/03N3lLpH9DjlXJDXWiF7YEVPnnrOWrKSbTPCe4LQ\n\txkDgDvKVoUM66EjvHA/T0Rc7hpXUg68jZ4avV0hNkJ0TJMiJ3zkaQyWCDRlJ59Oc5z7P\n\t9ktg==","X-Gm-Message-State":"AOAM532FqKib1m8Ngb74GvRpmDJLd1GA1Ib5HR6Vcv1SdlEq9KUMdpsU\n\tUu4TrhtZeR63khwmcbzZ/ygg2pfRCE1AtJ4l","X-Google-Smtp-Source":"ABdhPJzGu4oTs98HzXnUh712xfvPRPOV0lK3Jc6WD0zI6/RRoMPbOyR52gHqYn7G/t4DmIHSuLXH0Q==","X-Received":"by 2002:adf:b355:: with SMTP id\n\tk21mr39025149wrd.380.1635326891394; \n\tWed, 27 Oct 2021 02:28:11 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Oct 2021 10:28:00 +0100","Message-Id":"<20211027092803.3671096-7-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20211027092803.3671096-1-naush@raspberrypi.com>","References":"<20211027092803.3671096-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 6/9] pipeline: raspberrypi: Set packing\n\tformats for the Unicam image node","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Default to using CSI2 packed formats when setting up the Unicam image format,\nbut use an unpacked format if the user requests one through StreamConfiguration.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 48f561d31a31..1b78b5e74a63 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -96,14 +96,14 @@ BayerFormat mbusCodeToBayerFormat(unsigned int mbusCode)\n \treturn BayerFormat{};\n }\n \n-V4L2DeviceFormat toV4L2DeviceFormat(V4L2SubdeviceFormat &format)\n+V4L2DeviceFormat toV4L2DeviceFormat(V4L2SubdeviceFormat &format, BayerFormat::Packing packing)\n {\n \tV4L2DeviceFormat deviceFormat;\n \tBayerFormat bayer = mbusCodeToBayerFormat(format.mbus_code);\n \n \tASSERT(bayer.isValid());\n \n-\tbayer.packing = BayerFormat::Packing::CSI2Packed;\n+\tbayer.packing = packing;\n \tdeviceFormat.fourcc = bayer.toV4L2PixelFormat();\n \tdeviceFormat.size = format.size;\n \treturn deviceFormat;\n@@ -413,7 +413,8 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \t\t\t * the user request.\n \t\t\t */\n \t\t\tV4L2SubdeviceFormat sensorFormat = findBestFormat(data_->sensorFormats_, cfg.size);\n-\t\t\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat);\n+\t\t\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat,\n+\t\t\t\t\t\t\t\t\t   BayerFormat::Packing::CSI2Packed);\n \t\t\tint ret = data_->unicam_[Unicam::Image].dev()->tryFormat(&unicamFormat);\n \t\t\tif (ret)\n \t\t\t\treturn Invalid;\n@@ -631,6 +632,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tfor (auto const stream : data->streams_)\n \t\tstream->reset();\n \n+\tBayerFormat::Packing packing = BayerFormat::Packing::CSI2Packed;\n \tSize maxSize, sensorSize;\n \tunsigned int maxIndex = 0;\n \tbool rawStream = false;\n@@ -649,6 +651,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t\t */\n \t\t\tsensorSize = cfg.size;\n \t\t\trawStream = true;\n+\t\t\t/* Check if the user has explicitly set an unpacked format. */\n+\t\t\tpacking = BayerFormat::fromPixelFormat(cfg.pixelFormat).packing;\n \t\t} else {\n \t\t\tif (cfg.size > maxSize) {\n \t\t\t\tmaxSize = config->at(i).size;\n@@ -667,7 +671,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t * Unicam image output format. The ISP input format gets set at start,\n \t * just in case we have swapped bayer orders due to flips.\n \t */\n-\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat);\n+\tV4L2DeviceFormat unicamFormat = toV4L2DeviceFormat(sensorFormat, packing);\n \tret = data->unicam_[Unicam::Image].dev()->setFormat(&unicamFormat);\n \tif (ret)\n \t\treturn ret;\n","prefixes":["libcamera-devel","v3","6/9"]}