dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fixes for selective fetch area calculation
@ 2022-05-10 18:33 Jouni Högander
  2022-05-10 18:33 ` [PATCH v3 1/3] drm/print: Add drm_debug_once* macros Jouni Högander
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jouni Högander @ 2022-05-10 18:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: Jouni Högander, Mark Pearson, José Roberto de Souza,
	dri-devel, Mika Kahola

Currently selective fetch area calculation ends up as bogus area in
at least following cases:

1. Updated plane is partially or fully outside pipe area
2. Big fb with only part of memory area used for plane

These end up as y1 = 0, y2 = 4 or y2 being outside pipe area. This
patch set addresses these by ensuring update area is within pipe area
or by falling back to full update.

Patch set also adds drm_dbg_once* macros to print out debug message
only once. drm_dbg_once_kms is used to printout debug message when
selective fetch area calculation fails.

v3:
 - Add drm_dbg_once* and use it when sel fetch area calculation fails
 - Move drm_rect_intersect to clip_area_update
v2:
 - Update commit message of first patch
 - Set damaged_area x1 and x2 during initialization

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Mark Pearson <markpearson@lenovo.com>

Jouni Högander (3):
  drm/print: Add drm_debug_once* macros
  drm/i915/psr: Use full update In case of area calculation fails
  drm/i915: Ensure damage clip area is within pipe area

 drivers/gpu/drm/i915/display/intel_psr.c | 36 +++++++++++++++++++-----
 include/drm/drm_print.h                  | 29 +++++++++++++++++++
 2 files changed, 58 insertions(+), 7 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/3] drm/print: Add drm_debug_once* macros
  2022-05-10 18:33 [PATCH v3 0/3] Fixes for selective fetch area calculation Jouni Högander
@ 2022-05-10 18:33 ` Jouni Högander
  2022-05-10 19:22   ` Souza, Jose
  2022-05-10 18:33 ` [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails Jouni Högander
  2022-05-10 18:33 ` [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area Jouni Högander
  2 siblings, 1 reply; 7+ messages in thread
From: Jouni Högander @ 2022-05-10 18:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: Jouni Högander, Mark Pearson, José Roberto de Souza,
	dri-devel, Mika Kahola

Add drm_debug_once* macros to allow printing out one time debug
messages which can be still controlled via drm.debug parameter.

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Mark Pearson <markpearson@lenovo.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 include/drm/drm_print.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 22fabdeed297..e339f47eeb6d 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -476,6 +476,35 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 #define drm_dbg_drmres(drm, fmt, ...)					\
 	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
 
+#define drm_dev_dbg_once(dev, cat, fmt, ...)			\
+({								\
+	static bool __print_once __read_mostly;			\
+	if (!__print_once) {					\
+		__print_once = true;				\
+		drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__);	\
+	}							\
+})
+
+#define drm_dbg_once_core(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+#define drm_dbg_once(drm, fmt, ...)						\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_kms(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_prime(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_atomic(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_vbl(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_state(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_lease(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_dp(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
+#define drm_dbg_once_drmres(drm, fmt, ...)					\
+	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
 
 /*
  * printk based logging
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails
  2022-05-10 18:33 [PATCH v3 0/3] Fixes for selective fetch area calculation Jouni Högander
  2022-05-10 18:33 ` [PATCH v3 1/3] drm/print: Add drm_debug_once* macros Jouni Högander
@ 2022-05-10 18:33 ` Jouni Högander
  2022-05-10 18:52   ` Souza, Jose
  2022-05-10 18:33 ` [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area Jouni Högander
  2 siblings, 1 reply; 7+ messages in thread
From: Jouni Högander @ 2022-05-10 18:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: Jouni Högander, Mark Pearson, José Roberto de Souza,
	dri-devel, Mika Kahola

Currently we have some corner cases where area calculation fails.  For
these sel fetch area calculation ends up having update area as y1 = 0,
y2 = 4. Instead of these values safer option is full update.

One of such for example is big fb with offset. We don't have usable
offset in psr2_sel_fetch_update. Currently it's open what is the
proper way to fix this corner case. Use full update for now.

v2: Commit message modified
v3: Print out debug info once when area calculation fails

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Mark Pearson <markpearson@lenovo.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 06db407e2749..3561c218cfb1 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1685,6 +1685,7 @@ static bool psr2_sel_fetch_pipe_state_supported(const struct intel_crtc_state *c
 int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 				struct intel_crtc *crtc)
 {
+	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
 	struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
 	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
 	struct intel_plane_state *new_plane_state, *old_plane_state;
@@ -1770,6 +1771,17 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 		clip_area_update(&pipe_clip, &damaged_area);
 	}
 
+	/*
+	 * TODO: For now we are just using full update in case
+	 * selective fetch area calculation fails. To optimize this we
+	 * should identify cases where this happens and fix the area
+	 * calculation for those.
+	 */
+	if (pipe_clip.y1 == -1) {
+		drm_dbg_once_kms(&dev_priv->drm, "No selective fetch area, using full update");
+		full_update = true;
+	}
+
 	if (full_update)
 		goto skip_sel_fetch_set_loop;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area
  2022-05-10 18:33 [PATCH v3 0/3] Fixes for selective fetch area calculation Jouni Högander
  2022-05-10 18:33 ` [PATCH v3 1/3] drm/print: Add drm_debug_once* macros Jouni Högander
  2022-05-10 18:33 ` [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails Jouni Högander
@ 2022-05-10 18:33 ` Jouni Högander
  2022-05-10 18:53   ` Souza, Jose
  2 siblings, 1 reply; 7+ messages in thread
From: Jouni Högander @ 2022-05-10 18:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: Jouni Högander, Mark Pearson, José Roberto de Souza,
	dri-devel, Mika Kahola

Current update area calculation is not handling situation where
e.g. cursor plane is fully or partially outside pipe area.

Fix this by checking damage area against pipe_src area using
drm_rect_intersect.

v2: Set x1 and x2 in damaged_area initialization
v3: Move drm_rect_intersect into clip_area_update

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5440
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Mark Pearson <markpearson@lenovo.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 3561c218cfb1..f4b4c1c83d2b 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1618,8 +1618,12 @@ static void psr2_man_trk_ctl_calc(struct intel_crtc_state *crtc_state,
 }
 
 static void clip_area_update(struct drm_rect *overlap_damage_area,
-			     struct drm_rect *damage_area)
+			     struct drm_rect *damage_area,
+			     struct drm_rect *draw_area)
 {
+	if (!drm_rect_intersect(damage_area, draw_area))
+		return;
+
 	if (overlap_damage_area->y1 == -1) {
 		overlap_damage_area->y1 = damage_area->y1;
 		overlap_damage_area->y2 = damage_area->y2;
@@ -1709,7 +1713,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 	 */
 	for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
 					     new_plane_state, i) {
-		struct drm_rect src, damaged_area = { .y1 = -1 };
+		struct drm_rect src, damaged_area = { .x1 = 0, .y1 = -1,
+						      .x2 = INT_MAX };
 		struct drm_atomic_helper_damage_iter iter;
 		struct drm_rect clip;
 
@@ -1736,20 +1741,23 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 			if (old_plane_state->uapi.visible) {
 				damaged_area.y1 = old_plane_state->uapi.dst.y1;
 				damaged_area.y2 = old_plane_state->uapi.dst.y2;
-				clip_area_update(&pipe_clip, &damaged_area);
+				clip_area_update(&pipe_clip, &damaged_area,
+						 &crtc_state->pipe_src);
 			}
 
 			if (new_plane_state->uapi.visible) {
 				damaged_area.y1 = new_plane_state->uapi.dst.y1;
 				damaged_area.y2 = new_plane_state->uapi.dst.y2;
-				clip_area_update(&pipe_clip, &damaged_area);
+				clip_area_update(&pipe_clip, &damaged_area,
+						 &crtc_state->pipe_src);
 			}
 			continue;
 		} else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) {
 			/* If alpha changed mark the whole plane area as damaged */
 			damaged_area.y1 = new_plane_state->uapi.dst.y1;
 			damaged_area.y2 = new_plane_state->uapi.dst.y2;
-			clip_area_update(&pipe_clip, &damaged_area);
+			clip_area_update(&pipe_clip, &damaged_area,
+					 &crtc_state->pipe_src);
 			continue;
 		}
 
@@ -1760,7 +1768,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 						   &new_plane_state->uapi);
 		drm_atomic_for_each_plane_damage(&iter, &clip) {
 			if (drm_rect_intersect(&clip, &src))
-				clip_area_update(&damaged_area, &clip);
+				clip_area_update(&damaged_area, &clip,
+						 &crtc_state->pipe_src);
 		}
 
 		if (damaged_area.y1 == -1)
@@ -1768,7 +1777,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
 
 		damaged_area.y1 += new_plane_state->uapi.dst.y1 - src.y1;
 		damaged_area.y2 += new_plane_state->uapi.dst.y1 - src.y1;
-		clip_area_update(&pipe_clip, &damaged_area);
+
+		clip_area_update(&pipe_clip, &damaged_area, &crtc_state->pipe_src);
 	}
 
 	/*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails
  2022-05-10 18:33 ` [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails Jouni Högander
@ 2022-05-10 18:52   ` Souza, Jose
  0 siblings, 0 replies; 7+ messages in thread
From: Souza, Jose @ 2022-05-10 18:52 UTC (permalink / raw)
  To: intel-gfx, Hogander, Jouni; +Cc: markpearson, Kahola, Mika, dri-devel

On Tue, 2022-05-10 at 21:33 +0300, Jouni Högander wrote:
> Currently we have some corner cases where area calculation fails.  For
> these sel fetch area calculation ends up having update area as y1 = 0,
> y2 = 4. Instead of these values safer option is full update.
> 
> One of such for example is big fb with offset. We don't have usable
> offset in psr2_sel_fetch_update. Currently it's open what is the
> proper way to fix this corner case. Use full update for now.
> 
> v2: Commit message modified
> v3: Print out debug info once when area calculation fails
> 
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Mark Pearson <markpearson@lenovo.com>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 06db407e2749..3561c218cfb1 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1685,6 +1685,7 @@ static bool psr2_sel_fetch_pipe_state_supported(const struct intel_crtc_state *c
>  int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  				struct intel_crtc *crtc)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
>  	struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
>  	struct drm_rect pipe_clip = { .x1 = 0, .y1 = -1, .x2 = INT_MAX, .y2 = -1 };
>  	struct intel_plane_state *new_plane_state, *old_plane_state;
> @@ -1770,6 +1771,17 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  		clip_area_update(&pipe_clip, &damaged_area);
>  	}
>  
> +	/*
> +	 * TODO: For now we are just using full update in case
> +	 * selective fetch area calculation fails. To optimize this we
> +	 * should identify cases where this happens and fix the area
> +	 * calculation for those.
> +	 */
> +	if (pipe_clip.y1 == -1) {
> +		drm_dbg_once_kms(&dev_priv->drm, "No selective fetch area, using full update");

The debug message is misleading, a better message would be: Selective fetch area calculation failed in pipeA.

with that:
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> +		full_update = true;
> +	}
> +
>  	if (full_update)
>  		goto skip_sel_fetch_set_loop;
>  


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area
  2022-05-10 18:33 ` [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area Jouni Högander
@ 2022-05-10 18:53   ` Souza, Jose
  0 siblings, 0 replies; 7+ messages in thread
From: Souza, Jose @ 2022-05-10 18:53 UTC (permalink / raw)
  To: intel-gfx, Hogander, Jouni; +Cc: markpearson, Kahola, Mika, dri-devel

On Tue, 2022-05-10 at 21:33 +0300, Jouni Högander wrote:
> Current update area calculation is not handling situation where
> e.g. cursor plane is fully or partially outside pipe area.
> 
> Fix this by checking damage area against pipe_src area using
> drm_rect_intersect.
> 
> v2: Set x1 and x2 in damaged_area initialization
> v3: Move drm_rect_intersect into clip_area_update
> 
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5440
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Mark Pearson <markpearson@lenovo.com>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 3561c218cfb1..f4b4c1c83d2b 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1618,8 +1618,12 @@ static void psr2_man_trk_ctl_calc(struct intel_crtc_state *crtc_state,
>  }
>  
>  static void clip_area_update(struct drm_rect *overlap_damage_area,
> -			     struct drm_rect *damage_area)
> +			     struct drm_rect *damage_area,
> +			     struct drm_rect *draw_area)

s/draw_area/pipe_src?

>  {
> +	if (!drm_rect_intersect(damage_area, draw_area))
> +		return;
> +
>  	if (overlap_damage_area->y1 == -1) {
>  		overlap_damage_area->y1 = damage_area->y1;
>  		overlap_damage_area->y2 = damage_area->y2;
> @@ -1709,7 +1713,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  	 */
>  	for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
>  					     new_plane_state, i) {
> -		struct drm_rect src, damaged_area = { .y1 = -1 };
> +		struct drm_rect src, damaged_area = { .x1 = 0, .y1 = -1,
> +						      .x2 = INT_MAX };
>  		struct drm_atomic_helper_damage_iter iter;
>  		struct drm_rect clip;
>  
> @@ -1736,20 +1741,23 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  			if (old_plane_state->uapi.visible) {
>  				damaged_area.y1 = old_plane_state->uapi.dst.y1;
>  				damaged_area.y2 = old_plane_state->uapi.dst.y2;
> -				clip_area_update(&pipe_clip, &damaged_area);
> +				clip_area_update(&pipe_clip, &damaged_area,
> +						 &crtc_state->pipe_src);
>  			}
>  
>  			if (new_plane_state->uapi.visible) {
>  				damaged_area.y1 = new_plane_state->uapi.dst.y1;
>  				damaged_area.y2 = new_plane_state->uapi.dst.y2;
> -				clip_area_update(&pipe_clip, &damaged_area);
> +				clip_area_update(&pipe_clip, &damaged_area,
> +						 &crtc_state->pipe_src);
>  			}
>  			continue;
>  		} else if (new_plane_state->uapi.alpha != old_plane_state->uapi.alpha) {
>  			/* If alpha changed mark the whole plane area as damaged */
>  			damaged_area.y1 = new_plane_state->uapi.dst.y1;
>  			damaged_area.y2 = new_plane_state->uapi.dst.y2;
> -			clip_area_update(&pipe_clip, &damaged_area);
> +			clip_area_update(&pipe_clip, &damaged_area,
> +					 &crtc_state->pipe_src);
>  			continue;
>  		}
>  
> @@ -1760,7 +1768,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  						   &new_plane_state->uapi);
>  		drm_atomic_for_each_plane_damage(&iter, &clip) {
>  			if (drm_rect_intersect(&clip, &src))
> -				clip_area_update(&damaged_area, &clip);
> +				clip_area_update(&damaged_area, &clip,
> +						 &crtc_state->pipe_src);
>  		}
>  
>  		if (damaged_area.y1 == -1)
> @@ -1768,7 +1777,8 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state,
>  
>  		damaged_area.y1 += new_plane_state->uapi.dst.y1 - src.y1;
>  		damaged_area.y2 += new_plane_state->uapi.dst.y1 - src.y1;
> -		clip_area_update(&pipe_clip, &damaged_area);
> +
> +		clip_area_update(&pipe_clip, &damaged_area, &crtc_state->pipe_src);

white space ^

with those nits:
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

>  	}
>  
>  	/*


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/3] drm/print: Add drm_debug_once* macros
  2022-05-10 18:33 ` [PATCH v3 1/3] drm/print: Add drm_debug_once* macros Jouni Högander
@ 2022-05-10 19:22   ` Souza, Jose
  0 siblings, 0 replies; 7+ messages in thread
From: Souza, Jose @ 2022-05-10 19:22 UTC (permalink / raw)
  To: intel-gfx, Hogander, Jouni; +Cc: markpearson, Kahola, Mika, dri-devel

On Tue, 2022-05-10 at 21:33 +0300, Jouni Högander wrote:
> Add drm_debug_once* macros to allow printing out one time debug
> messages which can be still controlled via drm.debug parameter.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> 
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Mark Pearson <markpearson@lenovo.com>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  include/drm/drm_print.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 22fabdeed297..e339f47eeb6d 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -476,6 +476,35 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>  #define drm_dbg_drmres(drm, fmt, ...)					\
>  	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
>  
> +#define drm_dev_dbg_once(dev, cat, fmt, ...)			\
> +({								\
> +	static bool __print_once __read_mostly;			\
> +	if (!__print_once) {					\
> +		__print_once = true;				\
> +		drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__);	\
> +	}							\
> +})
> +
> +#define drm_dbg_once_core(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once(drm, fmt, ...)						\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_kms(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_prime(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_atomic(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_vbl(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_state(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_lease(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_dp(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
> +#define drm_dbg_once_drmres(drm, fmt, ...)					\
> +	drm_dev_dbg_once((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
>  
>  /*
>   * printk based logging


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-10 19:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 18:33 [PATCH v3 0/3] Fixes for selective fetch area calculation Jouni Högander
2022-05-10 18:33 ` [PATCH v3 1/3] drm/print: Add drm_debug_once* macros Jouni Högander
2022-05-10 19:22   ` Souza, Jose
2022-05-10 18:33 ` [PATCH v3 2/3] drm/i915/psr: Use full update In case of area calculation fails Jouni Högander
2022-05-10 18:52   ` Souza, Jose
2022-05-10 18:33 ` [PATCH v3 3/3] drm/i915: Ensure damage clip area is within pipe area Jouni Högander
2022-05-10 18:53   ` Souza, Jose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).