Commit 12f72a15 authored by George Shen's avatar George Shen Committed by Alex Deucher

drm/amd/display: Add DP audio BW validation

[Why]
Timings with small HBlank (such as CVT RBv2) can result in insufficient
HBlank bandwidth for audio SDP transmission when DSC is active. This
will cause some higher bandwidth audio modes to fail.

The combination of CVT RBv2 timings + DSC can commonly be encountered
in MST scenarios.

[How]
Add DP audio bandwidth validation for 8b/10b MST and 128b/132b SST/MST
cases and filter out modes that cannot be supported with the current
timing config.
Reviewed-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Acked-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarGeorge Shen <george.shen@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d451b534
......@@ -170,7 +170,8 @@ void dce_aud_az_disable(struct audio *audio);
void dce_aud_az_configure(struct audio *audio,
enum signal_type signal,
const struct audio_crtc_info *crtc_info,
const struct audio_info *audio_info);
const struct audio_info *audio_info,
const struct audio_dp_link_info *dp_link_info);
void dce_aud_wall_dto_setup(struct audio *audio,
enum signal_type signal,
......
......@@ -1291,6 +1291,46 @@ static enum audio_dto_source translate_to_dto_source(enum controller_id crtc_id)
}
}
static void populate_audio_dp_link_info(
const struct pipe_ctx *pipe_ctx,
struct audio_dp_link_info *dp_link_info)
{
const struct dc_stream_state *stream = pipe_ctx->stream;
const struct dc_link *link = stream->link;
struct fixed31_32 link_bw_kbps;
dp_link_info->encoding = link->dc->link_srv->dp_get_encoding_format(
&pipe_ctx->link_config.dp_link_settings);
dp_link_info->is_mst = (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST);
dp_link_info->lane_count = pipe_ctx->link_config.dp_link_settings.lane_count;
dp_link_info->link_rate = pipe_ctx->link_config.dp_link_settings.link_rate;
link_bw_kbps = dc_fixpt_from_int(dc_link_bandwidth_kbps(link,
&pipe_ctx->link_config.dp_link_settings));
/* For audio stream calculations, the video stream should not include FEC or SSC
* in order to get the most pessimistic values.
*/
if (dp_link_info->encoding == DP_8b_10b_ENCODING &&
link->dc->link_srv->dp_is_fec_supported(link)) {
link_bw_kbps = dc_fixpt_mul(link_bw_kbps,
dc_fixpt_from_fraction(100, DATA_EFFICIENCY_8b_10b_FEC_EFFICIENCY_x100));
} else if (dp_link_info->encoding == DP_128b_132b_ENCODING) {
link_bw_kbps = dc_fixpt_mul(link_bw_kbps,
dc_fixpt_from_fraction(10000, 9975)); /* 99.75% SSC overhead*/
}
dp_link_info->link_bandwidth_kbps = dc_fixpt_floor(link_bw_kbps);
/* HW minimum for 128b/132b HBlank is 4 frame symbols.
* TODO: Plumb the actual programmed HBlank min symbol width to here.
*/
if (dp_link_info->encoding == DP_128b_132b_ENCODING)
dp_link_info->hblank_min_symbol_width = 4;
else
dp_link_info->hblank_min_symbol_width = 0;
}
static void build_audio_output(
struct dc_state *state,
const struct pipe_ctx *pipe_ctx,
......@@ -1338,6 +1378,15 @@ static void build_audio_output(
audio_output->crtc_info.calculated_pixel_clock_100Hz =
pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz;
audio_output->crtc_info.pixel_encoding =
stream->timing.pixel_encoding;
audio_output->crtc_info.dsc_bits_per_pixel =
stream->timing.dsc_cfg.bits_per_pixel;
audio_output->crtc_info.dsc_num_slices =
stream->timing.dsc_cfg.num_slices_h;
/*for HDMI, audio ACR is with deep color ratio factor*/
if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) &&
audio_output->crtc_info.requested_pixel_clock_100Hz ==
......@@ -1371,6 +1420,10 @@ static void build_audio_output(
audio_output->pll_info.ss_percentage =
pipe_ctx->pll_settings.ss_percentage;
if (dc_is_dp_signal(pipe_ctx->stream->signal)) {
populate_audio_dp_link_info(pipe_ctx, &audio_output->dp_link_info);
}
}
static void program_scaler(const struct dc *dc,
......@@ -1507,7 +1560,8 @@ static enum dc_status apply_single_controller_ctx_to_hw(
pipe_ctx->stream_res.audio,
pipe_ctx->stream->signal,
&audio_output.crtc_info,
&pipe_ctx->stream->audio_info);
&pipe_ctx->stream->audio_info,
&audio_output.dp_link_info);
}
/* make sure no pipes syncd to the pipe being enabled */
......
......@@ -43,7 +43,8 @@ struct audio_funcs {
void (*az_configure)(struct audio *audio,
enum signal_type signal,
const struct audio_crtc_info *crtc_info,
const struct audio_info *audio_info);
const struct audio_info *audio_info,
const struct audio_dp_link_info *dp_link_info);
void (*wall_dto_setup)(struct audio *audio,
enum signal_type signal,
......
......@@ -27,11 +27,21 @@
#define __AUDIO_TYPES_H__
#include "signal_types.h"
#include "fixed31_32.h"
#include "dc_dp_types.h"
#define AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 20
#define MAX_HW_AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 18
#define MULTI_CHANNEL_SPLIT_NO_ASSO_INFO 0xFFFFFFFF
struct audio_dp_link_info {
uint32_t link_bandwidth_kbps;
uint32_t hblank_min_symbol_width;
enum dp_link_encoding encoding;
enum dc_link_rate link_rate;
enum dc_lane_count lane_count;
bool is_mst;
};
struct audio_crtc_info {
uint32_t h_total;
......@@ -42,7 +52,10 @@ struct audio_crtc_info {
uint32_t calculated_pixel_clock_100Hz; /* in 100Hz */
uint32_t refresh_rate;
enum dc_color_depth color_depth;
enum dc_pixel_encoding pixel_encoding;
bool interlaced;
uint32_t dsc_bits_per_pixel;
uint32_t dsc_num_slices;
};
struct azalia_clock_info {
uint32_t pixel_clock_in_10khz;
......@@ -95,6 +108,8 @@ struct audio_output {
enum signal_type signal;
/* video timing */
struct audio_crtc_info crtc_info;
/* DP link info */
struct audio_dp_link_info dp_link_info;
/* PLL for audio */
struct audio_pll_info pll_info;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment