From patchwork Wed Feb 16 12:35:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15367 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 36671C3261 for ; Wed, 16 Feb 2022 12:35:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 36BFE6113C; Wed, 16 Feb 2022 13:35:51 +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="qMYI/Lq2"; 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 F41BB610F8 for ; Wed, 16 Feb 2022 13:35:48 +0100 (CET) Received: from Monstersaurus.ksquared.org.uk.beta.tailscale.net (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9289C482; Wed, 16 Feb 2022 13:35:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1645014948; bh=mIpX4IaHO0YEY0B9M91PqnBwf7+YCBiaqrCIiLl+X10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMYI/Lq2WNr3T+18CptP6dal1bgPwJ06ID5BTKTDbEmI9Hvs3OZ4zEhgjKfXuFKsZ RTFfRZ52urtb6XE3dKigvEUvVm9jANFlTXGAxM+sf5bq3y4omDsVdHj4u6Q4KC8uuZ 4Zp/x7NxlXrISXIabME3jBqMaB5VfX2kz9ThC0Aw= From: Kieran Bingham To: libcamera devel Date: Wed, 16 Feb 2022 12:35:43 +0000 Message-Id: <20220216123544.637834-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220216123544.637834-1-kieran.bingham@ideasonboard.com> References: <20220216123544.637834-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [SimpleCam PATCH 1/2] simple-cam: processRequest: Report timestamp and enhance description 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" Report the timestamp of the completed buffers when the processRequest() call handles a request and improve the description to discuss more of the operations that can be done here. Signed-off-by: Kieran Bingham Reviewed-by: Paul Elder --- simple-cam.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/simple-cam.cpp b/simple-cam.cpp index 71a715a0c27d..e282463c3976 100644 --- a/simple-cam.cpp +++ b/simple-cam.cpp @@ -46,8 +46,17 @@ static void requestComplete(Request *request) static void processRequest(Request *request) { + /* + * Each buffer has its own FrameMetadata to describe its state, or the + * usage of each buffer. While in our simple capture we only provide one + * buffer per request, a request can have a buffer for each stream that + * is established when configuring the camera. + * + * This allows a viewfinder and a still image to be processed at the + * same time, or to allow obtaining the RAW capture buffer from the + * sensor along with the image as processed by the ISP. + */ const Request::BufferMap &buffers = request->buffers(); - for (auto bufferPair : buffers) { // (Unused) Stream *stream = bufferPair.first; FrameBuffer *buffer = bufferPair.second; @@ -55,6 +64,7 @@ static void processRequest(Request *request) /* Print some information about the buffer which has completed. */ std::cout << " seq: " << std::setw(6) << std::setfill('0') << metadata.sequence + << " timestamp: " << metadata.timestamp << " bytesused: "; unsigned int nplane = 0; From patchwork Wed Feb 16 12:35:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15368 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 C07F4BE08A for ; Wed, 16 Feb 2022 12:35:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9DF4E61140; Wed, 16 Feb 2022 13:35:51 +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="vuOQlH6+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3791661121 for ; Wed, 16 Feb 2022 13:35:49 +0100 (CET) Received: from Monstersaurus.ksquared.org.uk.beta.tailscale.net (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D06B5484; Wed, 16 Feb 2022 13:35:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1645014949; bh=o/S6asNw/vtJ1/G6uP6l+lwKSO6icCX6NWJk4FdGOwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vuOQlH6++Br6tHY9uYrXiCP6aPdaNrc1Nru9bvLMHZYGzF4yfPg4vX4qB8f7zW+6j Fd31uE9kzMniF2/x4VpI9Cc1lofmOLggV9OIVc+E6M8ncTPYU0B5LoqmHBEr7Es3Gv ukNB0f8bgTjWS9gTE+z/MehZ806+wZld+3C18tK8= From: Kieran Bingham To: libcamera devel Date: Wed, 16 Feb 2022 12:35:44 +0000 Message-Id: <20220216123544.637834-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220216123544.637834-1-kieran.bingham@ideasonboard.com> References: <20220216123544.637834-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [SimpleCam PATCH 2/2] simple-cam: processRequest: Report Request metadata 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: , Cc: Nejc Galof Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The completed Request can contain extra data associated with the completed capture to report IPA state or properties of the capture to the application. Process and report any metadata that is associated with the request when it completes, to demonstrate the extra metadata available to be processed. Now that there is substantially more information than one line per completed request, start each completed Request with a blank line to separate from previous completions and report the state of the Request itself with its .toString() helper. Suggested-by: Nejc Galof Signed-off-by: Kieran Bingham --- simple-cam.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/simple-cam.cpp b/simple-cam.cpp index e282463c3976..4de1b7de9ced 100644 --- a/simple-cam.cpp +++ b/simple-cam.cpp @@ -46,6 +46,29 @@ static void requestComplete(Request *request) static void processRequest(Request *request) { + std::cout << std::endl + << "Request completed: " << request->toString() << std::endl; + + /* + * When a request has completed, it is populated with a metadata control + * list that allows an application to determine various properties of + * the completed request. This can include the timestamp of the Sensor + * capture, or its gain and exposure values, or properties from the IPA + * such as the state of the 3A algorithms. + * + * ControlValue types have a toString, so to examine each request, print + * all the metadata for inspection. A custom application can parse each + * of these items and process them according to its needs. + */ + const ControlList &requestMetadata = request->metadata(); + for (const auto &ctrl : requestMetadata) { + const ControlId *id = controls::controls.at(ctrl.first); + const ControlValue &value = ctrl.second; + + std::cout << "\t" << id->name() << " = " << value.toString() + << std::endl; + } + /* * Each buffer has its own FrameMetadata to describe its state, or the * usage of each buffer. While in our simple capture we only provide one