diff mbox series

[8/8] drm/i915/scaler: Add scaler tracepoints

Message ID 20241219130827.22830-9-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/i915/scaler: Scaler cleanups and tracepoints | expand

Commit Message

Ville Syrjälä Dec. 19, 2024, 1:08 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add some tracpoints around skl+ scaler programming to help with
debugging.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 .../drm/i915/display/intel_display_trace.h    | 99 +++++++++++++++++++
 drivers/gpu/drm/i915/display/skl_scaler.c     |  8 ++
 2 files changed, 107 insertions(+)

Comments

Luca Coelho Dec. 20, 2024, 9:12 a.m. UTC | #1
On Thu, 2024-12-19 at 15:08 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add some tracpoints around skl+ scaler programming to help with
> debugging.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  .../drm/i915/display/intel_display_trace.h    | 99 +++++++++++++++++++
>  drivers/gpu/drm/i915/display/skl_scaler.c     |  8 ++
>  2 files changed, 107 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
> index 338b9f7b20b8..54a6e2a46b82 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_trace.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
> @@ -489,6 +489,105 @@ TRACE_EVENT(intel_plane_disable_arm,
>  		      __entry->frame, __entry->scanline)
>  );
>  
> +TRACE_EVENT(intel_plane_scaler_update_arm,
> +	    TP_PROTO(struct intel_plane *plane,
> +		     int scaler_id, int x, int y, int w, int h),
> +	    TP_ARGS(plane, scaler_id, x, y, w, h),
> +
> +	    TP_STRUCT__entry(
> +			     __string(dev, __dev_name_kms(plane))
> +			     __field(char, pipe_name)
> +			     __field(int, scaler_id)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     __field(int, x)
> +			     __field(int, y)
> +			     __field(int, w)
> +			     __field(int, h)
> +			     __string(name, plane->base.name)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   struct intel_display *display = to_intel_display(plane);
> +			   struct intel_crtc *crtc = intel_crtc_for_pipe(display, plane->pipe);
> +			   __assign_str(dev);
> +			   __assign_str(name);
> +			   __entry->pipe_name = pipe_name(crtc->pipe);
> +			   __entry->scaler_id = scaler_id;
> +			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);
> +			   __entry->x = x;
> +			   __entry->y = y;
> +			   __entry->w = w;
> +			   __entry->h = h;
> +			   ),
> +
> +	    TP_printk("dev %s, pipe %c, scaler %d, plane %s, frame=%u, scanline=%u, " DRM_RECT_FMT,
> +		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
> +		      __get_str(name), __entry->frame, __entry->scanline,
> +		      __entry->w, __entry->h, __entry->x, __entry->y)
> +);
> +
> +TRACE_EVENT(intel_pipe_scaler_update_arm,
> +	    TP_PROTO(struct intel_crtc *crtc, int scaler_id,
> +		     int x, int y, int w, int h),
> +	    TP_ARGS(crtc, scaler_id, x, y, w, h),
> +
> +	    TP_STRUCT__entry(
> +			     __string(dev, __dev_name_kms(crtc))
> +			     __field(char, pipe_name)
> +			     __field(int, scaler_id)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     __field(int, x)
> +			     __field(int, y)
> +			     __field(int, w)
> +			     __field(int, h)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __assign_str(dev);
> +			   __entry->pipe_name = pipe_name(crtc->pipe);
> +			   __entry->scaler_id = scaler_id;
> +			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);
> +			   __entry->x = x;
> +			   __entry->y = y;
> +			   __entry->w = w;
> +			   __entry->h = h;
> +			   ),
> +
> +	    TP_printk("dev %s, pipe %c, scaler %d frame=%u, scanline=%u, " DRM_RECT_FMT,
> +		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
> +		      __entry->frame, __entry->scanline,
> +		      __entry->w, __entry->h, __entry->x, __entry->y)
> +);
> +
> +TRACE_EVENT(intel_scaler_disable_arm,
> +	    TP_PROTO(struct intel_crtc *crtc, int scaler_id),
> +	    TP_ARGS(crtc, scaler_id),
> +
> +	    TP_STRUCT__entry(
> +			     __string(dev, __dev_name_kms(crtc))
> +			     __field(char, pipe_name)
> +			     __field(int, scaler_id)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __assign_str(dev);
> +			   __entry->pipe_name = pipe_name(crtc->pipe);
> +			   __entry->scaler_id = scaler_id;
> +			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);
> +			   ),
> +
> +	    TP_printk("dev %s, pipe %c, scaler %d, frame=%u, scanline=%u",
> +		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
> +		      __entry->frame, __entry->scanline)
> +);
> +
>  TRACE_EVENT(intel_fbc_activate,
>  	    TP_PROTO(struct intel_plane *plane),
>  	    TP_ARGS(plane),
> diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
> index 79739357162c..a11e09a15e23 100644
> --- a/drivers/gpu/drm/i915/display/skl_scaler.c
> +++ b/drivers/gpu/drm/i915/display/skl_scaler.c
> @@ -6,6 +6,7 @@
>  #include "i915_drv.h"
>  #include "i915_reg.h"
>  #include "intel_de.h"
> +#include "intel_display_trace.h"
>  #include "intel_display_types.h"
>  #include "intel_fb.h"
>  #include "skl_scaler.h"
> @@ -706,6 +707,8 @@ void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
>  	ps_ctrl = PS_SCALER_EN | PS_BINDING_PIPE | scaler_state->scalers[id].mode |
>  		skl_scaler_get_filter_select(crtc_state->hw.scaling_filter, 0);
>  
> +	trace_intel_pipe_scaler_update_arm(crtc, id, x, y, width, height);
> +
>  	skl_scaler_setup_filter(display, pipe, id, 0,
>  				crtc_state->hw.scaling_filter);
>  
> @@ -770,6 +773,9 @@ skl_program_plane_scaler(struct intel_plane *plane,
>  	ps_ctrl = PS_SCALER_EN | PS_BINDING_PLANE(plane->id) | scaler->mode |
>  		skl_scaler_get_filter_select(plane_state->hw.scaling_filter, 0);
>  
> +	trace_intel_plane_scaler_update_arm(plane, scaler_id,
> +					    crtc_x, crtc_y, crtc_w, crtc_h);
> +
>  	skl_scaler_setup_filter(display, pipe, scaler_id, 0,
>  				plane_state->hw.scaling_filter);
>  
> @@ -788,6 +794,8 @@ static void skl_detach_scaler(struct intel_crtc *crtc, int id)
>  {
>  	struct intel_display *display = to_intel_display(crtc);
>  
> +	trace_intel_scaler_disable_arm(crtc, id);
> +
>  	intel_de_write_fw(display, SKL_PS_CTRL(crtc->pipe, id), 0);
>  	intel_de_write_fw(display, SKL_PS_WIN_POS(crtc->pipe, id), 0);
>  	intel_de_write_fw(display, SKL_PS_WIN_SZ(crtc->pipe, id), 0);

Reviewed-by: Luca Coelho <luciano.coelho@intel.com>

--
Cheers,
Luca.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
index 338b9f7b20b8..54a6e2a46b82 100644
--- a/drivers/gpu/drm/i915/display/intel_display_trace.h
+++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
@@ -489,6 +489,105 @@  TRACE_EVENT(intel_plane_disable_arm,
 		      __entry->frame, __entry->scanline)
 );
 
+TRACE_EVENT(intel_plane_scaler_update_arm,
+	    TP_PROTO(struct intel_plane *plane,
+		     int scaler_id, int x, int y, int w, int h),
+	    TP_ARGS(plane, scaler_id, x, y, w, h),
+
+	    TP_STRUCT__entry(
+			     __string(dev, __dev_name_kms(plane))
+			     __field(char, pipe_name)
+			     __field(int, scaler_id)
+			     __field(u32, frame)
+			     __field(u32, scanline)
+			     __field(int, x)
+			     __field(int, y)
+			     __field(int, w)
+			     __field(int, h)
+			     __string(name, plane->base.name)
+			     ),
+
+	    TP_fast_assign(
+			   struct intel_display *display = to_intel_display(plane);
+			   struct intel_crtc *crtc = intel_crtc_for_pipe(display, plane->pipe);
+			   __assign_str(dev);
+			   __assign_str(name);
+			   __entry->pipe_name = pipe_name(crtc->pipe);
+			   __entry->scaler_id = scaler_id;
+			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
+			   __entry->scanline = intel_get_crtc_scanline(crtc);
+			   __entry->x = x;
+			   __entry->y = y;
+			   __entry->w = w;
+			   __entry->h = h;
+			   ),
+
+	    TP_printk("dev %s, pipe %c, scaler %d, plane %s, frame=%u, scanline=%u, " DRM_RECT_FMT,
+		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
+		      __get_str(name), __entry->frame, __entry->scanline,
+		      __entry->w, __entry->h, __entry->x, __entry->y)
+);
+
+TRACE_EVENT(intel_pipe_scaler_update_arm,
+	    TP_PROTO(struct intel_crtc *crtc, int scaler_id,
+		     int x, int y, int w, int h),
+	    TP_ARGS(crtc, scaler_id, x, y, w, h),
+
+	    TP_STRUCT__entry(
+			     __string(dev, __dev_name_kms(crtc))
+			     __field(char, pipe_name)
+			     __field(int, scaler_id)
+			     __field(u32, frame)
+			     __field(u32, scanline)
+			     __field(int, x)
+			     __field(int, y)
+			     __field(int, w)
+			     __field(int, h)
+			     ),
+
+	    TP_fast_assign(
+			   __assign_str(dev);
+			   __entry->pipe_name = pipe_name(crtc->pipe);
+			   __entry->scaler_id = scaler_id;
+			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
+			   __entry->scanline = intel_get_crtc_scanline(crtc);
+			   __entry->x = x;
+			   __entry->y = y;
+			   __entry->w = w;
+			   __entry->h = h;
+			   ),
+
+	    TP_printk("dev %s, pipe %c, scaler %d frame=%u, scanline=%u, " DRM_RECT_FMT,
+		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
+		      __entry->frame, __entry->scanline,
+		      __entry->w, __entry->h, __entry->x, __entry->y)
+);
+
+TRACE_EVENT(intel_scaler_disable_arm,
+	    TP_PROTO(struct intel_crtc *crtc, int scaler_id),
+	    TP_ARGS(crtc, scaler_id),
+
+	    TP_STRUCT__entry(
+			     __string(dev, __dev_name_kms(crtc))
+			     __field(char, pipe_name)
+			     __field(int, scaler_id)
+			     __field(u32, frame)
+			     __field(u32, scanline)
+			     ),
+
+	    TP_fast_assign(
+			   __assign_str(dev);
+			   __entry->pipe_name = pipe_name(crtc->pipe);
+			   __entry->scaler_id = scaler_id;
+			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
+			   __entry->scanline = intel_get_crtc_scanline(crtc);
+			   ),
+
+	    TP_printk("dev %s, pipe %c, scaler %d, frame=%u, scanline=%u",
+		      __get_str(dev), __entry->pipe_name, __entry->scaler_id,
+		      __entry->frame, __entry->scanline)
+);
+
 TRACE_EVENT(intel_fbc_activate,
 	    TP_PROTO(struct intel_plane *plane),
 	    TP_ARGS(plane),
diff --git a/drivers/gpu/drm/i915/display/skl_scaler.c b/drivers/gpu/drm/i915/display/skl_scaler.c
index 79739357162c..a11e09a15e23 100644
--- a/drivers/gpu/drm/i915/display/skl_scaler.c
+++ b/drivers/gpu/drm/i915/display/skl_scaler.c
@@ -6,6 +6,7 @@ 
 #include "i915_drv.h"
 #include "i915_reg.h"
 #include "intel_de.h"
+#include "intel_display_trace.h"
 #include "intel_display_types.h"
 #include "intel_fb.h"
 #include "skl_scaler.h"
@@ -706,6 +707,8 @@  void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 	ps_ctrl = PS_SCALER_EN | PS_BINDING_PIPE | scaler_state->scalers[id].mode |
 		skl_scaler_get_filter_select(crtc_state->hw.scaling_filter, 0);
 
+	trace_intel_pipe_scaler_update_arm(crtc, id, x, y, width, height);
+
 	skl_scaler_setup_filter(display, pipe, id, 0,
 				crtc_state->hw.scaling_filter);
 
@@ -770,6 +773,9 @@  skl_program_plane_scaler(struct intel_plane *plane,
 	ps_ctrl = PS_SCALER_EN | PS_BINDING_PLANE(plane->id) | scaler->mode |
 		skl_scaler_get_filter_select(plane_state->hw.scaling_filter, 0);
 
+	trace_intel_plane_scaler_update_arm(plane, scaler_id,
+					    crtc_x, crtc_y, crtc_w, crtc_h);
+
 	skl_scaler_setup_filter(display, pipe, scaler_id, 0,
 				plane_state->hw.scaling_filter);
 
@@ -788,6 +794,8 @@  static void skl_detach_scaler(struct intel_crtc *crtc, int id)
 {
 	struct intel_display *display = to_intel_display(crtc);
 
+	trace_intel_scaler_disable_arm(crtc, id);
+
 	intel_de_write_fw(display, SKL_PS_CTRL(crtc->pipe, id), 0);
 	intel_de_write_fw(display, SKL_PS_WIN_POS(crtc->pipe, id), 0);
 	intel_de_write_fw(display, SKL_PS_WIN_SZ(crtc->pipe, id), 0);