Skip to contentSkip to conversation

drm/i915: add display sub-struct to drm_i915_private

PATCH Superseded Jani Nikula 4 participants 110 messages Aug 11, 2022 – Aug 24, 2022 Page 2 of 2

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
Reviewed-by on v1 1/39
#7 lore raw
In reply to Jani Nikula
Quoted 42 lines · Jani Nikula

In another long-overdue cleanup, add a display sub-struct to drm_i915_private, and start moving display related members there. Start with display funcs that need a rename anyway to not collide with the new display member.

Add a new header under display/ for defining struct intel_display.

Rename struct drm_i915_display_funcs to intel_display_funcs while at it.

---

drivers/gpu/drm/i915/display/intel_display.c  | 28 +++++++-------
.../gpu/drm/i915/display/intel_display_core.h | 38 +++++++++++++++++++
.../drm/i915/display/intel_modeset_setup.c    |  2 +-
.../drm/i915/display/intel_plane_initial.c    |  2 +-
drivers/gpu/drm/i915/i915_drv.h               | 21 ++--------
5 files changed, 57 insertions(+), 34 deletions(-)

create mode 100644 drivers/gpu/drm/i915/display/intel_display_core.h

drivers/gpu/drm/i915/display/intel_display.c +2 -2
index f143adefdf38..24ab1501beea 100644
@@ -4144,7 +4144,7 @@ bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 
-	if (!i915->display->get_pipe_config(crtc, crtc_state))
+	if (!i915->display.funcs.crtc->get_pipe_config(crtc, crtc_state))
 		return false;
 
 	crtc_state->hw.active = true;
@@ -7119,7 +7119,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state,
 
 	intel_crtc_update_active_timings(new_crtc_state);
 
-	dev_priv->display->crtc_enable(state, crtc);
+	dev_priv->display.funcs.crtc->crtc_enable(state, crtc);
 
 	if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
 		return;

drivers/gpu/drm/i915/display/intel_display.c static void intel_old_crtc_state_disables(struct intel_atomic_state *state, · line 7201

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
@@ -7198,7 +7198,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
 	 */
 	intel_crtc_disable_pipe_crc(crtc);
 
-	dev_priv->display->crtc_disable(state, crtc);
+	dev_priv->display.funcs.crtc->crtc_disable(state, crtc);

lgtm. Regarding names: it's a little weird to have "crtc doubled in the funcs.crtc->crtc_ and it not being consistent accross all functions

Quoted 91 lines
drivers/gpu/drm/i915/display/intel_display.c +11 -11
 	crtc->active = false;
 	intel_fbc_disable(crtc);
 	intel_disable_shared_dpll(old_crtc_state);
@@ -7586,7 +7586,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 	}
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
-	dev_priv->display->commit_modeset_enables(state);
+	dev_priv->display.funcs.crtc->commit_modeset_enables(state);
 
 	intel_encoders_update_complete(state);
 
@@ -8317,7 +8317,7 @@ static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.atomic_state_free = intel_atomic_state_free,
 };
 
-static const struct drm_i915_display_funcs skl_display_funcs = {
+static const struct intel_display_funcs skl_display_funcs = {
 	.get_pipe_config = hsw_get_pipe_config,
 	.crtc_enable = hsw_crtc_enable,
 	.crtc_disable = hsw_crtc_disable,
@@ -8325,7 +8325,7 @@ static const struct drm_i915_display_funcs skl_display_funcs = {
 	.get_initial_plane_config = skl_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs ddi_display_funcs = {
+static const struct intel_display_funcs ddi_display_funcs = {
 	.get_pipe_config = hsw_get_pipe_config,
 	.crtc_enable = hsw_crtc_enable,
 	.crtc_disable = hsw_crtc_disable,
@@ -8333,7 +8333,7 @@ static const struct drm_i915_display_funcs ddi_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs pch_split_display_funcs = {
+static const struct intel_display_funcs pch_split_display_funcs = {
 	.get_pipe_config = ilk_get_pipe_config,
 	.crtc_enable = ilk_crtc_enable,
 	.crtc_disable = ilk_crtc_disable,
@@ -8341,7 +8341,7 @@ static const struct drm_i915_display_funcs pch_split_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs vlv_display_funcs = {
+static const struct intel_display_funcs vlv_display_funcs = {
 	.get_pipe_config = i9xx_get_pipe_config,
 	.crtc_enable = valleyview_crtc_enable,
 	.crtc_disable = i9xx_crtc_disable,
@@ -8349,7 +8349,7 @@ static const struct drm_i915_display_funcs vlv_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs i9xx_display_funcs = {
+static const struct intel_display_funcs i9xx_display_funcs = {
 	.get_pipe_config = i9xx_get_pipe_config,
 	.crtc_enable = i9xx_crtc_enable,
 	.crtc_disable = i9xx_crtc_disable,
@@ -8372,16 +8372,16 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
 	intel_dpll_init_clock_hook(dev_priv);
 
 	if (DISPLAY_VER(dev_priv) >= 9) {
-		dev_priv->display = &skl_display_funcs;
+		dev_priv->display.funcs.crtc = &skl_display_funcs;
 	} else if (HAS_DDI(dev_priv)) {
-		dev_priv->display = &ddi_display_funcs;
+		dev_priv->display.funcs.crtc = &ddi_display_funcs;
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
-		dev_priv->display = &pch_split_display_funcs;
+		dev_priv->display.funcs.crtc = &pch_split_display_funcs;
 	} else if (IS_CHERRYVIEW(dev_priv) ||
 		   IS_VALLEYVIEW(dev_priv)) {
-		dev_priv->display = &vlv_display_funcs;
+		dev_priv->display.funcs.crtc = &vlv_display_funcs;
 	} else {
-		dev_priv->display = &i9xx_display_funcs;
+		dev_priv->display.funcs.crtc = &i9xx_display_funcs;
 	}
 
 	intel_fdi_init_hook(dev_priv);
drivers/gpu/drm/i915/display/intel_display_core.h new file +6 -0
new file mode 100644
index 000000000000..aafe548875cc
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_DISPLAY_CORE_H__

drivers/gpu/drm/i915/display/intel_display_core.h line 16

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_core.h new file +10 -0
+#define __INTEL_DISPLAY_CORE_H__
+
+#include <linux/types.h>
+
+struct intel_atomic_state;
+struct intel_crtc;
+struct intel_crtc_state;
+struct intel_initial_plane_config;
+
+struct intel_display_funcs {

in the same line as comment above. Maybe we could give this struct a better name? Because it's already inside a intel_display.funcs.crtc

display->funcs.crtc->get_pipe_config()
display->funcs.crtc->get_initial_plane_nfig()
display->funcs.crtc->enable()
display->funcs.crtc->disable()
display->funcs.crtc->commit_modeset_enables()

and then call this struct intel_crtc_funcs.

This can be done later as this commit itself is basically moving things with the same name inside a substruct.

Lucas De Marchi

Reviewed-by on v1 4/39
#20 lore raw

Re: [Intel-gfx] [PATCH 04/39] drm/i915: move hotplug_funcs to display.funcs

In reply to Jani Nikula
Quoted 86 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

---

.../gpu/drm/i915/display/intel_display_core.h |  4 ++++
drivers/gpu/drm/i915/i915_drv.h               |  4 ----
drivers/gpu/drm/i915/i915_irq.c               | 20 +++++++++----------
3 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +4 -0
index f09bbb7b5cc9..ff76bd4079e4 100644
@@ -13,6 +13,7 @@ struct intel_cdclk_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;
+struct intel_hotplug_funcs;
 struct intel_initial_plane_config;
 
 struct intel_display_funcs {
@@ -40,6 +41,9 @@ struct intel_display {
 
 		/* Display pll funcs */
 		const struct intel_dpll_funcs *dpll;
+
+		/* irq display functions */
+		const struct intel_hotplug_funcs *hotplug;
 	} funcs;
 };
 
drivers/gpu/drm/i915/i915_drv.h +0 -4
index 375f526215a2..513fae9e7a81 100644
@@ -94,7 +94,6 @@ struct intel_encoder;
 struct intel_fbdev;
 struct intel_fdi_funcs;
 struct intel_gmbus;
-struct intel_hotplug_funcs;
 struct intel_limit;
 struct intel_overlay;
 struct intel_overlay_error_state;
@@ -509,9 +508,6 @@ struct drm_i915_private {
 	/* pm display functions */
 	const struct drm_i915_wm_disp_funcs *wm_disp;
 
-	/* irq display functions */
-	const struct intel_hotplug_funcs *hotplug_funcs;
-
 	/* fdi display functions */
 	const struct intel_fdi_funcs *fdi_funcs;
 
drivers/gpu/drm/i915/i915_irq.c +6 -7
index 0389f532d926..c1b8f949c53d 100644
@@ -4370,8 +4370,8 @@ HPD_FUNCS(ilk);
 
 void intel_hpd_irq_setup(struct drm_i915_private *i915)
 {
-	if (i915->display_irqs_enabled && i915->hotplug_funcs)
-		i915->hotplug_funcs->hpd_irq_setup(i915);
+	if (i915->display_irqs_enabled && i915->display.funcs.hotplug)
+		i915->display.funcs.hotplug->hpd_irq_setup(i915);
 }
 
 /**
@@ -4424,22 +4424,22 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 
 	if (HAS_GMCH(dev_priv)) {
 		if (I915_HAS_HOTPLUG(dev_priv))
-			dev_priv->hotplug_funcs = &i915_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &i915_hpd_funcs;
 	} else {
 		if (HAS_PCH_DG2(dev_priv))
-			dev_priv->hotplug_funcs = &icp_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &icp_hpd_funcs;
 		else if (HAS_PCH_DG1(dev_priv))
-			dev_priv->hotplug_funcs = &dg1_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &dg1_hpd_funcs;
 		else if (DISPLAY_VER(dev_priv) >= 11)
-			dev_priv->hotplug_funcs = &gen11_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &gen11_hpd_funcs;
 		else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
-			dev_priv->hotplug_funcs = &bxt_hpd_funcs;

drivers/gpu/drm/i915/i915_irq.c void intel_irq_init(struct drm_i915_private *dev_priv) · line 4442

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +4 -3
+			dev_priv->display.funcs.hotplug = &bxt_hpd_funcs;
 		else if (INTEL_PCH_TYPE(dev_priv) >= PCH_ICP)
-			dev_priv->hotplug_funcs = &icp_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &icp_hpd_funcs;
 		else if (INTEL_PCH_TYPE(dev_priv) >= PCH_SPT)
-			dev_priv->hotplug_funcs = &spt_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &spt_hpd_funcs;
 		else
-			dev_priv->hotplug_funcs = &ilk_hpd_funcs;
+			dev_priv->display.funcs.hotplug = &ilk_hpd_funcs;

pass by comment: eventually we will want to move all these irq related to display to display/, right?

Lucas De Marchi

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	}
 }
 
Signature · 1 line
2.34.1
#26 lore raw

Re: [Intel-gfx] [PATCH 05/39] drm/i915: move clock_gating_funcs to display.funcs

In reply to Jani Nikula
Quoted 25 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Rename struct i915_clock_gating_funcs to intel_clock_gating_funcs while at it.

---

.../gpu/drm/i915/display/intel_display_core.h |  4 ++
drivers/gpu/drm/i915/i915_drv.h               |  4 --
drivers/gpu/drm/i915/intel_pm.c               | 58 +++++++++----------
3 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index ff76bd4079e4..98c6ccdc9100 100644
@@ -10,6 +10,7 @@
 
 struct intel_atomic_state;
 struct intel_cdclk_funcs;
+struct intel_clock_gating_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 50

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
@@ -44,6 +45,9 @@ struct intel_display {
 
 		/* irq display functions */
 		const struct intel_hotplug_funcs *hotplug;
+
+		/* pm private clock gating functions */
+		const struct intel_clock_gating_funcs *clock_gating;

did we get this correct moving clock_gating to display? The question I'd
ask is: if a platform doesn't have display, would it need to do
anything clock-gating related? Looking at the current functions e.g. gen9_init_clock_gating setting some chicken bits, I'd say yes.

Another reasoning I'd have is regarding the registers it touches. And here they are not from display.

So, I don't really understand the reason for moving clock_gating here, except that there are indeed several functions doing display-related things. Should we rather split one for i915 and one for i915-display?

Lucas De Marchi

Reviewed-by on v1 8/39
#39 lore raw

Re: [Intel-gfx] [PATCH 08/39] drm/i915: move color_funcs to display.funcs

In reply to Jani Nikula
Quoted 19 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

---

drivers/gpu/drm/i915/display/intel_color.c    | 34 +++++++++----------
.../gpu/drm/i915/display/intel_display_core.h |  4 +++
drivers/gpu/drm/i915/i915_drv.h               |  4 ---
3 files changed, 21 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/display/intel_color.c +1 -1
index 9583d17e858d..ed98c732b24e 100644
@@ -1167,22 +1167,22 @@ void intel_color_load_luts(const struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
 
-	dev_priv->color_funcs->load_luts(crtc_state);
+	dev_priv->display.funcs.color->load_luts(crtc_state);

drivers/gpu/drm/i915/display/intel_color.c void intel_color_load_luts(const struct intel_crtc_state *crtc_state) · line 1178

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_color.c +2 -2
 }
 
 void intel_color_commit_noarm(const struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
 
-	if (dev_priv->color_funcs->color_commit_noarm)
-		dev_priv->color_funcs->color_commit_noarm(crtc_state);
+	if (dev_priv->display.funcs.color->color_commit_noarm)
+		dev_priv->display.funcs.color->color_commit_noarm(crtc_state);

similar comment as for crtc. Maybe later we can remove the color_ prefix?

Lucas De Marchi

Reviewed-by on v1 9/39
#46 lore raw

Re: [Intel-gfx] [PATCH 09/39] drm/i915: move and group gmbus members under display.gmbus

In reply to Jani Nikula
Quoted 58 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

---

drivers/gpu/drm/i915/display/intel_cdclk.c    |  6 +--
.../gpu/drm/i915/display/intel_display_core.h | 23 ++++++++++
drivers/gpu/drm/i915/display/intel_dp_aux.c   |  2 +-
drivers/gpu/drm/i915/display/intel_gmbus.c    | 46 +++++++++----------
drivers/gpu/drm/i915/i915_drv.h               | 16 -------
drivers/gpu/drm/i915/i915_irq.c               |  4 +-
drivers/gpu/drm/i915/i915_reg.h               | 14 +++---
7 files changed, 59 insertions(+), 52 deletions(-)
drivers/gpu/drm/i915/display/intel_cdclk.c +3 -3
index 6095f5800a2e..ea40c75c2986 100644
@@ -2098,12 +2098,12 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,
 	 * functions use cdclk. Not all platforms/ports do,
 	 * but we'll lock them all for simplicity.
 	 */
-	mutex_lock(&dev_priv->gmbus_mutex);
+	mutex_lock(&dev_priv->display.gmbus.mutex);
 	for_each_intel_dp(&dev_priv->drm, encoder) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
 		mutex_lock_nest_lock(&intel_dp->aux.hw_mutex,
-				     &dev_priv->gmbus_mutex);
+				     &dev_priv->display.gmbus.mutex);
 	}
 
 	intel_cdclk_set_cdclk(dev_priv, cdclk_config, pipe);
@@ -2113,7 +2113,7 @@ static void intel_set_cdclk(struct drm_i915_private *dev_priv,
 
 		mutex_unlock(&intel_dp->aux.hw_mutex);
 	}
-	mutex_unlock(&dev_priv->gmbus_mutex);
+	mutex_unlock(&dev_priv->display.gmbus.mutex);
 
 	for_each_intel_encoder_with_psr(&dev_priv->drm, encoder) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
drivers/gpu/drm/i915/display/intel_display_core.h +4 -0
index 306584c038c9..fe19d4f9a9ab 100644
@@ -6,7 +6,11 @@
 #ifndef __INTEL_DISPLAY_CORE_H__
 #define __INTEL_DISPLAY_CORE_H__
 
+#include <linux/mutex.h>
 #include <linux/types.h>
+#include <linux/wait.h>
+
+#include "intel_gmbus.h"
 
 struct drm_i915_private;
 struct intel_atomic_state;

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 86

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
@@ -78,6 +82,25 @@ struct intel_display {
 		/* Display internal color functions */
 		const struct intel_color_funcs *color;
 	} funcs;
+
+	/* Grouping using anonymous structs. Keep sorted. */

this maybe deserves to be a comment on top of struct intel_display. Maybe alsos s/Grouping/Group/

regardless,

Lucas De Marchi

Reviewed-by on v1 13/39
#64 lore raw

Re: [Intel-gfx] [PATCH 13/39] drm/i915: move dpll under display.dpll

In reply to Jani Nikula
Quoted 201 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

---

drivers/gpu/drm/i915/display/icl_dsi.c        |  12 +-
drivers/gpu/drm/i915/display/intel_ddi.c      |  24 ++--
drivers/gpu/drm/i915/display/intel_display.c  |   4 +-
.../gpu/drm/i915/display/intel_display_core.h |  21 ++++
.../drm/i915/display/intel_display_debugfs.c  |   8 +-
drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 112 +++++++++---------
.../gpu/drm/i915/display/intel_pch_refclk.c   |   2 +-
drivers/gpu/drm/i915/gvt/handlers.c           |   4 +-
drivers/gpu/drm/i915/i915_drv.h               |  21 ----
9 files changed, 104 insertions(+), 104 deletions(-)
drivers/gpu/drm/i915/display/icl_dsi.c +6 -6
index 5dcfa7feffa9..49357e4ed3be 100644
@@ -641,13 +641,13 @@ static void gen11_dsi_gate_clocks(struct intel_encoder *encoder)
 	u32 tmp;
 	enum phy phy;
 
-	mutex_lock(&dev_priv->dpll.lock);
+	mutex_lock(&dev_priv->display.dpll.lock);
 	tmp = intel_de_read(dev_priv, ICL_DPCLKA_CFGCR0);
 	for_each_dsi_phy(phy, intel_dsi->phys)
 		tmp |= ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy);
 
 	intel_de_write(dev_priv, ICL_DPCLKA_CFGCR0, tmp);
-	mutex_unlock(&dev_priv->dpll.lock);
+	mutex_unlock(&dev_priv->display.dpll.lock);
 }
 
 static void gen11_dsi_ungate_clocks(struct intel_encoder *encoder)
@@ -657,13 +657,13 @@ static void gen11_dsi_ungate_clocks(struct intel_encoder *encoder)
 	u32 tmp;
 	enum phy phy;
 
-	mutex_lock(&dev_priv->dpll.lock);
+	mutex_lock(&dev_priv->display.dpll.lock);
 	tmp = intel_de_read(dev_priv, ICL_DPCLKA_CFGCR0);
 	for_each_dsi_phy(phy, intel_dsi->phys)
 		tmp &= ~ICL_DPCLKA_CFGCR0_DDI_CLK_OFF(phy);
 
 	intel_de_write(dev_priv, ICL_DPCLKA_CFGCR0, tmp);
-	mutex_unlock(&dev_priv->dpll.lock);
+	mutex_unlock(&dev_priv->display.dpll.lock);
 }
 
 static bool gen11_dsi_is_clock_enabled(struct intel_encoder *encoder)
@@ -693,7 +693,7 @@ static void gen11_dsi_map_pll(struct intel_encoder *encoder,
 	enum phy phy;
 	u32 val;
 
-	mutex_lock(&dev_priv->dpll.lock);
+	mutex_lock(&dev_priv->display.dpll.lock);
 
 	val = intel_de_read(dev_priv, ICL_DPCLKA_CFGCR0);
 	for_each_dsi_phy(phy, intel_dsi->phys) {
@@ -709,7 +709,7 @@ static void gen11_dsi_map_pll(struct intel_encoder *encoder,
 
 	intel_de_posting_read(dev_priv, ICL_DPCLKA_CFGCR0);
 
-	mutex_unlock(&dev_priv->dpll.lock);
+	mutex_unlock(&dev_priv->display.dpll.lock);
 }
 

static void

drivers/gpu/drm/i915/display/intel_ddi.c +12 -12
index a4c8493f3ce7..23c8287b0262 100644
@@ -1425,7 +1425,7 @@ hsw_set_signal_levels(struct intel_encoder *encoder,
 static void _icl_ddi_enable_clock(struct drm_i915_private *i915, i915_reg_t reg,
 				  u32 clk_sel_mask, u32 clk_sel, u32 clk_off)
 {
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, reg, clk_sel_mask, clk_sel);
 
@@ -1435,17 +1435,17 @@ static void _icl_ddi_enable_clock(struct drm_i915_private *i915, i915_reg_t reg,
 	 */
 	intel_de_rmw(i915, reg, clk_off, 0);
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 }
 
 static void _icl_ddi_disable_clock(struct drm_i915_private *i915, i915_reg_t reg,
 				   u32 clk_off)
 {
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, reg, 0, clk_off);
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 }
 
 static bool _icl_ddi_is_clock_enabled(struct drm_i915_private *i915, i915_reg_t reg,
@@ -1720,12 +1720,12 @@ static void icl_ddi_tc_enable_clock(struct intel_encoder *encoder,
 	intel_de_write(i915, DDI_CLK_SEL(port),
 		       icl_pll_to_ddi_clk_sel(encoder, crtc_state));
 
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, ICL_DPCLKA_CFGCR0,
 		     ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port), 0);
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 }
 
 static void icl_ddi_tc_disable_clock(struct intel_encoder *encoder)
@@ -1734,12 +1734,12 @@ static void icl_ddi_tc_disable_clock(struct intel_encoder *encoder)
 	enum tc_port tc_port = intel_port_to_tc(i915, encoder->port);
 	enum port port = encoder->port;
 
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, ICL_DPCLKA_CFGCR0,
 		     0, ICL_DPCLKA_CFGCR0_TC_CLK_OFF(tc_port));
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 
 	intel_de_write(i915, DDI_CLK_SEL(port), DDI_CLK_SEL_NONE);
 }
@@ -1824,7 +1824,7 @@ static void skl_ddi_enable_clock(struct intel_encoder *encoder,
 	if (drm_WARN_ON(&i915->drm, !pll))
 		return;
 
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, DPLL_CTRL2,
 		     DPLL_CTRL2_DDI_CLK_OFF(port) |
@@ -1832,7 +1832,7 @@ static void skl_ddi_enable_clock(struct intel_encoder *encoder,
 		     DPLL_CTRL2_DDI_CLK_SEL(pll->info->id, port) |
 		     DPLL_CTRL2_DDI_SEL_OVERRIDE(port));
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 }
 
 static void skl_ddi_disable_clock(struct intel_encoder *encoder)
@@ -1840,12 +1840,12 @@ static void skl_ddi_disable_clock(struct intel_encoder *encoder)
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	enum port port = encoder->port;
 
-	mutex_lock(&i915->dpll.lock);
+	mutex_lock(&i915->display.dpll.lock);
 
 	intel_de_rmw(i915, DPLL_CTRL2,
 		     0, DPLL_CTRL2_DDI_CLK_OFF(port));
 
-	mutex_unlock(&i915->dpll.lock);
+	mutex_unlock(&i915->display.dpll.lock);
 }
 
 static bool skl_ddi_is_clock_enabled(struct intel_encoder *encoder)
drivers/gpu/drm/i915/display/intel_display.c +2 -2
index 7db4ac27364d..efc0fa648736 100644
@@ -1487,7 +1487,7 @@ static void intel_encoders_update_prepare(struct intel_atomic_state *state)
 	 * Make sure the DPLL state is up-to-date for fastset TypeC ports after non-blocking commits.
 	 * TODO: Update the DPLL state for all cases in the encoder->update_prepare() hook.
 	 */
-	if (i915->dpll.mgr) {
+	if (i915->display.dpll.mgr) {
 		for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
 			if (intel_crtc_needs_modeset(new_crtc_state))
 				continue;
@@ -5839,7 +5839,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 
 	PIPE_CONF_CHECK_BOOL(double_wide);
 
-	if (dev_priv->dpll.mgr) {
+	if (dev_priv->display.dpll.mgr) {
 		PIPE_CONF_CHECK_P(shared_dpll);
 
 		PIPE_CONF_CHECK_X(dpll_hw_state.dpll);
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index 748d2a84e20e..f12ff36fef07 100644
@@ -12,6 +12,7 @@
 
 #include "intel_display.h"
 #include "intel_dmc.h"
+#include "intel_dpll_mgr.h"
 #include "intel_gmbus.h"
 
 struct drm_i915_private;

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_color_funcs; · line 28

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
@@ -24,6 +25,7 @@ struct intel_color_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;
+struct intel_dpll_mgr;

if you include intel_dpll_mgr.h you don't need the fwd declaration?

Lucas De Marchi

Reviewed-by on v1 17/39
#73 lore raw

Re: [Intel-gfx] [PATCH 17/39] drm/i915: move hotplug to display.hotplug

In reply to Jani Nikula
Quoted 1 line · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

missed the mention that i915_hotplug is now intel_hotplug.

For this and all previous patches (except patch 5, for clock_gating_funcs):

Lucas De Marchi

Quoted 864 lines

---

drivers/gpu/drm/i915/display/g4x_dp.c         |   4 +-
drivers/gpu/drm/i915/display/intel_ddi.c      |   6 +-
.../gpu/drm/i915/display/intel_display_core.h |  40 ++++++
.../drm/i915/display/intel_display_debugfs.c  |  16 +--
drivers/gpu/drm/i915/display/intel_dp.c       |   4 +-
drivers/gpu/drm/i915/display/intel_hotplug.c  | 116 +++++++++---------
drivers/gpu/drm/i915/display/intel_tc.c       |   4 +-
drivers/gpu/drm/i915/i915_driver.c            |   6 +-
drivers/gpu/drm/i915/i915_drv.h               |  40 ------
drivers/gpu/drm/i915/i915_irq.c               |  52 ++++----
10 files changed, 144 insertions(+), 144 deletions(-)
drivers/gpu/drm/i915/display/g4x_dp.c +2 -2
index 82ad8fe7440c..e3e3d27ffb53 100644
@@ -1169,7 +1169,7 @@ intel_dp_hotplug(struct intel_encoder *encoder,
 static bool ibx_digital_port_connected(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	u32 bit = dev_priv->hotplug.pch_hpd[encoder->hpd_pin];
+	u32 bit = dev_priv->display.hotplug.pch_hpd[encoder->hpd_pin];
 
 	return intel_de_read(dev_priv, SDEISR) & bit;
 }
@@ -1223,7 +1223,7 @@ static bool gm45_digital_port_connected(struct intel_encoder *encoder)
 static bool ilk_digital_port_connected(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	u32 bit = dev_priv->hotplug.hpd[encoder->hpd_pin];
+	u32 bit = dev_priv->display.hotplug.hpd[encoder->hpd_pin];
 
 	return intel_de_read(dev_priv, DEISR) & bit;
 }
drivers/gpu/drm/i915/display/intel_ddi.c +3 -3
index 23c8287b0262..320304809ed6 100644
@@ -4032,7 +4032,7 @@ intel_ddi_hotplug(struct intel_encoder *encoder,
 static bool lpt_digital_port_connected(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	u32 bit = dev_priv->hotplug.pch_hpd[encoder->hpd_pin];
+	u32 bit = dev_priv->display.hotplug.pch_hpd[encoder->hpd_pin];
 
 	return intel_de_read(dev_priv, SDEISR) & bit;
 }
@@ -4040,7 +4040,7 @@ static bool lpt_digital_port_connected(struct intel_encoder *encoder)
 static bool hsw_digital_port_connected(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	u32 bit = dev_priv->hotplug.hpd[encoder->hpd_pin];
+	u32 bit = dev_priv->display.hotplug.hpd[encoder->hpd_pin];
 
 	return intel_de_read(dev_priv, DEISR) & bit;
 }
@@ -4048,7 +4048,7 @@ static bool hsw_digital_port_connected(struct intel_encoder *encoder)
 static bool bdw_digital_port_connected(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	u32 bit = dev_priv->hotplug.hpd[encoder->hpd_pin];
+	u32 bit = dev_priv->display.hotplug.hpd[encoder->hpd_pin];
 
 	return intel_de_read(dev_priv, GEN8_DE_PORT_ISR) & bit;
 }
drivers/gpu/drm/i915/display/intel_display_core.h +40 -0
index 8ac63352b27b..cf31ad0c9593 100644
@@ -102,6 +102,45 @@ struct intel_dpll {
 	} ref_clks;
 };
 
+struct intel_hotplug {
+	struct delayed_work hotplug_work;
+
+	const u32 *hpd, *pch_hpd;
+
+	struct {
+		unsigned long last_jiffies;
+		int count;
+		enum {
+			HPD_ENABLED = 0,
+			HPD_DISABLED = 1,
+			HPD_MARK_DISABLED = 2
+		} state;
+	} stats[HPD_NUM_PINS];
+	u32 event_bits;
+	u32 retry_bits;
+	struct delayed_work reenable_work;
+
+	u32 long_port_mask;
+	u32 short_port_mask;
+	struct work_struct dig_port_work;
+
+	struct work_struct poll_init_work;
+	bool poll_enabled;
+
+	unsigned int hpd_storm_threshold;
+	/* Whether or not to count short HPD IRQs in HPD storms */
+	u8 hpd_short_storm_enabled;
+
+	/*
+	 * if we get a HPD irq from DP and a HPD irq from non-DP
+	 * the non-DP HPD could block the workqueue on a mode config
+	 * mutex getting, that userspace may have taken. However
+	 * userspace is waiting on the DP workqueue to run which is
+	 * blocked behind the non-DP one.
+	 */
+	struct workqueue_struct *dp_wq;
+};
+
 struct intel_wm {
 	/*
 	 * Raw watermark latency values:
@@ -213,6 +252,7 @@ struct intel_display {
 	struct intel_audio audio;
 	struct intel_dmc dmc;
 	struct intel_dpll dpll;
+	struct intel_hotplug hotplug;
 	struct intel_wm wm;
 };
 
drivers/gpu/drm/i915/display/intel_display_debugfs.c +8 -8
index 395facf6c1aa..13c855b59f7d 100644
@@ -1618,14 +1618,14 @@ static const struct file_operations i915_cur_wm_latency_fops = {
 static int i915_hpd_storm_ctl_show(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = m->private;
-	struct i915_hotplug *hotplug = &dev_priv->hotplug;
+	struct intel_hotplug *hotplug = &dev_priv->display.hotplug;
 
 	/* Synchronize with everything first in case there's been an HPD
 	 * storm, but we haven't finished handling it in the kernel yet
 	 */
 	intel_synchronize_irq(dev_priv);
-	flush_work(&dev_priv->hotplug.dig_port_work);
-	flush_delayed_work(&dev_priv->hotplug.hotplug_work);
+	flush_work(&dev_priv->display.hotplug.dig_port_work);
+	flush_delayed_work(&dev_priv->display.hotplug.hotplug_work);
 
 	seq_printf(m, "Threshold: %d\n", hotplug->hpd_storm_threshold);
 	seq_printf(m, "Detected: %s\n",
@@ -1640,7 +1640,7 @@ static ssize_t i915_hpd_storm_ctl_write(struct file *file,
 {
 	struct seq_file *m = file->private_data;
 	struct drm_i915_private *dev_priv = m->private;
-	struct i915_hotplug *hotplug = &dev_priv->hotplug;
+	struct intel_hotplug *hotplug = &dev_priv->display.hotplug;
 	unsigned int new_threshold;
 	int i;
 	char *newline;
@@ -1679,7 +1679,7 @@ static ssize_t i915_hpd_storm_ctl_write(struct file *file,
 	spin_unlock_irq(&dev_priv->irq_lock);
 
 	/* Re-enable hpd immediately if we were in an irq storm */
-	flush_delayed_work(&dev_priv->hotplug.reenable_work);
+	flush_delayed_work(&dev_priv->display.hotplug.reenable_work);
 
 	return len;
 }
@@ -1703,7 +1703,7 @@ static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
 	struct drm_i915_private *dev_priv = m->private;
 
 	seq_printf(m, "Enabled: %s\n",
-		   str_yes_no(dev_priv->hotplug.hpd_short_storm_enabled));
+		   str_yes_no(dev_priv->display.hotplug.hpd_short_storm_enabled));
 
 	return 0;
 }
@@ -1721,7 +1721,7 @@ static ssize_t i915_hpd_short_storm_ctl_write(struct file *file,
 {
 	struct seq_file *m = file->private_data;
 	struct drm_i915_private *dev_priv = m->private;
-	struct i915_hotplug *hotplug = &dev_priv->hotplug;
+	struct intel_hotplug *hotplug = &dev_priv->display.hotplug;
 	char *newline;
 	char tmp[16];
 	int i;
@@ -1757,7 +1757,7 @@ static ssize_t i915_hpd_short_storm_ctl_write(struct file *file,
 	spin_unlock_irq(&dev_priv->irq_lock);
 
 	/* Re-enable hpd immediately if we were in an irq storm */
-	flush_delayed_work(&dev_priv->hotplug.reenable_work);
+	flush_delayed_work(&dev_priv->display.hotplug.reenable_work);
 
 	return len;
 }
drivers/gpu/drm/i915/display/intel_dp.c +2 -2
index 32292c0be2bd..8d9c3af8443d 100644
@@ -5023,9 +5023,9 @@ static void intel_dp_oob_hotplug_event(struct drm_connector *connector)
 	struct drm_i915_private *i915 = to_i915(connector->dev);
 
 	spin_lock_irq(&i915->irq_lock);
-	i915->hotplug.event_bits |= BIT(encoder->hpd_pin);
+	i915->display.hotplug.event_bits |= BIT(encoder->hpd_pin);
 	spin_unlock_irq(&i915->irq_lock);
-	queue_delayed_work(system_wq, &i915->hotplug.hotplug_work, 0);
+	queue_delayed_work(system_wq, &i915->display.hotplug.hotplug_work, 0);
 }
 
 static const struct drm_connector_funcs intel_dp_connector_funcs = {
drivers/gpu/drm/i915/display/intel_hotplug.c +58 -58
index 5f8b4f481cff..f7a2f485b177 100644
@@ -119,13 +119,13 @@ intel_connector_hpd_pin(struct intel_connector *connector)
 * responsible for further action.
 *
 * The number of IRQs that are allowed within @HPD_STORM_DETECT_PERIOD is
- * stored in @dev_priv->hotplug.hpd_storm_threshold which defaults to
+ * stored in @dev_priv->display.hotplug.hpd_storm_threshold which defaults to
 * @HPD_STORM_DEFAULT_THRESHOLD. Long IRQs count as +10 to this threshold, and
 * short IRQs count as +1. If this threshold is exceeded, it's considered an
 * IRQ storm and the IRQ state is set to @HPD_MARK_DISABLED.
 *
 * By default, most systems will only count long IRQs towards
- * &dev_priv->hotplug.hpd_storm_threshold. However, some older systems also
+ * &dev_priv->display.hotplug.hpd_storm_threshold. However, some older systems also
 * suffer from short IRQ storms and must also track these. Because short IRQ
 * storms are naturally caused by sideband interactions with DP MST devices,
 * short IRQ detection is only enabled for systems without DP MST support.
@@ -140,7 +140,7 @@ intel_connector_hpd_pin(struct intel_connector *connector)
 static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv,
 				       enum hpd_pin pin, bool long_hpd)
 {
-	struct i915_hotplug *hpd = &dev_priv->hotplug;
+	struct intel_hotplug *hpd = &dev_priv->display.hotplug;
 	unsigned long start = hpd->stats[pin].last_jiffies;
 	unsigned long end = start + msecs_to_jiffies(HPD_STORM_DETECT_PERIOD);
 	const int increment = long_hpd ? 10 : 1;
@@ -148,7 +148,7 @@ static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv,
 	bool storm = false;
 
 	if (!threshold ||
-	    (!long_hpd && !dev_priv->hotplug.hpd_short_storm_enabled))
+	    (!long_hpd && !dev_priv->display.hotplug.hpd_short_storm_enabled))
 		return false;
 
 	if (!time_in_range(jiffies, start, end)) {
@@ -191,7 +191,7 @@ intel_hpd_irq_storm_switch_to_polling(struct drm_i915_private *dev_priv)
 
 		pin = intel_connector_hpd_pin(connector);
 		if (pin == HPD_NONE ||
-		    dev_priv->hotplug.stats[pin].state != HPD_MARK_DISABLED)
+		    dev_priv->display.hotplug.stats[pin].state != HPD_MARK_DISABLED)
 			continue;
 
 		drm_info(&dev_priv->drm,
@@ -199,7 +199,7 @@ intel_hpd_irq_storm_switch_to_polling(struct drm_i915_private *dev_priv)
 			 "switching from hotplug detection to polling\n",
 			 connector->base.name);
 
-		dev_priv->hotplug.stats[pin].state = HPD_DISABLED;
+		dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED;
 		connector->base.polled = DRM_CONNECTOR_POLL_CONNECT |
 			DRM_CONNECTOR_POLL_DISCONNECT;
 		hpd_disabled = true;
@@ -209,7 +209,7 @@ intel_hpd_irq_storm_switch_to_polling(struct drm_i915_private *dev_priv)
 	/* Enable polling and queue hotplug re-enabling. */
 	if (hpd_disabled) {
 		drm_kms_helper_poll_enable(dev);
-		mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work,
+		mod_delayed_work(system_wq, &dev_priv->display.hotplug.reenable_work,
 				 msecs_to_jiffies(HPD_STORM_REENABLE_DELAY));
 	}
 }
@@ -218,7 +218,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
 		container_of(work, typeof(*dev_priv),
-			     hotplug.reenable_work.work);
+			     display.hotplug.reenable_work.work);
 	struct drm_device *dev = &dev_priv->drm;
 	struct drm_connector_list_iter conn_iter;
 	struct intel_connector *connector;
@@ -233,7 +233,7 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
 	for_each_intel_connector_iter(connector, &conn_iter) {
 		pin = intel_connector_hpd_pin(connector);
 		if (pin == HPD_NONE ||
-		    dev_priv->hotplug.stats[pin].state != HPD_DISABLED)
+		    dev_priv->display.hotplug.stats[pin].state != HPD_DISABLED)
 			continue;
 
 		if (connector->base.polled != connector->polled)
@@ -245,8 +245,8 @@ static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
 	drm_connector_list_iter_end(&conn_iter);
 
 	for_each_hpd_pin(pin) {
-		if (dev_priv->hotplug.stats[pin].state == HPD_DISABLED)
-			dev_priv->hotplug.stats[pin].state = HPD_ENABLED;
+		if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED)
+			dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED;
 	}
 
 	intel_hpd_irq_setup(dev_priv);
@@ -297,16 +297,16 @@ static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
 static void i915_digport_work_func(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
-		container_of(work, struct drm_i915_private, hotplug.dig_port_work);
+		container_of(work, struct drm_i915_private, display.hotplug.dig_port_work);
 	u32 long_port_mask, short_port_mask;
 	struct intel_encoder *encoder;
 	u32 old_bits = 0;
 
 	spin_lock_irq(&dev_priv->irq_lock);
-	long_port_mask = dev_priv->hotplug.long_port_mask;
-	dev_priv->hotplug.long_port_mask = 0;
-	short_port_mask = dev_priv->hotplug.short_port_mask;
-	dev_priv->hotplug.short_port_mask = 0;
+	long_port_mask = dev_priv->display.hotplug.long_port_mask;
+	dev_priv->display.hotplug.long_port_mask = 0;
+	short_port_mask = dev_priv->display.hotplug.short_port_mask;
+	dev_priv->display.hotplug.short_port_mask = 0;
 	spin_unlock_irq(&dev_priv->irq_lock);
 
 	for_each_intel_encoder(&dev_priv->drm, encoder) {
@@ -335,9 +335,9 @@ static void i915_digport_work_func(struct work_struct *work)
 
 	if (old_bits) {
 		spin_lock_irq(&dev_priv->irq_lock);
-		dev_priv->hotplug.event_bits |= old_bits;
+		dev_priv->display.hotplug.event_bits |= old_bits;
 		spin_unlock_irq(&dev_priv->irq_lock);
-		queue_delayed_work(system_wq, &dev_priv->hotplug.hotplug_work, 0);
+		queue_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work, 0);
 	}
 }
 
@@ -353,10 +353,10 @@ void intel_hpd_trigger_irq(struct intel_digital_port *dig_port)
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 
 	spin_lock_irq(&i915->irq_lock);
-	i915->hotplug.short_port_mask |= BIT(dig_port->base.port);
+	i915->display.hotplug.short_port_mask |= BIT(dig_port->base.port);
 	spin_unlock_irq(&i915->irq_lock);
 
-	queue_work(i915->hotplug.dp_wq, &i915->hotplug.dig_port_work);
+	queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work);
 }
 
 /*
@@ -366,7 +366,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
 		container_of(work, struct drm_i915_private,
-			     hotplug.hotplug_work.work);
+			     display.hotplug.hotplug_work.work);
 	struct drm_device *dev = &dev_priv->drm;
 	struct drm_connector_list_iter conn_iter;
 	struct intel_connector *connector;
@@ -379,10 +379,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
 	spin_lock_irq(&dev_priv->irq_lock);
 
-	hpd_event_bits = dev_priv->hotplug.event_bits;
-	dev_priv->hotplug.event_bits = 0;
-	hpd_retry_bits = dev_priv->hotplug.retry_bits;
-	dev_priv->hotplug.retry_bits = 0;
+	hpd_event_bits = dev_priv->display.hotplug.event_bits;
+	dev_priv->display.hotplug.event_bits = 0;
+	hpd_retry_bits = dev_priv->display.hotplug.retry_bits;
+	dev_priv->display.hotplug.retry_bits = 0;
 
 	/* Enable polling for connectors which had HPD IRQ storms */
 	intel_hpd_irq_storm_switch_to_polling(dev_priv);
@@ -435,10 +435,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
 	retry &= ~changed;
 	if (retry) {
 		spin_lock_irq(&dev_priv->irq_lock);
-		dev_priv->hotplug.retry_bits |= retry;
+		dev_priv->display.hotplug.retry_bits |= retry;
 		spin_unlock_irq(&dev_priv->irq_lock);
 
-		mod_delayed_work(system_wq, &dev_priv->hotplug.hotplug_work,
+		mod_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work,
 				 msecs_to_jiffies(HPD_RETRY_DELAY));
 	}
 }
@@ -502,10 +502,10 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 
 		if (long_hpd) {
 			long_hpd_pulse_mask |= BIT(pin);
-			dev_priv->hotplug.long_port_mask |= BIT(port);
+			dev_priv->display.hotplug.long_port_mask |= BIT(port);
 		} else {
 			short_hpd_pulse_mask |= BIT(pin);
-			dev_priv->hotplug.short_port_mask |= BIT(port);
+			dev_priv->display.hotplug.short_port_mask |= BIT(port);
 		}
 	}
 
@@ -516,7 +516,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 		if (!(BIT(pin) & pin_mask))
 			continue;
 
-		if (dev_priv->hotplug.stats[pin].state == HPD_DISABLED) {
+		if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) {
 			/*
 			 * On GMCH platforms the interrupt mask bits only
 			 * prevent irq generation, not the setting of the
@@ -529,7 +529,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 			continue;
 		}
 
-		if (dev_priv->hotplug.stats[pin].state != HPD_ENABLED)
+		if (dev_priv->display.hotplug.stats[pin].state != HPD_ENABLED)
 			continue;
 
 		/*
@@ -540,13 +540,13 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 		if (((short_hpd_pulse_mask | long_hpd_pulse_mask) & BIT(pin))) {
 			long_hpd = long_hpd_pulse_mask & BIT(pin);
 		} else {
-			dev_priv->hotplug.event_bits |= BIT(pin);
+			dev_priv->display.hotplug.event_bits |= BIT(pin);
 			long_hpd = true;
 			queue_hp = true;
 		}
 
 		if (intel_hpd_irq_storm_detect(dev_priv, pin, long_hpd)) {
-			dev_priv->hotplug.event_bits &= ~BIT(pin);
+			dev_priv->display.hotplug.event_bits &= ~BIT(pin);
 			storm_detected = true;
 			queue_hp = true;
 		}
@@ -567,9 +567,9 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	 * deadlock.
 	 */
 	if (queue_dig)
-		queue_work(dev_priv->hotplug.dp_wq, &dev_priv->hotplug.dig_port_work);
+		queue_work(dev_priv->display.hotplug.dp_wq, &dev_priv->display.hotplug.dig_port_work);
 	if (queue_hp)
-		queue_delayed_work(system_wq, &dev_priv->hotplug.hotplug_work, 0);
+		queue_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work, 0);
 }
 
 /**
@@ -594,8 +594,8 @@ void intel_hpd_init(struct drm_i915_private *dev_priv)
 		return;
 
 	for_each_hpd_pin(i) {
-		dev_priv->hotplug.stats[i].count = 0;
-		dev_priv->hotplug.stats[i].state = HPD_ENABLED;
+		dev_priv->display.hotplug.stats[i].count = 0;
+		dev_priv->display.hotplug.stats[i].state = HPD_ENABLED;
 	}
 
 	/*
@@ -611,7 +611,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
 		container_of(work, struct drm_i915_private,
-			     hotplug.poll_init_work);
+			     display.hotplug.poll_init_work);
 	struct drm_device *dev = &dev_priv->drm;
 	struct drm_connector_list_iter conn_iter;
 	struct intel_connector *connector;
@@ -619,7 +619,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
 
 	mutex_lock(&dev->mode_config.mutex);
 
-	enabled = READ_ONCE(dev_priv->hotplug.poll_enabled);
+	enabled = READ_ONCE(dev_priv->display.hotplug.poll_enabled);
 
 	drm_connector_list_iter_begin(dev, &conn_iter);
 	for_each_intel_connector_iter(connector, &conn_iter) {
@@ -672,7 +672,7 @@ void intel_hpd_poll_enable(struct drm_i915_private *dev_priv)
 	    !INTEL_DISPLAY_ENABLED(dev_priv))
 		return;
 
-	WRITE_ONCE(dev_priv->hotplug.poll_enabled, true);
+	WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true);
 
 	/*
 	 * We might already be holding dev->mode_config.mutex, so do this in a
@@ -680,7 +680,7 @@ void intel_hpd_poll_enable(struct drm_i915_private *dev_priv)
 	 * As well, there's no issue if we race here since we always reschedule
 	 * this worker anyway
 	 */
-	schedule_work(&dev_priv->hotplug.poll_init_work);
+	schedule_work(&dev_priv->display.hotplug.poll_init_work);
 }
 
 /**
@@ -707,17 +707,17 @@ void intel_hpd_poll_disable(struct drm_i915_private *dev_priv)
 	if (!HAS_DISPLAY(dev_priv))
 		return;
 
-	WRITE_ONCE(dev_priv->hotplug.poll_enabled, false);
-	schedule_work(&dev_priv->hotplug.poll_init_work);
+	WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, false);
+	schedule_work(&dev_priv->display.hotplug.poll_init_work);
 }
 
 void intel_hpd_init_work(struct drm_i915_private *dev_priv)
 {
-	INIT_DELAYED_WORK(&dev_priv->hotplug.hotplug_work,
+	INIT_DELAYED_WORK(&dev_priv->display.hotplug.hotplug_work,
 			  i915_hotplug_work_func);
-	INIT_WORK(&dev_priv->hotplug.dig_port_work, i915_digport_work_func);
-	INIT_WORK(&dev_priv->hotplug.poll_init_work, i915_hpd_poll_init_work);
-	INIT_DELAYED_WORK(&dev_priv->hotplug.reenable_work,
+	INIT_WORK(&dev_priv->display.hotplug.dig_port_work, i915_digport_work_func);
+	INIT_WORK(&dev_priv->display.hotplug.poll_init_work, i915_hpd_poll_init_work);
+	INIT_DELAYED_WORK(&dev_priv->display.hotplug.reenable_work,
 			  intel_hpd_irq_storm_reenable_work);
 }
 
@@ -728,17 +728,17 @@ void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
 
 	spin_lock_irq(&dev_priv->irq_lock);
 
-	dev_priv->hotplug.long_port_mask = 0;
-	dev_priv->hotplug.short_port_mask = 0;
-	dev_priv->hotplug.event_bits = 0;
-	dev_priv->hotplug.retry_bits = 0;
+	dev_priv->display.hotplug.long_port_mask = 0;
+	dev_priv->display.hotplug.short_port_mask = 0;
+	dev_priv->display.hotplug.event_bits = 0;
+	dev_priv->display.hotplug.retry_bits = 0;
 
 	spin_unlock_irq(&dev_priv->irq_lock);
 
-	cancel_work_sync(&dev_priv->hotplug.dig_port_work);
-	cancel_delayed_work_sync(&dev_priv->hotplug.hotplug_work);
-	cancel_work_sync(&dev_priv->hotplug.poll_init_work);
-	cancel_delayed_work_sync(&dev_priv->hotplug.reenable_work);
+	cancel_work_sync(&dev_priv->display.hotplug.dig_port_work);
+	cancel_delayed_work_sync(&dev_priv->display.hotplug.hotplug_work);
+	cancel_work_sync(&dev_priv->display.hotplug.poll_init_work);
+	cancel_delayed_work_sync(&dev_priv->display.hotplug.reenable_work);
 }
 
 bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin)
@@ -749,8 +749,8 @@ bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin)
 		return false;
 
 	spin_lock_irq(&dev_priv->irq_lock);
-	if (dev_priv->hotplug.stats[pin].state == HPD_ENABLED) {
-		dev_priv->hotplug.stats[pin].state = HPD_DISABLED;
+	if (dev_priv->display.hotplug.stats[pin].state == HPD_ENABLED) {
+		dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED;
 		ret = true;
 	}
 	spin_unlock_irq(&dev_priv->irq_lock);
@@ -764,6 +764,6 @@ void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin)
 		return;
 
 	spin_lock_irq(&dev_priv->irq_lock);
-	dev_priv->hotplug.stats[pin].state = HPD_ENABLED;
+	dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED;
 	spin_unlock_irq(&dev_priv->irq_lock);
 }
drivers/gpu/drm/i915/display/intel_tc.c +2 -2
index 6773840f6cc7..e5af955b5600 100644
@@ -246,7 +246,7 @@ static u32 icl_tc_port_live_status_mask(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 	struct intel_uncore *uncore = &i915->uncore;
-	u32 isr_bit = i915->hotplug.pch_hpd[dig_port->base.hpd_pin];
+	u32 isr_bit = i915->display.hotplug.pch_hpd[dig_port->base.hpd_pin];
 	u32 mask = 0;
 	u32 val;
 
@@ -279,7 +279,7 @@ static u32 adl_tc_port_live_status_mask(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
 	enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port);
-	u32 isr_bit = i915->hotplug.pch_hpd[dig_port->base.hpd_pin];
+	u32 isr_bit = i915->display.hotplug.pch_hpd[dig_port->base.hpd_pin];
 	struct intel_uncore *uncore = &i915->uncore;
 	u32 val, mask = 0;
 
drivers/gpu/drm/i915/i915_driver.c +3 -3
index 8841ec398b07..6607ed250531 100644
@@ -252,8 +252,8 @@ static int i915_workqueues_init(struct drm_i915_private *dev_priv)
 	if (dev_priv->wq == NULL)
 		goto out_err;
 
-	dev_priv->hotplug.dp_wq = alloc_ordered_workqueue("i915-dp", 0);
-	if (dev_priv->hotplug.dp_wq == NULL)
+	dev_priv->display.hotplug.dp_wq = alloc_ordered_workqueue("i915-dp", 0);
+	if (dev_priv->display.hotplug.dp_wq == NULL)
 		goto out_free_wq;
 
 	return 0;
@@ -268,7 +268,7 @@ static int i915_workqueues_init(struct drm_i915_private *dev_priv)
 
 static void i915_workqueues_cleanup(struct drm_i915_private *dev_priv)
 {
-	destroy_workqueue(dev_priv->hotplug.dp_wq);
+	destroy_workqueue(dev_priv->display.hotplug.dp_wq);
 	destroy_workqueue(dev_priv->wq);
 }
 
drivers/gpu/drm/i915/i915_drv.h +0 -40
index a0af8190ed87..ef67a5322c2d 100644
@@ -89,45 +89,6 @@ struct vlv_s0ix_state;
 /* Threshold == 5 for long IRQs, 50 for short */
 #define HPD_STORM_DEFAULT_THRESHOLD 50
 
-struct i915_hotplug {
-	struct delayed_work hotplug_work;
-
-	const u32 *hpd, *pch_hpd;
-
-	struct {
-		unsigned long last_jiffies;
-		int count;
-		enum {
-			HPD_ENABLED = 0,
-			HPD_DISABLED = 1,
-			HPD_MARK_DISABLED = 2
-		} state;
-	} stats[HPD_NUM_PINS];
-	u32 event_bits;
-	u32 retry_bits;
-	struct delayed_work reenable_work;
-
-	u32 long_port_mask;
-	u32 short_port_mask;
-	struct work_struct dig_port_work;
-
-	struct work_struct poll_init_work;
-	bool poll_enabled;
-
-	unsigned int hpd_storm_threshold;
-	/* Whether or not to count short HPD IRQs in HPD storms */
-	u8 hpd_short_storm_enabled;
-
-	/*
-	 * if we get a HPD irq from DP and a HPD irq from non-DP
-	 * the non-DP HPD could block the workqueue on a mode config
-	 * mutex getting, that userspace may have taken. However
-	 * userspace is waiting on the DP workqueue to run which is
-	 * blocked behind the non-DP one.
-	 */
-	struct workqueue_struct *dp_wq;
-};
-
 #define I915_GEM_GPU_DOMAINS \
 	(I915_GEM_DOMAIN_RENDER | \
 	 I915_GEM_DOMAIN_SAMPLER | \
@@ -375,7 +336,6 @@ struct drm_i915_private {
 	};
 	u32 pipestat_irq_mask[I915_MAX_PIPES];
 
-	struct i915_hotplug hotplug;
 	struct intel_fbc *fbc[I915_MAX_FBCS];
 	struct intel_opregion opregion;
 	struct intel_vbt_data vbt;
drivers/gpu/drm/i915/i915_irq.c +26 -26
index b0095b289a79..c2f2d7b8d964 100644
@@ -185,7 +185,7 @@ static const u32 hpd_sde_dg1[HPD_NUM_PINS] = {
 
 static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
 {
-	struct i915_hotplug *hpd = &dev_priv->hotplug;
+	struct intel_hotplug *hpd = &dev_priv->display.hotplug;
 
 	if (HAS_GMCH(dev_priv)) {
 		if (IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) ||
@@ -1272,7 +1272,7 @@ static u32 intel_hpd_enabled_irqs(struct drm_i915_private *dev_priv,
 	u32 enabled_irqs = 0;
 
 	for_each_intel_encoder(&dev_priv->drm, encoder)
-		if (dev_priv->hotplug.stats[encoder->hpd_pin].state == HPD_ENABLED)
+		if (dev_priv->display.hotplug.stats[encoder->hpd_pin].state == HPD_ENABLED)
 			enabled_irqs |= hpd[encoder->hpd_pin];
 
 	return enabled_irqs;
@@ -1637,7 +1637,7 @@ static void i9xx_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	if (hotplug_trigger) {
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   hotplug_trigger, hotplug_trigger,
-				   dev_priv->hotplug.hpd,
+				   dev_priv->display.hotplug.hpd,
 				   i9xx_port_hotplug_long_detect);
 
 		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
@@ -1841,7 +1841,7 @@ static void ibx_hpd_irq_handler(struct drm_i915_private *dev_priv,
 
 	intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 			   hotplug_trigger, dig_hotplug_reg,
-			   dev_priv->hotplug.pch_hpd,
+			   dev_priv->display.hotplug.pch_hpd,
 			   pch_port_hotplug_long_detect);
 
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
@@ -1986,7 +1986,7 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   ddi_hotplug_trigger, dig_hotplug_reg,
-				   dev_priv->hotplug.pch_hpd,
+				   dev_priv->display.hotplug.pch_hpd,
 				   icp_ddi_port_hotplug_long_detect);
 	}
 
@@ -1998,7 +1998,7 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   tc_hotplug_trigger, dig_hotplug_reg,
-				   dev_priv->hotplug.pch_hpd,
+				   dev_priv->display.hotplug.pch_hpd,
 				   icp_tc_port_hotplug_long_detect);
 	}
 
@@ -2024,7 +2024,7 @@ static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   hotplug_trigger, dig_hotplug_reg,
-				   dev_priv->hotplug.pch_hpd,
+				   dev_priv->display.hotplug.pch_hpd,
 				   spt_port_hotplug_long_detect);
 	}
 
@@ -2036,7 +2036,7 @@ static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   hotplug2_trigger, dig_hotplug_reg,
-				   dev_priv->hotplug.pch_hpd,
+				   dev_priv->display.hotplug.pch_hpd,
 				   spt_port_hotplug2_long_detect);
 	}
 
@@ -2057,7 +2057,7 @@ static void ilk_hpd_irq_handler(struct drm_i915_private *dev_priv,
 
 	intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 			   hotplug_trigger, dig_hotplug_reg,
-			   dev_priv->hotplug.hpd,
+			   dev_priv->display.hotplug.hpd,
 			   ilk_port_hotplug_long_detect);
 
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
@@ -2237,7 +2237,7 @@ static void bxt_hpd_irq_handler(struct drm_i915_private *dev_priv,
 
 	intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 			   hotplug_trigger, dig_hotplug_reg,
-			   dev_priv->hotplug.hpd,
+			   dev_priv->display.hotplug.hpd,
 			   bxt_port_hotplug_long_detect);
 
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
@@ -2257,7 +2257,7 @@ static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   trigger_tc, dig_hotplug_reg,
-				   dev_priv->hotplug.hpd,
+				   dev_priv->display.hotplug.hpd,
 				   gen11_port_hotplug_long_detect);
 	}
 
@@ -2269,7 +2269,7 @@ static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
 				   trigger_tbt, dig_hotplug_reg,
-				   dev_priv->hotplug.hpd,
+				   dev_priv->display.hotplug.hpd,
 				   gen11_port_hotplug_long_detect);
 	}
 
@@ -3313,8 +3313,8 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug_irqs, enabled_irqs;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
 
 	ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs);
 
@@ -3383,8 +3383,8 @@ static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug_irqs, enabled_irqs;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
 
 	if (INTEL_PCH_TYPE(dev_priv) <= PCH_TGP)
 		intel_uncore_write(&dev_priv->uncore, SHPD_FILTER_CNT, SHPD_FILTER_CNT_500_ADJ);
@@ -3460,8 +3460,8 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	u32 hotplug_irqs, enabled_irqs;
 	u32 val;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.hpd);
 
 	val = intel_uncore_read(&dev_priv->uncore, GEN11_DE_HPD_IMR);
 	val &= ~hotplug_irqs;
@@ -3538,8 +3538,8 @@ static void spt_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	if (INTEL_PCH_TYPE(dev_priv) >= PCH_CNP)
 		intel_uncore_write(&dev_priv->uncore, SHPD_FILTER_CNT, SHPD_FILTER_CNT_500_ADJ);
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.pch_hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.pch_hpd);
 
 	ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs);
 
@@ -3578,8 +3578,8 @@ static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug_irqs, enabled_irqs;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.hpd);
 
 	if (DISPLAY_VER(dev_priv) >= 8)
 		bdw_update_port_irq(dev_priv, hotplug_irqs, enabled_irqs);
@@ -3636,8 +3636,8 @@ static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug_irqs, enabled_irqs;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->hotplug.hpd);
-	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->hotplug.hpd);
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, dev_priv->display.hotplug.hpd);
+	hotplug_irqs = intel_hpd_hotplug_irqs(dev_priv, dev_priv->display.hotplug.hpd);
 
 	bdw_update_port_irq(dev_priv, hotplug_irqs, enabled_irqs);
 
@@ -4413,14 +4413,14 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
 		dev_priv->display_irqs_enabled = false;
 
-	dev_priv->hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD;
+	dev_priv->display.hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD;
 	/* If we have MST support, we want to avoid doing short HPD IRQ storm
 	 * detection, as short HPD storms will occur as a natural part of
 	 * sideband messaging with MST.
 	 * On older platforms however, IRQ storms can occur with both long and
 	 * short pulses, as seen on some G4x systems.
 	 */
-	dev_priv->hotplug.hpd_short_storm_enabled = !HAS_DP_MST(dev_priv);
+	dev_priv->display.hotplug.hpd_short_storm_enabled = !HAS_DP_MST(dev_priv);
 
 	if (HAS_GMCH(dev_priv)) {
 		if (I915_HAS_HOTPLUG(dev_priv))
Signature · 1 line
2.34.1
Reviewed-by on v1 23/39
#81 lore raw

Re: [Intel-gfx] [PATCH 23/39] drm/i915: move backlight to display.backlight

In reply to Jani Nikula
Quoted 6 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Prefer adding anonymous sub-structs even for single members that aren't our own structs.

For this and all previous patches (except patch 5, for clock_gating_funcs):

Lucas De Marchi

Reviewed-by on v1 24/39
#83 lore raw

Re: [Intel-gfx] [PATCH 24/39] drm/i915: move mipi_mmio_base to display.dsi

In reply to Jani Nikula
Quoted 20 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Prefer adding anonymous sub-structs even for single members that aren't our own structs.

Abstract mmio base member access in register definitions in a macro.

---

.../gpu/drm/i915/display/intel_display_core.h |   5 +
drivers/gpu/drm/i915/display/vlv_dsi.c        |   4 +-
drivers/gpu/drm/i915/display/vlv_dsi_regs.h   | 188 +++++++++---------
drivers/gpu/drm/i915/i915_drv.h               |   3 -
4 files changed, 102 insertions(+), 98 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +0 -0
index 533c2e3a6685..db1ba379797e 100644

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 255

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
@@ -251,6 +251,11 @@ struct intel_display {
 		unsigned int max_cdclk_freq;
 	} cdclk;
 
+	struct {
+		/* VLV/CHV/BXT/GLK DSI MMIO register base address */

this is already outdated, so maybe remove the platforms from the comment?

Quoted 36 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
+		u32 mmio_base;
+	} dsi;
+
 	struct {
 		/* list of fbdev register on this device */
 		struct intel_fbdev *fbdev;
drivers/gpu/drm/i915/display/vlv_dsi.c +2 -2
index b9b1fed99874..9651a1f00587 100644
@@ -1872,9 +1872,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 		return;
 
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
-		dev_priv->mipi_mmio_base = BXT_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = BXT_MIPI_BASE;
 	else
-		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = VLV_MIPI_BASE;
 
 	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
 	if (!intel_dsi)
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +2 -0
index 356e51515346..e065b8f2ee08 100644
@@ -11,6 +11,8 @@
 #define VLV_MIPI_BASE			VLV_DISPLAY_BASE
 #define BXT_MIPI_BASE			0x60000
 
+#define _MIPI_MMIO_BASE(__i915) ((__i915)->display.dsi.mmio_base)
+
 #define _MIPI_PORT(port, a, c)	(((port) == PORT_A) ? a : c)	/* ports A and C only */
 #define _MMIO_MIPI(port, a, c)	_MMIO(_MIPI_PORT(port, a, c))
 

drivers/gpu/drm/i915/display/vlv_dsi_regs.h line 101

Quoted 6 lines
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +1 -2
@@ -96,8 +98,8 @@
 
 /* MIPI DSI Controller and D-PHY registers */
 
-#define _MIPIA_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb000)
-#define _MIPIC_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb800)
+#define _MIPIA_DEVICE_READY		(_MIPI_MMIO_BASE(dev_priv) + 0xb000)

ugh, and I thought we wouldn't have so many implicit params anymore. Mind adding a "TODO: remove implicit dev_priv parameter" ?

Lucas De Marchi

Reviewed-by on v1 28/39
#91 lore raw

Re: [Intel-gfx] [PATCH 28/39] drm/i915: move and group power related members under display.power

In reply to Jani Nikula
Quoted 30 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Arguably chv_phy_control and chv_phy_assert could be placed in a phy substruct, but they are only used in the power code.

---

.../gpu/drm/i915/display/intel_display_core.h |  11 ++
.../drm/i915/display/intel_display_power.c    | 112 +++++++++---------
.../i915/display/intel_display_power_map.c    |   4 +-
.../i915/display/intel_display_power_well.c   |  56 ++++-----
.../i915/display/intel_display_power_well.h   |  12 +-
drivers/gpu/drm/i915/display/intel_dpio_phy.c |   2 +-
drivers/gpu/drm/i915/i915_debugfs.c           |   2 +-
drivers/gpu/drm/i915/i915_drv.h               |  20 +---
8 files changed, 110 insertions(+), 109 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index 066e7ee0b8df..19abdd05d413 100644
@@ -16,6 +16,7 @@
 
 #include "intel_cdclk.h"
 #include "intel_display.h"
+#include "intel_display_power.h"
 #include "intel_dmc.h"
 #include "intel_dpll_mgr.h"
 #include "intel_fbc.h"

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 331

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
@@ -326,6 +327,16 @@ struct intel_display {
 		struct mutex comp_mutex;
 	} hdcp;
 
+	struct {
+		struct i915_power_domains domains;

rename the struct to display_power_domains?

for all patches til this, expect patch 5

Lucas De Marchi

#109 lore raw
In reply to Jani Nikula
Quoted 11 lines · Jani Nikula

Add display sub-struct to drm_i915_private, and start moving display related members there.

This doesn't help with build dependencies yet, but adds a lot of clarity in organizing the display data, and who accesses display data and where.

This is a beginning, there are still stragglers, but need to start sending the patches instead of accumulating tons more.

BR,
Jani.

I was not sure if I would have time to review all the patches, so I started adding my r-b on each of them. But I made it through the end.

You can add my Reviewed-by: Lucas De Marchi <[email protected]> on all of them, except patch 5.

For patch 5, movingo clock_gating_funcs, I'm not really sure it's what we want.

thanks
Lucas De Marchi

#8 lore raw
In reply to Lucas De Marchi
Quoted 164 lines · Lucas De Marchi
Quoted 42 lines · Jani Nikula

In another long-overdue cleanup, add a display sub-struct to drm_i915_private, and start moving display related members there. Start with display funcs that need a rename anyway to not collide with the new display member.

Add a new header under display/ for defining struct intel_display.

Rename struct drm_i915_display_funcs to intel_display_funcs while at it.

---

drivers/gpu/drm/i915/display/intel_display.c  | 28 +++++++-------
.../gpu/drm/i915/display/intel_display_core.h | 38 +++++++++++++++++++
.../drm/i915/display/intel_modeset_setup.c    |  2 +-
.../drm/i915/display/intel_plane_initial.c    |  2 +-
drivers/gpu/drm/i915/i915_drv.h               | 21 ++--------
5 files changed, 57 insertions(+), 34 deletions(-)

create mode 100644 drivers/gpu/drm/i915/display/intel_display_core.h

drivers/gpu/drm/i915/display/intel_display.c +2 -2
index f143adefdf38..24ab1501beea 100644
@@ -4144,7 +4144,7 @@ bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 
-	if (!i915->display->get_pipe_config(crtc, crtc_state))
+	if (!i915->display.funcs.crtc->get_pipe_config(crtc, crtc_state))
 		return false;
 
 	crtc_state->hw.active = true;
@@ -7119,7 +7119,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state,
 
 	intel_crtc_update_active_timings(new_crtc_state);
 
-	dev_priv->display->crtc_enable(state, crtc);
+	dev_priv->display.funcs.crtc->crtc_enable(state, crtc);
 
 	if (intel_crtc_is_bigjoiner_slave(new_crtc_state))
 		return;

drivers/gpu/drm/i915/display/intel_display.c static void intel_old_crtc_state_disables(struct intel_atomic_state *state, · line 7201

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
@@ -7198,7 +7198,7 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
 	 */
 	intel_crtc_disable_pipe_crc(crtc);
 
-	dev_priv->display->crtc_disable(state, crtc);
+	dev_priv->display.funcs.crtc->crtc_disable(state, crtc);

lgtm. Regarding names: it's a little weird to have "crtc doubled in the funcs.crtc->crtc_ and it not being consistent accross all functions

Quoted 91 lines
drivers/gpu/drm/i915/display/intel_display.c +11 -11
 	crtc->active = false;
 	intel_fbc_disable(crtc);
 	intel_disable_shared_dpll(old_crtc_state);
@@ -7586,7 +7586,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 	}
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
-	dev_priv->display->commit_modeset_enables(state);
+	dev_priv->display.funcs.crtc->commit_modeset_enables(state);
 
 	intel_encoders_update_complete(state);
 
@@ -8317,7 +8317,7 @@ static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.atomic_state_free = intel_atomic_state_free,
 };
 
-static const struct drm_i915_display_funcs skl_display_funcs = {
+static const struct intel_display_funcs skl_display_funcs = {
 	.get_pipe_config = hsw_get_pipe_config,
 	.crtc_enable = hsw_crtc_enable,
 	.crtc_disable = hsw_crtc_disable,
@@ -8325,7 +8325,7 @@ static const struct drm_i915_display_funcs skl_display_funcs = {
 	.get_initial_plane_config = skl_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs ddi_display_funcs = {
+static const struct intel_display_funcs ddi_display_funcs = {
 	.get_pipe_config = hsw_get_pipe_config,
 	.crtc_enable = hsw_crtc_enable,
 	.crtc_disable = hsw_crtc_disable,
@@ -8333,7 +8333,7 @@ static const struct drm_i915_display_funcs ddi_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs pch_split_display_funcs = {
+static const struct intel_display_funcs pch_split_display_funcs = {
 	.get_pipe_config = ilk_get_pipe_config,
 	.crtc_enable = ilk_crtc_enable,
 	.crtc_disable = ilk_crtc_disable,
@@ -8341,7 +8341,7 @@ static const struct drm_i915_display_funcs pch_split_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs vlv_display_funcs = {
+static const struct intel_display_funcs vlv_display_funcs = {
 	.get_pipe_config = i9xx_get_pipe_config,
 	.crtc_enable = valleyview_crtc_enable,
 	.crtc_disable = i9xx_crtc_disable,
@@ -8349,7 +8349,7 @@ static const struct drm_i915_display_funcs vlv_display_funcs = {
 	.get_initial_plane_config = i9xx_get_initial_plane_config,
 };
 
-static const struct drm_i915_display_funcs i9xx_display_funcs = {
+static const struct intel_display_funcs i9xx_display_funcs = {
 	.get_pipe_config = i9xx_get_pipe_config,
 	.crtc_enable = i9xx_crtc_enable,
 	.crtc_disable = i9xx_crtc_disable,
@@ -8372,16 +8372,16 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
 	intel_dpll_init_clock_hook(dev_priv);
 
 	if (DISPLAY_VER(dev_priv) >= 9) {
-		dev_priv->display = &skl_display_funcs;
+		dev_priv->display.funcs.crtc = &skl_display_funcs;
 	} else if (HAS_DDI(dev_priv)) {
-		dev_priv->display = &ddi_display_funcs;
+		dev_priv->display.funcs.crtc = &ddi_display_funcs;
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
-		dev_priv->display = &pch_split_display_funcs;
+		dev_priv->display.funcs.crtc = &pch_split_display_funcs;
 	} else if (IS_CHERRYVIEW(dev_priv) ||
 		   IS_VALLEYVIEW(dev_priv)) {
-		dev_priv->display = &vlv_display_funcs;
+		dev_priv->display.funcs.crtc = &vlv_display_funcs;
 	} else {
-		dev_priv->display = &i9xx_display_funcs;
+		dev_priv->display.funcs.crtc = &i9xx_display_funcs;
 	}
 
 	intel_fdi_init_hook(dev_priv);
drivers/gpu/drm/i915/display/intel_display_core.h new file +6 -0
new file mode 100644
index 000000000000..aafe548875cc
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __INTEL_DISPLAY_CORE_H__

drivers/gpu/drm/i915/display/intel_display_core.h line 16

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_core.h new file +10 -0
+#define __INTEL_DISPLAY_CORE_H__
+
+#include <linux/types.h>
+
+struct intel_atomic_state;
+struct intel_crtc;
+struct intel_crtc_state;
+struct intel_initial_plane_config;
+
+struct intel_display_funcs {

in the same line as comment above. Maybe we could give this struct a better name? Because it's already inside a intel_display.funcs.crtc

display->funcs.crtc->get_pipe_config()
display->funcs.crtc->get_initial_plane_nfig()
display->funcs.crtc->enable()
display->funcs.crtc->disable()
display->funcs.crtc->commit_modeset_enables()

Quoted 4 lines

and then call this struct intel_crtc_funcs.

This can be done later as this commit itself is basically moving things with the same name inside a substruct.

I guess my question is, are the functions inside "crtc enough" to be called intel_crtc_funcs? Though intel_display_funcs is really too generic too.

Maybe I'll just go with crtc.

Quoted 1 line

Thanks!

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#27 lore raw

Re: [Intel-gfx] [PATCH 05/39] drm/i915: move clock_gating_funcs to display.funcs

In reply to Lucas De Marchi
Quoted 38 lines · Lucas De Marchi
Quoted 25 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Rename struct i915_clock_gating_funcs to intel_clock_gating_funcs while at it.

---

.../gpu/drm/i915/display/intel_display_core.h |  4 ++
drivers/gpu/drm/i915/i915_drv.h               |  4 --
drivers/gpu/drm/i915/intel_pm.c               | 58 +++++++++----------
3 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index ff76bd4079e4..98c6ccdc9100 100644
@@ -10,6 +10,7 @@
 
 struct intel_atomic_state;
 struct intel_cdclk_funcs;
+struct intel_clock_gating_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 50

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
@@ -44,6 +45,9 @@ struct intel_display {
 
 		/* irq display functions */
 		const struct intel_hotplug_funcs *hotplug;
+
+		/* pm private clock gating functions */
+		const struct intel_clock_gating_funcs *clock_gating;

did we get this correct moving clock_gating to display? The question I'd ask is: if a platform doesn't have display, would it need to do anything clock-gating related? Looking at the current functions e.g. gen9_init_clock_gating setting some chicken bits, I'd say yes.

Quoted 6 lines

Another reasoning I'd have is regarding the registers it touches. And here they are not from display.

So, I don't really understand the reason for moving clock_gating here, except that there are indeed several functions doing display-related things. Should we rather split one for i915 and one for i915-display?

Mmmh, maybe. It's hard to split the driver nicely when the hardware isn't!

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#84 lore raw

Re: [Intel-gfx] [PATCH 24/39] drm/i915: move mipi_mmio_base to display.dsi

In reply to Lucas De Marchi
Quoted 24 lines · Lucas De Marchi
Quoted 23 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Prefer adding anonymous sub-structs even for single members that aren't our own structs.

Abstract mmio base member access in register definitions in a macro.

---

.../gpu/drm/i915/display/intel_display_core.h |   5 +
drivers/gpu/drm/i915/display/vlv_dsi.c        |   4 +-
drivers/gpu/drm/i915/display/vlv_dsi_regs.h   | 188 +++++++++---------
drivers/gpu/drm/i915/i915_drv.h               |   3 -
4 files changed, 102 insertions(+), 98 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +0 -0
index 533c2e3a6685..db1ba379797e 100644
@@ -251,6 +251,11 @@ struct intel_display {
 		unsigned int max_cdclk_freq;
 	} cdclk;
 
Quoted 5 lines

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 255

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
+	struct {
+		/* VLV/CHV/BXT/GLK DSI MMIO register base address */

this is already outdated, so maybe remove the platforms from the comment?

What did I miss? It's only used for vlv_dsi, not icl_dsi which is the newer thing.

Quoted 39 lines
Quoted 39 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
+		u32 mmio_base;
+	} dsi;
+
 	struct {
 		/* list of fbdev register on this device */
 		struct intel_fbdev *fbdev;
drivers/gpu/drm/i915/display/vlv_dsi.c +2 -2
index b9b1fed99874..9651a1f00587 100644
@@ -1872,9 +1872,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 		return;
 
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
-		dev_priv->mipi_mmio_base = BXT_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = BXT_MIPI_BASE;
 	else
-		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = VLV_MIPI_BASE;
 
 	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
 	if (!intel_dsi)
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +2 -0
index 356e51515346..e065b8f2ee08 100644
@@ -11,6 +11,8 @@
 #define VLV_MIPI_BASE			VLV_DISPLAY_BASE
 #define BXT_MIPI_BASE			0x60000
 
+#define _MIPI_MMIO_BASE(__i915) ((__i915)->display.dsi.mmio_base)
+
 #define _MIPI_PORT(port, a, c)	(((port) == PORT_A) ? a : c)	/* ports A and C only */
 #define _MMIO_MIPI(port, a, c)	_MMIO(_MIPI_PORT(port, a, c))
 
@@ -96,8 +98,8 @@
 
Quoted 8 lines

drivers/gpu/drm/i915/display/vlv_dsi_regs.h line 101

Quoted 5 lines
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +1 -2
 /* MIPI DSI Controller and D-PHY registers */
 
-#define _MIPIA_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb000)
-#define _MIPIC_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb800)
+#define _MIPIA_DEVICE_READY		(_MIPI_MMIO_BASE(dev_priv) + 0xb000)

ugh, and I thought we wouldn't have so many implicit params anymore. Mind adding a "TODO: remove implicit dev_priv parameter" ?

It's been on my private todo list like 10 years. :(

BR,
Jani.

Quoted 6 lines

Lucas De Marchi

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#28 lore raw

Re: [Intel-gfx] [PATCH 05/39] drm/i915: move clock_gating_funcs to display.funcs

In reply to Jani Nikula
Quoted 42 lines · Jani Nikula
Quoted 41 lines · Lucas De Marchi
Quoted 25 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Rename struct i915_clock_gating_funcs to intel_clock_gating_funcs while at it.

---

.../gpu/drm/i915/display/intel_display_core.h |  4 ++
drivers/gpu/drm/i915/i915_drv.h               |  4 --
drivers/gpu/drm/i915/intel_pm.c               | 58 +++++++++----------
3 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index ff76bd4079e4..98c6ccdc9100 100644
@@ -10,6 +10,7 @@
 
 struct intel_atomic_state;
 struct intel_cdclk_funcs;
+struct intel_clock_gating_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 50

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
@@ -44,6 +45,9 @@ struct intel_display {
 
 		/* irq display functions */
 		const struct intel_hotplug_funcs *hotplug;
+
+		/* pm private clock gating functions */
+		const struct intel_clock_gating_funcs *clock_gating;

did we get this correct moving clock_gating to display? The question I'd ask is: if a platform doesn't have display, would it need to do anything clock-gating related? Looking at the current functions e.g. gen9_init_clock_gating setting some chicken bits, I'd say yes.

Another reasoning I'd have is regarding the registers it touches. And here they are not from display.

Quoted 6 lines
Quoted 3 lines

So, I don't really understand the reason for moving clock_gating here, except that there are indeed several functions doing display-related things. Should we rather split one for i915 and one for i915-display?

Mmmh, maybe. It's hard to split the driver nicely when the hardware isn't!

oh, maybe one alternative is to move most of those register settings (that appear to be WAs) somewhere else. And then declare the clock_gating stuff as "this is display stuff".

I don't mind if you move them inside display first just to get the ball rolling and we move them to a better place later.

Lucas De Marchi

Quoted 6 lines

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#85 lore raw

Re: [Intel-gfx] [PATCH 24/39] drm/i915: move mipi_mmio_base to display.dsi

In reply to Jani Nikula
Quoted 25 lines · Jani Nikula
Quoted 24 lines · Lucas De Marchi
Quoted 23 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Prefer adding anonymous sub-structs even for single members that aren't our own structs.

Abstract mmio base member access in register definitions in a macro.

---

.../gpu/drm/i915/display/intel_display_core.h |   5 +
drivers/gpu/drm/i915/display/vlv_dsi.c        |   4 +-
drivers/gpu/drm/i915/display/vlv_dsi_regs.h   | 188 +++++++++---------
drivers/gpu/drm/i915/i915_drv.h               |   3 -
4 files changed, 102 insertions(+), 98 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +0 -0
index 533c2e3a6685..db1ba379797e 100644
@@ -251,6 +251,11 @@ struct intel_display {
 		unsigned int max_cdclk_freq;
 	} cdclk;
 
Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 255

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
+	struct {
+		/* VLV/CHV/BXT/GLK DSI MMIO register base address */

this is already outdated, so maybe remove the platforms from the comment?

What did I miss? It's only used for vlv_dsi, not icl_dsi which is the newer thing.

you missed that I misread this part. It's the icl_dsi that is used later.

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
+		u32 mmio_base;
+	} dsi;
+
 	struct {
 		/* list of fbdev register on this device */
 		struct intel_fbdev *fbdev;
drivers/gpu/drm/i915/display/vlv_dsi.c +2 -2
index b9b1fed99874..9651a1f00587 100644
@@ -1872,9 +1872,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 		return;
 
 	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
-		dev_priv->mipi_mmio_base = BXT_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = BXT_MIPI_BASE;
 	else
-		dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
+		dev_priv->display.dsi.mmio_base = VLV_MIPI_BASE;
 
 	intel_dsi = kzalloc(sizeof(*intel_dsi), GFP_KERNEL);
 	if (!intel_dsi)
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +2 -0
index 356e51515346..e065b8f2ee08 100644
@@ -11,6 +11,8 @@
 #define VLV_MIPI_BASE			VLV_DISPLAY_BASE
 #define BXT_MIPI_BASE			0x60000
 
+#define _MIPI_MMIO_BASE(__i915) ((__i915)->display.dsi.mmio_base)
+
 #define _MIPI_PORT(port, a, c)	(((port) == PORT_A) ? a : c)	/* ports A and C only */
 #define _MMIO_MIPI(port, a, c)	_MMIO(_MIPI_PORT(port, a, c))
 
@@ -96,8 +98,8 @@
 
 /* MIPI DSI Controller and D-PHY registers */
 
Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/i915/display/vlv_dsi_regs.h line 101

Quoted 3 lines
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +1 -2
-#define _MIPIA_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb000)
-#define _MIPIC_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb800)
+#define _MIPIA_DEVICE_READY		(_MIPI_MMIO_BASE(dev_priv) + 0xb000)

ugh, and I thought we wouldn't have so many implicit params anymore. Mind adding a "TODO: remove implicit dev_priv parameter" ?

It's been on my private todo list like 10 years. :(

and we are finally removing that from the todo list soon. right? :)

Lucas De Marchi

Quoted 14 lines

BR,
Jani.

Quoted 6 lines

Lucas De Marchi

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#86 lore raw

Re: [Intel-gfx] [PATCH 24/39] drm/i915: move mipi_mmio_base to display.dsi

Quoted 10 lines · Lucas De Marchi
Quoted 9 lines · Jani Nikula
Quoted 7 lines · Lucas De Marchi

drivers/gpu/drm/i915/display/vlv_dsi_regs.h line 101

Quoted 3 lines · Jani Nikula
drivers/gpu/drm/i915/display/vlv_dsi_regs.h +1 -2
-#define _MIPIA_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb000)
-#define _MIPIC_DEVICE_READY		(dev_priv->mipi_mmio_base + 0xb800)
+#define _MIPIA_DEVICE_READY		(_MIPI_MMIO_BASE(dev_priv) + 0xb000)

ugh, and I thought we wouldn't have so many implicit params anymore. Mind adding a "TODO: remove implicit dev_priv parameter" ?

Quoted 3 lines
Quoted 1 line

It's been on my private todo list like 10 years. :(

and we are finally removing that from the todo list soon. right? :)

Maybe the perfect has been the enemy of the good here, too.

The simple thing to do is to just pass i915 to all register macros that need it, and be done with it. It's a little bit of churn here and there, not too bad.

But then some register macros need it, some don't, and it's all case by case. What if we passed i915 to *all* register macros instead? Some wouldn't need it and it would be all the same. But some could benefit. See e.g. how HDCP_CONF() in intel_hdcp_regs.h adapts to platforms. It's not really a style we use anywhere else, but should we do that more instead of having it inline in code?

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#9 lore raw
In reply to Jani Nikula
Quoted 10 lines · Jani Nikula
Quoted 9 lines · Lucas De Marchi
Quoted 8 lines · Jani Nikula

In another long-overdue cleanup, add a display sub-struct to drm_i915_private, and start moving display related members there. Start with display funcs that need a rename anyway to not collide with the new display member.

Add a new header under display/ for defining struct intel_display.

Rename struct drm_i915_display_funcs to intel_display_funcs while at it.

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

+struct intel_display_funcs {

in the same line as comment above. Maybe we could give this struct a better name? Because it's already inside a intel_display.funcs.crtc

display->funcs.crtc->get_pipe_config()
display->funcs.crtc->get_initial_plane_nfig()
display->funcs.crtc->enable()
display->funcs.crtc->disable()
display->funcs.crtc->commit_modeset_enables()

and then call this struct intel_crtc_funcs.

Quoted 8 lines
Quoted 2 lines

This can be done later as this commit itself is basically moving things with the same name inside a substruct.

I guess my question is, are the functions inside "crtc enough" to be called intel_crtc_funcs? Though intel_display_funcs is really too generic too.

Maybe I'll just go with crtc.

Mmh, except we already have a bunch of struct drm_crtc_funcs with <platform>_crtc_funcs in intel_crtc.c. Too confusing.

struct intel_random_collection_of_display_funcs. :p

The easy choice *for now* would be to stick with the struct intel_display_funcs and live with the display->funcs.display tautology.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#10 lore raw
Quoted 36 lines · Jani Nikula
Quoted 10 lines · Jani Nikula
Quoted 9 lines · Lucas De Marchi
Quoted 8 lines · Jani Nikula

In another long-overdue cleanup, add a display sub-struct to drm_i915_private, and start moving display related members there. Start with display funcs that need a rename anyway to not collide with the new display member.

Add a new header under display/ for defining struct intel_display.

Rename struct drm_i915_display_funcs to intel_display_funcs while at it.

[...]

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

+struct intel_display_funcs {

in the same line as comment above. Maybe we could give this struct a better name? Because it's already inside a intel_display.funcs.crtc

display->funcs.crtc->get_pipe_config()
display->funcs.crtc->get_initial_plane_nfig()
display->funcs.crtc->enable()
display->funcs.crtc->disable()
display->funcs.crtc->commit_modeset_enables()

and then call this struct intel_crtc_funcs.

Quoted 8 lines
Quoted 2 lines

This can be done later as this commit itself is basically moving things with the same name inside a substruct.

I guess my question is, are the functions inside "crtc enough" to be called intel_crtc_funcs? Though intel_display_funcs is really too generic too.

Maybe I'll just go with crtc.

Quoted 7 lines

Mmh, except we already have a bunch of struct drm_crtc_funcs with <platform>_crtc_funcs in intel_crtc.c. Too confusing.

struct intel_random_collection_of_display_funcs. :p

The easy choice *for now* would be to stick with the struct intel_display_funcs and live with the display->funcs.display tautology.

thanks
Lucas De Marchi

Quoted 9 lines

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Reviewed-by on v1 14/39
#67 lore raw

Re: [Intel-gfx] [PATCH 14/39] drm/i915: move and group fbdev under display.fbdev

In reply to Jani Nikula
Quoted 10 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 14/39] drm/i915: move and group fbdev under display.fbdev

Quoted 3 lines

Move display related members under drm_i915_private display sub-struct.

Thanks and Regards,
Arun R Murthy
--------------------

Quoted 199 lines
---
 .../gpu/drm/i915/display/intel_display_core.h |  8 ++++++
.../drm/i915/display/intel_display_debugfs.c  |  2 +-
 drivers/gpu/drm/i915/display/intel_fbdev.c    | 26 +++++++++----------
 drivers/gpu/drm/i915/i915_drv.h               |  5 ----
 4 files changed, 22 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +8 -0
index f12ff36fef07..71434a922695 100644
@@ -9,6 +9,7 @@
 #include <linux/mutex.h>
 #include <linux/types.h>
 #include <linux/wait.h>
+#include <linux/workqueue.h>
 
 #include "intel_display.h"
 #include "intel_dmc.h"
@@ -26,6 +27,7 @@ struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;
 struct intel_dpll_mgr;
+struct intel_fbdev;
 struct intel_fdi_funcs;
 struct intel_hotplug_funcs;
 struct intel_initial_plane_config;
@@ -130,6 +132,12 @@ struct intel_display {
 	} funcs;
 
 	/* Grouping using anonymous structs. Keep sorted. */
+	struct {
+		/* list of fbdev register on this device */
+		struct intel_fbdev *fbdev;
+		struct work_struct suspend_work;
+	} fbdev;
+
 	struct {
 		/*
 		 * Base address of where the gmbus and gpio blocks are

located diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 7994f78b889a..e568590faa82 100644

drivers/gpu/drm/i915/display/intel_display_debugfs.c +1 -1
@@ -129,7 +129,7 @@ static int i915_gem_framebuffer_info(struct seq_file
 *m, void *data)
 	struct drm_framebuffer *drm_fb;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-	fbdev_fb = intel_fbdev_framebuffer(dev_priv->fbdev);
+	fbdev_fb = intel_fbdev_framebuffer(dev_priv->display.fbdev.fbdev);
 	if (fbdev_fb) {
 		seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp,

modifier 0x%llx, refcount %d, obj ",

drivers/gpu/drm/i915/display/intel_display_debugfs.c +0 -0
 			   fbdev_fb->base.width,
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
index 221336178991..c08ff6a5c2e9 100644
@@ -500,7 +500,7 @@ static void intel_fbdev_suspend_worker(struct
 work_struct *work)  {
 	intel_fbdev_set_suspend(&container_of(work,
 					      struct drm_i915_private,
-					      fbdev_suspend_work)->drm,
+					      display.fbdev.suspend_work)-
 >drm,
 				FBINFO_STATE_RUNNING,
 				true);

}

drivers/gpu/drm/i915/display/intel_fbdev.c +9 -7
@@ -530,8 +530,8 @@ int intel_fbdev_init(struct drm_device *dev)
 		return ret;
 	}
 
-	dev_priv->fbdev = ifbdev;
-	INIT_WORK(&dev_priv->fbdev_suspend_work,
 intel_fbdev_suspend_worker);
+	dev_priv->display.fbdev.fbdev = ifbdev;
+	INIT_WORK(&dev_priv->display.fbdev.suspend_work,
+intel_fbdev_suspend_worker);
 
 	return 0;
 }
@@ -548,7 +548,7 @@ static void intel_fbdev_initial_config(void *data,
 async_cookie_t cookie)
 
 void intel_fbdev_initial_config_async(struct drm_device *dev)  {
-	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
 
 	if (!ifbdev)
 		return;
@@ -568,12 +568,12 @@ static void intel_fbdev_sync(struct intel_fbdev
 *ifbdev)
 
 void intel_fbdev_unregister(struct drm_i915_private *dev_priv)  {
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
 
 	if (!ifbdev)
 		return;
 
-	cancel_work_sync(&dev_priv->fbdev_suspend_work);
+	cancel_work_sync(&dev_priv->display.fbdev.suspend_work);
 	if (!current_is_async())
 		intel_fbdev_sync(ifbdev);
 
@@ -582,7 +582,7 @@ void intel_fbdev_unregister(struct drm_i915_private
 *dev_priv)
 
 void intel_fbdev_fini(struct drm_i915_private *dev_priv)  {
-	struct intel_fbdev *ifbdev = fetch_and_zero(&dev_priv->fbdev);
+	struct intel_fbdev *ifbdev =
+fetch_and_zero(&dev_priv->display.fbdev.fbdev);
 
 	if (!ifbdev)
 		return;
@@ -596,7 +596,7 @@ void intel_fbdev_fini(struct drm_i915_private
 *dev_priv)
  */
 static void intel_fbdev_hpd_set_suspend(struct drm_i915_private *i915, int
 state)  {
-	struct intel_fbdev *ifbdev = i915->fbdev;
+	struct intel_fbdev *ifbdev = i915->display.fbdev.fbdev;
 	bool send_hpd = false;
 
drivers/gpu/drm/i915/display/intel_fbdev.c +0 -0
 	mutex_lock(&ifbdev->hpd_lock);
@@ -614,7 +614,7 @@ static void intel_fbdev_hpd_set_suspend(struct

drm_i915_private *i915, int state void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) {

drivers/gpu/drm/i915/display/intel_fbdev.c +2 -2
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct intel_fbdev *ifbdev = dev_priv->fbdev;
+	struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
 	struct fb_info *info;
 
 	if (!ifbdev || !ifbdev->vma)
@@ -631,7 +631,7 @@ void intel_fbdev_set_suspend(struct drm_device
 *dev, int state, bool synchronous
 		 * ourselves, so only flush outstanding work upon suspend!
 		 */
 		if (state != FBINFO_STATE_RUNNING)
-			flush_work(&dev_priv->fbdev_suspend_work);
+			flush_work(&dev_priv-
 >display.fbdev.suspend_work);
 
drivers/gpu/drm/i915/display/intel_fbdev.c +1 -1
 		console_lock();
 	} else {
@@ -645,7 +645,7 @@ void intel_fbdev_set_suspend(struct drm_device
 *dev, int state, bool synchronous
 			/* Don't block our own workqueue as this can
 			 * be run in parallel with other i915.ko tasks.
 			 */
-			schedule_work(&dev_priv->fbdev_suspend_work);
+			schedule_work(&dev_priv-
 >display.fbdev.suspend_work);
 			return;
drivers/gpu/drm/i915/display/intel_fbdev.c +2 -2
 		}
 	}
@@ -666,7 +666,7 @@ void intel_fbdev_set_suspend(struct drm_device
 *dev, int state, bool synchronous
 
 void intel_fbdev_output_poll_changed(struct drm_device *dev)  {
-	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
 	bool send_hpd;
 
 	if (!ifbdev)
@@ -685,7 +685,7 @@ void intel_fbdev_output_poll_changed(struct
 drm_device *dev)
 
 void intel_fbdev_restore_mode(struct drm_device *dev)  {
-	struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;
+	struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
 
 	if (!ifbdev)
 		return;
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index 482a8c0d5a10..f1e47090c01e 100644

drivers/gpu/drm/i915/i915_drv.h +0 -0
@@ -82,7 +82,6 @@ struct intel_cdclk_vals;  struct intel_connector;  struct

intel_dp; struct intel_encoder; -struct intel_fbdev; struct intel_limit; struct intel_overlay; struct intel_overlay_error_state; @@ -474,10 +473,6 @@ struct drm_i915_private {

drivers/gpu/drm/i915/i915_drv.h +0 -5
 	struct i915_gpu_error gpu_error;
 
-	/* list of fbdev register on this device */
-	struct intel_fbdev *fbdev;
-	struct work_struct fbdev_suspend_work;
-
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
 
--

2.34.1

Reviewed-by on v1 15/39
#69 lore raw

Re: [Intel-gfx] [PATCH 15/39] drm/i915: move wm to display.wm

In reply to Jani Nikula
Quoted 9 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 15/39] drm/i915: move wm to display.wm

Quoted 6 lines

Move display related members under drm_i915_private display sub-struct.

It's a bit arbitrary when to define a named struct for grouping, but clearly intel_wm is big enough to warrant a separate definition.

Thanks and Regards
Arun R Murthy
--------------------

Quoted 771 lines
---
 .../gpu/drm/i915/display/intel_display_core.h |  38 ++++
.../drm/i915/display/intel_display_debugfs.c  |  24 +--
 drivers/gpu/drm/i915/i915_driver.c            |   2 +-
 drivers/gpu/drm/i915/i915_drv.h               |  37 ----
 drivers/gpu/drm/i915/intel_pm.c               | 166 +++++++++---------
 5 files changed, 134 insertions(+), 133 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +38 -0
index 71434a922695..c2a79e487ee9 100644
@@ -15,6 +15,7 @@
 #include "intel_dmc.h"
 #include "intel_dpll_mgr.h"
 #include "intel_gmbus.h"
+#include "intel_pm_types.h"
 
 struct drm_i915_private;
 struct i915_audio_component;
@@ -100,6 +101,42 @@ struct intel_dpll {
 	} ref_clks;
 };
 
+struct intel_wm {
+	/*
+	 * Raw watermark latency values:
+	 * in 0.1us units for WM0,
+	 * in 0.5us units for WM1+.
+	 */
+	/* primary */
+	u16 pri_latency[5];
+	/* sprite */
+	u16 spr_latency[5];
+	/* cursor */
+	u16 cur_latency[5];
+	/*
+	 * Raw watermark memory latency values
+	 * for SKL for all 8 levels
+	 * in 1us units.
+	 */
+	u16 skl_latency[8];
+
+	/* current hardware state */
+	union {
+		struct ilk_wm_values hw;
+		struct vlv_wm_values vlv;
+		struct g4x_wm_values g4x;
+	};
+
+	u8 max_level;
+
+	/*
+	 * Should be held around atomic WM register writing; also
+	 * protects * intel_crtc->wm.active and
+	 * crtc_state->wm.need_postvbl_update.
+	 */
+	struct mutex wm_mutex;
+};
+
 struct intel_display {
 	/* Display functions */
 	struct {
@@ -167,6 +204,7 @@ struct intel_display {
 	struct intel_audio audio;
 	struct intel_dmc dmc;
 	struct intel_dpll dpll;
+	struct intel_wm wm;
 };
 
 #endif /* __INTEL_DISPLAY_CORE_H__ */
drivers/gpu/drm/i915/display/intel_display_debugfs.c +8 -8
index e568590faa82..395facf6c1aa 100644
@@ -1428,9 +1428,9 @@ static int pri_wm_latency_show(struct seq_file *m,
 void *data)
 	const u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.pri_latency;
+		latencies = dev_priv->display.wm.pri_latency;
 
 	wm_latency_show(m, latencies);
@@ -1443,9 +1443,9 @@ static int spr_wm_latency_show(struct seq_file
 *m, void *data)
 	const u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.spr_latency;
+		latencies = dev_priv->display.wm.spr_latency;
 
 	wm_latency_show(m, latencies);
@@ -1458,9 +1458,9 @@ static int cur_wm_latency_show(struct seq_file
 *m, void *data)
 	const u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.cur_latency;
+		latencies = dev_priv->display.wm.cur_latency;
 
 	wm_latency_show(m, latencies);
@@ -1551,9 +1551,9 @@ static ssize_t pri_wm_latency_write(struct file *file,
 const char __user *ubuf,
 	u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.pri_latency;
+		latencies = dev_priv->display.wm.pri_latency;
 
 	return wm_latency_write(file, ubuf, len, offp, latencies);  } @@ -

1566,9 +1566,9 @@ static ssize_t spr_wm_latency_write(struct file *file, const char __user *ubuf,

drivers/gpu/drm/i915/display/intel_display_debugfs.c +2 -2
 	u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.spr_latency;
+		latencies = dev_priv->display.wm.spr_latency;
 
 	return wm_latency_write(file, ubuf, len, offp, latencies);  } @@ -

1581,9 +1581,9 @@ static ssize_t cur_wm_latency_write(struct file *file, const char __user *ubuf,

drivers/gpu/drm/i915/display/intel_display_debugfs.c +2 -2
 	u16 *latencies;
 
 	if (DISPLAY_VER(dev_priv) >= 9)
-		latencies = dev_priv->wm.skl_latency;
+		latencies = dev_priv->display.wm.skl_latency;
 	else
-		latencies = dev_priv->wm.cur_latency;
+		latencies = dev_priv->display.wm.cur_latency;
 
 	return wm_latency_write(file, ubuf, len, offp, latencies);  } diff --git

a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c index 0d3993e51138..f6841c1e5f0f 100644

drivers/gpu/drm/i915/i915_driver.c +1 -1
@@ -336,7 +336,7 @@ static int i915_driver_early_probe(struct
 drm_i915_private *dev_priv)
 	cpu_latency_qos_add_request(&dev_priv->sb_qos,
 PM_QOS_DEFAULT_VALUE);
 
 	mutex_init(&dev_priv->display.audio.mutex);
-	mutex_init(&dev_priv->wm.wm_mutex);
+	mutex_init(&dev_priv->display.wm.wm_mutex);
 	mutex_init(&dev_priv->display.pps.mutex);
drivers/gpu/drm/i915/i915_driver.c +0 -0
 	mutex_init(&dev_priv->hdcp_comp_mutex);
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index f1e47090c01e..9ee08e80f0aa 100644

drivers/gpu/drm/i915/i915_drv.h +0 -37
@@ -68,7 +68,6 @@
 #include "intel_device_info.h"
 #include "intel_memory_region.h"
 #include "intel_pch.h"
-#include "intel_pm_types.h"
 #include "intel_runtime_pm.h"
 #include "intel_step.h"
 #include "intel_uncore.h"
@@ -501,42 +500,6 @@ struct drm_i915_private {
 
 	u32 sagv_block_time_us;
 
-	struct {
-		/*
-		 * Raw watermark latency values:
-		 * in 0.1us units for WM0,
-		 * in 0.5us units for WM1+.
-		 */
-		/* primary */
-		u16 pri_latency[5];
-		/* sprite */
-		u16 spr_latency[5];
-		/* cursor */
-		u16 cur_latency[5];
-		/*
-		 * Raw watermark memory latency values
-		 * for SKL for all 8 levels
-		 * in 1us units.
-		 */
-		u16 skl_latency[8];
-
-		/* current hardware state */
-		union {
-			struct ilk_wm_values hw;
-			struct vlv_wm_values vlv;
-			struct g4x_wm_values g4x;
-		};
-
-		u8 max_level;
-
-		/*
-		 * Should be held around atomic WM register writing; also
-		 * protects * intel_crtc->wm.active and
-		 * crtc_state->wm.need_postvbl_update.
-		 */
-		struct mutex wm_mutex;
-	} wm;
-
 	struct dram_info {
 		bool wm_lv_0_adjust_needed;
 		u8 num_channels;
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_pm.c index 5febe91e44a0..14134e57034e 100644

drivers/gpu/drm/i915/intel_pm.c +5 -5
@@ -468,13 +468,13 @@ bool intel_set_memory_cxsr(struct
 drm_i915_private *dev_priv, bool enable)  {
 	bool ret;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	ret = _intel_set_memory_cxsr(dev_priv, enable);
 	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-		dev_priv->wm.vlv.cxsr = enable;
+		dev_priv->display.wm.vlv.cxsr = enable;
 	else if (IS_G4X(dev_priv))
-		dev_priv->wm.g4x.cxsr = enable;
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+		dev_priv->display.wm.g4x.cxsr = enable;
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 
 	return ret;
 }
@@ -834,7 +834,7 @@ static bool is_enabling(int old, int new, int threshold)
 
 static int intel_wm_num_levels(struct drm_i915_private *dev_priv)  {
-	return dev_priv->wm.max_level + 1;
+	return dev_priv->display.wm.max_level + 1;
 }
 
 static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
@@ -1093,11 +1093,11 @@ static void vlv_write_wm_values(struct

drm_i915_private *dev_priv, static void g4x_setup_wm_latency(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_pm.c +5 -4
 	/* all latencies in usec */
-	dev_priv->wm.pri_latency[G4X_WM_LEVEL_NORMAL] = 5;
-	dev_priv->wm.pri_latency[G4X_WM_LEVEL_SR] = 12;
-	dev_priv->wm.pri_latency[G4X_WM_LEVEL_HPLL] = 35;
+	dev_priv->display.wm.pri_latency[G4X_WM_LEVEL_NORMAL] = 5;
+	dev_priv->display.wm.pri_latency[G4X_WM_LEVEL_SR] = 12;
+	dev_priv->display.wm.pri_latency[G4X_WM_LEVEL_HPLL] = 35;
 
-	dev_priv->wm.max_level = G4X_WM_LEVEL_HPLL;
+	dev_priv->display.wm.max_level = G4X_WM_LEVEL_HPLL;
 }
 
 static int g4x_plane_fifo_size(enum plane_id plane_id, int level) @@ -1150,7
+1150,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state

*crtc_state,

drivers/gpu/drm/i915/intel_pm.c +2 -2
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	const struct drm_display_mode *pipe_mode =
 		&crtc_state->hw.pipe_mode;
-	unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
+	unsigned int latency = dev_priv->display.wm.pri_latency[level] * 10;
 	unsigned int pixel_rate, htotal, cpp, width, wm;
 
 	if (latency == 0)
@@ -1324,7 +1324,7 @@ static bool g4x_raw_crtc_wm_is_valid(const struct
 intel_crtc_state *crtc_state,  {
 	struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc-
 >dev);
 
-	if (level > dev_priv->wm.max_level)
+	if (level > dev_priv->display.wm.max_level)
 		return false;
 

return g4x_raw_plane_wm_is_valid(crtc_state, PLANE_PRIMARY,
level) && @@ -1583,7 +1583,7 @@ static void g4x_merge_wm(struct drm_i915_private *dev_priv,

static void g4x_program_watermarks(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_pm.c +3 -3
-	struct g4x_wm_values *old_wm = &dev_priv->wm.g4x;
+	struct g4x_wm_values *old_wm = &dev_priv->display.wm.g4x;
 	struct g4x_wm_values new_wm = {};
 
 	g4x_merge_wm(dev_priv, &new_wm);
@@ -1609,10 +1609,10 @@ static void g4x_initial_watermarks(struct
 intel_atomic_state *state,
 	const struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.g4x = crtc_state->wm.g4x.intermediate;
 	g4x_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 

static void g4x_optimize_watermarks(struct intel_atomic_state *state, @@ -
1625,10 +1625,10 @@ static void g4x_optimize_watermarks(struct intel_atomic_state *state,

drivers/gpu/drm/i915/intel_pm.c +2 -2
 	if (!crtc_state->wm.need_postvbl_update)
 		return;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.g4x = crtc_state->wm.g4x.optimal;
 	g4x_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 
 /* latency must be in 0.1us units. */
@@ -1650,15 +1650,15 @@ static unsigned int vlv_wm_method2(unsigned

int pixel_rate, static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_pm.c +3 -4
 	/* all latencies in usec */
-	dev_priv->wm.pri_latency[VLV_WM_LEVEL_PM2] = 3;
+	dev_priv->display.wm.pri_latency[VLV_WM_LEVEL_PM2] = 3;
 
-	dev_priv->wm.max_level = VLV_WM_LEVEL_PM2;
+	dev_priv->display.wm.max_level = VLV_WM_LEVEL_PM2;
 
 	if (IS_CHERRYVIEW(dev_priv)) {
-		dev_priv->wm.pri_latency[VLV_WM_LEVEL_PM5] = 12;
-		dev_priv->wm.pri_latency[VLV_WM_LEVEL_DDR_DVFS] = 33;
+		dev_priv->display.wm.pri_latency[VLV_WM_LEVEL_PM5] =

12;

drivers/gpu/drm/i915/intel_pm.c +1 -0
+		dev_priv-
Quoted 1 line

display.wm.pri_latency[VLV_WM_LEVEL_DDR_DVFS] = 33;

drivers/gpu/drm/i915/intel_pm.c +1 -1
-		dev_priv->wm.max_level = VLV_WM_LEVEL_DDR_DVFS;
+		dev_priv->display.wm.max_level =

VLV_WM_LEVEL_DDR_DVFS;

drivers/gpu/drm/i915/intel_pm.c +1 -1
 	}
 }
@@ -1672,7 +1672,7 @@ static u16 vlv_compute_wm_level(const struct
 intel_crtc_state *crtc_state,
 		&crtc_state->hw.pipe_mode;
 	unsigned int pixel_rate, htotal, cpp, width, wm;
 
-	if (dev_priv->wm.pri_latency[level] == 0)
+	if (dev_priv->display.wm.pri_latency[level] == 0)
 		return USHRT_MAX;
 

if (!intel_wm_plane_visible(crtc_state, plane_state)) @@ -1693,7
+1693,7 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/intel_pm.c +1 -1
 		wm = 63;
 	} else {
 		wm = vlv_wm_method2(pixel_rate, htotal, width, cpp,
-				    dev_priv->wm.pri_latency[level] * 10);
+				    dev_priv->display.wm.pri_latency[level] *

10);

drivers/gpu/drm/i915/intel_pm.c +0 -0
 	}
 
 	return min_t(unsigned int, wm, USHRT_MAX); @@ -2158,7 +2158,7

@@ static void vlv_merge_wm(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_pm.c +1 -1
 	struct intel_crtc *crtc;
 	int num_active_pipes = 0;
 
-	wm->level = dev_priv->wm.max_level;
+	wm->level = dev_priv->display.wm.max_level;
 	wm->cxsr = true;
 
 	for_each_intel_crtc(&dev_priv->drm, crtc) { @@ -2197,7 +2197,7

@@ static void vlv_merge_wm(struct drm_i915_private *dev_priv,

static void vlv_program_watermarks(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/intel_pm.c +3 -3
-	struct vlv_wm_values *old_wm = &dev_priv->wm.vlv;
+	struct vlv_wm_values *old_wm = &dev_priv->display.wm.vlv;
 	struct vlv_wm_values new_wm = {};
 
 	vlv_merge_wm(dev_priv, &new_wm);
@@ -2235,10 +2235,10 @@ static void vlv_initial_watermarks(struct
 intel_atomic_state *state,
 	const struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.vlv = crtc_state->wm.vlv.intermediate;
 	vlv_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 

static void vlv_optimize_watermarks(struct intel_atomic_state *state, @@ -
2251,10 +2251,10 @@ static void vlv_optimize_watermarks(struct intel_atomic_state *state,

drivers/gpu/drm/i915/intel_pm.c +2 -2
 	if (!crtc_state->wm.need_postvbl_update)
 		return;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.vlv = crtc_state->wm.vlv.optimal;
 	vlv_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 
 static void i965_update_wm(struct drm_i915_private *dev_priv) @@ -

2835,9 +2835,9 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_pm.c +7 -6
 				 const struct intel_plane_state *curstate,
 				 struct intel_wm_level *result)
 {
-	u16 pri_latency = dev_priv->wm.pri_latency[level];
-	u16 spr_latency = dev_priv->wm.spr_latency[level];
-	u16 cur_latency = dev_priv->wm.cur_latency[level];
+	u16 pri_latency = dev_priv->display.wm.pri_latency[level];
+	u16 spr_latency = dev_priv->display.wm.spr_latency[level];
+	u16 cur_latency = dev_priv->display.wm.cur_latency[level];
 
 	/* WM1+ latency values stored in 0.5us units */
 	if (level > 0) {
@@ -3061,18 +3061,18 @@ static void snb_wm_latency_quirk(struct
 drm_i915_private *dev_priv)
 	 * The BIOS provided WM memory latency values are often
 	 * inadequate for high resolution displays. Adjust them.
 	 */
-	changed = ilk_increase_wm_latency(dev_priv, dev_priv-
 >wm.pri_latency, 12);
-	changed |= ilk_increase_wm_latency(dev_priv, dev_priv-
 >wm.spr_latency, 12);
-	changed |= ilk_increase_wm_latency(dev_priv, dev_priv-
 >wm.cur_latency, 12);
+	changed = ilk_increase_wm_latency(dev_priv, dev_priv-
 >display.wm.pri_latency, 12);
+	changed |= ilk_increase_wm_latency(dev_priv, dev_priv-
 >display.wm.spr_latency, 12);
+	changed |= ilk_increase_wm_latency(dev_priv,
+dev_priv->display.wm.cur_latency, 12);
 
 	if (!changed)
 		return;
 
 	drm_dbg_kms(&dev_priv->drm,
 		    "WM latency values increased to avoid potential

underruns\n");

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Cursor", dev_priv-
Quoted 1 line

wm.cur_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

display.wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

display.wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +2 -0
+	intel_print_wm_latency(dev_priv, "Cursor",
+dev_priv->display.wm.cur_latency);
 }
 
 static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv) @@ -

3088,37 +3088,37 @@ static void snb_wm_lp3_irq_quirk(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/intel_pm.c +6 -6
 	 * interrupts only. To play it safe we disable LP3
 	 * watermarks entirely.
 	 */
-	if (dev_priv->wm.pri_latency[3] == 0 &&
-	    dev_priv->wm.spr_latency[3] == 0 &&
-	    dev_priv->wm.cur_latency[3] == 0)
+	if (dev_priv->display.wm.pri_latency[3] == 0 &&
+	    dev_priv->display.wm.spr_latency[3] == 0 &&
+	    dev_priv->display.wm.cur_latency[3] == 0)
 		return;
 
-	dev_priv->wm.pri_latency[3] = 0;
-	dev_priv->wm.spr_latency[3] = 0;
-	dev_priv->wm.cur_latency[3] = 0;
+	dev_priv->display.wm.pri_latency[3] = 0;
+	dev_priv->display.wm.spr_latency[3] = 0;
+	dev_priv->display.wm.cur_latency[3] = 0;
 
 	drm_dbg_kms(&dev_priv->drm,
 		    "LP3 watermarks disabled due to potential for lost

interrupts\n");

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Cursor", dev_priv-
Quoted 1 line

wm.cur_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

display.wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

display.wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +4 -5
+	intel_print_wm_latency(dev_priv, "Cursor",
+dev_priv->display.wm.cur_latency);
 }
 
 static void ilk_setup_wm_latency(struct drm_i915_private *dev_priv)  {
-	intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency);
+	intel_read_wm_latency(dev_priv, dev_priv->display.wm.pri_latency);
 
-	memcpy(dev_priv->wm.spr_latency, dev_priv->wm.pri_latency,
-	       sizeof(dev_priv->wm.pri_latency));
-	memcpy(dev_priv->wm.cur_latency, dev_priv->wm.pri_latency,
-	       sizeof(dev_priv->wm.pri_latency));
+	memcpy(dev_priv->display.wm.spr_latency, dev_priv-
Quoted 1 line

display.wm.pri_latency,

drivers/gpu/drm/i915/intel_pm.c +2 -0
+	       sizeof(dev_priv->display.wm.pri_latency));
+	memcpy(dev_priv->display.wm.cur_latency, dev_priv-
Quoted 1 line

display.wm.pri_latency,

drivers/gpu/drm/i915/intel_pm.c +2 -2
+	       sizeof(dev_priv->display.wm.pri_latency));
 
-	intel_fixup_spr_wm_latency(dev_priv, dev_priv->wm.spr_latency);
-	intel_fixup_cur_wm_latency(dev_priv, dev_priv->wm.cur_latency);
+	intel_fixup_spr_wm_latency(dev_priv, dev_priv-
Quoted 1 line

display.wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +2 -1
+	intel_fixup_cur_wm_latency(dev_priv,
+dev_priv->display.wm.cur_latency);
 
-	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +0 -1
-	intel_print_wm_latency(dev_priv, "Cursor", dev_priv-
Quoted 1 line

wm.cur_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Primary", dev_priv-
Quoted 1 line

display.wm.pri_latency);

drivers/gpu/drm/i915/intel_pm.c +1 -0
+	intel_print_wm_latency(dev_priv, "Sprite", dev_priv-
Quoted 1 line

display.wm.spr_latency);

drivers/gpu/drm/i915/intel_pm.c +6 -3
+	intel_print_wm_latency(dev_priv, "Cursor",
+dev_priv->display.wm.cur_latency);
 
 	if (DISPLAY_VER(dev_priv) == 6) {
 		snb_wm_latency_quirk(dev_priv);
@@ -3128,8 +3128,8 @@ static void ilk_setup_wm_latency(struct
 drm_i915_private *dev_priv)
 
 static void skl_setup_wm_latency(struct drm_i915_private *dev_priv)  {
-	intel_read_wm_latency(dev_priv, dev_priv->wm.skl_latency);
-	intel_print_wm_latency(dev_priv, "Gen9 Plane", dev_priv-
 >wm.skl_latency);
+	intel_read_wm_latency(dev_priv, dev_priv->display.wm.skl_latency);
+	intel_print_wm_latency(dev_priv, "Gen9 Plane",
+dev_priv->display.wm.skl_latency);
 }
 
 static bool ilk_validate_pipe_wm(const struct drm_i915_private *dev_priv,
@@ -3386,7 +3386,7 @@ static unsigned int ilk_wm_lp_latency(struct
 drm_i915_private *dev_priv,
 	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
 		return 2 * level;
 	else
-		return dev_priv->wm.pri_latency[level];
+		return dev_priv->display.wm.pri_latency[level];
 }
 

static void ilk_compute_wm_results(struct drm_i915_private *dev_priv, @@
-3538,7 +3538,7 @@ static unsigned int ilk_compute_wm_dirty(struct drm_i915_private *dev_priv, static bool _ilk_disable_lp_wm(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_pm.c +1 -1
 			       unsigned int dirty)
 {
-	struct ilk_wm_values *previous = &dev_priv->wm.hw;
+	struct ilk_wm_values *previous = &dev_priv->display.wm.hw;
 	bool changed = false;
 
 	if (dirty & WM_DIRTY_LP(3) && previous->wm_lp[2] &

WM_LP_ENABLE) { @@ -3572,7 +3572,7 @@ static bool _ilk_disable_lp_wm(struct drm_i915_private *dev_priv, static void ilk_write_wm_values(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_pm.c +2 -2
 				struct ilk_wm_values *results)
 {
-	struct ilk_wm_values *previous = &dev_priv->wm.hw;
+	struct ilk_wm_values *previous = &dev_priv->display.wm.hw;
 	unsigned int dirty;
 	u32 val;
@@ -3634,7 +3634,7 @@ static void ilk_write_wm_values(struct
 drm_i915_private *dev_priv,
 	if (dirty & WM_DIRTY_LP(3) && previous->wm_lp[2] != results-
 >wm_lp[2])
 		intel_uncore_write(&dev_priv->uncore, WM3_LP_ILK,
 results->wm_lp[2]);
 
-	dev_priv->wm.hw = *results;
+	dev_priv->display.wm.hw = *results;

}

bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv) @@ -4321,7
+4321,7 @@ skl_cursor_allocation(const struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/intel_pm.c +1 -1
 	drm_WARN_ON(&dev_priv->drm, ret);
 
 	for (level = 0; level <= max_level; level++) {
-		unsigned int latency = dev_priv->wm.skl_latency[level];
+		unsigned int latency = dev_priv-
Quoted 1 line

display.wm.skl_latency[level];

skl_compute_plane_wm(crtc_state, plane, level, latency,
&wp, &wm, &wm);

drivers/gpu/drm/i915/intel_pm.c +1 -1
 		if (wm.min_ddb_alloc == U16_MAX)
@@ -5576,7 +5576,7 @@ skl_compute_wm_levels(const struct
 intel_crtc_state *crtc_state,
 
 	for (level = 0; level <= max_level; level++) {
 		struct skl_wm_level *result = &levels[level];
-		unsigned int latency = dev_priv->wm.skl_latency[level];
+		unsigned int latency = dev_priv-
 >display.wm.skl_latency[level];
 
drivers/gpu/drm/i915/intel_pm.c +0 -0
 		skl_compute_plane_wm(crtc_state, plane, level, latency,
 				     wm_params, result_prev, result); @@ -

5596,7 +5596,7 @@ static void tgl_compute_sagv_wm(const struct intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/intel_pm.c +0 -1
 	unsigned int latency = 0;
 
 	if (dev_priv->sagv_block_time_us)
-		latency = dev_priv->sagv_block_time_us + dev_priv-
Quoted 1 line

wm.skl_latency[0];

drivers/gpu/drm/i915/intel_pm.c +4 -2
+		latency = dev_priv->sagv_block_time_us +
+dev_priv->display.wm.skl_latency[0];
 
 	skl_compute_plane_wm(crtc_state, plane, 0, latency,
 			     wm_params, &levels[0],
@@ -6458,10 +6458,10 @@ static void ilk_initial_watermarks(struct
 intel_atomic_state *state,
 	const struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.ilk = crtc_state->wm.ilk.intermediate;
 	ilk_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 

static void ilk_optimize_watermarks(struct intel_atomic_state *state, @@ -
6474,10 +6474,10 @@ static void ilk_optimize_watermarks(struct intel_atomic_state *state,

drivers/gpu/drm/i915/intel_pm.c +3 -3
 	if (!crtc_state->wm.need_postvbl_update)
 		return;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 	crtc->wm.active.ilk = crtc_state->wm.ilk.optimal;
 	ilk_program_watermarks(dev_priv);
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 
 static void skl_wm_level_from_reg_val(u32 val, struct skl_wm_level *level)
@@ -6677,7 +6677,7 @@ static void ilk_pipe_wm_get_hw_state(struct
 intel_crtc *crtc)  {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct ilk_wm_values *hw = &dev_priv->wm.hw;
+	struct ilk_wm_values *hw = &dev_priv->display.wm.hw;
 	struct intel_crtc_state *crtc_state = to_intel_crtc_state(crtc-
 >base.state);
 	struct intel_pipe_wm *active = &crtc_state->wm.ilk.optimal;
drivers/gpu/drm/i915/intel_pm.c +2 -2
 	enum pipe pipe = crtc->pipe;
@@ -6825,7 +6825,7 @@ static void vlv_read_wm_values(struct
 drm_i915_private *dev_priv,
 
 void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv)  {
-	struct g4x_wm_values *wm = &dev_priv->wm.g4x;
+	struct g4x_wm_values *wm = &dev_priv->display.wm.g4x;
 	struct intel_crtc *crtc;
 
 	g4x_read_wm_values(dev_priv, wm);
@@ -6919,7 +6919,7 @@ void g4x_wm_sanitize(struct drm_i915_private
 *dev_priv)
 	struct intel_plane *plane;
 	struct intel_crtc *crtc;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 
 	for_each_intel_plane(&dev_priv->drm, plane) {
drivers/gpu/drm/i915/intel_pm.c +3 -3
 		struct intel_crtc *crtc =
@@ -6967,12 +6967,12 @@ void g4x_wm_sanitize(struct drm_i915_private
 *dev_priv)
 
 	g4x_program_watermarks(dev_priv);
 
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 
 void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv)  {
-	struct vlv_wm_values *wm = &dev_priv->wm.vlv;
+	struct vlv_wm_values *wm = &dev_priv->display.wm.vlv;
 	struct intel_crtc *crtc;
 	u32 val;
 
@@ -7006,7 +7006,7 @@ void vlv_wm_get_hw_state(struct
 drm_i915_private *dev_priv)
 			drm_dbg_kms(&dev_priv->drm,
 				    "Punit not acking DDR DVFS request, "
 				    "assuming DDR DVFS is disabled\n");
-			dev_priv->wm.max_level = VLV_WM_LEVEL_PM5;
+			dev_priv->display.wm.max_level =
 VLV_WM_LEVEL_PM5;
 		} else {

val = vlv_punit_read(dev_priv,
PUNIT_REG_DDR_SETUP2);

drivers/gpu/drm/i915/intel_pm.c +3 -2
 			if ((val & FORCE_DDR_HIGH_FREQ) == 0) @@ -7075,7
+7075,7 @@ void vlv_wm_sanitize(struct drm_i915_private *dev_priv)
 	struct intel_plane *plane;
 	struct intel_crtc *crtc;
 
-	mutex_lock(&dev_priv->wm.wm_mutex);
+	mutex_lock(&dev_priv->display.wm.wm_mutex);
 
 	for_each_intel_plane(&dev_priv->drm, plane) {
 		struct intel_crtc *crtc =
@@ -7116,7 +7116,7 @@ void vlv_wm_sanitize(struct drm_i915_private
 *dev_priv)
 
 	vlv_program_watermarks(dev_priv);
 
-	mutex_unlock(&dev_priv->wm.wm_mutex);
+	mutex_unlock(&dev_priv->display.wm.wm_mutex);
 }
 

/*

drivers/gpu/drm/i915/intel_pm.c +1 -2
@@ -7137,7 +7137,7 @@ static void ilk_init_lp_watermarks(struct
 drm_i915_private *dev_priv)
 
 void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv)  {
-	struct ilk_wm_values *hw = &dev_priv->wm.hw;
+	struct ilk_wm_values *hw = &dev_priv->display.wm.hw;
 	struct intel_crtc *crtc;
 
 	ilk_init_lp_watermarks(dev_priv);
@@ -8231,10 +8231,10 @@ void intel_init_pm(struct drm_i915_private
 *dev_priv)
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		ilk_setup_wm_latency(dev_priv);
 
-		if ((DISPLAY_VER(dev_priv) == 5 && dev_priv-
Quoted 1 line

wm.pri_latency[1] &&

drivers/gpu/drm/i915/intel_pm.c +0 -1
-		     dev_priv->wm.spr_latency[1] && dev_priv-
Quoted 1 line

wm.cur_latency[1]) ||

drivers/gpu/drm/i915/intel_pm.c +0 -1
-		    (DISPLAY_VER(dev_priv) != 5 && dev_priv-
Quoted 1 line

wm.pri_latency[0] &&

drivers/gpu/drm/i915/intel_pm.c +0 -1
-		     dev_priv->wm.spr_latency[0] && dev_priv-
Quoted 1 line

wm.cur_latency[0])) {

drivers/gpu/drm/i915/intel_pm.c +1 -0
+		if ((DISPLAY_VER(dev_priv) == 5 && dev_priv-
Quoted 1 line

display.wm.pri_latency[1] &&

drivers/gpu/drm/i915/intel_pm.c +1 -0
+		     dev_priv->display.wm.spr_latency[1] && dev_priv-
Quoted 1 line

display.wm.cur_latency[1]) ||

drivers/gpu/drm/i915/intel_pm.c +1 -0
+		    (DISPLAY_VER(dev_priv) != 5 && dev_priv-
Quoted 1 line

display.wm.pri_latency[0] &&

drivers/gpu/drm/i915/intel_pm.c +2 -1
+		     dev_priv->display.wm.spr_latency[0] &&
+dev_priv->display.wm.cur_latency[0])) {
 			dev_priv->display.funcs.wm = &ilk_wm_funcs;
 		} else {
 			drm_dbg_kms(&dev_priv->drm,
--

2.34.1

Reviewed-by on v1 16/39
#71 lore raw

Re: [Intel-gfx] [PATCH 16/39] drm/i915: move and group hdcp under display.hdcp

In reply to Jani Nikula
Quoted 11 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 16/39] drm/i915: move and group hdcp under display.hdcp

Move display related members under drm_i915_private display sub-struct.

I hope the previous comments as to update of the patch description will be taken care!

Quoted 3 lines

---

With the above said updates included

Thanks and Regards,
Arun R Murthy
--------------------

Quoted 463 lines
 .../gpu/drm/i915/display/intel_display_core.h |   9 ++
 drivers/gpu/drm/i915/display/intel_hdcp.c     | 134 +++++++++---------
 drivers/gpu/drm/i915/i915_driver.c            |   2 +-
 drivers/gpu/drm/i915/i915_drv.h               |   6 -
 4 files changed, 77 insertions(+), 74 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +6 -0
index c2a79e487ee9..8ac63352b27b 100644
@@ -19,6 +19,7 @@
 
 struct drm_i915_private;
 struct i915_audio_component;
+struct i915_hdcp_comp_master;
 struct intel_atomic_state;
 struct intel_audio_funcs;
 struct intel_cdclk_funcs;
@@ -193,6 +194,14 @@ struct intel_display {
 		wait_queue_head_t wait_queue;
 	} gmbus;
 
+	struct {
+		struct i915_hdcp_comp_master *master;
+		bool comp_added;
+
+		/* Mutex to protect the above hdcp component related

values. */

drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
+		struct mutex comp_mutex;
+	} hdcp;
+
 	struct {
 		u32 mmio_base;
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
index c5e9e86bb4cb..6f04dd69087e 100644
@@ -188,12 +188,12 @@ bool intel_hdcp2_capable(struct intel_connector
 *connector)
 		return false;
 
 	/* MEI interface is solid */
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	if (!dev_priv->hdcp_comp_added ||  !dev_priv->hdcp_master) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	if (!dev_priv->display.hdcp.comp_added ||  !dev_priv-
 >display.hdcp.master) {
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return false;
 	}
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +5 -4
 	/* Sink's capability for HDCP2.2 */
 	hdcp->shim->hdcp_2_2_capable(dig_port, &capable); @@ -1124,11
+1124,11 @@ hdcp2_prepare_ake_init(struct intel_connector *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1136,7 +1136,7 @@ hdcp2_prepare_ake_init(struct intel_connector
 *connector,
 	if (ret)
 		drm_dbg_kms(&dev_priv->drm, "Prepare_ake_init failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1154,11 +1154,11 @@ hdcp2_verify_rx_cert_prepare_km(struct
 intel_connector *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1168,7 +1168,7 @@ hdcp2_verify_rx_cert_prepare_km(struct
 intel_connector *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Verify rx_cert failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1182,18 +1182,18 @@ static int hdcp2_verify_hprime(struct
 intel_connector *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
 
 	ret = comp->ops->verify_hprime(comp->mei_dev, data, rx_hprime);
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Verify hprime failed.
 %d\n", ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1208,11 +1208,11 @@ hdcp2_store_pairing_info(struct intel_connector
 *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1220,7 +1220,7 @@ hdcp2_store_pairing_info(struct intel_connector
 *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Store pairing info failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1235,11 +1235,11 @@ hdcp2_prepare_lc_init(struct intel_connector
 *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1247,7 +1247,7 @@ hdcp2_prepare_lc_init(struct intel_connector
 *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Prepare lc_init failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1262,11 +1262,11 @@ hdcp2_verify_lprime(struct intel_connector
 *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1274,7 +1274,7 @@ hdcp2_verify_lprime(struct intel_connector
 *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Verify L_Prime failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1288,11 +1288,11 @@ static int hdcp2_prepare_skey(struct
 intel_connector *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1300,7 +1300,7 @@ static int hdcp2_prepare_skey(struct
 intel_connector *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Get session key failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1317,11 +1317,11 @@ hdcp2_verify_rep_topology_prepare_ack(struct
 intel_connector *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1331,7 +1331,7 @@ hdcp2_verify_rep_topology_prepare_ack(struct
 intel_connector *connector,
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm,
 			    "Verify rep topology failed. %d\n", ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
 	return ret;

}

drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
@@ -1346,18 +1346,18 @@ hdcp2_verify_mprime(struct intel_connector
 *connector,
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
 
 	ret = comp->ops->verify_mprime(comp->mei_dev, data,
 stream_ready);
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Verify mprime failed.
 %d\n", ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1370,11 +1370,11 @@ static int hdcp2_authenticate_port(struct
 intel_connector *connector)
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
@@ -1382,7 +1382,7 @@ static int hdcp2_authenticate_port(struct
 intel_connector *connector)
 	if (ret < 0)
 		drm_dbg_kms(&dev_priv->drm, "Enable hdcp auth failed.
 %d\n",
 			    ret);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
 	return ret;
 }
@@ -1394,17 +1394,17 @@ static int hdcp2_close_mei_session(struct
 intel_connector *connector)
 	struct i915_hdcp_comp_master *comp;
 	int ret;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	comp = dev_priv->hdcp_master;
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	comp = dev_priv->display.hdcp.master;
 
 	if (!comp || !comp->ops) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return -EINVAL;
 	}
 
 	ret = comp->ops->close_hdcp_session(comp->mei_dev,
 					     &dig_port->hdcp_port_data);
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
 	return ret;

}

drivers/gpu/drm/i915/display/intel_hdcp.c +4 -4
@@ -2122,10 +2122,10 @@ static int i915_hdcp_component_bind(struct
 device *i915_kdev,
 	struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
 
 	drm_dbg(&dev_priv->drm, "I915 HDCP comp bind\n");
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	dev_priv->hdcp_master = (struct i915_hdcp_comp_master *)data;
-	dev_priv->hdcp_master->mei_dev = mei_kdev;
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	dev_priv->display.hdcp.master = (struct i915_hdcp_comp_master
 *)data;
+	dev_priv->display.hdcp.master->mei_dev = mei_kdev;
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
drivers/gpu/drm/i915/display/intel_hdcp.c +3 -3
 	return 0;
 }
@@ -2136,9 +2136,9 @@ static void i915_hdcp_component_unbind(struct
 device *i915_kdev,
 	struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
 
 	drm_dbg(&dev_priv->drm, "I915 HDCP comp unbind\n");
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	dev_priv->hdcp_master = NULL;
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	dev_priv->display.hdcp.master = NULL;
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 }
 

static const struct component_ops i915_hdcp_component_ops = { @@ -
2229,19 +2229,19 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/display/intel_hdcp.c +2 -2
 	if (!is_hdcp2_supported(dev_priv))
 		return;
 
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	drm_WARN_ON(&dev_priv->drm, dev_priv->hdcp_comp_added);
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	drm_WARN_ON(&dev_priv->drm, dev_priv-
Quoted 1 line

display.hdcp.comp_added);

drivers/gpu/drm/i915/display/intel_hdcp.c +2 -2
-	dev_priv->hdcp_comp_added = true;
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	dev_priv->display.hdcp.comp_added = true;
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 	ret = component_add_typed(dev_priv->drm.dev,

&i915_hdcp_component_ops,

drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 				  I915_COMPONENT_HDCP);
 	if (ret < 0) {
 		drm_dbg_kms(&dev_priv->drm, "Failed at component

add(%d)\n",

drivers/gpu/drm/i915/display/intel_hdcp.c +8 -8
 			    ret);
-		mutex_lock(&dev_priv->hdcp_comp_mutex);
-		dev_priv->hdcp_comp_added = false;
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+		mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+		dev_priv->display.hdcp.comp_added = false;
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return;
 	}
 }
@@ -2454,14 +2454,14 @@ void intel_hdcp_update_pipe(struct
 intel_atomic_state *state,
 
 void intel_hdcp_component_fini(struct drm_i915_private *dev_priv)  {
-	mutex_lock(&dev_priv->hdcp_comp_mutex);
-	if (!dev_priv->hdcp_comp_added) {
-		mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
+	if (!dev_priv->display.hdcp.comp_added) {
+		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 		return;
 	}
 
-	dev_priv->hdcp_comp_added = false;
-	mutex_unlock(&dev_priv->hdcp_comp_mutex);
+	dev_priv->display.hdcp.comp_added = false;
+	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
 	component_del(dev_priv->drm.dev, &i915_hdcp_component_ops);
 } diff --git a/drivers/gpu/drm/i915/i915_driver.c

b/drivers/gpu/drm/i915/i915_driver.c
index f6841c1e5f0f..8841ec398b07 100644

drivers/gpu/drm/i915/i915_driver.c +1 -1
@@ -338,7 +338,7 @@ static int i915_driver_early_probe(struct
 drm_i915_private *dev_priv)
 	mutex_init(&dev_priv->display.audio.mutex);
 	mutex_init(&dev_priv->display.wm.wm_mutex);
 	mutex_init(&dev_priv->display.pps.mutex);
-	mutex_init(&dev_priv->hdcp_comp_mutex);
+	mutex_init(&dev_priv->display.hdcp.comp_mutex);
 
 	i915_memcpy_init_early(dev_priv);
drivers/gpu/drm/i915/i915_driver.c +0 -0
 	intel_runtime_pm_init_early(&dev_priv->runtime_pm);
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index 9ee08e80f0aa..a0af8190ed87 100644

drivers/gpu/drm/i915/i915_drv.h +0 -7
@@ -588,12 +588,6 @@ struct drm_i915_private {
 
 	struct i915_drm_clients clients;
 
-	struct i915_hdcp_comp_master *hdcp_master;
-	bool hdcp_comp_added;
-
-	/* Mutex to protect the above hdcp component related values. */
-	struct mutex hdcp_comp_mutex;
-
 	/* The TTM device structure. */
 	struct ttm_device bdev;
 
--

2.34.1

Reviewed-by on v1 18/39
#75 lore raw

Re: [Intel-gfx] [PATCH 18/39] drm/i915: move overlay to display.overlay

In reply to Jani Nikula
Quoted 10 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 18/39] drm/i915: move overlay to display.overlay

Move display related members under drm_i915_private display sub-struct.

Please update the patch description!

Quoted 3 lines

---

Upon adding the above said updates

Thanks and Regards,
Arun R Murthy
--------------------

Quoted 124 lines
 drivers/gpu/drm/i915/display/intel_display_core.h |  2 ++
 drivers/gpu/drm/i915/display/intel_overlay.c      | 12 ++++++------
 drivers/gpu/drm/i915/i915_drv.h                   |  4 ----
 drivers/gpu/drm/i915/i915_getparam.c              |  2 +-
 4 files changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index cf31ad0c9593..a5cd3a3d440e 100644
@@ -33,6 +33,7 @@ struct intel_fbdev;
 struct intel_fdi_funcs;
 struct intel_hotplug_funcs;
 struct intel_initial_plane_config;
+struct intel_overlay;
 
 struct intel_display_funcs {
 	/* Returns the active state of the crtc, and if the crtc is active, @@ -

253,6 +254,7 @@ struct intel_display {

drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
 	struct intel_dmc dmc;
 	struct intel_dpll dpll;
 	struct intel_hotplug hotplug;
+	struct intel_overlay *overlay;
 	struct intel_wm wm;
 };
drivers/gpu/drm/i915/display/intel_overlay.c +2 -2
index 79ed8bd04a07..6f26f7f91925 100644
@@ -487,7 +487,7 @@ static int intel_overlay_release_old_vid(struct
 intel_overlay *overlay)
 
 void intel_overlay_reset(struct drm_i915_private *dev_priv)  {
-	struct intel_overlay *overlay = dev_priv->overlay;
+	struct intel_overlay *overlay = dev_priv->display.overlay;
 
 	if (!overlay)
 		return;
@@ -1113,7 +1113,7 @@ int intel_overlay_put_image_ioctl(struct
 drm_device *dev, void *data,
 	struct drm_i915_gem_object *new_bo;
 	int ret;
 
-	overlay = dev_priv->overlay;
+	overlay = dev_priv->display.overlay;
 	if (!overlay) {
 		drm_dbg(&dev_priv->drm, "userspace bug: no overlay\n");
drivers/gpu/drm/i915/display/intel_overlay.c +1 -1
 		return -ENODEV;
@@ -1273,7 +1273,7 @@ int intel_overlay_attrs_ioctl(struct drm_device
 *dev, void *data,
 	struct intel_overlay *overlay;
 	int ret;
 
-	overlay = dev_priv->overlay;
+	overlay = dev_priv->display.overlay;
 	if (!overlay) {
 		drm_dbg(&dev_priv->drm, "userspace bug: no overlay\n");
drivers/gpu/drm/i915/display/intel_overlay.c +2 -2
 		return -ENODEV;
@@ -1416,7 +1416,7 @@ void intel_overlay_setup(struct drm_i915_private
 *dev_priv)
 	update_polyphase_filter(overlay->regs);
 	update_reg_attrs(overlay, overlay->regs);
 
-	dev_priv->overlay = overlay;
+	dev_priv->display.overlay = overlay;
 	drm_info(&dev_priv->drm, "Initialized overlay support.\n");
 	return;
@@ -1428,7 +1428,7 @@ void intel_overlay_cleanup(struct
 drm_i915_private *dev_priv)  {
 	struct intel_overlay *overlay;
 
-	overlay = fetch_and_zero(&dev_priv->overlay);
+	overlay = fetch_and_zero(&dev_priv->display.overlay);
 	if (!overlay)
 		return;
 
@@ -1457,7 +1457,7 @@ struct intel_overlay_error_state {  struct

intel_overlay_error_state * intel_overlay_capture_error_state(struct drm_i915_private *dev_priv) {

drivers/gpu/drm/i915/display/intel_overlay.c +1 -1
-	struct intel_overlay *overlay = dev_priv->overlay;
+	struct intel_overlay *overlay = dev_priv->display.overlay;
 	struct intel_overlay_error_state *error;
 
 	if (!overlay || !overlay->active)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h index ef67a5322c2d..3637ee4ca088 100644

drivers/gpu/drm/i915/i915_drv.h +0 -0
@@ -82,7 +82,6 @@ struct intel_connector;  struct intel_dp;  struct

intel_encoder; struct intel_limit; -struct intel_overlay; struct intel_overlay_error_state; struct vlv_s0ix_state;

drivers/gpu/drm/i915/i915_drv.h +0 -3
@@ -342,9 +341,6 @@ struct drm_i915_private {
 
 	bool preserve_bios_swizzle;
 
-	/* overlay */
-	struct intel_overlay *overlay;
-
 	/* backlight registers and fields in struct intel_panel */
 	struct mutex backlight_lock;
 
drivers/gpu/drm/i915/i915_getparam.c +1 -1
index 6fd15b39570c..342c8ca6414e 100644
@@ -36,7 +36,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void
 *data,
 		value = to_gt(i915)->ggtt->num_fences;
 		break;
 	case I915_PARAM_HAS_OVERLAY:
-		value = !!i915->overlay;
+		value = !!i915->display.overlay;
 		break;
 	case I915_PARAM_HAS_BSD:

value = !!intel_engine_lookup_user(i915,
--
2.34.1

#65 lore raw

Re: [Intel-gfx] [PATCH 13/39] drm/i915: move dpll under display.dpll

In reply to Lucas De Marchi
Quoted 12 lines · Lucas De Marchi
Quoted 11 lines · Jani Nikula
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index 748d2a84e20e..f12ff36fef07 100644
@@ -12,6 +12,7 @@
 
 #include "intel_display.h"
 #include "intel_dmc.h"
+#include "intel_dpll_mgr.h"
 #include "intel_gmbus.h"
 
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_color_funcs; · line 28

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
 struct drm_i915_private;
@@ -24,6 +25,7 @@ struct intel_color_funcs;
 struct intel_crtc;
 struct intel_crtc_state;
 struct intel_dpll_funcs;
+struct intel_dpll_mgr;

if you include intel_dpll_mgr.h you don't need the fwd declaration?

Funny as it is, intel_dpll_mgr.h does not define or forward declare struct intel_dpll_mgr. :)

BR,
Jani.

Quoted 6 lines

Lucas De Marchi

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Reviewed-by
#43 lore raw

Re: [Intel-gfx] [PATCH 09/39] drm/i915: move and group gmbus members under display.gmbus

In reply to Jani Nikula
Quoted 111 lines

-----Original Message-----
From: Nikula, Jani <[email protected]>
Sent: Friday, August 12, 2022 12:26 PM
To: Murthy, Arun R <[email protected]>; intel- [email protected]
Cc: De Marchi, Lucas <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 09/39] drm/i915: move and group gmbus members under display.gmbus

Quoted 11 lines · Arun R
Quoted 11 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 09/39] drm/i915: move and group gmbus members under display.gmbus

Move display related members under drm_i915_private display sub-

struct.

Quoted 80 lines
Quoted 80 lines
---
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  6 +--
 .../gpu/drm/i915/display/intel_display_core.h | 23 ++++++++++
 drivers/gpu/drm/i915/display/intel_dp_aux.c   |  2 +-
 drivers/gpu/drm/i915/display/intel_gmbus.c    | 46 +++++++++----------
 drivers/gpu/drm/i915/i915_drv.h               | 16 -------
 drivers/gpu/drm/i915/i915_irq.c               |  4 +-
 drivers/gpu/drm/i915/i915_reg.h               | 14 +++---
 7 files changed, 59 insertions(+), 52 deletions(-)
drivers/gpu/drm/i915/display/intel_cdclk.c +2 -2
index 6095f5800a2e..ea40c75c2986 100644
@@ -2098,12 +2098,12 @@ static void intel_set_cdclk(struct
 drm_i915_private *dev_priv,
       * functions use cdclk. Not all platforms/ports do,
       * but we'll lock them all for simplicity.
       */
-     mutex_lock(&dev_priv->gmbus_mutex);
+     mutex_lock(&dev_priv->display.gmbus.mutex);
      for_each_intel_dp(&dev_priv->drm, encoder) {
              struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
              mutex_lock_nest_lock(&intel_dp->aux.hw_mutex,
-                                  &dev_priv->gmbus_mutex);
+                                  &dev_priv->display.gmbus.mutex);
      }
 
      intel_cdclk_set_cdclk(dev_priv, cdclk_config, pipe); @@ -2113,7

+2113,7 @@ static void intel_set_cdclk(struct drm_i915_private

drivers/gpu/drm/i915/display/intel_cdclk.c +2 -1
+*dev_priv,
 
              mutex_unlock(&intel_dp->aux.hw_mutex);
      }
-     mutex_unlock(&dev_priv->gmbus_mutex);
+     mutex_unlock(&dev_priv->display.gmbus.mutex);
 
      for_each_intel_encoder_with_psr(&dev_priv->drm, encoder) {
              struct intel_dp *intel_dp = enc_to_intel_dp(encoder);

diff -- git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h index 306584c038c9..fe19d4f9a9ab 100644

drivers/gpu/drm/i915/display/intel_display_core.h +9 -0
@@ -6,7 +6,11 @@
 #ifndef __INTEL_DISPLAY_CORE_H__
 #define __INTEL_DISPLAY_CORE_H__
 
+#include <linux/mutex.h>
 #include <linux/types.h>
+#include <linux/wait.h>
+
+#include "intel_gmbus.h"
 
 struct drm_i915_private;
 struct intel_atomic_state;
@@ -78,6 +82,25 @@ struct intel_display {
              /* Display internal color functions */
              const struct intel_color_funcs *color;
      } funcs;
+
+     /* Grouping using anonymous structs. Keep sorted. */
+     struct {
+             /*
+              * Base address of where the gmbus and gpio blocks are

located

drivers/gpu/drm/i915/display/intel_display_core.h +6 -0
+              * (either on PCH or on SoC for platforms without PCH).
+              */
+             u32 mmio_base;
+
+             /*
+              * gmbus.mutex protects against concurrent usage of the

single

drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
+              * hw gmbus controller on different i2c buses.
+              */
+             struct mutex mutex;
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display_core.h struct intel_display { · line 104

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_core.h +5 -0
+
+             struct intel_gmbus *bus[GMBUS_NUM_PINS];
+
+             wait_queue_head_t wait_queue;
+     } gmbus;
 };

Can this be moved to struct intel_dp?

Quoted 2 lines

Well, no. The data here is shared across all of them.

Then maybe we might need to think on this. I somehow feel having this under display wont look good. Since it's a low level bus communication, can be tagged under bus related to interface. I agree from your other comments that this is just a first step to cleanup i915 and there is scope to cleanup further.

Thanks and Regards,
Arun R Murthy
-------------------

#60 lore raw

Re: [Intel-gfx] [PATCH 12/39] drm/i915: move and split audio under display.audio and display.funcs

In reply to Murthy, Arun R
Quoted 26 lines · Arun R
Quoted 26 lines

-----Original Message-----
From: Nikula, Jani <[email protected]>
Sent: Friday, August 12, 2022 12:33 PM
To: Murthy, Arun R <[email protected]>; intel- [email protected]
Cc: De Marchi, Lucas <[email protected]>
Subject: RE: [Intel-gfx] [PATCH 12/39] drm/i915: move and split audio under display.audio and display.funcs

Quoted 11 lines · Arun R
Quoted 11 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Jani Nikula
Sent: Thursday, August 11, 2022 8:37 PM
To: [email protected]
Cc: Nikula, Jani <[email protected]>; De Marchi, Lucas <[email protected]>
Subject: [Intel-gfx] [PATCH 12/39] drm/i915: move and split audio under display.audio and display.funcs

Move display related members under drm_i915_private display sub-

struct.

Quoted 4 lines
Quoted 4 lines

Split audio funcs to display.funcs to follow the same pattern as all the other display functions.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Audio is a feature as such so wouldn't intel_audio struct stand parallel to

intel_display?

For i915, audio doesn't exist other than as a display feature. Display is a higher level split here, parallel to gt/gem.

Will leave it to you, since you have started this huger series containing the cleanup and understand you also have some more cleanup in queue. My small suggestion is not to mix audio with display and let this audi reside in i915_priv and let it leave in parallel similar to gt/gem.

No, I'm going to stick with this hierarchy. Audio is part of display here.

BR,
Jani.

Quoted 4 lines

Thanks and Regards,
Arun R Murthy
--------------------

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Reviewed-by on v1 12/39
#62 lore raw

Re: [Intel-gfx] [PATCH 12/39] drm/i915: move and split audio under display.audio and display.funcs

In reply to Jani Nikula
Quoted 6 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Split audio funcs to display.funcs to follow the same pattern as all the other display functions.

Lucas De Marchi

Reviewed-by on v1 37/39
#101 lore raw

Re: [Intel-gfx] [PATCH 37/39] drm/i915: move quirks under display sub-struct

In reply to Jani Nikula
Quoted 32 lines · Jani Nikula

Move display related members under drm_i915_private display sub-struct.

Prefer adding anonymous sub-structs even for single members that aren't our own structs.

---

drivers/gpu/drm/i915/display/intel_display_core.h | 4 ++++
drivers/gpu/drm/i915/display/intel_quirks.c       | 4 ++--
drivers/gpu/drm/i915/i915_drv.h                   | 1 -
3 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +4 -0
index da76b3eecbf5..252da61f2c6a 100644
@@ -367,6 +367,10 @@ struct intel_display {
 		struct mutex mutex;
 	} pps;
 
+	struct {
+		unsigned long mask;
+	} quirks;
+
 	struct {
 		enum {
 			I915_SAGV_UNKNOWN = 0,
drivers/gpu/drm/i915/display/intel_quirks.c +0 -0
index 22e0df9d9dba..e74ff042a9da 100644

drivers/gpu/drm/i915/display/intel_quirks.c line 14

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_quirks.c +1 -1
@@ -11,7 +11,7 @@
 
 static void intel_set_quirk(struct drm_i915_private *i915, enum intel_quirk_id quirk)
 {
-	i915->quirks |= BIT(quirk);
+	i915->display.quirks.mask |= BIT(quirk);

you started splitting gem from the display, so maybe this could be intel_display_set_quirk()? similar for other functions

anyway:

until this patch, except patch 5

Lucas De Marchi