From: Lu Yao <[email protected]>

Playing audio/video will speed up when color space is NV12.
For POLARIS12, audio request clock has to be same as
'stream->timing.pix_clk_100hz', so double clock now for it
has been halved in the 'get_pixel_clock_parameters' function.

Signed-off-by: Lu Yao <[email protected]>
---
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
---
Test environment:
  Card: RX550  device id: 0X699F
  Display mode: 4K@60 clock:59400

A similar issue was reported in the community a long time ago,
but it was not dealt with, link as follow:
https://gitlab.freedesktop.org/drm/amd/-/issues/556

Discovered through logs audio_output requested&calculated is half
of stream->timing.pix_clk_100hz before, so I double it.
I'm not sure if this patch modification has correctly solved the
root cause and whether all DCE_VERSION_11_2 have problem or POLARIS12
only, but it's working properly on my machine now.
---

diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
index 24184b4eb352..a93313248db3 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
@@ -1440,13 +1440,21 @@ void build_audio_output(
 
 /*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 ==
-                               (stream->timing.pix_clk_100hz)) {
-               if (pipe_ctx->stream_res.pix_clk_params.pixel_encoding == 
PIXEL_ENCODING_YCBCR420) {
+               pipe_ctx->stream_res.pix_clk_params.pixel_encoding == 
PIXEL_ENCODING_YCBCR420) {
+               struct hw_asic_id asic_id = stream->link->ctx->asic_id;
+
+               if (asic_id.chip_family == FAMILY_VI &&
+                   ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev)) {
+                       audio_output->crtc_info.requested_pixel_clock_100Hz =
+                               
audio_output->crtc_info.requested_pixel_clock_100Hz*2;
+                       audio_output->crtc_info.calculated_pixel_clock_100Hz =
+                               
pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz*2;
+               } else if (audio_output->crtc_info.requested_pixel_clock_100Hz 
==
+                          (stream->timing.pix_clk_100hz)) {
                        audio_output->crtc_info.requested_pixel_clock_100Hz =
-                                       
audio_output->crtc_info.requested_pixel_clock_100Hz/2;
+                               
audio_output->crtc_info.requested_pixel_clock_100Hz/2;
                        audio_output->crtc_info.calculated_pixel_clock_100Hz =
-                                       
pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz/2;
+                               
pipe_ctx->stream_res.pix_clk_params.requested_pix_clk_100hz/2;
 
                }
        }
-- 
2.25.1

Reply via email to