Enable vblank_disable_immediate on more drivers.
Subsystems (5)
This patch series sets dev->vblank_disable_immediate = true on radeon/amdgpu-kms, nouveau-kms for nv50+, and vc4 for the real kms driver (as opposed to dispmanx firmware backed kms).
All the drivers should be ready in theory, given their implementation, for fast vblank disable/enable. In practice, i have performed timing tests with my measurement equipment for all those drivers with the current 4.12.0-rc5 based drm-next tree, and the rpi-4.12.0-rc5 Raspberry Pi kernel tree under Raspian during the last days, and everything seems to work fine.
Thanks to Chris Wilsons nice vblank on/off/query optimizations from Linux 4.12 this should now generally be a win for power saving without degradation in performance, so time to flip the switch on and see if it works out on non-Intel gpu's as well.
One restriction for vc4: I couldn't test yet if this could cause any trouble for the vc4-fkms-v3d devicetree binding, using the firmware based kms path. For some reason the rpi-4.12-rc5 kernel never makes it to a working display if i choose vc4-fkms-v3d instead of vc4-kms-v3d dt. This also happens with the unpatched kernel, so is not related to this patch, but with a black screen, dead network and nothing logged in any log, i gave up debugging this atm. Just to say, that path is untested, only the proper kms driver is successfully tested.
thanks,
-mario
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20170621014457.26587-1-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/4 drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
With instantaneous high precision vblank timestamping that updates at leading edge of vblank, the emulated "hw vblank counter" from vblank timestamping 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 vblank irq disable/enable.
Testing against rpi-4.12-rc5 Linux kernel 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 would keep vblank irqs on to approximate old behavior.
--- drivers/gpu/drm/vc4/vc4_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/vc4/vc4_kms.c +4 -0
@@ -216,6 +216,10 @@ int vc4_kms_load(struct drm_device *dev)sema_init (&vc4->async_modeset,1 ); +/* Set support for vblank irq fast disable, before drm_vblank_init() */ +if (!vc4->firmware_kms) + dev->vblank_disable_immediate = true; + ret =drm_vblank_init (dev, dev->mode_config.num_crtc);if (ret <0 ) {dev_err (dev->dev,"failed to initialize vblank\n" );
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170621014457.26587-2-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
Quoted 12 lines · Mario Kleiner
With instantaneous high precision vblank timestamping that updates at leading edge of vblank, the emulated "hw vblank counter" from vblank timestamping 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 vblank irq disable/enable.
Testing against rpi-4.12-rc5 Linux kernel with timing measurement equipment indicates this works fine, so allow immediate vblank disable for power saving.
Quoted 6 lines
For debugging in case of unexpected trouble, booting with kernel cmdline option drm.vblankoffdelay=0 would keep vblank irqs on to approximate old behavior.
Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>
If you can spin this against drm-misc-next instead of the downstream tree, I can get it applied.
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 87r2ydco07.fsf-omZaPlIz5HhaEpDpdNBo/[email protected]
Re: [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
Quoted 18 lines · Eric Anholt
Quoted 16 lines · Mario Kleiner
With instantaneous high precision vblank timestamping that updates at leading edge of vblank, the emulated "hw vblank counter" from vblank timestamping 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 vblank irq disable/enable.
Testing against rpi-4.12-rc5 Linux kernel 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 would keep vblank irqs on to approximate old behavior.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>If you can spin this against drm-misc-next instead of the downstream tree, I can get it applied.
Done, thanks!
-mario
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
kbuild test robot
build botRe: [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
In reply to a message not in the archivereproduce:
Hi Mario,
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.12-rc6 next-20170621]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mario-Kleiner/drm-vc4-Allow-vblank_disable_immediate-on-non-fw-kms/20170622-013723 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/gpu//drm/vc4/vc4_kms.c: In function 'vc4_kms_load':
>> drivers/gpu//drm/vc4/vc4_kms.c:220:10: error: 'struct vc4_dev' has no member named 'firmware_kms'
if (!vc4->firmware_kms)
^~vim +220 drivers/gpu//drm/vc4/vc4_kms.c
214 struct vc4_dev *vc4 = to_vc4_dev(dev);
215 int ret;
216
217 sema_init(&vc4->async_modeset, 1);
218
219 /* Set support for vblank irq fast disable, before drm_vblank_init() */
> 220 if (!vc4->firmware_kms)
221 dev->vblank_disable_immediate = true;
222
223 ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/radeon: Allow vblank_disable_immediate.
In reply to a message not in the archiveWith 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 HD 5770 (DCE 4) 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.
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +4 -0
@@ -283,6 +283,10 @@ int radeon_irq_kms_init(struct radeon_device *rdev)int r =0 ;spin_lock_init (&rdev->irq.lock); + +/* Disable vblank irqs aggressively for power-saving */ + rdev->ddev->vblank_disable_immediate = true; + r =drm_vblank_init (rdev->ddev, rdev->num_crtc);if (r) {return r;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170621014457.26587-3-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/4] drm/radeon: Allow vblank_disable_immediate.
Quoted 18 lines · Mario Kleiner
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 HD 5770 (DCE 4) 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.
Quoted 3 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Alex Deucher <[email protected]>Cc Michel Dänzer <[email protected]>
My only doubt is whether this is also reliable on older (e.g. pre-R600) GPUs. For newer GPUs (tested on Kaveri):
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: Allow vblank_disable_immediate.
In reply to a message not in the archiveWith 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +4 -0
@@ -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;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/4] drm/amdgpu: Allow vblank_disable_immediate.
Quoted 31 lines · Mario Kleiner
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 <[email protected]>Cc Alex Deucher <[email protected]>Cc Michel Dänzer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c int amdgpu_irq_init(struct amdgpu_device *adev) · line 229
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +4
-0@@ -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;
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 423330d7-44ef-041a-2c76-c06731febc61-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH 3/4] drm/amdgpu: Allow vblank_disable_immediate.
Quoted 33 lines · Michel Dänzer
Quoted 32 lines · Mario Kleiner
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 <[email protected]>Cc Alex Deucher <[email protected]>Cc Michel Dänzer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0@@ -220,6 +220,10 @@ int amdgpu_irq_init(struct amdgpu_device *adev)int r =0 ;
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c int amdgpu_irq_init(struct amdgpu_device *adev) · line 229
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +4
-0spin_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 <[email protected]>
Applied patches 2 and 3.
Thanks,
Alex
Quoted 9 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/nouveau/kms/nv50-: Allow vblank_disable_immediate.
In reply to a message not in the archiveWith instantaneous high precision vblank timestamping that updates at leading edge of vblank, the emulated "hw vblank counter" from vblank timestamping, 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.
This is only allowed on nv50+ gpu's, ie. the ones with atomic modesetting. One requirement for immediate vblank disable is that high precision vblank timestamping works reliably all the time on all connectors. This is not the case on all pre-nv50 parts for analog VGA outputs, where we currently don't always have support for scanout position queries and therefore fall back to vblank interrupt timestamping. The implementation in nv04_head_state() does not return valid values for vblanks, vtotal, hblanks, htotal for VGA outputs on all cards, but those are needed for scanout position queries.
Testing on Linux-4.12-rc5 + drm-next on a GeForce 9500 GT (NV G96) 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.
--- drivers/gpu/drm/nouveau/nv50_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nv50_display.c +3 -0
@@ -4495,6 +4495,9 @@ nv50_display_create(struct drm_device *dev) connector->funcs->destroy (connector); } +/* Disable vblank irqs aggressively for power-saving, safe on nv50+ */ + dev->vblank_disable_immediate = true; + out:if (ret)nv50_display_destroy (dev);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx