[{"id":21107,"web_url":"https://patchwork.libcamera.org/comment/21107/","msgid":"<YZw2IWL1fBzG6xLA@pendragon.ideasonboard.com>","date":"2021-11-23T00:30:25","subject":"Re: [libcamera-devel] [RFC PATCH 2/2] android: camera_request:\n\tLifetime of a Camera3RequestDescriptor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Fri, Nov 19, 2021 at 06:45:06PM +0530, Umang Jain wrote:\n> This commit provides a sketch regarding Camera3RequestDescriptor\n> which is aids tracking each capture reuquest placed by the android\n\ns/which is/which/\ns/reuquest/request/\n\n> framework to libcamera HAL.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  src/android/camera_request.cpp | 97 ++++++++++++++++++++++++++++++++++\n>  1 file changed, 97 insertions(+)\n> \n> diff --git a/src/android/camera_request.cpp b/src/android/camera_request.cpp\n> index 4e017792..824b667d 100644\n> --- a/src/android/camera_request.cpp\n> +++ b/src/android/camera_request.cpp\n> @@ -18,6 +18,9 @@ using namespace libcamera;\n>   *\n>   * A utility class that groups information about a capture request to be later\n>   * reused at request complete time to notify the framework.\n> + *\n> + * Also, refer to the Camera3RequestDescriptor's lifetime diagram at the end of\n> + * this file.\n\nI was going to say that \"end of this file\" won't mean much after\ncompiling the documentation with Doxygen, but we don't use Doxygen for\nthe HAL :-) I would however move the diagram here, regardless of that.\n\n>   */\n>  \n>  Camera3RequestDescriptor::Camera3RequestDescriptor(\n> @@ -105,3 +108,97 @@ Camera3RequestDescriptor::StreamBuffer::StreamBuffer(StreamBuffer &&) = default;\n>  \n>  Camera3RequestDescriptor::StreamBuffer &\n>  Camera3RequestDescriptor::StreamBuffer::operator=(Camera3RequestDescriptor::StreamBuffer &&) = default;\n> +\n> +/*******************************************************************************\n> + * Lifetime of a Camera3RequestDescriptor tracking a capture request placed by\n> + * Android Framework\n> + *******************************************************************************\n> + *\n> + *\n> + *  Android Framework\n> + *     │\n> + *     │    ┌──────────────────────────────────┐\n> + *     │    │camera3_capture_request_t         │\n> + *     │    │                                  │\n> + *     │    │Requested output streams          │\n> + *     │    │  stream1   stream2   stream3 ... │\n> + *     │    └──────────────────────────────────┘\n> + *     ▼\n> + * ┌─────────────────────────────────────────────────────────────┐\n> + * │ libcamera HAL                                               │\n> + * ├─────────────────────────────────────────────────────────────┤\n> + * │  CameraDevice                                               │\n> + * │                                                             │\n> + * │  processCaptureRequest(camera3_capture_request_t request)   │\n> + * │                                                             │\n> + * │   - Create Camera3RequestDescriptor tracking this request   │\n> + * │   - Streams requiring post-processing is stored as a        │\n\ns/is stored/are stored/\ns/as a map Camera3Requestdescriptor::pendingStreamsToProcess/in the pendingStreamsToProcess map/\n\n> + * │     map Camera3Requestdescriptor::pendingStreamsToProcess   │\n> + * │   - Add this Camera3RequestDescriptor to descriptors' queue │\n> + * │     CameraDevice::descriptors_                              │\n> + * │                                                             │ ┌─────────────────────────┐\n> + * │   - Queue the capture request to libcamera core ────────────┤►│libcamera core           │\n> + * │                                                             │ ├─────────────────────────┤\n> + * │                                                             │ │- Capture from Camera    │\n> + * │                                                             │ │                         │\n> + * │                                                             │ │- Emit                   │\n> + * │                                                             │ │  Camera::requestComplete│\n> + * │  requestCompleted(Request *request) ◄───────────────────────┼─┼────                     │\n> + * │                                                             │ │                         │\n> + * │   - Check request completion status                         │ └─────────────────────────┘\n> + * │                                                             │\n> + * │   - If(pendingStreamsToProcess > 0)                         │\n\ns/If(/if /\n\n> + * │      Queue all entries from pendingStreamsToProcess         │\n> + * │    else                                   │                 │\n> + * │      completeDescriptor()                 │                 └──────────────────────┐\n> + * │                                           │                                        │\n> + * │                ┌──────────────────────────┴───┬──────────────────┐                 │\n> + * │                │                              │                  │                 │\n> + * │     ┌──────────▼────────────┐     ┌───────────▼─────────┐        ▼                 │\n> + * │     │CameraStream1          │     │CameraStream2        │      ....                │\n> + * │     ├┬───┬───┬──────────────┤     ├┬───┬───┬────────────┤                          │\n> + * │     ││   │   │              │     ││   │   │            │                          │\n> + * │     │▼───▼───▼──────────────┤     │▼───▼───▼────────────┤                          │\n> + * │     │PostProcessorWorker    ├─    │PostProcessorWorker  │                          │\n\nIs the \"├─\" there on purpose ?\n\n> + * │     │                       │     │                     │                          │\n> + * │     │ xxxxxxxxxxxxxxxxxxx   │     │ xxxxxxxxxxxxxxxxxxx │                          │\n> + * │     │ x PostProcessor   x   │     │ x PostProcessor   x │                          │\n> + * │     │ x     process()   x   │     │ x     process()   x │                          │\n> + * │     │ x                 x   │     │ x                 x │                          │\n> + * │     │ x Emit            x   │     │ x Emit            x │                          │\n> + * │     │ x processComplete x   │     │ x processComplete x │                          │\n> + * │     │ x                 x   │     │ x                 x │                          │\n> + * │     │ xxxxxxxxxxxxxxx│xxx   │     │ xxxxxxxxxxxxxxx│xxx │                          │\n> + * │     │                │      │     │                │    │                          │\n> + * │     │                │      │     │                │    │                          │\n> + * │     └────────────────┼──────┘     └────────────────┼────┘                          │\n> + * │                      │                             │                               │\n> + * │                      │                             │                               │\n> + * │                      │                             │                               │\n> + * │                      ▼                             ▼                               │\n> + * │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │\n> + * │ x CameraDevice                        x    x CameraDevice                        x │\n> + * │ x                                     x    x                                     x │\n> + * │ x streamProcessingComplete()          x    x streamProcessingComplete()          x │\n> + * │ x                                     x    x                                     x │\n> + * │ x - Check and set buffer status       x    x - Check and set buffer status       x │\n> + * │ x - Remove post-processing entry      x    x - Remove post-processing entry      x │\n> + * │ x   from pendingStreamsToProcess      x    x   from pendingStreamsToProcess      x │\n> + * │ x                                     x    x                                     x │\n> + * │ x - If(pendingStreamsToProcess.empty()x    x - If(pendingStreamsToProcess.empty()x │\n\ns/If(/if (/\ns/empty()/empty())/\n\n> + * │ x        completeDescriptor           x    x        completeDescriptor           x │\n> + * │ x                                     x    x                                     x │\n> + * │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │\n\nYou could remove the text from the second box to avoid the duplication,\nand just write ....\n\n> + * │                                                                                    │\n> + * └────────────────────────────────────────────────────────────────────────────────────┘\n> + *\n> + *\n> + *\n> + *\n> + *\n> + *\n\nI'd keep a single blank line only.\n\n> + *  xxxxxxxxxxxxxx\n> + *  x            x   - PostProcessorWorker's thread\n> + *  x            x\n> + *  xxxxxxxxxxxxxx\n\nCould this be easier to read with a double-line box instead of x's ?\n\n╔═══════╗\n║       ║\n║       ║\n║       ║\n╚═══════╝\n\n(and for completeness, if you need the other characters)\n\n╔═══╦═══╗\n║   ║   ║\n╠═══╬═══╣\n║   ║   ║\n╚═══╩═══╝\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + */","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 B3CE6BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 00:30:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CECA86036F;\n\tTue, 23 Nov 2021 01:30:50 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9BB2160227\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 01:30:48 +0100 (CET)","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 F29ADA1B;\n\tTue, 23 Nov 2021 01:30:47 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XrKdFAuH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637627448;\n\tbh=pEWFHkTW2Uv4vzjDSl8bEHhbtVAXxmPD5ROaLufhZEk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=XrKdFAuHzabr3kBim2H/RCFIVuoVWR3bHTzUeM690EfZIMHeoqwAEQDPgww92REOZ\n\t7rwiLbiTg5hsFESNuOSNBtlEmHTMYUtZFBY3bhC5a/mXlvV+xcrhsium0dRDUCZdtE\n\tlOz+fKyy7y/qB+ZgZc7urTNfZ3tBYV7IZCoizAtg=","Date":"Tue, 23 Nov 2021 02:30:25 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<YZw2IWL1fBzG6xLA@pendragon.ideasonboard.com>","References":"<20211119131506.382462-1-umang.jain@ideasonboard.com>\n\t<20211119131506.382462-3-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20211119131506.382462-3-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 2/2] android: camera_request:\n\tLifetime of a Camera3RequestDescriptor","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>"}}]