Commit ad2d834f authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Extract intel_bw_update_hw_state()



Hoist the bw stuff into a separate function from
intel_modeset_readout_hw_state() so that the details
are better hidden inside intel_bw.c.

We can also skip the whole thing on pre-skl since the dbuf state
isn't actually used on those platforms.

Reviewed-by: default avatarVinod Govindapillai <vinod.govindapillai@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250306163420.3961-11-ville.syrjala@linux.intel.com
parent bd17fc4b
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -806,7 +806,7 @@ static int intel_bw_crtc_min_cdclk(const struct intel_crtc_state *crtc_state)
	return DIV_ROUND_UP_ULL(mul_u32_u32(intel_bw_crtc_data_rate(crtc_state), 10), 512);
}

void intel_bw_crtc_update(struct intel_bw_state *bw_state,
static void intel_bw_crtc_update(struct intel_bw_state *bw_state,
				 const struct intel_crtc_state *crtc_state)
{
	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1422,6 +1422,23 @@ int intel_bw_atomic_check(struct intel_atomic_state *state)
	return 0;
}

void intel_bw_update_hw_state(struct intel_display *display)
{
	struct intel_bw_state *bw_state =
		to_intel_bw_state(display->bw.obj.state);
	struct intel_crtc *crtc;

	if (DISPLAY_VER(display) < 9)
		return;

	for_each_intel_crtc(display->drm, crtc) {
		const struct intel_crtc_state *crtc_state =
			to_intel_crtc_state(crtc->base.state);

		intel_bw_crtc_update(bw_state, crtc_state);
	}
}

void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc)
{
	struct intel_display *display = to_intel_display(crtc);
+2 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ struct drm_i915_private;
struct intel_atomic_state;
struct intel_crtc;
struct intel_crtc_state;
struct intel_display;

struct intel_dbuf_bw {
	unsigned int max_bw[I915_MAX_DBUF_SLICES];
@@ -74,14 +75,13 @@ intel_atomic_get_bw_state(struct intel_atomic_state *state);
void intel_bw_init_hw(struct drm_i915_private *dev_priv);
int intel_bw_init(struct drm_i915_private *dev_priv);
int intel_bw_atomic_check(struct intel_atomic_state *state);
void intel_bw_crtc_update(struct intel_bw_state *bw_state,
			  const struct intel_crtc_state *crtc_state);
int icl_pcode_restrict_qgv_points(struct drm_i915_private *dev_priv,
				  u32 points_mask);
int intel_bw_calc_min_cdclk(struct intel_atomic_state *state,
			    bool *need_cdclk_calc);
int intel_bw_min_cdclk(struct drm_i915_private *i915,
		       const struct intel_bw_state *bw_state);
void intel_bw_update_hw_state(struct intel_display *display);
void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc);

#endif /* __INTEL_BW_H__ */
+1 −4
Original line number Diff line number Diff line
@@ -825,8 +825,6 @@ static void intel_modeset_readout_hw_state(struct drm_i915_private *i915)
	drm_connector_list_iter_end(&conn_iter);

	for_each_intel_crtc(&i915->drm, crtc) {
		struct intel_bw_state *bw_state =
			to_intel_bw_state(i915->display.bw.obj.state);
		struct intel_crtc_state *crtc_state =
			to_intel_crtc_state(crtc->base.state);
		struct intel_plane *plane;
@@ -880,10 +878,9 @@ static void intel_modeset_readout_hw_state(struct drm_i915_private *i915)

		intel_pmdemand_update_port_clock(display, pmdemand_state, pipe,
						 crtc_state->port_clock);

		intel_bw_crtc_update(bw_state, crtc_state);
	}

	intel_bw_update_hw_state(display);
	intel_cdclk_update_hw_state(display);

	intel_pmdemand_init_pmdemand_params(display, pmdemand_state);