[PATCH] drm/amdgpu:No action needs when VCN PG state is unchanged

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 10, 2018 at 4:34 PM James Zhu <jzhums at gmail.com> wrote:
>
> Signed-off-by: James Zhu <James.Zhu at amd.com>
>
> When VCN PG state is unchanged, it is unnecessary to reset
> power gate state again.

Don't you need to initialize and store the PG state somewhere?  You
are just using a local variable here.

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 2664bb2..86d98d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> @@ -1633,12 +1633,21 @@ static int vcn_v1_0_set_powergating_state(void *handle,
>          * revisit this when there is a cleaner line between
>          * the smc and the hw blocks
>          */
> +       int ret;
> +       static enum amd_powergating_state cur_state = AMD_PG_STATE_GATE;
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>
> +       if (state == cur_state)
> +               return 0;
> +
>         if (state == AMD_PG_STATE_GATE)
> -               return vcn_v1_0_stop(adev);
> +               ret = vcn_v1_0_stop(adev);
>         else
> -               return vcn_v1_0_start(adev);
> +               ret = vcn_v1_0_start(adev);
> +
> +       if (!ret)
> +               cur_state = state;
> +       return ret;
>  }
>
>  static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux