drm/atomic: Rename async parameter to nonblocking.

This is the first step of renaming async commit to nonblocking commit.
The flag passed by userspace is NONBLOCKING, and async has a different
meaning for page flips, where it means as soon as possible.

Fixing up comments in drm core is done manually, to make sure I didn't
miss anything.

For drivers, the following cocci script is used to rename bool async to bool
nonblock:
@@
identifier I =~ "^async";
identifier func;
@@
func(..., bool
- I
+ nonblock
, ...)
{
<...
- I
+ nonblock
...>
}
@@
identifier func;
type T;
identifier I =~ "^async";
@@
T func(..., bool
- I
+ nonblock
, ...);

Thanks to Tvrtko Ursulin for the cocci script.

Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1461679905-30177-2-git-send-email-maarten.lankhorst@linux.intel.com
This commit is contained in:
Maarten Lankhorst 2016-04-26 16:11:34 +02:00 committed by Daniel Vetter
parent e375882406
commit 286dbb8d5d
3 changed files with 20 additions and 20 deletions

View file

@ -1114,13 +1114,13 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
* drm_atomic_helper_commit - commit validated state object * drm_atomic_helper_commit - commit validated state object
* @dev: DRM device * @dev: DRM device
* @state: the driver state object * @state: the driver state object
* @async: asynchronous commit * @nonblocking: whether nonblocking behavior is requested.
* *
* This function commits a with drm_atomic_helper_check() pre-validated state * This function commits a with drm_atomic_helper_check() pre-validated state
* object. This can still fail when e.g. the framebuffer reservation fails. For * object. This can still fail when e.g. the framebuffer reservation fails. For
* now this doesn't implement asynchronous commits. * now this doesn't implement nonblocking commits.
* *
* Note that right now this function does not support async commits, and hence * Note that right now this function does not support nonblocking commits, hence
* driver writers must implement their own version for now. Also note that the * driver writers must implement their own version for now. Also note that the
* default ordering of how the various stages are called is to match the legacy * default ordering of how the various stages are called is to match the legacy
* modeset helper library closest. One peculiarity of that is that it doesn't * modeset helper library closest. One peculiarity of that is that it doesn't
@ -1141,11 +1141,11 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);
*/ */
int drm_atomic_helper_commit(struct drm_device *dev, int drm_atomic_helper_commit(struct drm_device *dev,
struct drm_atomic_state *state, struct drm_atomic_state *state,
bool async) bool nonblock)
{ {
int ret; int ret;
if (async) if (nonblock)
return -EBUSY; return -EBUSY;
ret = drm_atomic_helper_prepare_planes(dev, state); ret = drm_atomic_helper_prepare_planes(dev, state);
@ -1195,20 +1195,20 @@ int drm_atomic_helper_commit(struct drm_device *dev,
EXPORT_SYMBOL(drm_atomic_helper_commit); EXPORT_SYMBOL(drm_atomic_helper_commit);
/** /**
* DOC: implementing async commit * DOC: implementing nonblocking commit
* *
* For now the atomic helpers don't support async commit directly. If there is * For now the atomic helpers don't support nonblocking commit directly. If
* real need it could be added though, using the dma-buf fence infrastructure * there is real need it could be added though, using the dma-buf fence
* for generic synchronization with outstanding rendering. * infrastructure for generic synchronization with outstanding rendering.
* *
* For now drivers have to implement async commit themselves, with the following * For now drivers have to implement nonblocking commit themselves, with the
* sequence being the recommended one: * following sequence being the recommended one:
* *
* 1. Run drm_atomic_helper_prepare_planes() first. This is the only function * 1. Run drm_atomic_helper_prepare_planes() first. This is the only function
* which commit needs to call which can fail, so we want to run it first and * which commit needs to call which can fail, so we want to run it first and
* synchronously. * synchronously.
* *
* 2. Synchronize with any outstanding asynchronous commit worker threads which * 2. Synchronize with any outstanding nonblocking commit worker threads which
* might be affected the new state update. This can be done by either cancelling * might be affected the new state update. This can be done by either cancelling
* or flushing the work items, depending upon whether the driver can deal with * or flushing the work items, depending upon whether the driver can deal with
* cancelled updates. Note that it is important to ensure that the framebuffer * cancelled updates. Note that it is important to ensure that the framebuffer
@ -1222,9 +1222,9 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
* 3. The software state is updated synchronously with * 3. The software state is updated synchronously with
* drm_atomic_helper_swap_state(). Doing this under the protection of all modeset * drm_atomic_helper_swap_state(). Doing this under the protection of all modeset
* locks means concurrent callers never see inconsistent state. And doing this * locks means concurrent callers never see inconsistent state. And doing this
* while it's guaranteed that no relevant async worker runs means that async * while it's guaranteed that no relevant nonblocking worker runs means that
* workers do not need grab any locks. Actually they must not grab locks, for * nonblocking workers do not need grab any locks. Actually they must not grab
* otherwise the work flushing will deadlock. * locks, for otherwise the work flushing will deadlock.
* *
* 4. Schedule a work item to do all subsequent steps, using the split-out * 4. Schedule a work item to do all subsequent steps, using the split-out
* commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and * commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and

View file

@ -40,7 +40,7 @@ int drm_atomic_helper_check(struct drm_device *dev,
struct drm_atomic_state *state); struct drm_atomic_state *state);
int drm_atomic_helper_commit(struct drm_device *dev, int drm_atomic_helper_commit(struct drm_device *dev,
struct drm_atomic_state *state, struct drm_atomic_state *state,
bool async); bool nonblock);
void drm_atomic_helper_wait_for_fences(struct drm_device *dev, void drm_atomic_helper_wait_for_fences(struct drm_device *dev,
struct drm_atomic_state *state); struct drm_atomic_state *state);

View file

@ -1887,7 +1887,7 @@ struct drm_mode_config_funcs {
* drm_atomic_helper_commit(), or one of the exported sub-functions of * drm_atomic_helper_commit(), or one of the exported sub-functions of
* it. * it.
* *
* Asynchronous commits (as indicated with the async parameter) must * Nonblocking commits (as indicated with the nonblock parameter) must
* do any preparatory work which might result in an unsuccessful commit * do any preparatory work which might result in an unsuccessful commit
* in the context of this callback. The only exceptions are hardware * in the context of this callback. The only exceptions are hardware
* errors resulting in -EIO. But even in that case the driver must * errors resulting in -EIO. But even in that case the driver must
@ -1900,7 +1900,7 @@ struct drm_mode_config_funcs {
* The driver must wait for any pending rendering to the new * The driver must wait for any pending rendering to the new
* framebuffers to complete before executing the flip. It should also * framebuffers to complete before executing the flip. It should also
* wait for any pending rendering from other drivers if the underlying * wait for any pending rendering from other drivers if the underlying
* buffer is a shared dma-buf. Asynchronous commits must not wait for * buffer is a shared dma-buf. Nonblocking commits must not wait for
* rendering in the context of this callback. * rendering in the context of this callback.
* *
* An application can request to be notified when the atomic commit has * An application can request to be notified when the atomic commit has
@ -1931,7 +1931,7 @@ struct drm_mode_config_funcs {
* *
* 0 on success or one of the below negative error codes: * 0 on success or one of the below negative error codes:
* *
* - -EBUSY, if an asynchronous updated is requested and there is * - -EBUSY, if a nonblocking updated is requested and there is
* an earlier updated pending. Drivers are allowed to support a queue * an earlier updated pending. Drivers are allowed to support a queue
* of outstanding updates, but currently no driver supports that. * of outstanding updates, but currently no driver supports that.
* Note that drivers must wait for preceding updates to complete if a * Note that drivers must wait for preceding updates to complete if a
@ -1961,7 +1961,7 @@ struct drm_mode_config_funcs {
*/ */
int (*atomic_commit)(struct drm_device *dev, int (*atomic_commit)(struct drm_device *dev,
struct drm_atomic_state *state, struct drm_atomic_state *state,
bool async); bool nonblock);
/** /**
* @atomic_state_alloc: * @atomic_state_alloc: