[RFC PATCH 2/6] drm/i915/psr: Add proper handling for disabling sel fetch for planes

Jouni Högander jouni.hogander at intel.com
Tue Feb 7 12:03:22 UTC 2023


Currently we are enabling selective fetch for all planes that are visible.
This is suboptimal as we are all the time fetching planes that are not part
of selective update.

Fix this by adding proper handling for disabling plane selective fetch:
If plane is not part of update (new_crtc_state->update_planes) disable
selective fetch for it.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 .../gpu/drm/i915/display/intel_atomic_plane.c | 37 ++++++++++++++++---
 .../drm/i915/display/intel_display_trace.h    | 25 +++++++++++++
 .../drm/i915/display/intel_display_types.h    |  3 ++
 3 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
index 3bd8f7eb75a6..72beda644237 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
@@ -790,12 +790,25 @@ void intel_plane_disable_arm(struct intel_plane *plane,
 	plane->disable_arm(plane, crtc_state);
 }
 
+static void intel_plane_disable_sel_fetch_noarm(struct intel_plane *plane,
+			     const struct intel_crtc_state *crtc_state)
+{
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+	trace_intel_plane_disable_sel_fetch_noarm(plane, crtc);
+	if (plane->disable_sel_fetch_noarm)
+		plane->disable_sel_fetch_noarm(plane, crtc_state);
+}
+
 void intel_crtc_planes_update_noarm(struct intel_atomic_state *state,
 				    struct intel_crtc *crtc)
 {
+	struct intel_crtc_state *old_crtc_state =
+		intel_atomic_get_old_crtc_state(state, crtc);
 	struct intel_crtc_state *new_crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
-	u32 update_mask = new_crtc_state->update_planes;
+	u32 old_update_mask = old_crtc_state->update_planes;
+	u32 new_update_mask = new_crtc_state->update_planes;
 	struct intel_plane_state *new_plane_state;
 	struct intel_plane *plane;
 	int i;
@@ -808,14 +821,28 @@ void intel_crtc_planes_update_noarm(struct intel_atomic_state *state,
 	 * the order does not matter even for skl+.
 	 */
 	for_each_new_intel_plane_in_state(state, plane, new_plane_state, i) {
+		/*
+		 * We still want to disable selective fetch for a
+		 * plane that is visible but not part of update if it
+		 * was part of update previously
+		 */
 		if (crtc->pipe != plane->pipe ||
-		    !(update_mask & BIT(plane->id)))
+		    (!(new_update_mask & BIT(plane->id)) &&
+		    !new_plane_state->uapi.visible &&
+		     !new_plane_state->planar_slave) ||
+		    (!(old_update_mask & BIT(plane->id)) &&
+		     !(new_update_mask & BIT(plane->id))))
 			continue;
 
 		/* TODO: for mailbox updates this should be skipped */
-		if (new_plane_state->uapi.visible ||
-		    new_plane_state->planar_slave)
-			intel_plane_update_noarm(plane, new_crtc_state, new_plane_state);
+		if ((new_plane_state->uapi.visible ||
+		     new_plane_state->planar_slave) &&
+		    (new_update_mask & BIT(plane->id)))
+			intel_plane_update_noarm(plane, new_crtc_state,
+						 new_plane_state);
+		else
+			intel_plane_disable_sel_fetch_noarm(plane,
+							    new_crtc_state);
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_trace.h b/drivers/gpu/drm/i915/display/intel_display_trace.h
index 651ea8564e1b..9fabee5da4e4 100644
--- a/drivers/gpu/drm/i915/display/intel_display_trace.h
+++ b/drivers/gpu/drm/i915/display/intel_display_trace.h
@@ -396,6 +396,31 @@ TRACE_EVENT(intel_plane_disable_arm,
 		      __entry->frame, __entry->scanline)
 );
 
+TRACE_EVENT(intel_plane_disable_sel_fetch_noarm,
+	    TP_PROTO(struct intel_plane *plane, struct intel_crtc *crtc),
+	    TP_ARGS(plane, crtc),
+
+	    TP_STRUCT__entry(
+			     __string(dev, __dev_name_kms(plane))
+			     __field(enum pipe, pipe)
+			     __field(u32, frame)
+			     __field(u32, scanline)
+			     __string(name, plane->base.name)
+			     ),
+
+	    TP_fast_assign(
+			   __assign_str(dev, __dev_name_kms(plane));
+			   __assign_str(name, plane->base.name);
+			   __entry->pipe = crtc->pipe;
+			   __entry->frame = intel_crtc_get_vblank_counter(crtc);
+			   __entry->scanline = intel_get_crtc_scanline(crtc);
+			   ),
+
+	    TP_printk("dev %s, pipe %c, plane %s, frame=%u, scanline=%u",
+		      __get_str(dev), pipe_name(__entry->pipe), __get_str(name),
+		      __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/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 9ccae7a46020..26e24e18ec2c 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1477,6 +1477,9 @@ struct intel_plane {
 	void (*update_noarm)(struct intel_plane *plane,
 			     const struct intel_crtc_state *crtc_state,
 			     const struct intel_plane_state *plane_state);
+	/* Disable selective fetch */
+	void (*disable_sel_fetch_noarm)(struct intel_plane *plane,
+					const struct intel_crtc_state *crtc_state);
 	/* Write all self-arming plane registers */
 	void (*update_arm)(struct intel_plane *plane,
 			   const struct intel_crtc_state *crtc_state,
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list