drm: introduce drm_can_sleep and use in intel/radeon drivers.
Subsystems (4)
Dave Airlie
maintainerPATCH 1/1 drm: introduce drm_can_sleep and use in intel/radeon drivers.
From: Dave Airlie <[email protected]>
So we have a few places where the drm drivers would like to sleep to be nice to the system, mainly in the modesetting paths, but we also have two cases were atomic modesetting must take place, panic writing and kernel debugger. So provide a central inline to determine if a sleep or delay should be used and use this in the intel and radeon drivers.
Based on patch from Michel Dänzer <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
--- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/radeon/atom.c | 2 ++ include/drm/drmP.h | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +2 -2
@@ -39,7 +39,7 @@ ret__ = -ETIMEDOUT ; \break ; \ } \ -if (W && !(in_atomic () ||in_dbg_master ()))msleep (W ); \ +if (W &&drm_can_sleep ())msleep (W ); \ } \ ret__; \ })
@@ -48,7 +48,7 @@#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0)#define MSLEEP (x) do { \ - if (in_dbg_master()) \ + if (!drm_can_sleeep()) \ mdelay(x); \ else \ msleep(x); \
drivers/gpu/drm/radeon/atom.c +2 -0
@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (!drm_can_sleep ()) +mdelay (count);else msleep (count); }
include/drm/drmP.h +8 -0
@@ -1696,5 +1696,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_deviceextern int drm_get_platform_dev (struct platform_device *pdev,struct drm_driver *driver); +/* returns true if currently okay to sleep */ +static __inline__bool drm_can_sleep (void ) +{ +if (in_atomic () ||in_dbg_master () ||irqs_disabled ()) +return false; +return true; +} +#endif /* __KERNEL__ */ #endif
Signature · 6 lines
1.7.7.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 23 lines · Dave Airlie
From: Dave Airlie <[email protected]>
So we have a few places where the drm drivers would like to sleep to be nice to the system, mainly in the modesetting paths, but we also have two cases were atomic modesetting must take place, panic writing and kernel debugger. So provide a central inline to determine if a sleep or delay should be used and use this in the intel and radeon drivers.
Based on patch from Michel Dänzer <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/radeon/atom.c | 2 ++ include/drm/drmP.h | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_drv.h +0
-0
[...]
drivers/gpu/drm/i915/intel_drv.h line 52
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -48,7 +48,7 @@#define wait_for_atomic (COND ,MS ) _wait_for(COND, MS, 0)#define MSLEEP (x) do { \ - if (in_dbg_master()) \ + if (!drm_can_sleeep()) \ mdelay(x); \
So for MSLEEP it's not enough if it can sleep, it has to be able to 'sleeep'? ;) Looks like this macro is unused.
Looks good to me otherwise, thanks.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Dave Airlie
From: Dave Airlie <[email protected]>
So we have a few places where the drm drivers would like to sleep to be nice to the system, mainly in the modesetting paths, but we also have two cases were atomic modesetting must take place, panic writing and kernel debugger. So provide a central inline to determine if a sleep or delay should be used and use this in the intel and radeon drivers.
Quoted 5 lines
Based on patch from Michel Dänzer <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Dave Airlie <[email protected]>
If MSLEEP is indeed unused, I think it should just die - we have way too much yelling cruft from dri1 yonder lying around that hides important details like this. Otherwise
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 3 lines · Daniel Vetter
If MSLEEP is indeed unused, I think it should just die - we have way too much yelling cruft from dri1 yonder lying around that hides important details like this. Otherwise
It was used, they just happened to all be redundant or mispellings of wait-for-vblank. All the remaining sleeps now look to be away from the atomic paths, and so MSLEEP can die for the time being. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Dave Airlie
maintainerQuoted 11 lines
Quoted 11 lines
So we have a few places where the drm drivers would like to sleep to be nice to the system, mainly in the modesetting paths, but we also have two cases were atomic modesetting must take place, panic writing and kernel debugger. So provide a central inline to determine if a sleep or delay should be used and use this in the intel and radeon drivers.
Based on patch from Michel Dänzer <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Quoted 7 lines
Quoted 1 line
Signed-off-by Dave Airlie <[email protected]>If MSLEEP is indeed unused, I think it should just die - we have way too much yelling cruft from dri1 yonder lying around that hides important details like this. Otherwise
Reviewed-by Daniel Vetter <[email protected]>
I've pushed the version that just drops MSLEEP since nobody used it.
Thanks,
Dave.