Commit 39818c06 authored by Imre Deak's avatar Imre Deak
Browse files

drm/i915/dp: Add DP tunnel atomic state and check BW limit



Add the atomic state during a modeset required to enable the DP tunnel
BW allocation mode on links where such a tunnel was detected. This state
applies to an already enabled output, the state added for a newly
enabled output will be computed and added/cleared to/from the atomic
state in a follow-up patch.

v2:
- s/old_crtc_state/crtc_state in intel_crtc_duplicate_state().
- Move intel_dp_tunnel_atomic_cleanup_inherited_state() to a follow-up
  patch adding the corresponding state. (Ville)
- Move intel_dp_tunnel_atomic_clear_stream_bw() to a follow-up
  patch adding the corresponding state.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarUma Shankar <uma.shankar@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240220211841.448846-14-imre.deak@intel.com
parent 91888b5b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -260,6 +260,10 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
	if (crtc_state->post_csc_lut)
		drm_property_blob_get(crtc_state->post_csc_lut);

	if (crtc_state->dp_tunnel_ref.tunnel)
		drm_dp_tunnel_ref_get(crtc_state->dp_tunnel_ref.tunnel,
				      &crtc_state->dp_tunnel_ref);

	crtc_state->update_pipe = false;
	crtc_state->update_m_n = false;
	crtc_state->update_lrr = false;
@@ -311,6 +315,8 @@ intel_crtc_destroy_state(struct drm_crtc *crtc,

	__drm_atomic_helper_crtc_destroy_state(&crtc_state->uapi);
	intel_crtc_free_hw_state(crtc_state);
	if (crtc_state->dp_tunnel_ref.tunnel)
		drm_dp_tunnel_ref_put(&crtc_state->dp_tunnel_ref);
	kfree(crtc_state);
}

+12 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <linux/string_helpers.h>

#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_dp_tunnel.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_uapi.h>
@@ -73,6 +74,7 @@
#include "intel_dp.h"
#include "intel_dp_link_training.h"
#include "intel_dp_mst.h"
#include "intel_dp_tunnel.h"
#include "intel_dpll.h"
#include "intel_dpll_mgr.h"
#include "intel_dpt.h"
@@ -4490,6 +4492,8 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
	saved_state->crc_enabled = slave_crtc_state->crc_enabled;

	intel_crtc_free_hw_state(slave_crtc_state);
	if (slave_crtc_state->dp_tunnel_ref.tunnel)
		drm_dp_tunnel_ref_put(&slave_crtc_state->dp_tunnel_ref);
	memcpy(slave_crtc_state, saved_state, sizeof(*slave_crtc_state));
	kfree(saved_state);

@@ -4505,6 +4509,10 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
		      &master_crtc_state->hw.adjusted_mode);
	slave_crtc_state->hw.scaling_filter = master_crtc_state->hw.scaling_filter;

	if (master_crtc_state->dp_tunnel_ref.tunnel)
		drm_dp_tunnel_ref_get(master_crtc_state->dp_tunnel_ref.tunnel,
				      &slave_crtc_state->dp_tunnel_ref);

	copy_bigjoiner_crtc_state_nomodeset(state, slave_crtc);

	slave_crtc_state->uapi.mode_changed = master_crtc_state->uapi.mode_changed;
@@ -5366,6 +5374,10 @@ static int intel_modeset_pipe(struct intel_atomic_state *state,
	if (ret)
		return ret;

	ret = intel_dp_tunnel_atomic_add_state_for_crtc(state, crtc);
	if (ret)
		return ret;

	ret = intel_dp_mst_add_topology_state_for_crtc(state, crtc);
	if (ret)
		return ret;
+5 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include "intel_crtc.h"
#include "intel_display_types.h"
#include "intel_dp_mst.h"
#include "intel_dp_tunnel.h"
#include "intel_fdi.h"
#include "intel_link_bw.h"

@@ -163,6 +164,10 @@ static int check_all_link_config(struct intel_atomic_state *state,
	if (ret)
		return ret;

	ret = intel_dp_tunnel_atomic_check_link(state, limits);
	if (ret)
		return ret;

	ret = intel_fdi_atomic_check_link(state, limits);
	if (ret)
		return ret;