Re: [PATCH v3] drm/vc4: Add a debugfs entry to disable/enable the load tracker
From: Boris Brezillon
Date: Tue Dec 11 2018 - 08:12:49 EST
On Fri, 7 Dec 2018 14:47:57 +0100
Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx> wrote:
> diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> index f3fd34faa812..e80b1ad5c938 100644
> --- a/drivers/gpu/drm/vc4/vc4_kms.c
> +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> @@ -479,6 +479,7 @@ static const struct drm_private_state_funcs vc4_load_tracker_state_funcs = {
> static int
> vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
> {
> + struct vc4_dev *vc4 = to_vc4_dev(dev);
> int ret;
>
> ret = vc4_ctm_atomic_check(dev, state);
> @@ -489,7 +490,10 @@ vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
> if (ret)
> return ret;
>
> - return vc4_load_tracker_atomic_check(state);
> + if (vc4->load_tracker_enabled)
> + return vc4_load_tracker_atomic_check(state);
Even if we don't return an error when ->load_tracker_enabled is false,
we should keep updating the ->{hvs,membus}_load state, otherwise those
fields will contain bad values if we activate the load tracker after
the planes have been enabled.
I suggest moving this test in vc4_load_tracker_atomic_check() just
before
if (load_state->membus_load > SZ_1G + SZ_512M)