[libcamera-devel,v4,9/9] android: camera_device: Add stream mapping log

Message ID 20200930132707.19367-10-jacopo@jmondi.org
State Accepted
Headers show
Series
  • android: camera_device: Add support for internal buffers
Related show

Commit Message

Jacopo Mondi Sept. 30, 2020, 1:27 p.m. UTC
To ease following how Android streams get mapped to libcamera ones
add a (quite verbose) printout before queueing a request to libcamera.

The output looks like:
 0 -  (320x240)[0x00000022] -> (320x240)[NV12] (direct)
 1 -  (640x480)[0x00000021] -> (640x480)[NV12] (internal)

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Patch

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index dc19faf8edd7..7383664e2e2f 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1476,9 +1476,12 @@  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 	Request *request =
 		camera_->createRequest(reinterpret_cast<uint64_t>(descriptor));
 
+	LOG(HAL, Debug) << "Queueing Request to libcamera with "
+			<< descriptor->numBuffers << " HAL streams";
 	for (unsigned int i = 0; i < descriptor->numBuffers; ++i) {
+		camera3_stream *camera3Stream = camera3Buffers[i].stream;
 		CameraStream *cameraStream =
-			static_cast<CameraStream *>(camera3Buffers[i].stream->priv);
+			static_cast<CameraStream *>(camera3Stream->priv);
 		const StreamConfiguration &config = config_->at(cameraStream->index());
 		Stream *stream = config.stream();
 
@@ -1489,6 +1492,13 @@  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 		descriptor->buffers[i].stream = camera3Buffers[i].stream;
 		descriptor->buffers[i].buffer = camera3Buffers[i].buffer;
 
+		std::stringstream ss;
+		ss << i << " - ("
+		   << camera3Stream->width << "x" << camera3Stream->height << ")"
+		   << "[" << utils::hex(camera3Stream->format) << "] -> "
+		   << "(" << config.size.toString() << ")["
+		   << config.pixelFormat.toString() << "]";
+
 		/*
 		 * Inspect the camera stream type, create buffers opportunely
 		 * and add them to the Request if required.
@@ -1500,6 +1510,7 @@  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 			 * Mapped streams don't need buffers added to the
 			 * Request.
 			 */
+			LOG(HAL, Debug) << ss.str() << " (mapped)";
 			continue;
 
 		case CameraStream::Type::Direct:
@@ -1511,6 +1522,7 @@  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 			 */
 			buffer = createFrameBuffer(*camera3Buffers[i].buffer);
 			descriptor->frameBuffers.emplace_back(buffer);
+			LOG(HAL, Debug) << ss.str() << " (direct)";
 			break;
 
 		case CameraStream::Type::Internal:
@@ -1524,6 +1536,7 @@  int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
 			 * allocator once it has been processed.
 			 */
 			buffer = getBuffer(stream);
+			LOG(HAL, Debug) << ss.str() << " (internal)";
 			break;
 		}
 		if (!buffer) {