From patchwork Thu Dec 2 13:46:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 14987 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 EBDEFBF415 for ; Thu, 2 Dec 2021 13:46:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E84460592; Thu, 2 Dec 2021 14:46:54 +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="A6+lBa3B"; 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 6132D6011A for ; Thu, 2 Dec 2021 14:46:52 +0100 (CET) Received: from perceval.ideasonboard.com (unknown [103.251.226.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D3510D8C; Thu, 2 Dec 2021 14:46:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638452812; bh=hTLTpp/Ps8p9qawjh1CONOj9Gr5Yjp50ghtevY2QOoU=; h=From:To:Cc:Subject:Date:From; b=A6+lBa3B58tqqrQWxGgQbQNpYi+c7vOztGKeHt4jn/n7feRTyDt0v9rUoBk5H6UCv X9zj29JTt6Nd9EFxkfffZgECPs1kG3kJEBQQqBCJXbRJDqQ1Xm/Kk4NMGKyFddy+1N 6vhFXPMaAb5Gwu/Ue2f48TLvdohKUtNtoQilBaxc= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Thu, 2 Dec 2021 19:16:44 +0530 Message-Id: <20211202134644.1094233-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2] android: Do not cap those minFrameDuration nearabout 30fps 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" We have some stream resolution which can provide slightly better frame duration than what we cap (i.e. 1/30 fps). The problem with this is CTS complains if the camera goes faster during the test than minFrameDuration reported for that stream. For instance, 1080p minFrameDuration: - Nautilus : 33282000 - Soraka : 33147000 Both are less than capped minFrameDuration (3333333). This patch considers this situation and doesn't cap the minFrameDuration if the hardware can provide frame durations slightly better. The delta considered is 1% only from the cap. Signed-off-by: Umang Jain --- On LIMITED level - no regressions were found : 230/231 pass rate (retested locally from RFC v1) On FULL level - this fixes the test: android.hardware.camera2.cts.SurfaceViewPreviewTest#testPreviewFpsRange --- src/android/camera_capabilities.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index f357902e..66ff1274 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -667,8 +667,17 @@ int CameraCapabilities::initializeStreamConfigurations() * control to be specified for each Request. Defer this * to the in-development configuration API rework. */ - if (minFrameDuration < 1e9 / 30.0) - minFrameDuration = 1e9 / 30.0; + int64_t capMinFrameDuration = 1e9 / 30.0; + if (minFrameDuration < capMinFrameDuration) { + float delta = (capMinFrameDuration - minFrameDuration) * 100 / capMinFrameDuration; + + /* + * If the delta is less than 1%, do not cap the + * frame duration. + */ + if (delta > 1) + minFrameDuration = capMinFrameDuration; + } streamConfigurations_.push_back({ res, androidFormat, minFrameDuration, maxFrameDuration,