drm/vblank: drop use of DRM_WAIT_ON()
Subsystems (2)
PATCH v3 1/1 drm/vblank: drop use of DRM_WAIT_ON()
DRM_WAIT_ON() is from the deprecated drm_os_linux header and the modern replacement is the wait_event_*.
The return values differ, so a conversion is needed to keep the original interface towards userspace. Introduced a switch/case to make code obvious.
Analysis from Michel Dänzer:
The waiting condition rely on all relevant places where vblank_count is modified calls wake_up(&vblank->queue).
drm_handle_vblank():
- Calls wake_up(&vblank->queue)
drm_vblank_enable():
- There is no need here because there can be no sleeping waiters in the queue, because vblank->enabled == false immediately terminates any waits.
drm_crtc_accurate_vblank_count():
- This is called from interrupt handlers, at least from amdgpu_dm.c:dm_pflip_high_irq(). Not sure it needs to wake up the queue though, the driver should call drm_(crtc_)_handle_vblank anyway.
drm_vblank_disable_and_save():
- It can be called from an interrupt, via drm_handle_vblank -> vblank_disable_fn. However, the only place where drm_vblank_disable_and_save can be called with sleeping waiters in the queue is in drm_crtc_vblank_off, which wakes up the queue afterwards (which terminates all waits, because vblank->enabled == false at this point).
v3:
- Added analysis to changelog from Michel Dänzer
- Moved return result handling inside if (req_seq != seq) (Daniel V)
- Reused more of the former logic - resulting in simpler code
- Dropped Reviewed-by from Sean Paul as this is a new implmentation
v2:
- Fix so the case where req_seq equals seq was handled properly
- quick hack to check if IGT became happy
- Only sent to igt, not to dri-devel
---
This patch survives my testing here.
vbltest spits out the same value as before, and I can see something on the screen.
Added [email protected], as IGT have identified troubles with this in v1.
Sam
drivers/gpu/drm/drm_vblank.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_vblank.c +20 -5
@@ -31,7 +31,6 @@#include <drm/drm_drv.h> #include <drm/drm_framebuffer.h> #include <drm/drm_print.h> -#include <drm/drm_os_linux.h> #include <drm/drm_vblank.h> #include "drm_internal.h"
@@ -1670,12 +1669,28 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, }if (req_seq != seq) { +int wait; +DRM_DEBUG ("waiting on vblank count %llu, crtc %u\n" , req_seq, pipe); -DRM_WAIT_ON (ret, vblank->queue,3 *HZ , -vblank_passed (drm_vblank_count (dev, pipe), - req_seq) || - !READ_ONCE (vblank->enabled)); + wait =wait_event_interruptible_timeout (vblank->queue, +vblank_passed (drm_vblank_count (dev, pipe), req_seq) || + !READ_ONCE (vblank->enabled), +msecs_to_jiffies (3000 )); + +switch (wait) { +case 0 : +/* timeout */ + ret = -EBUSY ; +break ; +case -ERESTARTSYS : +/* interrupted by signal */ + ret = -EINTR ; +break ; +default : + ret =0 ; +break ; + } }if (ret != -EINTR ) {
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
== Series Details ==
== Series Details ==
Series: series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
URL : https://patchwork.freedesktop.org/series/64337/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip c558d403f099 drm/vblank: drop use of DRM_WAIT_ON() -:47: WARNING:TYPO_SPELLING: 'implmentation' may be misspelled - perhaps 'implementation'? #47: - Dropped Reviewed-by from Sean Paul as this is a new implmentation
-:87: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #87: FILE: drivers/gpu/drm/drm_vblank.c:1677:
+ wait = wait_event_interruptible_timeout(vblank->queue,
+ vblank_passed(drm_vblank_count(dev, pipe), req_seq) ||
total: 0 errors, 1 warnings, 1 checks, 39 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
In reply to Sam Ravnborg== Series Details ==
== Series Details ==
Series: series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
URL : https://patchwork.freedesktop.org/series/64337/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6565 -> Patchwork_13776
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/
Known issues
------------
Here are the changes found in Patchwork_13776 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@debugfs_test@read_all_entries:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-icl-u3/igt@debugfs_test@read_all_entries.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-icl-u3/igt@debugfs_test@read_all_entries.html
* igt@gem_ctx_create@basic:
- fi-apl-guc: [PASS][3] -> [INCOMPLETE][4] ([fdo#103927])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-apl-guc/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-apl-guc/igt@[email protected]
* igt@kms_busy@basic-flip-a:
- fi-kbl-7567u: [PASS][5] -> [SKIP][6] ([fdo#109271] / [fdo#109278]) +2 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-kbl-7567u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-kbl-7567u/igt@[email protected]
* igt@prime_vgem@basic-fence-flip:
- fi-kbl-7500u: [PASS][7] -> [SKIP][8] ([fdo#109271]) +23 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-kbl-7500u/igt@[email protected]
#### Possible fixes ####
* igt@i915_module_load@reload:
- fi-blb-e6850: [INCOMPLETE][9] ([fdo#107718]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-blb-e6850/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-blb-e6850/igt@[email protected]
* igt@i915_selftest@live_hangcheck:
- fi-kbl-guc: [INCOMPLETE][11] ([fdo#108744]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-kbl-guc/igt@i915_selftest@live_hangcheck.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-kbl-guc/igt@i915_selftest@live_hangcheck.html
* igt@kms_addfb_basic@bo-too-small-due-to-tiling:
- fi-icl-dsi: [INCOMPLETE][13] ([fdo#107713]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-icl-dsi/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-icl-dsi/igt@[email protected]
* igt@kms_busy@basic-flip-c:
- fi-kbl-7500u: [SKIP][15] ([fdo#109271] / [fdo#109278]) -> [PASS][16] +2 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-kbl-7500u/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-kbl-7500u/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][17] ([fdo#109485]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-kbl-7500u/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-kbl-7500u/igt@[email protected]
* igt@vgem_basic@debugfs:
- fi-icl-u3: [DMESG-WARN][19] ([fdo#107724]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/fi-icl-u3/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/fi-icl-u3/igt@[email protected]
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485
Participating hosts (54 -> 46)
------------------------------
Missing (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6565 -> Patchwork_13776
CI-20190529: 20190529
CI_DRM_6565: 5559389e889c125a9aa0982e4ef79bb4c1853438 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5113: f8f1bfbd25559e01c59a55635477cb74b326ea0b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13776: c558d403f099f4d59555fe1fdaadc4390d585bd7 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
c558d403f099 drm/vblank: drop use of DRM_WAIT_ON()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
In reply to Sam Ravnborg== Series Details ==
== Series Details ==
Series: series starting with [v3,1/1] drm/vblank: drop use of DRM_WAIT_ON()
URL : https://patchwork.freedesktop.org/series/64337/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6565_full -> Patchwork_13776_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_13776_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_eio@unwedge-stress:
- shard-snb: [PASS][1] -> [FAIL][2] ([fdo#109661])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-snb6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-snb1/igt@[email protected]
* igt@gem_tiled_swapping@non-threaded:
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([fdo#108686])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-glk1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-glk1/igt@[email protected]
* igt@i915_suspend@debugfs-reader:
- shard-apl: [PASS][5] -> [DMESG-WARN][6] ([fdo#108566]) +4 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-apl5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-apl5/igt@[email protected]
* igt@kms_flip@flip-vs-suspend:
- shard-hsw: [PASS][7] -> [INCOMPLETE][8] ([fdo#103540])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-hsw6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-hsw4/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][9] -> [FAIL][10] ([fdo#103167]) +6 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb3/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render.html
* igt@kms_frontbuffer_tracking@fbc-badstride:
- shard-iclb: [PASS][11] -> [INCOMPLETE][12] ([fdo#107713]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb4/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb7/igt@[email protected]
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-skl: [PASS][13] -> [INCOMPLETE][14] ([fdo#104108])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-skl5/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-skl6/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [PASS][15] -> [FAIL][16] ([fdo#108145])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-skl10/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-skl8/igt@[email protected]
* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [PASS][17] -> [FAIL][18] ([fdo#103166])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb6/igt@[email protected]
* igt@kms_psr2_su@frontbuffer:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109642] / [fdo#111068])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb1/igt@[email protected]
* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [PASS][21] -> [SKIP][22] ([fdo#109441])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb7/igt@kms_psr@psr2_primary_page_flip.html
#### Possible fixes ####
* igt@gem_ctx_isolation@vcs0-s3:
- shard-apl: [DMESG-WARN][23] ([fdo#108566]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-apl6/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-apl4/igt@[email protected]
* igt@gem_eio@reset-stress:
- shard-snb: [FAIL][25] ([fdo#109661]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-snb6/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-snb4/igt@[email protected]
* igt@gem_softpin@noreloc-s3:
- shard-skl: [INCOMPLETE][27] ([fdo#104108]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-skl6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-skl6/igt@[email protected]
* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: [FAIL][29] ([fdo#105363]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-skl3/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-skl8/igt@[email protected]
* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl: [DMESG-WARN][31] ([fdo#108566]) -> [PASS][32] +6 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-kbl3/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-kbl6/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-shrfb-plflip-blt:
- shard-iclb: [FAIL][33] ([fdo#103167]) -> [PASS][34] +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb3/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb2/igt@[email protected]
* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][35] ([fdo#109642] / [fdo#111068]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb3/igt@kms_psr2_su@page_flip.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb2/igt@kms_psr2_su@page_flip.html
* igt@kms_psr@no_drrs:
- shard-iclb: [FAIL][37] ([fdo#108341]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb1/igt@kms_psr@no_drrs.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb6/igt@kms_psr@no_drrs.html
* igt@kms_psr@psr2_suspend:
- shard-iclb: [SKIP][39] ([fdo#109441]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb3/igt@kms_psr@psr2_suspend.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb2/igt@kms_psr@psr2_suspend.html
#### Warnings ####
* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: [DMESG-WARN][41] ([fdo#107724]) -> [SKIP][42] ([fdo#109349])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6565/shard-iclb2/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/shard-iclb1/igt@[email protected]
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
Participating hosts (9 -> 9)
------------------------------
No changes in participating hosts
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6565 -> Patchwork_13776
CI-20190529: 20190529
CI_DRM_6565: 5559389e889c125a9aa0982e4ef79bb4c1853438 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5113: f8f1bfbd25559e01c59a55635477cb74b326ea0b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13776: c558d403f099f4d59555fe1fdaadc4390d585bd7 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13776/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 45 lines · Sam Ravnborg
DRM_WAIT_ON()is from the deprecateddrm_os_linuxheader and the modern replacement is the wait_event_*.The return values differ, so a conversion is needed to keep the original interface towards userspace. Introduced a switch/case to make code obvious.
Analysis from Michel Dänzer:
The waiting condition rely on all relevant places where
vblank_countis modified callswake_up(&vblank->queue).
drm_handle_vblank():
- Callswake_up(&vblank->queue)
drm_vblank_enable():
- There is no need here because there can be no sleeping waiters in the queue, becausevblank->enabled== false immediately terminates any waits.
drm_crtc_accurate_vblank_count():
- This is called from interrupt handlers, at least from amdgpu_dm.c:dm_pflip_high_irq(). Not sure it needs to wake up the queue though, the driver should call drm_(crtc_)_handle_vblank anyway.
drm_vblank_disable_and_save():
- It can be called from an interrupt, viadrm_handle_vblank->vblank_disable_fn. However, the only place wheredrm_vblank_disable_and_savecan be called with sleeping waiters in the queue is indrm_crtc_vblank_off, which wakes up the queue afterwards (which terminates all waits, becausevblank->enabled== false at this point).v3:
- Added analysis to changelog from Michel Dänzer
- Moved return result handling inside if (req_seq!= seq) (Daniel V)
- Reused more of the former logic - resulting in simpler code
- Dropped Reviewed-by from Sean Paul as this is a new implmentationv2:
- Fix so the case wherereq_seqequals seq was handled properly
- quick hack to check if IGT became happy
- Only sent to igt, not to dri-devel
Quoted 7 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc "Michel Dänzer" <[email protected]>Cc Sean Paul <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi all.
Quoted 6 lines · Sam Ravnborg
DRM_WAIT_ON()is from the deprecateddrm_os_linuxheader and the modern replacement is the wait_event_*.The return values differ, so a conversion is needed to keep the original interface towards userspace. Introduced a switch/case to make code obvious.
Patch passes igt testing, and Michel was happy with it. It is now applied to drm-misc-next and pushed out.
With this we have one less user of drm_os_linux.h
(only very few remains)
And one less cryptic macro use.
Sam
Quoted 111 lines
Analysis from Michel Dänzer:
The waiting condition rely on all relevant places where
vblank_countis modified callswake_up(&vblank->queue).
drm_handle_vblank():
- Callswake_up(&vblank->queue)
drm_vblank_enable():
- There is no need here because there can be no sleeping waiters in the queue, becausevblank->enabled== false immediately terminates any waits.
drm_crtc_accurate_vblank_count():
- This is called from interrupt handlers, at least from amdgpu_dm.c:dm_pflip_high_irq(). Not sure it needs to wake up the queue though, the driver should call drm_(crtc_)_handle_vblank anyway.
drm_vblank_disable_and_save():
- It can be called from an interrupt, viadrm_handle_vblank->vblank_disable_fn. However, the only place wheredrm_vblank_disable_and_savecan be called with sleeping waiters in the queue is indrm_crtc_vblank_off, which wakes up the queue afterwards (which terminates all waits, becausevblank->enabled== false at this point).v3:
- Added analysis to changelog from Michel Dänzer
- Moved return result handling inside if (req_seq!= seq) (Daniel V)
- Reused more of the former logic - resulting in simpler code
- Dropped Reviewed-by from Sean Paul as this is a new implmentationv2:
- Fix so the case wherereq_seqequals seq was handled properly
- quick hack to check if IGT became happy
- Only sent to igt, not to dri-develSigned-off-by Sam Ravnborg <[email protected]>Cc "Michel Dänzer" <[email protected]>Cc Sean Paul <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>---
This patch survives my testing here.
vbltest spits out the same value as before, and I can see something on the screen.
Added [email protected], as IGT have identified troubles with this in v1.Sam
drivers/gpu/drm/drm_vblank.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_vblank.c +20
-5@@ -31,7 +31,6 @@#include <drm/drm_drv.h> #include <drm/drm_framebuffer.h> #include <drm/drm_print.h> -#include <drm/drm_os_linux.h> #include <drm/drm_vblank.h> #include "drm_internal.h" @@ -1670,12 +1669,28 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, }if (req_seq != seq) { +int wait; +DRM_DEBUG ("waiting on vblank count %llu, crtc %u\n" , req_seq, pipe); -DRM_WAIT_ON (ret, vblank->queue,3 *HZ , -vblank_passed (drm_vblank_count (dev, pipe), - req_seq) || - !READ_ONCE (vblank->enabled)); + wait =wait_event_interruptible_timeout (vblank->queue, +vblank_passed (drm_vblank_count (dev, pipe), req_seq) || + !READ_ONCE (vblank->enabled), +msecs_to_jiffies (3000 )); + +switch (wait) { +case 0 : +/* timeout */ + ret = -EBUSY ; +break ; +case -ERESTARTSYS : +/* interrupted by signal */ + ret = -EINTR ; +break ; +default : + ret =0 ; +break ; + } }if (ret != -EINTR ) {Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx