[PATCH 77/81] drm/amd/display: fix aviInfoFrame bar Info and add set_avMute
sunpeng.li at amd.com
sunpeng.li at amd.com
Tue Jul 25 13:54:37 UTC 2017
From: Charlene Liu <charlene.liu at amd.com>
Change-Id: I8933d7bafe3b3cc18bc5aa41cedd89879d59de5a
Signed-off-by: Charlene Liu <charlene.liu at amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 10 ++++++
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 37 ++++++++++++++++++----
.../drm/amd/display/dc/dce/dce_stream_encoder.c | 13 +++++++-
.../amd/display/dc/dce110/dce110_hw_sequencer.c | 13 ++++++--
.../amd/display/dc/dce110/dce110_hw_sequencer.h | 1 +
.../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 +-
drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 +
.../gpu/drm/amd/display/dc/inc/hw/stream_encoder.h | 3 ++
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 2 ++
.../display/dc/virtual/virtual_stream_encoder.c | 4 +++
10 files changed, 77 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index fed38fb..036d22f 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -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);
+}
+
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 00fed61..d196d0d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -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)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
index daab81b..532c6e6 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
@@ -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(
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 5d64611..b691ef9 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -801,6 +801,13 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
pipe_ctx->stream_enc->funcs->dp_unblank(pipe_ctx->stream_enc, ¶ms);
}
+
+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)
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
index 52462c1..89782ca 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
@@ -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);
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index cadc940..8284837 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -1867,7 +1867,8 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
.set_drr = set_drr,
.get_position = get_position,
.set_static_screen_control = set_static_screen_control,
- .setup_stereo = dcn10_setup_stereo
+ .setup_stereo = dcn10_setup_stereo,
+ .set_avmute = dce110_set_avmute,
};
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index d216522..d753680 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -179,6 +179,7 @@ void core_link_enable_stream(struct pipe_ctx *pipe_ctx);
void core_link_disable_stream(struct pipe_ctx *pipe_ctx);
+void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable);
/********** DAL Core*********************/
#include "display_clock.h"
#include "transform.h"
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h b/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
index 9fb27bd..6ff90a0f 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h
@@ -123,6 +123,9 @@ struct stream_encoder_funcs {
struct stream_encoder *enc,
int tg_inst,
bool enable);
+
+ void (*set_avmute)(
+ struct stream_encoder *enc, bool enable);
};
#endif /* STREAM_ENCODER_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
index 97dbd25..d94e8e4 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
@@ -152,6 +152,8 @@ struct hw_sequencer_funcs {
void (*setup_stereo)(
struct pipe_ctx *pipe_ctx,
struct core_dc *dc);
+
+ void (*set_avmute)(struct pipe_ctx *pipe_ctx, bool enable);
};
void color_space_to_black_color(
diff --git a/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
index 8de21d9..7fe6085 100644
--- a/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
@@ -53,6 +53,9 @@ static void virtual_stream_encoder_update_hdmi_info_packets(
static void virtual_stream_encoder_stop_hdmi_info_packets(
struct stream_encoder *enc) {}
+static void virtual_stream_encoder_set_avmute(
+ struct stream_encoder *enc,
+ bool enable) {}
static void virtual_stream_encoder_update_dp_info_packets(
struct stream_encoder *enc,
const struct encoder_info_frame *info_frame) {}
@@ -94,6 +97,7 @@ static const struct stream_encoder_funcs virtual_str_enc_funcs = {
virtual_stream_encoder_dp_unblank,
.audio_mute_control = virtual_audio_mute_control,
+ .set_avmute = virtual_stream_encoder_set_avmute,
};
bool virtual_stream_encoder_construct(
--
2.7.4
More information about the amd-gfx
mailing list