diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2021-05-10 10:13:36 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-06-14 12:26:28 +0200 |
commit | efd5fb7288a7a9c72f3ae7b1256c2b808aaf525f (patch) | |
tree | 7e034a7a29c2be7b4c6ca423fbd67a3349226bc9 /src/android/camera_ops.cpp | |
parent | 103dfb85a7e12c00c1a41eef69f45faa8f5c7597 (diff) |
android: Implement flush() camera operation
Implement the flush() camera operation in the CameraDevice class
and make it available to the camera framework by implementing the
operation wrapper in camera_ops.cpp.
Introduce a new camera state State::Flushing to handle concurrent
flush() and process_capture_request() calls.
As flush() can race with processCaptureRequest() protect it
by introducing a new State::Flushing state that
processCaptureRequest() inspects before queuing the Request to the
Camera. If flush() is in progress while processCaptureRequest() is
called, return the current Request immediately in error state. If
flush() has completed and a new call to processCaptureRequest() is
made just after, start the camera again before queuing the request.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/camera_ops.cpp')
-rw-r--r-- | src/android/camera_ops.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/android/camera_ops.cpp b/src/android/camera_ops.cpp index 696e8043..8a3cfa17 100644 --- a/src/android/camera_ops.cpp +++ b/src/android/camera_ops.cpp @@ -66,8 +66,14 @@ static void hal_dev_dump([[maybe_unused]] const struct camera3_device *dev, { } -static int hal_dev_flush([[maybe_unused]] const struct camera3_device *dev) +static int hal_dev_flush(const struct camera3_device *dev) { + if (!dev) + return -EINVAL; + + CameraDevice *camera = reinterpret_cast<CameraDevice *>(dev->priv); + camera->flush(); + return 0; } |