[libcamera-devel,v2,1/5] ipa: raspberrypi: controller: Replace Raspberry Pi debug with libcamera debug
diff mbox series

Message ID 20210125184858.16339-2-david.plowman@raspberrypi.com
State Accepted
Commit 15d3970c0ce8a21e1344cc9f4d60bb5928ce293d
Headers show
Series
  • Remove Raspberry Pi logging
Related show

Commit Message

David Plowman Jan. 25, 2021, 6:48 p.m. UTC
Some unhelpful debug statements have been removed.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/ipa/raspberrypi/controller/controller.cpp | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Laurent Pinchart Jan. 26, 2021, 8:14 a.m. UTC | #1
Hi David,

Thank you for the patch.

On Mon, Jan 25, 2021 at 06:48:54PM +0000, David Plowman wrote:
> Some unhelpful debug statements have been removed.
> 
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/ipa/raspberrypi/controller/controller.cpp | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp
> index 22461cc4..96b58359 100644
> --- a/src/ipa/raspberrypi/controller/controller.cpp
> +++ b/src/ipa/raspberrypi/controller/controller.cpp
> @@ -5,6 +5,8 @@
>   * controller.cpp - ISP controller
>   */
>  
> +#include "libcamera/internal/log.h"
> +
>  #include "algorithm.hpp"
>  #include "controller.hpp"
>  
> @@ -12,6 +14,9 @@
>  #include <boost/property_tree/ptree.hpp>
>  
>  using namespace RPiController;
> +using namespace libcamera;
> +
> +LOG_DEFINE_CATEGORY(RPiController)
>  
>  Controller::Controller()
>  	: switch_mode_called_(false) {}
> @@ -27,7 +32,6 @@ Controller::~Controller() {}
>  
>  void Controller::Read(char const *filename)
>  {
> -	RPI_LOG("Controller starting");
>  	boost::property_tree::ptree root;
>  	boost::property_tree::read_json(filename, root);
>  	for (auto const &key_and_value : root) {
> @@ -36,10 +40,9 @@ void Controller::Read(char const *filename)
>  			algo->Read(key_and_value.second);
>  			algorithms_.push_back(AlgorithmPtr(algo));
>  		} else
> -			RPI_LOG("WARNING: No algorithm found for \""
> -				<< key_and_value.first << "\"");
> +			LOG(RPiController, Warning)
> +				<< "No algorithm found for \"" << key_and_value.first << "\"";
>  	}
> -	RPI_LOG("Controller finished");
>  }
>  
>  Algorithm *Controller::CreateAlgorithm(char const *name)
> @@ -50,39 +53,31 @@ Algorithm *Controller::CreateAlgorithm(char const *name)
>  
>  void Controller::Initialise()
>  {
> -	RPI_LOG("Controller starting");
>  	for (auto &algo : algorithms_)
>  		algo->Initialise();
> -	RPI_LOG("Controller finished");
>  }
>  
>  void Controller::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
>  {
> -	RPI_LOG("Controller starting");
>  	for (auto &algo : algorithms_)
>  		algo->SwitchMode(camera_mode, metadata);
>  	switch_mode_called_ = true;
> -	RPI_LOG("Controller finished");
>  }
>  
>  void Controller::Prepare(Metadata *image_metadata)
>  {
> -	RPI_LOG("Controller::Prepare starting");
>  	assert(switch_mode_called_);
>  	for (auto &algo : algorithms_)
>  		if (!algo->IsPaused())
>  			algo->Prepare(image_metadata);
> -	RPI_LOG("Controller::Prepare finished");
>  }
>  
>  void Controller::Process(StatisticsPtr stats, Metadata *image_metadata)
>  {
> -	RPI_LOG("Controller::Process starting");
>  	assert(switch_mode_called_);
>  	for (auto &algo : algorithms_)
>  		if (!algo->IsPaused())
>  			algo->Process(stats, image_metadata);
> -	RPI_LOG("Controller::Process finished");
>  }
>  
>  Metadata &Controller::GetGlobalMetadata()

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp
index 22461cc4..96b58359 100644
--- a/src/ipa/raspberrypi/controller/controller.cpp
+++ b/src/ipa/raspberrypi/controller/controller.cpp
@@ -5,6 +5,8 @@ 
  * controller.cpp - ISP controller
  */
 
+#include "libcamera/internal/log.h"
+
 #include "algorithm.hpp"
 #include "controller.hpp"
 
@@ -12,6 +14,9 @@ 
 #include <boost/property_tree/ptree.hpp>
 
 using namespace RPiController;
+using namespace libcamera;
+
+LOG_DEFINE_CATEGORY(RPiController)
 
 Controller::Controller()
 	: switch_mode_called_(false) {}
@@ -27,7 +32,6 @@  Controller::~Controller() {}
 
 void Controller::Read(char const *filename)
 {
-	RPI_LOG("Controller starting");
 	boost::property_tree::ptree root;
 	boost::property_tree::read_json(filename, root);
 	for (auto const &key_and_value : root) {
@@ -36,10 +40,9 @@  void Controller::Read(char const *filename)
 			algo->Read(key_and_value.second);
 			algorithms_.push_back(AlgorithmPtr(algo));
 		} else
-			RPI_LOG("WARNING: No algorithm found for \""
-				<< key_and_value.first << "\"");
+			LOG(RPiController, Warning)
+				<< "No algorithm found for \"" << key_and_value.first << "\"";
 	}
-	RPI_LOG("Controller finished");
 }
 
 Algorithm *Controller::CreateAlgorithm(char const *name)
@@ -50,39 +53,31 @@  Algorithm *Controller::CreateAlgorithm(char const *name)
 
 void Controller::Initialise()
 {
-	RPI_LOG("Controller starting");
 	for (auto &algo : algorithms_)
 		algo->Initialise();
-	RPI_LOG("Controller finished");
 }
 
 void Controller::SwitchMode(CameraMode const &camera_mode, Metadata *metadata)
 {
-	RPI_LOG("Controller starting");
 	for (auto &algo : algorithms_)
 		algo->SwitchMode(camera_mode, metadata);
 	switch_mode_called_ = true;
-	RPI_LOG("Controller finished");
 }
 
 void Controller::Prepare(Metadata *image_metadata)
 {
-	RPI_LOG("Controller::Prepare starting");
 	assert(switch_mode_called_);
 	for (auto &algo : algorithms_)
 		if (!algo->IsPaused())
 			algo->Prepare(image_metadata);
-	RPI_LOG("Controller::Prepare finished");
 }
 
 void Controller::Process(StatisticsPtr stats, Metadata *image_metadata)
 {
-	RPI_LOG("Controller::Process starting");
 	assert(switch_mode_called_);
 	for (auto &algo : algorithms_)
 		if (!algo->IsPaused())
 			algo->Process(stats, image_metadata);
-	RPI_LOG("Controller::Process finished");
 }
 
 Metadata &Controller::GetGlobalMetadata()