]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu:No action when VCN PG state is unchanged
authorJames Zhu <jzhums@gmail.com>
Thu, 13 Sep 2018 20:55:44 +0000 (16:55 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Sep 2018 02:09:12 +0000 (21:09 -0500)
When VCN PG state is unchanged, it is unnecessary to reset power
gate state

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c

index 0b0b8638d73fba480c6431995862b63e22065f26..d2219abd50f03095fe8fc5c6ca82cad9fc05a215 100644 (file)
@@ -69,6 +69,7 @@ struct amdgpu_vcn {
        struct amdgpu_ring      ring_jpeg;
        struct amdgpu_irq_src   irq;
        unsigned                num_enc_rings;
+       enum amd_powergating_state cur_state;
 };
 
 int amdgpu_vcn_sw_init(struct amdgpu_device *adev);
index 2664bb2c47c3a49748d5721c08f146835d5c12fb..2cde0b4046db6f5a30bd4f23fa0d615e4ee57c02 100644 (file)
@@ -1633,12 +1633,20 @@ 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;
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       if(state == adev->vcn.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)
+               adev->vcn.cur_state = state;
+       return ret;
 }
 
 static const struct amd_ip_funcs vcn_v1_0_ip_funcs = {