From: George Shen <george.s...@amd.com>

[Why]
Certain small HBlank timings may not have a large enough HBlank to
support audio when low bpp DSC is enabled. HBlank expansion by the
source can solve this problem, but requires the branch/sink to support
HBlank reduction.

[How]
Update DPMS sequence to call DM to perform DPCD write to enable HBlank
reduction on the branch/sink. Add stub in dm_helpers to be implemented
later.

Reviewed-by: Michael Strauss <michael.stra...@amd.com>
Reviewed-by: Wenjing Liu <wenjing....@amd.com>
Signed-off-by: George Shen <george.s...@amd.com>
Signed-off-by: Roman Li <roman...@amd.com>
Tested-by: Daniel Wheeler <daniel.whee...@amd.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c   |  6 ++++++
 drivers/gpu/drm/amd/display/dc/dm_helpers.h     |  5 +++++
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 17 +++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 6cbbb71d752b..fbd80d8545a8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -885,6 +885,12 @@ bool dm_helpers_dp_write_dsc_enable(
        return ret;
 }
 
+bool dm_helpers_dp_write_hblank_reduction(struct dc_context *ctx, const struct 
dc_stream_state *stream)
+{
+       // TODO
+       return false;
+}
+
 bool dm_helpers_is_dp_sink_present(struct dc_link *link)
 {
        bool dp_sink_present;
diff --git a/drivers/gpu/drm/amd/display/dc/dm_helpers.h 
b/drivers/gpu/drm/amd/display/dc/dm_helpers.h
index 2e4a46f1b499..5efddd48d5c5 100644
--- a/drivers/gpu/drm/amd/display/dc/dm_helpers.h
+++ b/drivers/gpu/drm/amd/display/dc/dm_helpers.h
@@ -158,6 +158,11 @@ bool dm_helpers_dp_write_dsc_enable(
                const struct dc_stream_state *stream,
                bool enable
 );
+
+bool dm_helpers_dp_write_hblank_reduction(
+               struct dc_context *ctx,
+               const struct dc_stream_state *stream);
+
 bool dm_helpers_is_dp_sink_present(
                struct dc_link *link);
 
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c 
b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
index 6f3e7e182145..ae79dc213901 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
@@ -772,6 +772,20 @@ static bool dp_set_dsc_on_rx(struct pipe_ctx *pipe_ctx, 
bool enable)
        return result;
 }
 
+static bool dp_set_hblank_reduction_on_rx(struct pipe_ctx *pipe_ctx)
+{
+       struct dc *dc = pipe_ctx->stream->ctx->dc;
+       struct dc_stream_state *stream = pipe_ctx->stream;
+       bool result = false;
+
+       if (dc_is_virtual_signal(stream->signal))
+               result = true;
+       else
+               result = dm_helpers_dp_write_hblank_reduction(dc->ctx, stream);
+       return result;
+}
+
+
 /* The stream with these settings can be sent (unblanked) only after DSC was 
enabled on RX first,
  * i.e. after dp_enable_dsc_on_rx() had been called
  */
@@ -2599,6 +2613,9 @@ void link_set_dpms_on(
                }
        }
 
+       if (dc_is_dp_signal(pipe_ctx->stream->signal))
+               dp_set_hblank_reduction_on_rx(pipe_ctx);
+
        if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
                allocate_usb4_bandwidth(pipe_ctx->stream);
 
-- 
2.34.1

Reply via email to