diff options
| author | Rex Zhu <Rex.Zhu@amd.com> | 2018-07-27 16:06:30 +0300 | 
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 19:09:52 +0300 | 
| commit | 1e317b99f0c244bd8830918fdae9715210baf4fe (patch) | |
| tree | 1a58b47f1992f10d20c7d0ce21971ad1b993258b /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
| parent | d23ee13fba23a3039971a976b2c4857cb5ba9c73 (diff) | |
| download | linux-1e317b99f0c244bd8830918fdae9715210baf4fe.tar.xz | |
drm/amdgpu: Put enable gfx off feature to a delay thread
delay to enable gfx off feature to avoid gfx on/off frequently
suggested by Alex and Evan.
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 2068b7fe7523..82bc329919fe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1925,6 +1925,19 @@ static void amdgpu_device_ip_late_init_func_handler(struct work_struct *work)  		DRM_ERROR("ib ring test failed (%d).\n", r);  } +static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work) +{ +	struct amdgpu_device *adev = +		container_of(work, struct amdgpu_device, gfx.gfx_off_delay_work.work); + +	mutex_lock(&adev->gfx.gfx_off_mutex); +	if (!adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) { +		if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true)) +			adev->gfx.gfx_off_state = true; +	} +	mutex_unlock(&adev->gfx.gfx_off_mutex); +} +  /**   * amdgpu_device_ip_suspend_phase1 - run suspend for hardware IPs (phase 1)   * @@ -2394,6 +2407,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,  	INIT_DELAYED_WORK(&adev->late_init_work,  			  amdgpu_device_ip_late_init_func_handler); +	INIT_DELAYED_WORK(&adev->gfx.gfx_off_delay_work, +			  amdgpu_device_delay_enable_gfx_off);  	adev->gfx.gfx_off_req_count = 1;  	adev->pm.ac_power = power_supply_is_system_supplied() > 0 ? true : false; | 
