[libcamera-devel,v3,4/6] pipeline: raspberrypi: Add IPA call tracepoints
diff mbox series

Message ID 20201029101629.61798-5-paul.elder@ideasonboard.com
State Superseded
Delegated to: Paul Elder
Headers show
Series
  • Tracing
Related show

Commit Message

Paul Elder Oct. 29, 2020, 10:16 a.m. UTC
Emit tracepoints for IPA calls in the raspberrypi pipeline handler, to
allow profiling of IPA calls.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
Changes in v3:
- rename the tracepoints to ipa_call_begin and ipa_call_end
- remove the char * casts for the strings passed to the tracepoints
- use the new ipa call tracepoint macros

New in v2
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Laurent Pinchart Oct. 30, 2020, 12:43 a.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Thu, Oct 29, 2020 at 07:16:27PM +0900, Paul Elder wrote:
> Emit tracepoints for IPA calls in the raspberrypi pipeline handler, to
> allow profiling of IPA calls.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> Changes in v3:
> - rename the tracepoints to ipa_call_begin and ipa_call_end
> - remove the char * casts for the strings passed to the tracepoints

\o/

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

> - use the new ipa call tracepoint macros
> 
> New in v2
> ---
>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 0a5a7288..07c9c25a 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -31,6 +31,7 @@
>  #include "libcamera/internal/ipa_manager.h"
>  #include "libcamera/internal/media_device.h"
>  #include "libcamera/internal/pipeline_handler.h"
> +#include "libcamera/internal/tracepoints.h"
>  #include "libcamera/internal/utils.h"
>  #include "libcamera/internal/v4l2_controls.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> @@ -1240,6 +1241,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)
>  
>  void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls)
>  {
> +	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalStatReady);
> +
>  	if (state_ == State::Stopped)
>  		handleState();
>  
> @@ -1273,6 +1276,8 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &
>  
>  void RPiCameraData::runIsp(uint32_t bufferId)
>  {
> +	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalIspPrepare);
> +
>  	if (state_ == State::Stopped)
>  		handleState();
>  
> @@ -1406,6 +1411,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
>  	 * application until after the IPA signals so.
>  	 */
>  	if (stream == &isp_[Isp::Stats]) {
> +		LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalStatReady);
>  		ipa_->signalStatReady(RPi::BufferMask::STATS | static_cast<unsigned int>(index));
>  	} else {
>  		/* Any other ISP output can be handed back to the application now. */
> @@ -1658,7 +1664,9 @@ void RPiCameraData::tryRunPipeline()
>  	 * queue the ISP output buffer listed in the request to start the HW
>  	 * pipeline.
>  	 */
> +	LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalQueueRequest);
>  	ipa_->signalQueueRequest(request->controls());
> +	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalQueueRequest);
>  
>  	/* Ready to use the buffers, pop them off the queue. */
>  	bayerQueue_.pop();
> @@ -1677,6 +1685,7 @@ void RPiCameraData::tryRunPipeline()
>  	ipa::rpi::IspPreparePayload ispPrepare;
>  	ispPrepare.embeddedbufferId_ = RPi::BufferMask::EMBEDDED_DATA | embeddedId;
>  	ispPrepare.bayerbufferId_ = RPi::BufferMask::BAYER_DATA | bayerId;
> +	LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalIspPrepare);
>  	ipa_->signalIspPrepare(ispPrepare);
>  }
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 0a5a7288..07c9c25a 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -31,6 +31,7 @@ 
 #include "libcamera/internal/ipa_manager.h"
 #include "libcamera/internal/media_device.h"
 #include "libcamera/internal/pipeline_handler.h"
+#include "libcamera/internal/tracepoints.h"
 #include "libcamera/internal/utils.h"
 #include "libcamera/internal/v4l2_controls.h"
 #include "libcamera/internal/v4l2_videodevice.h"
@@ -1240,6 +1241,8 @@  int RPiCameraData::configureIPA(const CameraConfiguration *config)
 
 void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &controls)
 {
+	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalStatReady);
+
 	if (state_ == State::Stopped)
 		handleState();
 
@@ -1273,6 +1276,8 @@  void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &
 
 void RPiCameraData::runIsp(uint32_t bufferId)
 {
+	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalIspPrepare);
+
 	if (state_ == State::Stopped)
 		handleState();
 
@@ -1406,6 +1411,7 @@  void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
 	 * application until after the IPA signals so.
 	 */
 	if (stream == &isp_[Isp::Stats]) {
+		LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalStatReady);
 		ipa_->signalStatReady(RPi::BufferMask::STATS | static_cast<unsigned int>(index));
 	} else {
 		/* Any other ISP output can be handed back to the application now. */
@@ -1658,7 +1664,9 @@  void RPiCameraData::tryRunPipeline()
 	 * queue the ISP output buffer listed in the request to start the HW
 	 * pipeline.
 	 */
+	LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalQueueRequest);
 	ipa_->signalQueueRequest(request->controls());
+	LIBCAMERA_TRACEPOINT_IPA_END(rpi, signalQueueRequest);
 
 	/* Ready to use the buffers, pop them off the queue. */
 	bayerQueue_.pop();
@@ -1677,6 +1685,7 @@  void RPiCameraData::tryRunPipeline()
 	ipa::rpi::IspPreparePayload ispPrepare;
 	ispPrepare.embeddedbufferId_ = RPi::BufferMask::EMBEDDED_DATA | embeddedId;
 	ispPrepare.bayerbufferId_ = RPi::BufferMask::BAYER_DATA | bayerId;
+	LIBCAMERA_TRACEPOINT_IPA_BEGIN(rpi, signalIspPrepare);
 	ipa_->signalIspPrepare(ispPrepare);
 }