{"id":12493,"url":"https://patchwork.libcamera.org/api/patches/12493/?format=json","web_url":"https://patchwork.libcamera.org/patch/12493/","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":"<20210604102606.218464-1-umang.jain@ideasonboard.com>","date":"2021-06-04T10:26:06","name":"[libcamera-devel,DNI] : Fixes for CTS on nautilus(LIMITED)","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"14905303a6778b1ca2b0417976e4075ea2b26d9e","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12493/mbox/","series":[{"id":2104,"url":"https://patchwork.libcamera.org/api/series/2104/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2104","date":"2021-06-04T10:26:06","name":"[libcamera-devel,DNI] : Fixes for CTS on nautilus(LIMITED)","version":1,"mbox":"https://patchwork.libcamera.org/series/2104/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12493/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12493/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 2AB59C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Jun 2021 10:26:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B17D568926;\n\tFri,  4 Jun 2021 12:26:18 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3575968925\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Jun 2021 12:26:17 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.187])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EDEC53E6;\n\tFri,  4 Jun 2021 12:26:14 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PQtqISrq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622802376;\n\tbh=HLPd5afkKq0eJQ6dkR7NgFUCr2QnZjMyKriVs6YcxmM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=PQtqISrqa06UKfhZpqc6xtpM7Ur2WGR2jEC8KBsko6rFNTl3cs8kXQ6dmReZ88g29\n\t5dSiO8NuN1z//PLM5+kc3YcNYS6U45hCIobl59QsnxTiG5r0aWVl4DeLe2VTwpHpvL\n\twZ31MgSnMQJ99sipb5jYm+oGpBE2myy0S+/Mn2II=","From":"Umang Jain <umang.jain@ideasonboard.com>","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","Content-Transfer-Encoding":"8bit","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":"<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":"Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n\nThis patch is for reference and discussion purposes only.\nPlease DO NOT MERGE. If anything, there will be follow up\nseparate patches for merge separately.\n\nProblem:\nOn nautilus, 26 tests were failing because of \"Fail to open camera\",\nbut more specifically from adb logcat:\n\n```\nE Camera2-Parameters: generated preview size list is empty!!\nE Camera2Client: initializeImpl: Camera 0: unable to build defaults: Invalid argument (-22)\nE CameraService: connectHelper: Could not initialize client from HAL.\nI Camera2Client: Camera 0: Closed\n```\n\nwas found to be root of the problem. The checks triggered are here:\n> Parameters::getFilteredSizes()\n  https://android.googlesource.com/platform/frameworks/av/+/refs/heads/master/services/camera/libcameraservice/api1/client2/Parameters.cpp#2976\n\nnautilus reports higher frame-duration to start with: 34100000\n(in CameraDevice::getStaticMetadata()).\nminFrameDurationNsec is meant to be re-adjusted down the line \nbefore round-up, *if* the difference is < 500 useconds.\n\nOn nautilus, since the difference was much larger than 500 useconds,\nthe re-adjustment failed and libcamera reported a much higher\nframe-duration to upper-layers/libcameraservice. \nThis led to the problem in Parameters::getFilteredSizes(),\nwhere all potential streams for preview are skipped to be added,\ndue to high minFrameDuration.\n\nTo force this re-adjustment, the scope of difference was increased\nto 1200 useconds as done in the patch.\n\nCTS Results on nautilus after applying the changes:\nTotal Run time: 8m 42s\n1/1 modules completed\nTotal Tests       : 221\nPASSED            : 221\nFAILED            : 0\n\n---\n src/android/camera_device.cpp | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex fe332ec3..d0676a7f 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -877,13 +877,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t * (see MAX_PREVIEW_RECORD_DURATION_NS in the camera service\n \t\t * implementation).\n \t\t *\n-\t\t * If we're close enough (+ 500 useconds) to that value, round\n+\t\t * If we're close enough (+ 1200 useconds) to that value, round\n \t\t * the minimum frame duration of the camera to an accepted\n \t\t * value.\n \t\t */\n \t\tstatic constexpr int64_t MAX_PREVIEW_RECORD_DURATION_NS = 1e9 / 29.97;\n \t\tif (minFrameDurationNsec > MAX_PREVIEW_RECORD_DURATION_NS &&\n-\t\t    minFrameDurationNsec < MAX_PREVIEW_RECORD_DURATION_NS + 500000)\n+\t\t    minFrameDurationNsec < MAX_PREVIEW_RECORD_DURATION_NS + 1200000)\n \t\t\tminFrameDurationNsec = MAX_PREVIEW_RECORD_DURATION_NS - 1000;\n \n \t\t/*\n@@ -1335,6 +1335,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,\n \t\tANDROID_SCALER_AVAILABLE_STALL_DURATIONS,\n \t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,\n+\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,\n \t\tANDROID_SCALER_CROPPING_TYPE,\n \t\tANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,\n \t\tANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,\n","prefixes":["libcamera-devel","DNI"]}