From: Harry VanZyllDeJong <hvanz...@amd.com>

[HOW&WHY]
VRR was getting set at the same time
the timing generator would be null when there was no display
connected. Added null check to the timing generator variable
so it does not get referenced if it is null.

Reviewed-by: Harry Vanzylldejong <harry.vanzylldej...@amd.com>
Reviewed-by: Evgenii Krasnikov <evgenii.krasni...@amd.com>
Reviewed-by: Nicholas Choi <nicholas.c...@amd.com>
Acked-by: Pavle Kotarac <pavle.kota...@amd.com>
Signed-off-by: Harry VanZyllDeJong <hvanz...@amd.com>
---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

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 2d3d870f0bea..328569ad2bd6 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
@@ -3049,12 +3049,16 @@ void dcn10_set_drr(struct pipe_ctx **pipe_ctx,
         * as well.
         */
        for (i = 0; i < num_pipes; i++) {
-               pipe_ctx[i]->stream_res.tg->funcs->set_drr(
-                       pipe_ctx[i]->stream_res.tg, &params);
-               if (adjust.v_total_max != 0 && adjust.v_total_min != 0)
-                       
pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control(
-                                       pipe_ctx[i]->stream_res.tg,
-                                       event_triggers, num_frames);
+               if ((pipe_ctx[i]->stream_res.tg != NULL) && 
pipe_ctx[i]->stream_res.tg->funcs) {
+                       if (pipe_ctx[i]->stream_res.tg->funcs->set_drr)
+                               pipe_ctx[i]->stream_res.tg->funcs->set_drr(
+                                       pipe_ctx[i]->stream_res.tg, &params);
+                       if (adjust.v_total_max != 0 && adjust.v_total_min != 0)
+                               if 
(pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control)
+                                       
pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control(
+                                               pipe_ctx[i]->stream_res.tg,
+                                               event_triggers, num_frames);
+               }
        }
 }
 
-- 
2.32.0

Reply via email to