{"id":11789,"url":"https://patchwork.libcamera.org/api/patches/11789/?format=json","web_url":"https://patchwork.libcamera.org/patch/11789/","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":"<20210330094941.127664-1-paul.elder@ideasonboard.com>","date":"2021-03-30T09:49:41","name":"[libcamera-devel] android: CameraDevice: Report proper min and max frame durations","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f3e30f41643556a25982c4c268c57b900edfb2ce","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":{"id":17,"url":"https://patchwork.libcamera.org/api/users/17/?format=json","username":"epaul","first_name":"Paul","last_name":"Elder","email":"paul.elder@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/11789/mbox/","series":[{"id":1870,"url":"https://patchwork.libcamera.org/api/series/1870/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1870","date":"2021-03-30T09:49:41","name":"[libcamera-devel] android: CameraDevice: Report proper min and max frame durations","version":1,"mbox":"https://patchwork.libcamera.org/series/1870/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11789/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11789/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 3F145C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Mar 2021 09:50:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5B22868784;\n\tTue, 30 Mar 2021 11:50:05 +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 3FB826877C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Mar 2021 11:50:04 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 918B9102;\n\tTue, 30 Mar 2021 11:50:02 +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=\"AMYSkfJb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1617097803;\n\tbh=cPPQz3aQ69LRgyoDcvY84Dix8Z29CXiFuhR+KkyS2oM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=AMYSkfJbGnQCDWDQaj34F//KZikuVqwcAG9ooIq3ljqOqhgdRjfJ7zLHWamWGBccQ\n\t/1vtXYp6PsPKnhBO9Rs2FNX+KyNqkCPNxIIgNCqdPSk0p27U3lB3MpGPPKMDJHz3RU\n\tB3nEyfnDj+xew6l9XrmDGEC+ksQioM5uJlDsllXU=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 30 Mar 2021 18:49:41 +0900","Message-Id":"<20210330094941.127664-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] android: CameraDevice: Report proper min\n\tand max frame durations","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The HAL layer was getting the min and max frame durations from from the\ncamera, then rounding it to fps to report as available fps ranges. The\nsame min and max frame durations were then being reported as min and max\nframe durations. Since the fps are integer values while the frame\ndurations are in ns, this caused a rounding error making it seem like we\nwere reporting an available max fps that was higher than was was allowed\nby the minimum frame duration.\n\nFix this by recalculating the frame durations based on the rounded fps\nvalues.\n\nThis allows the following CTS test to pass:\n- android.hardware.camera2.cts.SurfaceViewPreviewTest#testPreviewFpsRange\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/android/camera_device.cpp | 4 ++++\n 1 file changed, 4 insertions(+)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 931e9f37..91d4e8d4 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -799,6 +799,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tint32_t minFps = std::round(1e9 / maxFrameDurationNsec);\n \t\tminFps = std::max(1, minFps);\n \n+\t\t/* Avoid rounding errors when we reuse these variables later */\n+\t\tminFrameDurationNsec = 1e9 / maxFps;\n+\t\tmaxFrameDurationNsec = 1e9 / minFps;\n+\n \t\t/*\n \t\t * Register to the camera service {min, max} and {max, max}\n \t\t * intervals as requested by the metadata documentation.\n","prefixes":["libcamera-devel"]}