drm/amd/display: decouple global lock out of pipe control lock
authorWenjing Liu <Wenjing.Liu@amd.com>
Wed, 22 Jan 2020 16:54:54 +0000 (11:54 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Feb 2020 20:04:37 +0000 (15:04 -0500)
[why]
hwss should not guess what type of pipe lock is needed.
The caller of the lock function should know
the right type of pipe lock.
Decouple the setup of global lock outside of pipe control lock
logic.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c

index 7fdd82b..40878b8 100644 (file)
@@ -2220,6 +2220,11 @@ static void commit_planes_for_stream(struct dc *dc,
                }
        }
 
+       if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed)
+               if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable)
+                       top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable(
+                                       top_pipe_to_program->stream_res.tg);
+
        if ((update_type != UPDATE_TYPE_FAST) && dc->hwss.interdependent_update_lock)
                dc->hwss.interdependent_update_lock(dc, context, true);
        else
@@ -2377,6 +2382,21 @@ static void commit_planes_for_stream(struct dc *dc,
        else
                dc->hwss.pipe_control_lock(dc, top_pipe_to_program, false);
 
+       if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed)
+               if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
+                       top_pipe_to_program->stream_res.tg->funcs->wait_for_state(
+                                       top_pipe_to_program->stream_res.tg,
+                                       CRTC_STATE_VACTIVE);
+                       top_pipe_to_program->stream_res.tg->funcs->wait_for_state(
+                                       top_pipe_to_program->stream_res.tg,
+                                       CRTC_STATE_VBLANK);
+                       top_pipe_to_program->stream_res.tg->funcs->wait_for_state(
+                                       top_pipe_to_program->stream_res.tg,
+                                       CRTC_STATE_VACTIVE);
+                       top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_disable(
+                                       top_pipe_to_program->stream_res.tg);
+               }
+
        if (update_type != UPDATE_TYPE_FAST)
                dc->hwss.post_unlock_program_front_end(dc, context);
 
index 9713f45..52ef4d3 100644 (file)
@@ -1094,7 +1094,6 @@ void dcn20_pipe_control_lock(
        bool lock)
 {
        bool flip_immediate = false;
-       bool dig_update_required = false;
 
        /* use TG master update lock to lock everything on the TG
         * therefore only top pipe need to lock
@@ -1132,19 +1131,6 @@ void dcn20_pipe_control_lock(
                    (!flip_immediate && pipe->stream_res.gsl_group > 0))
                        dcn20_setup_gsl_group_as_lock(dc, pipe, flip_immediate);
 
-       if (pipe->stream && pipe->stream->update_flags.bits.dsc_changed)
-               dig_update_required = true;
-
-       /* Need double buffer lock mode in order to synchronize front end pipe
-        * updates with dig updates.
-        */
-       if (dig_update_required) {
-               if (lock) {
-                       pipe->stream_res.tg->funcs->lock_doublebuffer_enable(
-                                       pipe->stream_res.tg);
-               }
-       }
-
        if (pipe->plane_state != NULL && pipe->plane_state->triplebuffer_flips) {
                if (lock)
                        pipe->stream_res.tg->funcs->triplebuffer_lock(pipe->stream_res.tg);
@@ -1156,19 +1142,6 @@ void dcn20_pipe_control_lock(
                else
                        pipe->stream_res.tg->funcs->unlock(pipe->stream_res.tg);
        }
-
-       if (dig_update_required) {
-               if (!lock) {
-                       pipe->stream_res.tg->funcs->wait_for_state(pipe->stream_res.tg,
-                                       CRTC_STATE_VACTIVE);
-                       pipe->stream_res.tg->funcs->wait_for_state(pipe->stream_res.tg,
-                                       CRTC_STATE_VBLANK);
-                       pipe->stream_res.tg->funcs->wait_for_state(pipe->stream_res.tg,
-                                       CRTC_STATE_VACTIVE);
-                       pipe->stream_res.tg->funcs->lock_doublebuffer_disable(
-                                       pipe->stream_res.tg);
-               }
-       }
 }
 
 static void dcn20_detect_pipe_changes(struct pipe_ctx *old_pipe, struct pipe_ctx *new_pipe)