From: Charlene Liu <[email protected]>

[Why]
This is a HW-required change.

[How]
Enable the existing TMDS double-buffer bypass before the first
metadata packet-enable write. FRL behavior remains unchanged.

This mitigates lost updates but does not prevent V_UPDATE collisions.

Only update DCN42 or later for now.

Cc: Roman Li <[email protected]>
Cc: Chris Park <[email protected]>
Signed-off-by: Charlene Liu <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 .../dc/dio/dcn401/dcn401_dio_stream_encoder.c     | 15 +++++++++++++++
 .../dc/dio/dcn401/dcn401_dio_stream_encoder.h     |  4 ++++
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.c       |  2 +-
 .../dc/dio/dcn60/dcn60_dio_stream_encoder.c       |  2 +-
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git 
a/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c 
b/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c
index 4616b6f76aeb..86111cebc944 100644
--- a/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c
@@ -436,6 +436,21 @@ void enc401_stream_encoder_enable(
        }
 }
 
+void enc401_stream_encoder_enable_with_hdmi_db_bypass(
+       struct stream_encoder *enc,
+       enum signal_type signal,
+       bool enable)
+{
+       struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
+
+       if (enable && signal == SIGNAL_TYPE_HDMI_TYPE_A) {
+               /* Bypass HDMI double buffering before enabling the stream. */
+               REG_UPDATE(HDMI_DB_CONTROL, HDMI_DB_DISABLE, 1);
+       }
+
+       enc401_stream_encoder_enable(enc, signal, enable);
+}
+
 void enc401_stream_encoder_dp_set_stream_attribute(
        struct stream_encoder *enc,
        struct dc_crtc_timing *crtc_timing,
diff --git 
a/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h 
b/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h
index d6b00cd246b1..dea7f941675d 100644
--- a/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h
+++ b/drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h
@@ -226,6 +226,10 @@ void enc401_stream_encoder_enable(
        struct stream_encoder *enc,
        enum signal_type signal,
        bool enable);
+void enc401_stream_encoder_enable_with_hdmi_db_bypass(
+       struct stream_encoder *enc,
+       enum signal_type signal,
+       bool enable);
 void enc401_set_dig_input_mode(struct stream_encoder *enc, unsigned int 
pix_per_container);
 void enc401_stream_encoder_map_to_link(
                struct stream_encoder *enc,
diff --git 
a/drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c 
b/drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c
index b7671d41ea24..98dc158e7094 100644
--- a/drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c
@@ -552,7 +552,7 @@ static const struct stream_encoder_funcs 
dcn42_str_enc_funcs = {
        .dp_set_dsc_pps_info_packet = enc42_dp_set_dsc_pps_info_packet,
        .set_dynamic_metadata = enc401_set_dynamic_metadata,
        .hdmi_reset_stream_attribute = enc42_reset_hdmi_stream_attribute,
-       .enable_stream = enc401_stream_encoder_enable,
+       .enable_stream = enc401_stream_encoder_enable_with_hdmi_db_bypass,
 
        .set_input_mode = enc401_set_dig_input_mode,
        .enable_fifo = enc35_enable_fifo,
diff --git 
a/drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c 
b/drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c
index b645914c1c71..3fc503681177 100644
--- a/drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c
@@ -506,7 +506,7 @@ static const struct stream_encoder_funcs 
dcn60_str_enc_funcs = {
        .dp_set_dsc_pps_info_packet = enc60_dp_set_dsc_pps_info_packet,
        .set_dynamic_metadata = enc401_set_dynamic_metadata,
        .hdmi_reset_stream_attribute = enc60_reset_hdmi_stream_attribute,
-       .enable_stream = enc401_stream_encoder_enable,
+       .enable_stream = enc401_stream_encoder_enable_with_hdmi_db_bypass,
 
        .set_input_mode = enc401_set_dig_input_mode,
        .enable_fifo = enc35_enable_fifo,
-- 
2.43.0

Reply via email to