diff mbox series

[4/6] drm/i915/display: add intel_display_gpu_reset_clobbers_display() helper

Message ID 14809d0398a260febbeb0e4bf2c25f97cc3bb8d7.1736332802.git.jani.nikula@intel.com (mailing list archive)
State New
Headers show
Series drm/i915: display reset cleanups | expand

Commit Message

Jani Nikula Jan. 8, 2025, 10:41 a.m. UTC
Add a helper for checking the gpu_reset_clobbers_display flag to make it
easier to relocate the flag later.

We keep the intel_gt_gpu_reset_clobbers_display() helper to not have to
duplicate the gt -> display pointer chase.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_reset.c | 11 +++++++++--
 drivers/gpu/drm/i915/display/intel_display_reset.h |  3 +++
 drivers/gpu/drm/i915/gt/intel_reset.c              |  3 ++-
 3 files changed, 14 insertions(+), 3 deletions(-)

Comments

Matt Roper Jan. 8, 2025, 9:19 p.m. UTC | #1
On Wed, Jan 08, 2025 at 12:41:19PM +0200, Jani Nikula wrote:
> Add a helper for checking the gpu_reset_clobbers_display flag to make it
> easier to relocate the flag later.
> 
> We keep the intel_gt_gpu_reset_clobbers_display() helper to not have to
> duplicate the gt -> display pointer chase.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display_reset.c | 11 +++++++++--
>  drivers/gpu/drm/i915/display/intel_display_reset.h |  3 +++
>  drivers/gpu/drm/i915/gt/intel_reset.c              |  3 ++-
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.c b/drivers/gpu/drm/i915/display/intel_display_reset.c
> index 1e6421d51c51..93399ace7761 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_reset.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_reset.c
> @@ -13,12 +13,19 @@
>  #include "intel_hotplug.h"
>  #include "intel_pps.h"
>  
> +bool intel_display_gpu_reset_clobbers_display(struct intel_display *display)
> +{
> +	struct drm_i915_private *i915 = to_i915(display->drm);
> +
> +	return INTEL_INFO(i915)->gpu_reset_clobbers_display;
> +}
> +
>  static bool gpu_reset_clobbers_display(struct intel_display *display)
>  {
>  	struct drm_i915_private *i915 = to_i915(display->drm);
>  
> -	return (INTEL_INFO(i915)->gpu_reset_clobbers_display &&
> -		intel_has_gpu_reset(to_gt(i915)));
> +	return intel_display_gpu_reset_clobbers_display(display) &&
> +		intel_has_gpu_reset(to_gt(i915));
>  }
>  
>  void intel_display_reset_prepare(struct intel_display *display)
> diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.h b/drivers/gpu/drm/i915/display/intel_display_reset.h
> index 9a1fe99bfcd4..5acc07aab7b5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_reset.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_reset.h
> @@ -6,9 +6,12 @@
>  #ifndef __INTEL_RESET_H__
>  #define __INTEL_RESET_H__
>  
> +#include <linux/types.h>
> +
>  struct intel_display;
>  
>  void intel_display_reset_prepare(struct intel_display *display);
>  void intel_display_reset_finish(struct intel_display *display);
> +bool intel_display_gpu_reset_clobbers_display(struct intel_display *display);
>  
>  #endif /* __INTEL_RESET_H__ */
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index 0d863aa58fb6..774caaaa4ce5 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -1181,8 +1181,9 @@ static int resume(struct intel_gt *gt)
>  bool intel_gt_gpu_reset_clobbers_display(struct intel_gt *gt)
>  {
>  	struct drm_i915_private *i915 = gt->i915;
> +	struct intel_display *display = &i915->display;
>  
> -	return INTEL_INFO(i915)->gpu_reset_clobbers_display;
> +	return intel_display_gpu_reset_clobbers_display(display);
>  }
>  
>  /**
> -- 
> 2.39.5
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.c b/drivers/gpu/drm/i915/display/intel_display_reset.c
index 1e6421d51c51..93399ace7761 100644
--- a/drivers/gpu/drm/i915/display/intel_display_reset.c
+++ b/drivers/gpu/drm/i915/display/intel_display_reset.c
@@ -13,12 +13,19 @@ 
 #include "intel_hotplug.h"
 #include "intel_pps.h"
 
+bool intel_display_gpu_reset_clobbers_display(struct intel_display *display)
+{
+	struct drm_i915_private *i915 = to_i915(display->drm);
+
+	return INTEL_INFO(i915)->gpu_reset_clobbers_display;
+}
+
 static bool gpu_reset_clobbers_display(struct intel_display *display)
 {
 	struct drm_i915_private *i915 = to_i915(display->drm);
 
-	return (INTEL_INFO(i915)->gpu_reset_clobbers_display &&
-		intel_has_gpu_reset(to_gt(i915)));
+	return intel_display_gpu_reset_clobbers_display(display) &&
+		intel_has_gpu_reset(to_gt(i915));
 }
 
 void intel_display_reset_prepare(struct intel_display *display)
diff --git a/drivers/gpu/drm/i915/display/intel_display_reset.h b/drivers/gpu/drm/i915/display/intel_display_reset.h
index 9a1fe99bfcd4..5acc07aab7b5 100644
--- a/drivers/gpu/drm/i915/display/intel_display_reset.h
+++ b/drivers/gpu/drm/i915/display/intel_display_reset.h
@@ -6,9 +6,12 @@ 
 #ifndef __INTEL_RESET_H__
 #define __INTEL_RESET_H__
 
+#include <linux/types.h>
+
 struct intel_display;
 
 void intel_display_reset_prepare(struct intel_display *display);
 void intel_display_reset_finish(struct intel_display *display);
+bool intel_display_gpu_reset_clobbers_display(struct intel_display *display);
 
 #endif /* __INTEL_RESET_H__ */
diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index 0d863aa58fb6..774caaaa4ce5 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -1181,8 +1181,9 @@  static int resume(struct intel_gt *gt)
 bool intel_gt_gpu_reset_clobbers_display(struct intel_gt *gt)
 {
 	struct drm_i915_private *i915 = gt->i915;
+	struct intel_display *display = &i915->display;
 
-	return INTEL_INFO(i915)->gpu_reset_clobbers_display;
+	return intel_display_gpu_reset_clobbers_display(display);
 }
 
 /**