From patchwork Tue Dec 21 05:34:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15207 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 C0FF8BF415 for ; Tue, 21 Dec 2021 05:35:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0740660906; Tue, 21 Dec 2021 06:35:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WqUVULP4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC6A5608F8 for ; Tue, 21 Dec 2021 06:35:18 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C8319881; Tue, 21 Dec 2021 06:35:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640064918; bh=Xab/Pr3GTpyMiNIUUwj3qAFSmELbNUuN2YTD0C2f70o=; h=From:To:Cc:Subject:Date:From; b=WqUVULP4h32pWw6fz8Wrn/9MyEvvFGvOidLEwIdCmIgo7piYIYT9W1kiat9Z8uSOl zT0A0+a8U6aI24nLEhmUQgnEDrRyxc2D9Skj+L5sBF87QPfFJ7/bgYdhUqdg/ZacDm KLyC7fc8KHwO4SfPZNapGpRcRplhENAj7LuxQUYc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 23:34:58 -0600 Message-Id: <20211221053458.2711409-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: Hardcode black level lock 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" Hardcode black level lock in request and result metadata. Also add it to the template. Signed-off-by: Paul Elder --- src/android/camera_capabilities.cpp | 7 +++++++ src/android/camera_device.cpp | 9 +++++++++ src/android/camera_request.h | 1 + 3 files changed, 17 insertions(+) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index c52b22be..3f3b7303 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -492,6 +492,8 @@ void CameraCapabilities::computeHwLevel( hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED; } + /* Black level lock doesn't need to be checked as we hardcode it */ + found = availableResultKeys_.count(ANDROID_HOT_PIXEL_MODE); if (!found) { LOG(HAL, Info) << noFull << "missing hot pixel mode"; @@ -940,6 +942,7 @@ int CameraCapabilities::initializeStaticMetadata() }; availableRequestKeys_ = { + ANDROID_BLACK_LEVEL_LOCK, ANDROID_COLOR_CORRECTION_ABERRATION_MODE, ANDROID_CONTROL_AE_ANTIBANDING_MODE, ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, @@ -972,6 +975,7 @@ int CameraCapabilities::initializeStaticMetadata() }; availableResultKeys_ = { + ANDROID_BLACK_LEVEL_LOCK, ANDROID_COLOR_CORRECTION_ABERRATION_MODE, ANDROID_CONTROL_AE_ANTIBANDING_MODE, ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, @@ -2032,6 +2036,9 @@ std::unique_ptr CameraCapabilities::requestTemplatePreview() con requestTemplate->addEntry(ANDROID_TONEMAP_MODE, tonemapMode); } + uint8_t blackLevelLock = ANDROID_BLACK_LEVEL_LOCK_OFF; + requestTemplate->addEntry(ANDROID_BLACK_LEVEL_LOCK, blackLevelLock); + if (staticMetadata_->entryContains(ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES, ANDROID_HOT_PIXEL_MODE_FAST)) { uint8_t hotPixelMode = ANDROID_HOT_PIXEL_MODE_FAST; diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 7cab878c..a097d384 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -973,6 +973,9 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor) } } + if (settings.getEntry(ANDROID_BLACK_LEVEL_LOCK, &entry)) + descriptor->blackLevelLock_ = *entry.data.u8; + if (settings.getEntry(ANDROID_HOT_PIXEL_MODE, &entry)) { const int32_t data = static_cast(*entry.data.u8); int32_t hotPixelMode; @@ -1814,6 +1817,12 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons resultMetadata->addEntry(ANDROID_EDGE_MODE, descriptor.edgeMode_); } + /* + * \todo Hardcode the black level lock for now, as simply reporting + * what the request asked for satsifies CTS. + */ + resultMetadata->addEntry(ANDROID_BLACK_LEVEL_LOCK, descriptor.blackLevelLock_); + if (metadata.contains(controls::draft::HotPixelMode)) { bool valid; switch (metadata.get(controls::draft::HotPixelMode)) { diff --git a/src/android/camera_request.h b/src/android/camera_request.h index 69b6c8fc..1e53ceb0 100644 --- a/src/android/camera_request.h +++ b/src/android/camera_request.h @@ -90,6 +90,7 @@ public: /* The android edge mode associated with this request */ /* \todo Wrap all such controls? */ int32_t edgeMode_; + uint8_t blackLevelLock_; private: LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor)