diff mbox

[3/4] drm/amdgpu: Allow vblank_disable_immediate.

Message ID 20170621014457.26587-4-mario.kleiner.de@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mario Kleiner June 21, 2017, 1:44 a.m. UTC
With instantaneous high precision vblank timestamping
that updates at leading edge of vblank, a cooked hw
vblank counter which increments at leading edge of
vblank, and reliable page flip execution and completion
at leading edge of vblank, we should meet the requirements
for fast/immediate vblank irq disable/enable.

Testing on Linux-4.12-rc5 + drm-next on a Radeon R9 380
Tonga Pro (DCE 10) with timing measurement equipment
indicates this works fine, so allow immediate vblank
disable for power saving.

For debugging in case of unexpected trouble, booting
with kernel cmdline option drm.vblankoffdelay=0
(or echo 0 > /sys/module/drm/parameters/vblankoffdelay)
would keep vblank irqs permanently on to approximate old
behavior.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michel Dänzer June 21, 2017, 7:22 a.m. UTC | #1
On 21/06/17 10:44 AM, Mario Kleiner wrote:
> With instantaneous high precision vblank timestamping
> that updates at leading edge of vblank, a cooked hw
> vblank counter which increments at leading edge of
> vblank, and reliable page flip execution and completion
> at leading edge of vblank, we should meet the requirements
> for fast/immediate vblank irq disable/enable.
> 
> Testing on Linux-4.12-rc5 + drm-next on a Radeon R9 380
> Tonga Pro (DCE 10) with timing measurement equipment
> indicates this works fine, so allow immediate vblank
> disable for power saving.
> 
> For debugging in case of unexpected trouble, booting
> with kernel cmdline option drm.vblankoffdelay=0
> (or echo 0 > /sys/module/drm/parameters/vblankoffdelay)
> would keep vblank irqs permanently on to approximate old
> behavior.
> 
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Michel Dänzer <michel.daenzer@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> index 62da6c5..a28f8aa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
> @@ -220,6 +220,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>  	int r = 0;
>  
>  	spin_lock_init(&adev->irq.lock);
> +
> +	/* Disable vblank irqs aggressively for power-saving */
> +	adev->ddev->vblank_disable_immediate = true;
> +
>  	r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc);
>  	if (r) {
>  		return r;
> 

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher June 21, 2017, 10:15 p.m. UTC | #2
On Wed, Jun 21, 2017 at 3:22 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 21/06/17 10:44 AM, Mario Kleiner wrote:
>> With instantaneous high precision vblank timestamping
>> that updates at leading edge of vblank, a cooked hw
>> vblank counter which increments at leading edge of
>> vblank, and reliable page flip execution and completion
>> at leading edge of vblank, we should meet the requirements
>> for fast/immediate vblank irq disable/enable.
>>
>> Testing on Linux-4.12-rc5 + drm-next on a Radeon R9 380
>> Tonga Pro (DCE 10) with timing measurement equipment
>> indicates this works fine, so allow immediate vblank
>> disable for power saving.
>>
>> For debugging in case of unexpected trouble, booting
>> with kernel cmdline option drm.vblankoffdelay=0
>> (or echo 0 > /sys/module/drm/parameters/vblankoffdelay)
>> would keep vblank irqs permanently on to approximate old
>> behavior.
>>
>> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Michel Dänzer <michel.daenzer@amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> index 62da6c5..a28f8aa 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
>> @@ -220,6 +220,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
>>       int r = 0;
>>
>>       spin_lock_init(&adev->irq.lock);
>> +
>> +     /* Disable vblank irqs aggressively for power-saving */
>> +     adev->ddev->vblank_disable_immediate = true;
>> +
>>       r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc);
>>       if (r) {
>>               return r;
>>
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


Applied patches 2 and 3.

Thanks,

Alex

>
>
> --
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 62da6c5..a28f8aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -220,6 +220,10 @@  int amdgpu_irq_init(struct amdgpu_device *adev)
 	int r = 0;
 
 	spin_lock_init(&adev->irq.lock);
+
+	/* Disable vblank irqs aggressively for power-saving */
+	adev->ddev->vblank_disable_immediate = true;
+
 	r = drm_vblank_init(adev->ddev, adev->mode_info.num_crtc);
 	if (r) {
 		return r;