From patchwork Mon Feb 1 12:56:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11101 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 C6510BD808 for ; Mon, 1 Feb 2021 12:56:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 533F9683FF; Mon, 1 Feb 2021 13:56:48 +0100 (CET) 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="LAlqj7w3"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E177E683FF for ; Mon, 1 Feb 2021 13:56:46 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id s7so13468892wru.5 for ; Mon, 01 Feb 2021 04:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ovn/7RwaCa9oCo+oeP0CfvsGRzh82LoJ7GIXw6ESflw=; b=LAlqj7w3y4Wb89oVoEYj81bHToJ7sBtLPUqGiTjg4wVtSbD7D1O43mlV/PES6eFTD+ 5lvENHaPnsiL2k4D7lWKXNU7cik3zHSFeHYI+XHsUWHfUtDcsMHe/ZXDyi2s11CNpwKR LMrDMXCCC/dnMH53opGRjo5vQRumrb9+Xzsf0U+n1VmmRi38ZCwdH2PSIpThrcHeeVtS geGweFwIJrAchbKJi8J+jxs4SRhwdlv6U5fR4I8kQw9KxOubuDI+mU/OQfsGkSkZj4G7 sLfXa5btUoaB6N4D5KZOtd4Az9a8aedIVF10ThIAm3iWWU/gppW26UZTI/ledYxA0nMC F16A== 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:mime-version :content-transfer-encoding; bh=ovn/7RwaCa9oCo+oeP0CfvsGRzh82LoJ7GIXw6ESflw=; b=N8AW+5X1/R5LOWGyO2esUFyp9zsHoKRKq6Xv2t8mtq1QdhC5ti7W02W0W2M62vp4pJ Ss6d/SPhZs4UFGiayiRhi7YTx1roL3SPVRA0oGzujziDh8tKLO1Epz1e2L5mLHo44o/t s74oqObKhVEKcxerT3n74WjA7V5+MM4uTEged05uNAApfPVtGl5GSxjZgMl+PQvVMJit bN7J21nCCIwbAkwXtWVjJsZqqFfr2+Itl0vYGJKjgOReIpw6BpvIWXtBxhWGCDcnoh+g YxU/BZ7LHowAj3WpWXZzHHOs1ZdyDDhPx9WyQOFgjFD2AE1kJAgFboyciHfxTmgmM2YE je2A== X-Gm-Message-State: AOAM5316WNfvAdpQjeEtcQIdQsM6tV5ymgTnu7r9l3qpmfv8EJb1mcdc nNovT1uvjf+vm9TwrNk+KqJt7s02R1e5/dhj X-Google-Smtp-Source: ABdhPJzqmdiQz4pIyWHUv3anPhYJ4u2tQHTTsq7xn4MpGm9YVo5SjhVbqaduYTBvDR+dUeSiaAIn1A== X-Received: by 2002:adf:f8c8:: with SMTP id f8mr18236373wrq.132.1612184206085; Mon, 01 Feb 2021 04:56:46 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id r17sm12655002wro.46.2021.02.01.04.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 04:56:45 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Feb 2021 12:56:32 +0000 Message-Id: <20210201125633.26242-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] pipeline: ipa: raspberrypi: Rename RPi::ConfigParameters enum values 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" Rename the enum values to indicate pipeline handler -> IPA actions (IPA_CONFIG_*) and IPA -> pipeline handler return results (IPA_RESULT_*). Additionally, provide more descriptive names for these values. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.h | 10 +++++----- src/ipa/raspberrypi/raspberrypi.cpp | 18 +++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index 5a9433825d5a..970b9e931188 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -20,11 +20,11 @@ namespace RPi { enum ConfigParameters { IPA_CONFIG_LS_TABLE = (1 << 0), - IPA_CONFIG_STAGGERED_WRITE = (1 << 1), - IPA_CONFIG_SENSOR = (1 << 2), - IPA_CONFIG_DROP_FRAMES = (1 << 3), - IPA_CONFIG_FAILED = (1 << 4), - IPA_CONFIG_STARTUP = (1 << 5), + IPA_CONFIG_STARTUP_CTRLS = (1 << 1), + IPA_RESULT_CONFIG_FAILED = (1 << 2), + IPA_RESULT_SENSOR_PARAMS = (1 << 3), + IPA_RESULT_SENSOR_CTRLS = (1 << 4), + IPA_RESULT_DROP_FRAMES = (1 << 5), }; enum Operations { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 681ab9211b7c..fea1ea3957bb 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -170,7 +170,7 @@ int IPARPi::start(const IPAOperationData &data, IPAOperationData *result) ASSERT(result); result->operation = 0; - if (data.operation & RPi::IPA_CONFIG_STARTUP) { + if (data.operation & RPi::IPA_CONFIG_STARTUP_CTRLS) { /* We have been given some controls to action before start. */ queueRequest(data.controls[0]); } @@ -188,7 +188,7 @@ int IPARPi::start(const IPAOperationData &data, IPAOperationData *result) ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); result->controls.emplace_back(ctrls); - result->operation |= RPi::IPA_CONFIG_SENSOR; + result->operation |= RPi::IPA_RESULT_SENSOR_CTRLS; } /* @@ -236,7 +236,7 @@ int IPARPi::start(const IPAOperationData &data, IPAOperationData *result) } result->data.push_back(dropFrame); - result->operation |= RPi::IPA_CONFIG_DROP_FRAMES; + result->operation |= RPi::IPA_RESULT_DROP_FRAMES; firstStart_ = false; @@ -289,7 +289,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; - result->operation = RPi::IPA_CONFIG_FAILED; + result->operation = RPi::IPA_RESULT_CONFIG_FAILED; return; } @@ -300,13 +300,13 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!validateSensorControls()) { LOG(IPARPI, Error) << "Sensor control validation failed."; - result->operation = RPi::IPA_CONFIG_FAILED; + result->operation = RPi::IPA_RESULT_CONFIG_FAILED; return; } if (!validateIspControls()) { LOG(IPARPI, Error) << "ISP control validation failed."; - result->operation = RPi::IPA_CONFIG_FAILED; + result->operation = RPi::IPA_RESULT_CONFIG_FAILED; return; } @@ -325,7 +325,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!helper_) { LOG(IPARPI, Error) << "Could not create camera helper for " << cameraName; - result->operation = RPi::IPA_CONFIG_FAILED; + result->operation = RPi::IPA_RESULT_CONFIG_FAILED; return; } @@ -342,7 +342,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, result->data.push_back(exposureDelay); /* For VBLANK ctrl */ result->data.push_back(sensorMetadata); - result->operation |= RPi::IPA_CONFIG_STAGGERED_WRITE; + result->operation |= RPi::IPA_RESULT_SENSOR_PARAMS; } /* Re-assemble camera mode using the sensor info. */ @@ -395,7 +395,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, applyAGC(&agcStatus, ctrls); result->controls.emplace_back(ctrls); - result->operation |= RPi::IPA_CONFIG_SENSOR; + result->operation |= RPi::IPA_RESULT_SENSOR_CTRLS; } lastMode_ = mode_; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5ad12d99638f..48e5943edc1a 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -753,7 +753,7 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont IPAOperationData ipaData = {}; IPAOperationData result = {}; if (controls) { - ipaData.operation = RPi::IPA_CONFIG_STARTUP; + ipaData.operation = RPi::IPA_CONFIG_STARTUP_CTRLS; ipaData.controls.emplace_back(*controls); } ret = data->ipa_->start(ipaData, &result); @@ -765,12 +765,12 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont } /* Apply any gain/exposure settings that the IPA may have passed back. */ - if (result.operation & RPi::IPA_CONFIG_SENSOR) { + if (result.operation & RPi::IPA_RESULT_SENSOR_CTRLS) { ControlList &ctrls = result.controls[0]; data->unicam_[Unicam::Image].dev()->setControls(&ctrls); } - if (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) { + if (result.operation & RPi::IPA_RESULT_DROP_FRAMES) { /* Configure the number of dropped frames required on startup. */ data->dropFrameCount_ = result.data[0]; } @@ -1213,13 +1213,13 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, &result); - if (result.operation & RPi::IPA_CONFIG_FAILED) { + if (result.operation & RPi::IPA_RESULT_CONFIG_FAILED) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE; } unsigned int resultIdx = 0; - if (result.operation & RPi::IPA_CONFIG_STAGGERED_WRITE) { + if (result.operation & RPi::IPA_RESULT_SENSOR_PARAMS) { /* * Setup our delayed control writer with the sensor default * gain and exposure delays. @@ -1237,7 +1237,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) } } - if (result.operation & RPi::IPA_CONFIG_SENSOR) { + if (result.operation & RPi::IPA_RESULT_SENSOR_CTRLS) { ControlList &ctrls = result.controls[0]; unicam_[Unicam::Image].dev()->setControls(&ctrls); } From patchwork Mon Feb 1 12:56:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11102 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 DB958BD808 for ; Mon, 1 Feb 2021 12:56:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A87C968405; Mon, 1 Feb 2021 13:56:49 +0100 (CET) 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="Yb6VQnKv"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E225268403 for ; Mon, 1 Feb 2021 13:56:47 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id j18so12564686wmi.3 for ; Mon, 01 Feb 2021 04:56:47 -0800 (PST) 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=owTe+UnimzoeH5UX2dLevt6U/8gQYnQ59u5O4axdyRA=; b=Yb6VQnKvnUDMRY6DM0addDK9Zx+VwOBqQUTHQKK6QoYlUyWDDK7kTPY+y8FnsX5Eh7 AW+8qeeQGgEKnnOHpXUmi5wpNHS5uoqgi4BbK7XYJdv5VvI09ttRCyJN0Kiw5q7T5+Ba t5rnMwbgTM+DH48CL7nxrZ5MvyyZNMGq/xiPrRO84X8sjXMS71Anb6HQitRS05vGyJGw iztZaNBF0ck1ymBXmqVRBhbfJiDz3LEFCW+0hifpZUCI+fDpqZ9poEfLi/SiscXRUxW+ xJ5iBfxrOXDAjz2HIqYv6e6sMIkSFk+sJtbHay8fAeICnbgxArfiSNHcIH5r8VO8VDBe Sl0A== 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=owTe+UnimzoeH5UX2dLevt6U/8gQYnQ59u5O4axdyRA=; b=FmC/swbD5omg/Vkh46v6JTcI5F5zRXn9+ehqKS0gAJRmVNk+GLKGzzX0JH8ZGjKzYv ixAPYw9Z1dJhDyTbbcevg2MgWLcm1cX3qZubF84IBF85AAQasws+kgFrj5fhH7H0hNJ9 Ty7aknERZQ45OCUKCzLLTUZw7h8xDsZRQqo6vGIGxSDbBle1kF++bHffEnnqM4j/s0E7 Sm68WWhDI9rYsO2QGcTGXcHNhK1zMO0na6HhkT/MsY6ctUIvv7BrSwHAz17ACEfVqltR Jd4itaSFpmw4ZwFqmMU50ccvODw9zvI9qWcoBCmYnpkG10x5/u2WqkL9q+43mXfv35O4 AqPQ== X-Gm-Message-State: AOAM530qzhKUjh2UGY001mAGpCyQN8znKp8zhHhAhjhZlVij10hI6R1i rhJufIA7yg/u07/cFGpHEUyJ1fMfSAyVnCj5 X-Google-Smtp-Source: ABdhPJxbzigqHdCtiwgQytQQUmWCTSylFJxVZK0ySiggGNytUdhKb0+l93PkqttWl1HzNcy/c0xr8Q== X-Received: by 2002:a1c:65d5:: with SMTP id z204mr9636127wmb.184.1612184207332; Mon, 01 Feb 2021 04:56:47 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id r17sm12655002wro.46.2021.02.01.04.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 04:56:46 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Feb 2021 12:56:33 +0000 Message-Id: <20210201125633.26242-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201125633.26242-1-naush@raspberrypi.com> References: <20210201125633.26242-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] pipeline: raspberrypi: Always save sensor params on IPA_RESULT_SENSOR_PARAMS 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" Fixup logic when handling IPA_RESULT_SENSOR_PARAMS where we must always overwrite the parameters if provided by IPA. In the current codebase, this only happens once on startup, so there is no effective functional difference. But this change allows the option for the IPA to request new sensor parameters per-mode if required. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 48e5943edc1a..63bdbe2b91bd 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1224,17 +1224,15 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) * Setup our delayed control writer with the sensor default * gain and exposure delays. */ - if (!delayedCtrls_) { - std::unordered_map delays = { - { V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] }, - { V4L2_CID_EXPOSURE, result.data[resultIdx++] }, - { V4L2_CID_VBLANK, result.data[resultIdx++] } - }; + std::unordered_map delays = { + { V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] }, + { V4L2_CID_EXPOSURE, result.data[resultIdx++] }, + { V4L2_CID_VBLANK, result.data[resultIdx++] } + }; - delayedCtrls_ = std::make_unique(unicam_[Unicam::Image].dev(), delays); + delayedCtrls_ = std::make_unique(unicam_[Unicam::Image].dev(), delays); - sensorMetadata_ = result.data[resultIdx++]; - } + sensorMetadata_ = result.data[resultIdx++]; } if (result.operation & RPi::IPA_RESULT_SENSOR_CTRLS) {