lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 139/207] drm/vc4: kms: Wait for the commit before increasing our clock rate
    Date
    From: Maxime Ripard <maxime@cerno.tech>

    commit 0c980a006d3fbee86c4d0698f66d6f5381831787 upstream.

    Several DRM/KMS atomic commits can run in parallel if they affect
    different CRTC. These commits share the global HVS state, so we have
    some code to make sure we run commits in sequence. This synchronization
    code is one of the first thing that runs in vc4_atomic_commit_tail().

    Another constraints we have is that we need to make sure the HVS clock
    gets a boost during the commit. That code relies on clk_set_min_rate and
    will remove the old minimum and set a new one. We also need another,
    temporary, minimum for the duration of the commit.

    The algorithm is thus to set a temporary minimum, drop the previous
    one, do the commit, and finally set the minimum for the current mode.

    However, the part that sets the temporary minimum and drops the older
    one runs before the commit synchronization code.

    Thus, under the proper conditions, we can end up mixing up the minimums
    and ending up with the wrong one for our current step.

    To avoid it, let's move the clock setup in the protected section.

    Fixes: d7d96c00e585 ("drm/vc4: hvs: Boost the core clock during modeset")
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Tested-by: Jian-Hong Pan <jhp@endlessos.org>
    Link: https://lore.kernel.org/r/20211117094527.146275-2-maxime@cerno.tech
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/gpu/drm/vc4/vc4_kms.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    --- a/drivers/gpu/drm/vc4/vc4_kms.c
    +++ b/drivers/gpu/drm/vc4/vc4_kms.c
    @@ -353,9 +353,6 @@ static void vc4_atomic_commit_tail(struc
    vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
    }

    - if (vc4->hvs->hvs5)
    - clk_set_min_rate(hvs->core_clk, 500000000);
    -
    old_hvs_state = vc4_hvs_get_old_global_state(state);
    if (!old_hvs_state)
    return;
    @@ -377,6 +374,9 @@ static void vc4_atomic_commit_tail(struc
    drm_err(dev, "Timed out waiting for commit\n");
    }

    + if (vc4->hvs->hvs5)
    + clk_set_min_rate(hvs->core_clk, 500000000);
    +
    drm_atomic_helper_commit_modeset_disables(dev, state);

    vc4_ctm_commit(vc4, state);

    \
     
     \ /
      Last update: 2021-12-06 17:11    [W:4.345 / U:0.472 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site