For HDMI TMDS we need to check if the Hblank tribytes are sufficient for HDMI audio packets tribytes for a given audio configuration.
For FRL we need to check the above and also that the whole line meets the line budget for a given FRL rate. Add a helper to check whether a given audio configuration (L-PCM sample rate + channel count) fits the committed non DSC FRL video config, using the FRL DFM. Signed-off-by: Ankit Nautiyal <[email protected]> --- drivers/gpu/drm/i915/display/intel_hdmi.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_hdmi.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 425971d8927a..c57d99195ed0 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2341,6 +2341,28 @@ compute_frl_mn(struct intel_crtc_state *crtc_state, u32 ftb_avg_k) crtc_state->frl.div18 = DIV_ROUND_UP_ULL(div_18_clk, 1000); } +bool intel_hdmi_frl_audio_rate_supported(const struct intel_crtc_state *crtc_state, + int audio_rate, int channels) +{ + const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; + struct intel_hdmi_frl_dfm frl_dfm = {}; + + frl_dfm.config.pixel_clock_nominal_khz = adjusted_mode->clock; + frl_dfm.config.hactive = adjusted_mode->hdisplay; + frl_dfm.config.hblank = adjusted_mode->htotal - adjusted_mode->hdisplay; + frl_dfm.config.bpc = crtc_state->pipe_bpp / 3; + frl_dfm.config.color_format = get_drm_color_format(crtc_state->output_format); + + frl_dfm.config.lanes = crtc_state->frl.required_lanes; + frl_dfm.config.bit_rate_kbps = crtc_state->frl.required_rate * 1000000; + + /* Audio config under test */ + frl_dfm.config.audio_hz = audio_rate; + frl_dfm.config.audio_channels = channels; + + return intel_hdmi_frl_dfm_nondsc_requirement_met(&frl_dfm); +} + static int intel_hdmi_compute_frl_config(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.h b/drivers/gpu/drm/i915/display/intel_hdmi.h index 305ee1186d0b..71b12f557d75 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.h +++ b/drivers/gpu/drm/i915/display/intel_hdmi.h @@ -63,6 +63,8 @@ int intel_hdmi_dsc_get_num_slices(const struct drm_display_mode *mode, int hdmi_max_slices, int hdmi_throughput); int intel_hdmi_dsc_get_slice_height(int vactive); bool intel_hdmi_is_frl(u32 clock); +bool intel_hdmi_frl_audio_rate_supported(const struct intel_crtc_state *crtc_state, + int audio_rate, int channels); void intel_hdmi_prepare_for_frl_mode(const struct intel_crtc_state *crtc_state); int intel_hdmi_start_frl(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state); -- 2.50.1
