summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2022-01-04 12:22:01 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2022-03-03 17:29:02 +0530
commite68e0f1ed2880ea26b5e317f94e2bbd5332e1598 (patch)
tree147d280d2c9f553603da8ecd16f564096e090888 /src
parentbf0154697b69a92a0c4647fe7d1527a9f77042a1 (diff)
android: camera_request: Lifetime of a Camera3RequestDescriptor
This commit provides a sketch regarding Camera3RequestDescriptor which aids tracking each capture reuqest placed by the android framework to libcamera HAL. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_request.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/android/camera_request.cpp b/src/android/camera_request.cpp
index 1593f219..6c87adba 100644
--- a/src/android/camera_request.cpp
+++ b/src/android/camera_request.cpp
@@ -18,6 +18,94 @@ using namespace libcamera;
*
* A utility class that groups information about a capture request to be later
* reused at request complete time to notify the framework.
+ *
+ *******************************************************************************
+ * Lifetime of a Camera3RequestDescriptor tracking a capture request placed by
+ * Android Framework
+ *******************************************************************************
+ *
+ *
+ * Android Framework
+ * │
+ * │ ┌──────────────────────────────────┐
+ * │ │camera3_capture_request_t │
+ * │ │ │
+ * │ │Requested output streams │
+ * │ │ stream1 stream2 stream3 ... │
+ * │ └──────────────────────────────────┘
+ * ▼
+ * ┌─────────────────────────────────────────────────────────────┐
+ * │ libcamera HAL │
+ * ├─────────────────────────────────────────────────────────────┤
+ * │ CameraDevice │
+ * │ │
+ * │ processCaptureRequest(camera3_capture_request_t request) │
+ * │ │
+ * │ - Create Camera3RequestDescriptor tracking this request │
+ * │ - Streams requiring post-processing are stored in the │
+ * │ pendingStreamsToProcess map │
+ * │ - Add this Camera3RequestDescriptor to descriptors' queue │
+ * │ CameraDevice::descriptors_ │
+ * │ │ ┌─────────────────────────┐
+ * │ - Queue the capture request to libcamera core ────────────┤►│libcamera core │
+ * │ │ ├─────────────────────────┤
+ * │ │ │- Capture from Camera │
+ * │ │ │ │
+ * │ │ │- Emit │
+ * │ │ │ Camera::requestComplete│
+ * │ requestCompleted(Request *request) ◄───────────────────────┼─┼──── │
+ * │ │ │ │
+ * │ - Check request completion status │ └─────────────────────────┘
+ * │ │
+ * │ - if (pendingStreamsToProcess > 0) │
+ * │ Queue all entries from pendingStreamsToProcess │
+ * │ else │ │
+ * │ completeDescriptor() │ └──────────────────────┐
+ * │ │ │
+ * │ ┌──────────────────────────┴───┬──────────────────┐ │
+ * │ │ │ │ │
+ * │ ┌──────────▼────────────┐ ┌───────────▼─────────┐ ▼ │
+ * │ │CameraStream1 │ │CameraStream2 │ .... │
+ * │ ├┬───┬───┬──────────────┤ ├┬───┬───┬────────────┤ │
+ * │ ││ │ │ │ ││ │ │ │ │
+ * │ │▼───▼───▼──────────────┤ │▼───▼───▼────────────┤ │
+ * │ │PostProcessorWorker │ │PostProcessorWorker │ │
+ * │ │ │ │ │ │
+ * │ │ +------------------+ │ │ +------------------+│ │
+ * │ │ | PostProcessor | │ │ | PostProcessor |│ │
+ * │ │ | process() | │ │ | process() |│ │
+ * │ │ | | │ │ | |│ │
+ * │ │ | Emit | │ │ | Emit |│ │
+ * │ │ | processComplete | │ │ | processComplete |│ │
+ * │ │ | | │ │ | |│ │
+ * │ │ +--------------│---+ │ │ +--------------│---+│ │
+ * │ │ │ │ │ │ │ │
+ * │ │ │ │ │ │ │ │
+ * │ └────────────────┼──────┘ └────────────────┼────┘ │
+ * │ │ │ │
+ * │ │ │ │
+ * │ │ │ │
+ * │ ▼ ▼ │
+ * │ +---------------------------------------+ +--------------+ │
+ * │ | CameraDevice | | | │
+ * │ | | | | │
+ * │ | streamProcessingComplete() | | | │
+ * │ | | | | │
+ * │ | - Check and set buffer status | | .... | │
+ * │ | - Remove post+processing entry | | | │
+ * │ | from pendingStreamsToProcess | | | │
+ * │ | | | | │
+ * │ | - if (pendingStreamsToProcess.empty())| | | │
+ * │ | completeDescriptor | | | │
+ * │ | | | | │
+ * │ +---------------------------------------+ +--------------+ │
+ * │ │
+ * └────────────────────────────────────────────────────────────────────────────────────┘
+ *
+ * +-------------+
+ * | | - PostProcessorWorker's thread
+ * | |
+ * +-------------+
*/
Camera3RequestDescriptor::Camera3RequestDescriptor(