diff mbox series

[11/11] drm/i915: Implement audio fastset

Message ID 20231106211915.13406-12-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Audio fastset, and some fixes | expand

Commit Message

Ville Syrjälä Nov. 6, 2023, 9:19 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

There's no real why we'd need a full modeset for audio changes.
So let's allow audio to be toggled during fastset. In case the
ELD changes while has_audio isn't changing state we force both
audio disable and enable so the new ELD gets propagated to the
audio driver.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 32 ++++++--------------
 1 file changed, 10 insertions(+), 22 deletions(-)

Comments

Jani Nikula Nov. 13, 2023, 3:51 p.m. UTC | #1
On Mon, 06 Nov 2023, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> There's no real why we'd need a full modeset for audio changes.

+reason

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> So let's allow audio to be toggled during fastset. In case the
> ELD changes while has_audio isn't changing state we force both
> audio disable and enable so the new ELD gets propagated to the
> audio driver.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 32 ++++++--------------
>  1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 98d4fcd28073..a87a9ac63c4a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -996,7 +996,9 @@ static bool audio_enabling(const struct intel_crtc_state *old_crtc_state,
>  	if (!new_crtc_state->hw.active)
>  		return false;
>  
> -	return is_enabling(has_audio, old_crtc_state, new_crtc_state);
> +	return is_enabling(has_audio, old_crtc_state, new_crtc_state) ||
> +		(new_crtc_state->has_audio &&
> +		 memcmp(old_crtc_state->eld, new_crtc_state->eld, MAX_ELD_BYTES) != 0);
>  }
>  
>  static bool audio_disabling(const struct intel_crtc_state *old_crtc_state,
> @@ -1005,7 +1007,9 @@ static bool audio_disabling(const struct intel_crtc_state *old_crtc_state,
>  	if (!old_crtc_state->hw.active)
>  		return false;
>  
> -	return is_disabling(has_audio, old_crtc_state, new_crtc_state);
> +	return is_disabling(has_audio, old_crtc_state, new_crtc_state) ||
> +		(old_crtc_state->has_audio &&
> +		 memcmp(old_crtc_state->eld, new_crtc_state->eld, MAX_ELD_BYTES) != 0);
>  }
>  
>  #undef is_disabling
> @@ -5123,23 +5127,6 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  	} \
>  } while (0)
>  
> -/*
> - * Checks state where we only read out the enabling, but not the entire
> - * state itself (like full infoframes or ELD for audio). These states
> - * require a full modeset on bootup to fix up.
> - */
> -#define PIPE_CONF_CHECK_BOOL_INCOMPLETE(name) do { \
> -	if (!fixup_inherited || (!current_config->name && !pipe_config->name)) { \
> -		PIPE_CONF_CHECK_BOOL(name); \
> -	} else { \
> -		pipe_config_mismatch(fastset, crtc, __stringify(name), \
> -				     "unable to verify whether state matches exactly, forcing modeset (expected %s, found %s)", \
> -				     str_yes_no(current_config->name), \
> -				     str_yes_no(pipe_config->name)); \
> -		ret = false; \
> -	} \
> -} while (0)
> -
>  #define PIPE_CONF_CHECK_P(name) do { \
>  	if (current_config->name != pipe_config->name) { \
>  		pipe_config_mismatch(fastset, crtc, __stringify(name), \
> @@ -5327,8 +5314,10 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  	PIPE_CONF_CHECK_BOOL(enhanced_framing);
>  	PIPE_CONF_CHECK_BOOL(fec_enable);
>  
> -	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
> -	PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
> +	if (!fastset) {
> +		PIPE_CONF_CHECK_BOOL(has_audio);
> +		PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
> +	}
>  
>  	PIPE_CONF_CHECK_X(gmch_pfit.control);
>  	/* pfit ratios are autocomputed by the hw on gen4+ */
> @@ -5498,7 +5487,6 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  #undef PIPE_CONF_CHECK_X
>  #undef PIPE_CONF_CHECK_I
>  #undef PIPE_CONF_CHECK_BOOL
> -#undef PIPE_CONF_CHECK_BOOL_INCOMPLETE
>  #undef PIPE_CONF_CHECK_P
>  #undef PIPE_CONF_CHECK_FLAGS
>  #undef PIPE_CONF_CHECK_COLOR_LUT
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 98d4fcd28073..a87a9ac63c4a 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -996,7 +996,9 @@  static bool audio_enabling(const struct intel_crtc_state *old_crtc_state,
 	if (!new_crtc_state->hw.active)
 		return false;
 
-	return is_enabling(has_audio, old_crtc_state, new_crtc_state);
+	return is_enabling(has_audio, old_crtc_state, new_crtc_state) ||
+		(new_crtc_state->has_audio &&
+		 memcmp(old_crtc_state->eld, new_crtc_state->eld, MAX_ELD_BYTES) != 0);
 }
 
 static bool audio_disabling(const struct intel_crtc_state *old_crtc_state,
@@ -1005,7 +1007,9 @@  static bool audio_disabling(const struct intel_crtc_state *old_crtc_state,
 	if (!old_crtc_state->hw.active)
 		return false;
 
-	return is_disabling(has_audio, old_crtc_state, new_crtc_state);
+	return is_disabling(has_audio, old_crtc_state, new_crtc_state) ||
+		(old_crtc_state->has_audio &&
+		 memcmp(old_crtc_state->eld, new_crtc_state->eld, MAX_ELD_BYTES) != 0);
 }
 
 #undef is_disabling
@@ -5123,23 +5127,6 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	} \
 } while (0)
 
-/*
- * Checks state where we only read out the enabling, but not the entire
- * state itself (like full infoframes or ELD for audio). These states
- * require a full modeset on bootup to fix up.
- */
-#define PIPE_CONF_CHECK_BOOL_INCOMPLETE(name) do { \
-	if (!fixup_inherited || (!current_config->name && !pipe_config->name)) { \
-		PIPE_CONF_CHECK_BOOL(name); \
-	} else { \
-		pipe_config_mismatch(fastset, crtc, __stringify(name), \
-				     "unable to verify whether state matches exactly, forcing modeset (expected %s, found %s)", \
-				     str_yes_no(current_config->name), \
-				     str_yes_no(pipe_config->name)); \
-		ret = false; \
-	} \
-} while (0)
-
 #define PIPE_CONF_CHECK_P(name) do { \
 	if (current_config->name != pipe_config->name) { \
 		pipe_config_mismatch(fastset, crtc, __stringify(name), \
@@ -5327,8 +5314,10 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	PIPE_CONF_CHECK_BOOL(enhanced_framing);
 	PIPE_CONF_CHECK_BOOL(fec_enable);
 
-	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
-	PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
+	if (!fastset) {
+		PIPE_CONF_CHECK_BOOL(has_audio);
+		PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
+	}
 
 	PIPE_CONF_CHECK_X(gmch_pfit.control);
 	/* pfit ratios are autocomputed by the hw on gen4+ */
@@ -5498,7 +5487,6 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 #undef PIPE_CONF_CHECK_X
 #undef PIPE_CONF_CHECK_I
 #undef PIPE_CONF_CHECK_BOOL
-#undef PIPE_CONF_CHECK_BOOL_INCOMPLETE
 #undef PIPE_CONF_CHECK_P
 #undef PIPE_CONF_CHECK_FLAGS
 #undef PIPE_CONF_CHECK_COLOR_LUT