{"id":17488,"url":"https://patchwork.libcamera.org/api/patches/17488/?format=json","web_url":"https://patchwork.libcamera.org/patch/17488/","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":"<20221003083934.31629-2-naush@raspberrypi.com>","date":"2022-10-03T08:39:27","name":"[libcamera-devel,v1,1/9] camera_sensor: Add minimum and maximum line length to IPACameraSensorInfo","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"c4ee90c0c1095587ad6a02fb7cda8fc39a6b0f7b","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/17488/mbox/","series":[{"id":3523,"url":"https://patchwork.libcamera.org/api/series/3523/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3523","date":"2022-10-03T08:39:26","name":"Raspberry Pi: Horizontal blanking control","version":1,"mbox":"https://patchwork.libcamera.org/series/3523/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17488/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17488/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 C88CDC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Oct 2022 08:40:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 74EB562CD8;\n\tMon,  3 Oct 2022 10:40:00 +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 683BB61F74\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Oct 2022 10:39:58 +0200 (CEST)","by mail-wr1-x436.google.com with SMTP id f11so12949208wrm.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 03 Oct 2022 01:39:58 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti13-20020a5d55cd000000b0022ae59d472esm8922787wrw.112.2022.10.03.01.39.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 03 Oct 2022 01:39:57 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664786400;\n\tbh=PjWiq/L7a4VC3oYdfXVuQxR0D5yH6HEqDmGss+Y5yGc=;\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=PkX1GET3T2EdrPjT5E+eghfW8I+eh9+DcSzpL74UiNYXCecnn+yC1TokfIr2AkFOn\n\t9ostbzQQqvZeeGFm4UkxhwZOjxScr4VYU4UX8cMC130hppaWgMMQUeGX2B1Pwk/GnI\n\trIS8Hm0ePAb7FOUHvooYaxkgmSqJgHiOR+ircDUKSOV39lMmpFJaHwhJwqaaC/W/lN\n\t4MMUJU1+WkFX3MmZY+l50h70B2SWr4tIue3+WKXwW0ohLZz9Bky2L7WE9hqpCWQh2a\n\toZ+8cTzmy6G7gDqVl+a8Q7z0OQ0oBOMQTjk7ew4cMxeXhsAQGueTlXWbxc5BkE168f\n\tpI+25qjFEhWGQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\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\tbh=LK2i2ckLcU1EfLDok6fdgMsrZrSMhaaEYIQAq22FIN4=;\n\tb=SWyVqmywuek5j6IOEBRH9n1V/Dz/rSzbzHsmh9oCW5L//QSqk863DaOaTVI2Ucjnzl\n\tps05oO1nzI66i7A5Gxu2akCB0BFWbOq7wi5CgMg5INdOZwXyLsL1ivsuW31kk3KVN5lL\n\tAI9Kx44LkYnbmlDvOUXLLnpwB5ILRU/WgUoyG3QWJCjFkBtLWBWt6Tsxk0MzDMiroyOz\n\tmZarF5VieBSc9Lzq3v4bkRxVV1WZer0QaVryMqpi5GsJ4fpGlfYuW09/hrkZPqNejTFR\n\tRXXiCknhhtlpENJ2IyQtKLJGUC46AwCMmg6Msa+g3lVTrDd3Iw/Ayk5JD5gJiRvFeYkv\n\t3T4Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"SWyVqmyw\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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;\n\tbh=LK2i2ckLcU1EfLDok6fdgMsrZrSMhaaEYIQAq22FIN4=;\n\tb=DhmLRBnzmx/CmKLK0/TW8PkgOJBifJBqWgzjcH+kHAoVjRplDcG0yEto6ATchARNtE\n\t8J7u3x4ue9TVa2R3+wn5P6Uh1T67MZIEahOAlDO1eTBkpjthaljNVYpu8dOq0gDcBl2p\n\tFFzqj7LZALJfzfGKKVCuy4MdFbpXxIgPqfB0rchlnxZ5x6BVJzjGrO15E654GfCnArTt\n\t/9DopHqzp/Nu8RVN3m0dTUZZezD8LJVtD51SVZEM6wnI9ziUt8hnmcgXhS/g+QBIgHmq\n\tQgMLXySzXXDkArnWaorJ2mAiv06VoJ5MhKNKJpB1BswmPGsOj/6EA2xoN1swGMrK1xOR\n\t4xKg==","X-Gm-Message-State":"ACrzQf3CgrMxofV42k0Jo1SDi702aaZZJfyrrHfcbEOOZz2GN8Cgdx0a\n\t/gCDQ2VqkHkaaF/PTlQlsNZbqiDzKiwx5g==","X-Google-Smtp-Source":"AMsMyM52TV2HmkFNZa9LhFjRdxscKRlU8pZx5e21wQnNKbmdOjm+2jtch24nY+BO57Om0xbDKMBpcw==","X-Received":"by 2002:adf:aad1:0:b0:22e:3667:d307 with SMTP id\n\ti17-20020adfaad1000000b0022e3667d307mr3595581wrc.359.1664786397786; \n\tMon, 03 Oct 2022 01:39:57 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  3 Oct 2022 09:39:27 +0100","Message-Id":"<20221003083934.31629-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221003083934.31629-1-naush@raspberrypi.com>","References":"<20221003083934.31629-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 1/9] camera_sensor: Add minimum and\n\tmaximum line length to IPACameraSensorInfo","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":"Add fields for minimum and maximum line length (in units of pixels) to the\nIPACameraSensorInfo structure. This replaces the existing lineLength field.\n\nUpdate the ipu3, raspberrypi and rkisp1 IPAs to use IPACameraSensorInfo::minLineLength\ninstead of IPACameraSensorInfo::lineLength, as logically we will always want to\nuse the fastest sensor readout by default.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/core.mojom    | 21 +++++++++++++++------\n src/ipa/ipu3/ipu3.cpp               |  2 +-\n src/ipa/raspberrypi/raspberrypi.cpp |  2 +-\n src/ipa/rkisp1/rkisp1.cpp           |  2 +-\n src/libcamera/camera_sensor.cpp     |  6 ++++--\n 5 files changed, 22 insertions(+), 11 deletions(-)","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nindex 74f3339e56f2..2bc3028c22d6 100644\n--- a/include/libcamera/ipa/core.mojom\n+++ b/include/libcamera/ipa/core.mojom\n@@ -172,10 +172,17 @@ module libcamera;\n  */\n \n /**\n- * \\var IPACameraSensorInfo::lineLength\n- * \\brief Total line length in pixels\n+ * \\var IPACameraSensorInfo::minLineLength\n+ * \\brief The minimum line length in pixels\n  *\n- * The total line length in pixel clock periods, including blanking.\n+ * The minimum allowable line length in pixel clock periods, including blanking.\n+ */\n+\n+/**\n+ * \\var IPACameraSensorInfo::maxLineLength\n+ * \\brief The maximum line length in pixels\n+ *\n+ * The maximum allowable line length in pixel clock periods, including blanking.\n  */\n \n /**\n@@ -189,7 +196,7 @@ module libcamera;\n  * To obtain the minimum frame duration:\n  *\n  * \\verbatim\n-       frameDuration(s) = minFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second)\n+       frameDuration(s) = minFrameLength(lines) * minLineLength(pixels) / pixelRate(pixels per second)\n    \\endverbatim\n  */\n \n@@ -204,7 +211,7 @@ module libcamera;\n  * To obtain the maximum frame duration:\n  *\n  * \\verbatim\n-       frameDuration(s) = maxFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second)\n+       frameDuration(s) = maxFrameLength(lines) * maxLineLength(pixels) / pixelRate(pixels per second)\n    \\endverbatim\n  */\n struct IPACameraSensorInfo {\n@@ -217,7 +224,9 @@ struct IPACameraSensorInfo {\n \tSize outputSize;\n \n \tuint64 pixelRate;\n-\tuint32 lineLength;\n+\n+\tuint32 minLineLength;\n+\tuint32 maxLineLength;\n \n \tuint32 minFrameLength;\n \tuint32 maxFrameLength;\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex d1ea081d595d..da029571ba55 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -341,7 +341,7 @@ int IPAIPU3::init(const IPASettings &settings,\n \n \t/* Clean context */\n \tcontext_.configuration = {};\n-\tcontext_.configuration.sensor.lineDuration = sensorInfo.lineLength * 1.0s / sensorInfo.pixelRate;\n+\tcontext_.configuration.sensor.lineDuration = sensorInfo.minLineLength * 1.0s / sensorInfo.pixelRate;\n \n \t/* Load the tuning data file. */\n \tFile file(settings.configurationFile);\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 8d731435764e..358a119da222 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -356,7 +356,7 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo)\n \t * Calculate the line length as the ratio between the line length in\n \t * pixels and the pixel rate.\n \t */\n-\tmode_.lineLength = sensorInfo.lineLength * (1.0s / sensorInfo.pixelRate);\n+\tmode_.lineLength = sensorInfo.minLineLength * (1.0s / sensorInfo.pixelRate);\n \n \t/*\n \t * Set the frame length limits for the mode to ensure exposure and\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 32feb1682749..ddb22d98eb41 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -246,7 +246,7 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n \tcontext_.configuration.hw.revision = hwRevision_;\n \n \tcontext_.configuration.sensor.size = info.outputSize;\n-\tcontext_.configuration.sensor.lineDuration = info.lineLength * 1.0s / info.pixelRate;\n+\tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n \n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 911fd0beae4e..c2c8d3d44e26 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -883,10 +883,12 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const\n \t\treturn -EINVAL;\n \t}\n \n-\tint32_t hblank = ctrls.get(V4L2_CID_HBLANK).get<int32_t>();\n-\tinfo->lineLength = info->outputSize.width + hblank;\n \tinfo->pixelRate = ctrls.get(V4L2_CID_PIXEL_RATE).get<int64_t>();\n \n+\tconst ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);\n+\tinfo->minLineLength = info->outputSize.width + hblank.min().get<int32_t>();\n+\tinfo->maxLineLength = info->outputSize.width + hblank.max().get<int32_t>();\n+\n \tconst ControlInfo vblank = ctrls.infoMap()->at(V4L2_CID_VBLANK);\n \tinfo->minFrameLength = info->outputSize.height + vblank.min().get<int32_t>();\n \tinfo->maxFrameLength = info->outputSize.height + vblank.max().get<int32_t>();\n","prefixes":["libcamera-devel","v1","1/9"]}