From patchwork Fri Jun 4 10:26:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12493 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 2AB59C3206 for ; Fri, 4 Jun 2021 10:26:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B17D568926; Fri, 4 Jun 2021 12:26:18 +0200 (CEST) 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="PQtqISrq"; 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 3575968925 for ; Fri, 4 Jun 2021 12:26:17 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.187]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EDEC53E6; Fri, 4 Jun 2021 12:26:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622802376; bh=HLPd5afkKq0eJQ6dkR7NgFUCr2QnZjMyKriVs6YcxmM=; h=From:To:Cc:Subject:Date:From; b=PQtqISrqa06UKfhZpqc6xtpM7Ur2WGR2jEC8KBsko6rFNTl3cs8kXQ6dmReZ88g29 5dSiO8NuN1z//PLM5+kc3YcNYS6U45hCIobl59QsnxTiG5r0aWVl4DeLe2VTwpHpvL wZ31MgSnMQJ99sipb5jYm+oGpBE2myy0S+/Mn2II= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Fri, 4 Jun 2021 15:56:06 +0530 Message-Id: <20210604102606.218464-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] [DNI]: Fixes for CTS on nautilus(LIMITED) 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" Signed-off-by: Umang Jain --- This patch is for reference and discussion purposes only. Please DO NOT MERGE. If anything, there will be follow up separate patches for merge separately. Problem: On nautilus, 26 tests were failing because of "Fail to open camera", but more specifically from adb logcat: ``` E Camera2-Parameters: generated preview size list is empty!! E Camera2Client: initializeImpl: Camera 0: unable to build defaults: Invalid argument (-22) E CameraService: connectHelper: Could not initialize client from HAL. I Camera2Client: Camera 0: Closed ``` was found to be root of the problem. The checks triggered are here: > Parameters::getFilteredSizes() https://android.googlesource.com/platform/frameworks/av/+/refs/heads/master/services/camera/libcameraservice/api1/client2/Parameters.cpp#2976 nautilus reports higher frame-duration to start with: 34100000 (in CameraDevice::getStaticMetadata()). minFrameDurationNsec is meant to be re-adjusted down the line before round-up, *if* the difference is < 500 useconds. On nautilus, since the difference was much larger than 500 useconds, the re-adjustment failed and libcamera reported a much higher frame-duration to upper-layers/libcameraservice. This led to the problem in Parameters::getFilteredSizes(), where all potential streams for preview are skipped to be added, due to high minFrameDuration. To force this re-adjustment, the scope of difference was increased to 1200 useconds as done in the patch. CTS Results on nautilus after applying the changes: Total Run time: 8m 42s 1/1 modules completed Total Tests : 221 PASSED : 221 FAILED : 0 --- src/android/camera_device.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index fe332ec3..d0676a7f 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -877,13 +877,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() * (see MAX_PREVIEW_RECORD_DURATION_NS in the camera service * implementation). * - * If we're close enough (+ 500 useconds) to that value, round + * If we're close enough (+ 1200 useconds) to that value, round * the minimum frame duration of the camera to an accepted * value. */ static constexpr int64_t MAX_PREVIEW_RECORD_DURATION_NS = 1e9 / 29.97; if (minFrameDurationNsec > MAX_PREVIEW_RECORD_DURATION_NS && - minFrameDurationNsec < MAX_PREVIEW_RECORD_DURATION_NS + 500000) + minFrameDurationNsec < MAX_PREVIEW_RECORD_DURATION_NS + 1200000) minFrameDurationNsec = MAX_PREVIEW_RECORD_DURATION_NS - 1000; /* @@ -1335,6 +1335,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, ANDROID_SCALER_AVAILABLE_STALL_DURATIONS, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, ANDROID_SCALER_CROPPING_TYPE, ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,