Mario Kleiner
2017-Jun-21 01:44 UTC
[Nouveau] Enable vblank_disable_immediate on more drivers.
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
Mario Kleiner
2017-Jun-21 01:44 UTC
[Nouveau] [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. Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com> Cc: Eric Anholt <eric at anholt.net> --- drivers/gpu/drm/vc4/vc4_kms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 928d191..70c4e17 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -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"); -- 2.7.4
Mario Kleiner
2017-Jun-21 01:44 UTC
[Nouveau] [PATCH 2/4] drm/radeon: Allow vblank_disable_immediate.
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. Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com> Cc: Alex Deucher <alexander.deucher at amd.com> Cc: Michel Dänzer <michel.daenzer at amd.com> --- drivers/gpu/drm/radeon/radeon_irq_kms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 7aacb44..1860764 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c @@ -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; -- 2.7.4
Mario Kleiner
2017-Jun-21 01:44 UTC
[Nouveau] [PATCH 3/4] drm/amdgpu: Allow vblank_disable_immediate.
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 at gmail.com> Cc: Alex Deucher <alexander.deucher at amd.com> Cc: Michel Dänzer <michel.daenzer at 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; -- 2.7.4
Mario Kleiner
2017-Jun-21 01:44 UTC
[Nouveau] [PATCH 4/4] drm/nouveau/kms/nv50-: Allow vblank_disable_immediate.
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/ 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. Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com> Cc: Ben Skeggs <bskeggs at redhat.com> --- drivers/gpu/drm/nouveau/nv50_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index e3132a2..f2f2a7c 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -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); -- 2.7.4
Eric Anholt
2017-Jun-21 16:19 UTC
[Nouveau] [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
Mario Kleiner <mario.kleiner.de at gmail.com> writes:> 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. > > Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com> > Cc: Eric Anholt <eric at anholt.net>If you can spin this against drm-misc-next instead of the downstream tree, I can get it applied. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20170621/dd425031/attachment.sig>
kbuild test robot
2017-Jun-21 19:08 UTC
[Nouveau] [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 59315 bytes Desc: not available URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20170622/e908b0c1/attachment-0001.gz>
Apparently Analagous Threads
- [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
- [PATCH 1/4] drm/vc4: Allow vblank_disable_immediate on non-fw-kms.
- [PATCH v2 02/21] drm: Evaluate struct drm_device.vblank_disable_immediate on each use
- [PATCH v2 00/21] drm: Clean up VBLANK callbacks in struct drm_driver
- [PATCH 1/2] drm/nouveau: Use drm_vblank_count_and_time() for pageflip completion events.