summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-10-14 12:28:48 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-10-19 11:04:18 +0200
commit12ecb75c4ff49f0c15b7a93bd82c1fad4f69f9f1 (patch)
treeb61955abb1a420145afd53cb2cc2d53be1adb684 /src/android
parent375aeafb58efea248f64832b2e529284385bc777 (diff)
android: Re-order out-of-order completion path
When the camera HAL detects an out-of-order completion of a request, it sends to the camera framework a CAMERA3_MSG_ERROR_DEVICE error. Such error not only forces the service to close the camera as prescribed by the camera3 specification, but in some implementation (specifically the ChromeOS one) it causes the camera service to abort and exit. This prevents any error messages from being printed by libcamera, as the library gets terminated before getting to that point, and also hides the printout of error messages that lead to out-of-order completion, making it impossible to get from the output log what happened. Move the call to notifyError() at the end of the error path and demote the error message to LogLevels::Error from Fatal to let the service implementation decide how to handle CAMERA3_MSG_ERROR_DEVICE errors. Before this patch, when waiting on a fence fails and the capture request is not queued to the Camera, we get an out-of-order completion but no backtrace. With this patch applied the error path is visible: ERROR HAL camera_worker.cpp:122 Failed waiting for fence: 82: Timer expired ERROR HAL camera_device.cpp:1110 '\_SB_.PCI0.I2C2.CAM0': Out-of-order completion for request 0x00007e6de4004c70 Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/camera_device.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index bd341888..fe29b7bc 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1075,16 +1075,17 @@ void CameraDevice::requestComplete(Request *request)
if (descriptor->request_->cookie() != request->cookie()) {
/*
* \todo Clarify if the Camera has to be closed on
- * ERROR_DEVICE and possibly demote the Fatal to simple
- * Error.
+ * ERROR_DEVICE.
*/
- notifyError(0, nullptr, CAMERA3_MSG_ERROR_DEVICE);
- LOG(HAL, Fatal)
+ LOG(HAL, Error)
<< "Out-of-order completion for request "
<< utils::hex(request->cookie());
MutexLocker descriptorsLock(descriptorsMutex_);
descriptors_.pop();
+
+ notifyError(0, nullptr, CAMERA3_MSG_ERROR_DEVICE);
+
return;
}