[{"id":17825,"web_url":"https://patchwork.libcamera.org/comment/17825/","msgid":"<YNkIxst5S4ADecKs@pendragon.ideasonboard.com>","date":"2021-06-27T23:24:54","subject":"Re: [libcamera-devel] [RFC PATCH 02/14] android,\n\tcontrols: Add and plumb MaxLatency control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, Jun 18, 2021 at 07:33:39PM +0900, Paul Elder wrote:\n> Add a MaxLatency control, and plumb it into the HAL accordingly.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=50\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp  |  8 ++++++++\n>  src/libcamera/control_ids.yaml | 10 ++++++++++\n>  2 files changed, 18 insertions(+)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 25dd2569..86f47e00 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1187,6 +1187,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \n>  \t/* Sync static metadata. */\n>  \tint32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN;\n> +\tconst auto &maxLatencyInfo = controlsInfo.find(&controls::draft::MaxLatency);\n> +\tif (maxLatencyInfo != controlsInfo.end())\n> +\t\tmaxLatency = maxLatencyInfo->second.def().get<int32_t>();\n> +\tif (maxLatency < 0 && 4 < maxLatency)\n\nmaxLatency will have a hard time being smaller than zero and larger than\nfour at the same time.\n\nWhere does 4 come from btw ? A comment to explain the logic could be\nuseful.\n\n> +\t\tcapabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE] = false;\n> +\t/* \\todo Double check if this is the case */\n\nI think this is correct, the documentation explicitly states\n\nPER_FRAME_CONTROL (v3.2) = 0 [...] All FULL capability devices will\nhave this as their maxLatency.\n\nWith this fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\tif (maxLatency != 0)\n> +\t\tfullSupport = false;\n>  \tstaticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, maxLatency);\n>  \n>  \t/* Flash static metadata. */\n> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> index d92f29f5..9d4638ae 100644\n> --- a/src/libcamera/control_ids.yaml\n> +++ b/src/libcamera/control_ids.yaml\n> @@ -622,6 +622,16 @@ controls:\n>          detection, additional format conversions etc) count as an additional\n>          pipeline stage.\n>  \n> +  - MaxLatency:\n> +      type: int32_t\n> +      draft: true\n> +      description: |\n> +        The maximum number of frames that can occur after a request (different\n> +        than the previous) has been submitted, and before the result's state\n> +        becomes synchronized. A value of -1 indicates unknown latency, and 0\n> +        indicates per-frame control. Currently identical to\n> +        ANDROID_SYNC_MAX_LATENCY.\n> +\n>    - TestPatternMode:\n>        type: int32_t\n>        draft: true","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 1C4C0C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 27 Jun 2021 23:25:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44C80684D5;\n\tMon, 28 Jun 2021 01:24:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 86F626028C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 01:24:56 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 02000E1A;\n\tMon, 28 Jun 2021 01:24:55 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gOs3Z98X\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624836296;\n\tbh=FyEOkvGrDODmGxIQVM49SbTUmP1kjWcA1pBk7l3FWC8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gOs3Z98X9occbve/eeiAVfu5aS7g9Y0GNB3SNk/vl/z1W9Cvt7s/FMpU0nf97BZ6Z\n\txeSPlUmn8ATOSDzbZme5RCjTVNIu0miZtfTvY+HgmsicF7bNsKutuaa6e0qcqKaEPK\n\tjmQhj6IOvGwryWKBN75ePwB6xqxGRc/9aHpRGc9c=","Date":"Mon, 28 Jun 2021 02:24:54 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YNkIxst5S4ADecKs@pendragon.ideasonboard.com>","References":"<20210618103351.1642060-1-paul.elder@ideasonboard.com>\n\t<20210618103351.1642060-3-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210618103351.1642060-3-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 02/14] android,\n\tcontrols: Add and plumb MaxLatency control","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]