From 89dc54af09d4885a4134b332ddd9f82eef3789ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>
Date: Thu, 21 Nov 2019 18:44:29 +0100
Subject: libcamera: Remove buffer index from logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The buffer index is a V4L2 concept that will be hidden from users with
the introduction of a new FrameBuffer class. In preparation for this,
remove the index from log messages.

Keep and move one debug log message where the index is available as the
V4L2 buffer is being dequeued for the video device and it's useful when
debugging.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/cam/capture.cpp                | 3 +--
 src/libcamera/v4l2_videodevice.cpp | 3 +--
 src/qcam/main_window.cpp           | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp
index e665d819..4b65b1d0 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/capture.cpp
@@ -155,7 +155,6 @@ void Capture::requestComplete(Request *request)
 		const std::string &name = streamName_[stream];
 
 		info << " " << name
-		     << " (" << buffer->index() << ")"
 		     << " seq: " << std::setw(6) << std::setfill('0') << buffer->sequence()
 		     << " bytesused: " << buffer->bytesused();
 
@@ -182,7 +181,7 @@ void Capture::requestComplete(Request *request)
 
 		std::unique_ptr<Buffer> newBuffer = stream->createBuffer(index);
 		if (!newBuffer) {
-			std::cerr << "Can't create buffer " << index << std::endl;
+			std::cerr << "Can't create buffer" << std::endl;
 			return;
 		}
 
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 99213075..13e02323 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1102,6 +1102,7 @@ Buffer *V4L2VideoDevice::dequeueBuffer()
 		return nullptr;
 	}
 
+	LOG(V4L2, Debug) << "Dequeuing buffer " << buf.index;
 	ASSERT(buf.index < bufferPool_->count());
 
 	auto it = queuedBuffers_.find(buf.index);
@@ -1138,8 +1139,6 @@ void V4L2VideoDevice::bufferAvailable(EventNotifier *notifier)
 	if (!buffer)
 		return;
 
-	LOG(V4L2, Debug) << "Buffer " << buffer->index() << " is available";
-
 	/* Notify anyone listening to the device. */
 	bufferReady.emit(buffer);
 }
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index cca7365a..0c7ca61a 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -264,7 +264,6 @@ void MainWindow::requestComplete(Request *request)
 	lastBufferTime_ = buffer->timestamp();
 
 	std::cout << "seq: " << std::setw(6) << std::setfill('0') << buffer->sequence()
-		  << " buf: " << buffer->index()
 		  << " bytesused: " << buffer->bytesused()
 		  << " timestamp: " << buffer->timestamp()
 		  << " fps: " << std::fixed << std::setprecision(2) << fps
@@ -285,7 +284,7 @@ void MainWindow::requestComplete(Request *request)
 
 		std::unique_ptr<Buffer> newBuffer = stream->createBuffer(index);
 		if (!newBuffer) {
-			std::cerr << "Can't create buffer " << index << std::endl;
+			std::cerr << "Can't create buffer" << std::endl;
 			return;
 		}
 
-- 
cgit v1.2.1