Commit 15e17335 authored by Charlene Liu's avatar Charlene Liu Committed by Alex Deucher
Browse files

drm/amd/display: fix aviInfoFrame bar Info and add set_avMute

parent 1674d35b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1911,3 +1911,13 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
	disable_link(pipe_ctx->stream->sink->link, pipe_ctx->stream->signal);
}

void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
{
	struct core_dc *core_dc = DC_TO_CORE(pipe_ctx->stream->ctx->dc);

	if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
		return;

	core_dc->hwss.set_avmute(pipe_ctx, enable);
}
+31 −6
Original line number Diff line number Diff line
@@ -1607,6 +1607,8 @@ static void set_avi_info_frame(
	uint8_t *check_sum = NULL;
	uint8_t byte_index = 0;
	union hdmi_info_packet *hdmi_info = &info_frame.avi_info_packet.info_packet_hdmi;
	unsigned int vic = pipe_ctx->stream->public.timing.vic;
	enum dc_timing_3d_format format;

	color_space = pipe_ctx->stream->public.output_color_space;
	if (color_space == COLOR_SPACE_UNKNOWN)
@@ -1661,8 +1663,7 @@ static void set_avi_info_frame(

	/* C0, C1 : Colorimetry */
	if (color_space == COLOR_SPACE_YCBCR709 ||
			color_space == COLOR_SPACE_YCBCR709_LIMITED ||
			color_space == COLOR_SPACE_2020_YCBCR)
			color_space == COLOR_SPACE_YCBCR709_LIMITED)
		hdmi_info->bits.C0_C1 = COLORIMETRY_ITU709;
	else if (color_space == COLOR_SPACE_YCBCR601 ||
			color_space == COLOR_SPACE_YCBCR601_LIMITED)
@@ -1722,9 +1723,29 @@ static void set_avi_info_frame(
		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_DEFAULT_RANGE;
		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
	}

	hdmi_info->bits.VIC0_VIC7 =
					stream->public.timing.vic;
	///VIC
	format = stream->public.timing.timing_3d_format;
	/*todo, add 3DStereo support*/
	if (format != TIMING_3D_FORMAT_NONE) {
		// Based on HDMI specs hdmi vic needs to be converted to cea vic when 3D is enabled
		switch (pipe_ctx->stream->public.timing.hdmi_vic) {
		case 1:
			vic = 95;
			break;
		case 2:
			vic = 94;
			break;
		case 3:
			vic = 93;
			break;
		case 4:
			vic = 98;
			break;
		default:
			break;
		}
	}
	hdmi_info->bits.VIC0_VIC7 = vic;

	/* pixel repetition
	 * PR0 - PR3 start from 0 whereas pHwPathMode->mode.timing.flags.pixel
@@ -1737,7 +1758,7 @@ static void set_avi_info_frame(
	 * barLeft:   Pixel Number of End of Left Bar.
	 * barRight:  Pixel Number of Start of Right Bar. */
	hdmi_info->bits.bar_top = stream->public.timing.v_border_top;
	hdmi_info->bits.bar_bottom = (stream->public.timing.v_border_top
	hdmi_info->bits.bar_bottom = (stream->public.timing.v_total
			- stream->public.timing.v_border_bottom + 1);
	hdmi_info->bits.bar_left  = stream->public.timing.h_border_left;
	hdmi_info->bits.bar_right = (stream->public.timing.h_total
@@ -1776,6 +1797,10 @@ static void set_vendor_info_packet(
	uint8_t checksum = 0;
	uint32_t i = 0;
	enum dc_timing_3d_format format;
	// Can be different depending on packet content /*todo*/
	// unsigned int length = pPathMode->dolbyVision ? 24 : 5;

	info_packet->valid = false;

	format = stream->public.timing.timing_3d_format;
	if (stream->public.view_format == VIEW_3D_FORMAT_NONE)
+12 −1
Original line number Diff line number Diff line
@@ -1003,6 +1003,16 @@ static void dce110_stream_encoder_dp_unblank(
	REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, true);
}

static void dce110_stream_encoder_set_avmute(
	struct stream_encoder *enc,
	bool enable)
{
	struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc);
	unsigned int value = enable ? 1 : 0;

	REG_UPDATE(HDMI_GC, HDMI_GC_AVMUTE, value);
}


#define DP_SEC_AUD_N__DP_SEC_AUD_N__DEFAULT 0x8000
#define DP_SEC_TIMESTAMP__DP_SEC_TIMESTAMP_MODE__AUTO_CALC 1
@@ -1582,7 +1592,6 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = {
		dce110_stream_encoder_dp_blank,
	.dp_unblank =
		dce110_stream_encoder_dp_unblank,

	.audio_mute_control = dce110_se_audio_mute_control,

	.dp_audio_setup = dce110_se_dp_audio_setup,
@@ -1592,6 +1601,8 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = {
	.hdmi_audio_setup = dce110_se_hdmi_audio_setup,
	.hdmi_audio_disable = dce110_se_hdmi_audio_disable,
	.setup_stereo_sync  = setup_stereo_sync,
	.set_avmute = dce110_stream_encoder_set_avmute,

};

bool dce110_stream_encoder_construct(
+11 −2
Original line number Diff line number Diff line
@@ -801,6 +801,13 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
	pipe_ctx->stream_enc->funcs->dp_unblank(pipe_ctx->stream_enc, &params);
}


void dce110_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
{
	if (pipe_ctx != NULL && pipe_ctx->stream_enc != NULL)
		pipe_ctx->stream_enc->funcs->set_avmute(pipe_ctx->stream_enc, enable);
}

static enum audio_dto_source translate_to_dto_source(enum controller_id crtc_id)
{
	switch (crtc_id) {
@@ -1095,10 +1102,11 @@ static enum dc_status apply_single_controller_ctx_to_hw(
			(pipe_ctx->stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ?
			true : false);

	resource_build_info_frame(pipe_ctx);

	if (!pipe_ctx_old->stream) {
		core_link_enable_stream(pipe_ctx);

	resource_build_info_frame(pipe_ctx);
	dce110_update_info_frame(pipe_ctx);
		if (dc_is_dp_signal(pipe_ctx->stream->signal))
			dce110_unblank_stream(pipe_ctx,
@@ -2600,7 +2608,8 @@ static const struct hw_sequencer_funcs dce110_funcs = {
	.set_static_screen_control = set_static_screen_control,
	.reset_hw_ctx_wrap = reset_hw_ctx_wrap,
	.prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg,
	.setup_stereo = NULL
	.setup_stereo = NULL,
	.set_avmute = dce110_set_avmute,
};

bool dce110_hw_sequencer_construct(struct core_dc *dc)
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,

void dce110_update_info_frame(struct pipe_ctx *pipe_ctx);

void dce110_set_avmute(struct pipe_ctx *pipe_ctx, bool enable);
void dce110_enable_accelerated_mode(struct core_dc *dc);

void dce110_power_down(struct core_dc *dc);
Loading