From: Daniel Sa <daniel...@amd.com>

[WHY]
Driver reports 0 display when the virtual display is still present, and
causes P-state hang in FW.

[HOW]
When enumerating through streams, check for active planes and use that
to indicate number of displays.

Reviewed-by: Dillon Varone <dillon.var...@amd.com>
Signed-off-by: Daniel Sa <daniel...@amd.com>
Signed-off-by: Alex Hung <alex.h...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c 
b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
index f770828df149..0e243f4344d0 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
@@ -59,6 +59,7 @@ int clk_mgr_helper_get_active_display_cnt(
        display_count = 0;
        for (i = 0; i < context->stream_count; i++) {
                const struct dc_stream_state *stream = context->streams[i];
+               const struct dc_stream_status *stream_status = 
&context->stream_status[i];
 
                /* Don't count SubVP phantom pipes as part of active
                 * display count
@@ -66,13 +67,7 @@ int clk_mgr_helper_get_active_display_cnt(
                if (dc_state_get_stream_subvp_type(context, stream) == 
SUBVP_PHANTOM)
                        continue;
 
-               /*
-                * Only notify active stream or virtual stream.
-                * Need to notify virtual stream to work around
-                * headless case. HPD does not fire when system is in
-                * S0i2.
-                */
-               if (!stream->dpms_off || stream->signal == SIGNAL_TYPE_VIRTUAL)
+               if (!stream->dpms_off || (stream_status && 
stream_status->plane_count))
                        display_count++;
        }
 
-- 
2.34.1

Reply via email to