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

drm/i915/bw: Skip the bw_state->active_pipes update if no pipe is changing its active state



Currently we may end up doing a bunch of redundant bw_state
recomputation whenever any modeset happens. Skip a bunch of
that by only considering whether any pipe actually changes
its active state.

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250923171943.7319-4-ville.syrjala@linux.intel.com


Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
parent 663cb3e9
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "intel_atomic.h"
#include "intel_bw.h"
#include "intel_cdclk.h"
#include "intel_crtc.h"
#include "intel_display_core.h"
#include "intel_display_regs.h"
#include "intel_display_types.h"
@@ -1530,10 +1531,14 @@ static int intel_bw_modeset_checks(struct intel_atomic_state *state)
	struct intel_display *display = to_intel_display(state);
	const struct intel_bw_state *old_bw_state;
	struct intel_bw_state *new_bw_state;
	int ret;

	if (DISPLAY_VER(display) < 9)
		return 0;

	if (!intel_any_crtc_active_changed(state))
		return 0;

	new_bw_state = intel_atomic_get_bw_state(state);
	if (IS_ERR(new_bw_state))
		return PTR_ERR(new_bw_state);
@@ -1543,13 +1548,9 @@ static int intel_bw_modeset_checks(struct intel_atomic_state *state)
	new_bw_state->active_pipes =
		intel_calc_active_pipes(state, old_bw_state->active_pipes);

	if (new_bw_state->active_pipes != old_bw_state->active_pipes) {
		int ret;

	ret = intel_atomic_lock_global_state(&new_bw_state->base);
	if (ret)
		return ret;
	}

	return 0;
}
@@ -1599,7 +1600,7 @@ static int intel_bw_check_sagv_mask(struct intel_atomic_state *state)
	return 0;
}

int intel_bw_atomic_check(struct intel_atomic_state *state, bool any_ms)
int intel_bw_atomic_check(struct intel_atomic_state *state)
{
	struct intel_display *display = to_intel_display(state);
	bool changed = false;
@@ -1610,11 +1611,9 @@ int intel_bw_atomic_check(struct intel_atomic_state *state, bool any_ms)
	if (DISPLAY_VER(display) < 9)
		return 0;

	if (any_ms) {
	ret = intel_bw_modeset_checks(state);
	if (ret)
		return ret;
	}

	ret = intel_bw_check_sagv_mask(state);
	if (ret)
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ intel_atomic_get_bw_state(struct intel_atomic_state *state);

void intel_bw_init_hw(struct intel_display *display);
int intel_bw_init(struct intel_display *display);
int intel_bw_atomic_check(struct intel_atomic_state *state, bool any_ms);
int intel_bw_atomic_check(struct intel_atomic_state *state);
int intel_bw_calc_min_cdclk(struct intel_atomic_state *state,
			    bool *need_cdclk_calc);
int intel_bw_min_cdclk(struct intel_display *display,
+1 −1
Original line number Diff line number Diff line
@@ -6434,7 +6434,7 @@ int intel_atomic_check(struct drm_device *dev,
	if (ret)
		goto fail;

	ret = intel_bw_atomic_check(state, any_ms);
	ret = intel_bw_atomic_check(state);
	if (ret)
		goto fail;