diff mbox series

[v3,1/7] drm/i915/display: add intel_display -> drm_device backpointer

Message ID aedbc76b3d01e25bea691b61a331f71a7c63f3b3.1712665176.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: better high level abstraction for display | expand

Commit Message

Jani Nikula April 9, 2024, 12:26 p.m. UTC
As a baby step towards making struct intel_display the main data
structure for display, add a backpointer to struct drm_device that can
be used instead of &i915->drm.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_core.h   | 3 +++
 drivers/gpu/drm/i915/display/intel_display_device.c | 3 +++
 2 files changed, 6 insertions(+)

Comments

Rodrigo Vivi April 16, 2024, 4:05 p.m. UTC | #1
On Tue, Apr 09, 2024 at 03:26:43PM +0300, Jani Nikula wrote:
> As a baby step towards making struct intel_display the main data
> structure for display, add a backpointer to struct drm_device that can
> be used instead of &i915->drm.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

I needed that a few weeks ago when doing that display metrics,
willing to add a drm_debug without having to go through
drm_i915_private.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display_core.h   | 3 +++
>  drivers/gpu/drm/i915/display/intel_display_device.c | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
> index db9b6492758e..368a4953bc1b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_core.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_core.h
> @@ -282,6 +282,9 @@ struct intel_wm {
>  };
>  
>  struct intel_display {
> +	/* drm device backpointer */
> +	struct drm_device *drm;
> +
>  	/* Display functions */
>  	struct {
>  		/* Top level crtc-ish functions */
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
> index b8903bd0e82a..120e209ee74a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -927,6 +927,9 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  	const struct intel_display_device_info *info;
>  	u16 ver, rel, step;
>  
> +	/* Add drm device backpointer as early as possible. */
> +	i915->display.drm = &i915->drm;
> +
>  	if (HAS_GMD_ID(i915))
>  		info = probe_gmdid_display(i915, &ver, &rel, &step);
>  	else
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
index db9b6492758e..368a4953bc1b 100644
--- a/drivers/gpu/drm/i915/display/intel_display_core.h
+++ b/drivers/gpu/drm/i915/display/intel_display_core.h
@@ -282,6 +282,9 @@  struct intel_wm {
 };
 
 struct intel_display {
+	/* drm device backpointer */
+	struct drm_device *drm;
+
 	/* Display functions */
 	struct {
 		/* Top level crtc-ish functions */
diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
index b8903bd0e82a..120e209ee74a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -927,6 +927,9 @@  void intel_display_device_probe(struct drm_i915_private *i915)
 	const struct intel_display_device_info *info;
 	u16 ver, rel, step;
 
+	/* Add drm device backpointer as early as possible. */
+	i915->display.drm = &i915->drm;
+
 	if (HAS_GMD_ID(i915))
 		info = probe_gmdid_display(i915, &ver, &rel, &step);
 	else