Userspace calls the atomic ioctl with DRM_MODE_ATOMIC_NONBLOCK when it doesn't want the ioctl to block for completion.
In the kernel it's called async commit, which is confusing. The legacy pageflip and atomic ioctl also have a flag DRM_MODE_PAGE_FLIP_ASYNC which means that the flip should happen as soon as possible, even if it causes tearing.
Because of this we should rename async commit to nonblocking commit, which should reduce a lot of the confusion.
This is done partially with a cocci script, and inspection by hand because cocci doesn't patch comments.
Maarten Lankhorst (12): drm/atomic: Rename async parameter to nonblocking. drm/atomic: Rename drm_atomic_async_commit to nonblocking. drm/arm/hdlcd: Rename async to nonblock. drm/exynos: Rename async to nonblock. drm/msm: Rename async to nonblock. drm/omapdrm: Rename async to nonblock. drm/rcar-du: Rename async to nonblock. drm/sti: Rename async to nonblock. drm/tegra: Rename async to nonblock. drm/rockchip: Rename async to nonblock. drm/vc4: Rename async to nonblock. drm/i915: Rename async to nonblock.
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/drm_atomic.c | 12 +++++------ drivers/gpu/drm/drm_atomic_helper.c | 34 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 16 +++++++------- drivers/gpu/drm/msm/msm_atomic.c | 9 ++++---- drivers/gpu/drm/msm/msm_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 +++-- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++--- drivers/gpu/drm/sti/sti_drv.c | 6 +++--- drivers/gpu/drm/tegra/drm.c | 6 +++--- drivers/gpu/drm/vc4/vc4_kms.c | 6 +++--- include/drm/drm_atomic.h | 2 +- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 8 +++---- 17 files changed, 63 insertions(+), 63 deletions(-)
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 --- drivers/gpu/drm/drm_atomic_helper.c | 30 +++++++++++++++--------------- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 40c7b268a9bc..297713bab549 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1114,13 +1114,13 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); * drm_atomic_helper_commit - commit validated state object * @dev: DRM device * @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 * 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 * 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 @@ -1141,11 +1141,11 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); */ int drm_atomic_helper_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { int ret;
- if (async) + if (nonblock) return -EBUSY;
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);
/** - * DOC: implementing async commit + * DOC: implementing nonblocking commit * - * For now the atomic helpers don't support async commit directly. If there is - * real need it could be added though, using the dma-buf fence infrastructure - * for generic synchronization with outstanding rendering. + * For now the atomic helpers don't support nonblocking commit directly. If + * there is real need it could be added though, using the dma-buf fence + * infrastructure for generic synchronization with outstanding rendering. * - * For now drivers have to implement async commit themselves, with the following - * sequence being the recommended one: + * For now drivers have to implement nonblocking commit themselves, with the + * following sequence being the recommended one: * * 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 * 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 * 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 @@ -1222,9 +1222,9 @@ EXPORT_SYMBOL(drm_atomic_helper_commit); * 3. The software state is updated synchronously with * drm_atomic_helper_swap_state(). Doing this under the protection of all modeset * locks means concurrent callers never see inconsistent state. And doing this - * while it's guaranteed that no relevant async worker runs means that async - * workers do not need grab any locks. Actually they must not grab locks, for - * otherwise the work flushing will deadlock. + * while it's guaranteed that no relevant nonblocking worker runs means that + * nonblocking workers do not need grab any locks. Actually they must not grab + * locks, for otherwise the work flushing will deadlock. * * 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 diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index fe9d89c7d1ed..03642878bc51 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -40,7 +40,7 @@ int drm_atomic_helper_check(struct drm_device *dev, struct drm_atomic_state *state); int drm_atomic_helper_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async); + bool nonblock);
void drm_atomic_helper_wait_for_fences(struct drm_device *dev, struct drm_atomic_state *state); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 43c31496a5a7..800c48e80811 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1887,7 +1887,7 @@ struct drm_mode_config_funcs { * drm_atomic_helper_commit(), or one of the exported sub-functions of * 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 * in the context of this callback. The only exceptions are hardware * 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 * framebuffers to complete before executing the flip. It should also * 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. * * 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: * - * - -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 * of outstanding updates, but currently no driver supports that. * 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, struct drm_atomic_state *state, - bool async); + bool nonblock);
/** * @atomic_state_alloc:
Another step in renaming async to nonblocking for atomic commit.
Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/drm_atomic.c | 12 ++++++------ drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- include/drm/drm_atomic.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 8ee1db866e80..c5ebcdca67d4 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -143,7 +143,7 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) continue;
/* - * FIXME: Async commits can race with connector unplugging and + * FIXME: Nonblocking commits can race with connector unplugging and * there's currently nothing that prevents cleanup up state for * deleted connectors. As long as the callback doesn't look at * the connector we'll be fine though, so make sure that's the @@ -1388,7 +1388,7 @@ int drm_atomic_commit(struct drm_atomic_state *state) EXPORT_SYMBOL(drm_atomic_commit);
/** - * drm_atomic_async_commit - atomic&async configuration commit + * drm_atomic_nonblocking_commit - atomic&nonblocking configuration commit * @state: atomic configuration to check * * Note that this function can return -EDEADLK if the driver needed to acquire @@ -1403,7 +1403,7 @@ EXPORT_SYMBOL(drm_atomic_commit); * Returns: * 0 on success, negative error code on failure. */ -int drm_atomic_async_commit(struct drm_atomic_state *state) +int drm_atomic_nonblocking_commit(struct drm_atomic_state *state) { struct drm_mode_config *config = &state->dev->mode_config; int ret; @@ -1412,11 +1412,11 @@ int drm_atomic_async_commit(struct drm_atomic_state *state) if (ret) return ret;
- DRM_DEBUG_ATOMIC("commiting %p asynchronously\n", state); + DRM_DEBUG_ATOMIC("commiting %p nonblocking\n", state);
return config->funcs->atomic_commit(state->dev, state, true); } -EXPORT_SYMBOL(drm_atomic_async_commit); +EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
/* * The big monstor ioctl @@ -1685,7 +1685,7 @@ retry: */ ret = drm_atomic_check_only(state); } else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) { - ret = drm_atomic_async_commit(state); + ret = drm_atomic_nonblocking_commit(state); } else { ret = drm_atomic_commit(state); } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 297713bab549..b04662e0e608 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2371,11 +2371,11 @@ retry: goto fail; }
- ret = drm_atomic_async_commit(state); + ret = drm_atomic_nonblocking_commit(state); if (ret != 0) goto fail;
- /* Driver takes ownership of state on successful async commit. */ + /* Driver takes ownership of state on successful commit. */ return 0; fail: if (ret == -EDEADLK) diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index d3eaa5df187a..92c84e9ab09a 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -137,7 +137,7 @@ drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret);
int __must_check drm_atomic_check_only(struct drm_atomic_state *state); int __must_check drm_atomic_commit(struct drm_atomic_state *state); -int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); +int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
#define for_each_connector_in_state(state, connector, connector_state, __i) \ for ((__i) = 0; \
The async name is deprecated and should be changed to nonblocking.
Cc: Liviu Dudau liviu.dudau@arm.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 3ac1ae4d8caf..734899c4e4bb 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -113,7 +113,7 @@ static void hdlcd_fb_output_poll_changed(struct drm_device *drm) }
static int hdlcd_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, bool nonblock) { return drm_atomic_helper_commit(dev, state, false); }
On Tue, Apr 26, 2016 at 04:11:36PM +0200, Maarten Lankhorst wrote:
The async name is deprecated and should be changed to nonblocking.
Cc: Liviu Dudau liviu.dudau@arm.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
Acked-by: Liviu Dudau liviu.dudau@arm.com
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 3ac1ae4d8caf..734899c4e4bb 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -113,7 +113,7 @@ static void hdlcd_fb_output_poll_changed(struct drm_device *drm) }
static int hdlcd_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state, bool async)
struct drm_atomic_state *state, bool nonblock)
{ return drm_atomic_helper_commit(dev, state, false); } -- 2.5.5
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
The async name is deprecated and should be changed to nonblocking.
Cc: Inki Dae inki.dae@samsung.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 5344940c8a07..8ff355ddcf51 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -270,7 +270,7 @@ static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs) }
int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { struct exynos_drm_private *priv = dev->dev_private; struct exynos_atomic_commit *commit; @@ -308,7 +308,7 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
drm_atomic_helper_swap_state(dev, state);
- if (async) + if (nonblock) schedule_work(&commit->work); else exynos_atomic_commit_complete(commit); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 502f750bad2a..e50c09b4dce1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -296,7 +296,7 @@ static inline int exynos_dpi_bind(struct drm_device *dev, #endif
int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async); + bool nonblock);
extern struct platform_driver fimd_driver;
The async name is deprecated and should be changed to nonblocking.
Also comments seem to be a bit outdated, as it looks like nonblocking commit is supported by msm.
Cc: Rob Clark robdclark@gmail.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/msm/msm_atomic.c | 9 ++++----- drivers/gpu/drm/msm/msm_drv.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 7eb253bc24df..5c6130969f4d 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -190,17 +190,16 @@ int msm_atomic_check(struct drm_device *dev, * drm_atomic_helper_commit - commit validated state object * @dev: DRM device * @state: the driver state object - * @async: asynchronous commit + * @nonblock: nonblocking commit * * 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 - * now this doesn't implement asynchronous commits. + * object. This can still fail when e.g. the framebuffer reservation fails. * * RETURNS * Zero for success or -errno. */ int msm_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, bool nonblock) { int nplanes = dev->mode_config.num_total_plane; int ncrtcs = dev->mode_config.num_crtc; @@ -276,7 +275,7 @@ int msm_atomic_commit(struct drm_device *dev, * current layout. */
- if (async) { + if (nonblock) { msm_queue_fence_cb(dev, &c->fence_cb, c->fence); return 0; } diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 870dbe58c259..0b8b0e630e42 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -174,7 +174,7 @@ void __msm_fence_worker(struct work_struct *work); int msm_atomic_check(struct drm_device *dev, struct drm_atomic_state *state); int msm_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool async); + struct drm_atomic_state *state, bool nonblock);
int msm_register_mmu(struct drm_device *dev, struct msm_mmu *mmu);
The async name is deprecated and should be changed to nonblocking.
Cc: Tomi Valkeinen tomi.valkeinen@ti.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 80398a684cae..fe794980f1c8 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -138,7 +138,7 @@ static bool omap_atomic_is_pending(struct omap_drm_private *priv, }
static int omap_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, bool nonblock) { struct omap_drm_private *priv = dev->dev_private; struct omap_atomic_state_commit *commit; @@ -177,7 +177,7 @@ static int omap_atomic_commit(struct drm_device *dev, /* Swap the state, this is the point of no return. */ drm_atomic_helper_swap_state(dev, state);
- if (async) + if (nonblock) schedule_work(&commit->work); else omap_atomic_complete(commit);
The async name is deprecated and should be changed to nonblocking.
Cc: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 24725bf859b4..e70a4f33d970 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -283,7 +283,8 @@ static void rcar_du_atomic_work(struct work_struct *work) }
static int rcar_du_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, + bool nonblock) { struct rcar_du_device *rcdu = dev->dev_private; struct rcar_du_commit *commit; @@ -328,7 +329,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev, /* Swap the state, this is the point of no return. */ drm_atomic_helper_swap_state(dev, state);
- if (async) + if (nonblock) schedule_work(&commit->work); else rcar_du_atomic_complete(commit);
Hi Maarten,
Thank you for the patch.
On Tuesday 26 Apr 2016 16:11:40 Maarten Lankhorst wrote:
The async name is deprecated and should be changed to nonblocking.
Cc: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
Acked-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 24725bf859b4..e70a4f33d970 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -283,7 +283,8 @@ static void rcar_du_atomic_work(struct work_struct *work) }
static int rcar_du_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state, bool async)
struct drm_atomic_state *state,
bool nonblock)
{ struct rcar_du_device *rcdu = dev->dev_private; struct rcar_du_commit *commit; @@ -328,7 +329,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev, /* Swap the state, this is the point of no return. */ drm_atomic_helper_swap_state(dev, state);
- if (async)
- if (nonblock) schedule_work(&commit->work); else rcar_du_atomic_complete(commit);
The async name is deprecated and should be changed to nonblocking.
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Cc: Vincent Abriou vincent.abriou@st.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/sti/sti_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 6bd6abaa5a70..872495e72294 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -202,7 +202,7 @@ static void sti_atomic_work(struct work_struct *work) }
static int sti_atomic_commit(struct drm_device *drm, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, bool nonblock) { struct sti_private *private = drm->dev_private; int err; @@ -211,7 +211,7 @@ static int sti_atomic_commit(struct drm_device *drm, if (err) return err;
- /* serialize outstanding asynchronous commits */ + /* serialize outstanding nonblocking commits */ mutex_lock(&private->commit.lock); flush_work(&private->commit.work);
@@ -223,7 +223,7 @@ static int sti_atomic_commit(struct drm_device *drm,
drm_atomic_helper_swap_state(drm, state);
- if (async) + if (nonblock) sti_atomic_schedule(private, state); else sti_atomic_complete(private, state);
Hi Maarten,
Thanks for the patch. Acked-by: Vincent Abriou vincent.abriou@st.com
On 04/26/2016 04:11 PM, Maarten Lankhorst wrote:
The async name is deprecated and should be changed to nonblocking.
Cc: Benjamin Gaignard benjamin.gaignard@linaro.org Cc: Vincent Abriou vincent.abriou@st.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
drivers/gpu/drm/sti/sti_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 6bd6abaa5a70..872495e72294 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -202,7 +202,7 @@ static void sti_atomic_work(struct work_struct *work) }
static int sti_atomic_commit(struct drm_device *drm,
struct drm_atomic_state *state, bool async)
{ struct sti_private *private = drm->dev_private; int err;struct drm_atomic_state *state, bool nonblock)
@@ -211,7 +211,7 @@ static int sti_atomic_commit(struct drm_device *drm, if (err) return err;
- /* serialize outstanding asynchronous commits */
- /* serialize outstanding nonblocking commits */ mutex_lock(&private->commit.lock); flush_work(&private->commit.work);
@@ -223,7 +223,7 @@ static int sti_atomic_commit(struct drm_device *drm,
drm_atomic_helper_swap_state(drm, state);
- if (async)
- if (nonblock) sti_atomic_schedule(private, state); else sti_atomic_complete(private, state);
The async name is deprecated and should be changed to nonblocking.
Cc: Thierry Reding thierry.reding@gmail.com Cc: "Terje Bergström" tbergstrom@nvidia.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/tegra/drm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 2be88eb0cb83..71a52f4e688b 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -74,7 +74,7 @@ static void tegra_atomic_work(struct work_struct *work) }
static int tegra_atomic_commit(struct drm_device *drm, - struct drm_atomic_state *state, bool async) + struct drm_atomic_state *state, bool nonblock) { struct tegra_drm *tegra = drm->dev_private; int err; @@ -83,7 +83,7 @@ static int tegra_atomic_commit(struct drm_device *drm, if (err) return err;
- /* serialize outstanding asynchronous commits */ + /* serialize outstanding nonblocking commits */ mutex_lock(&tegra->commit.lock); flush_work(&tegra->commit.work);
@@ -95,7 +95,7 @@ static int tegra_atomic_commit(struct drm_device *drm,
drm_atomic_helper_swap_state(drm, state);
- if (async) + if (nonblock) tegra_atomic_schedule(tegra, state); else tegra_atomic_complete(tegra, state);
The async name is deprecated and should be changed to nonblocking.
Cc: Mark Yao mark.yao@rock-chips.com Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 3b8f652698f8..8c10163a95bc 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -276,7 +276,7 @@ void rockchip_drm_atomic_work(struct work_struct *work)
int rockchip_drm_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { struct rockchip_drm_private *private = dev->dev_private; struct rockchip_atomic_commit *commit = &private->commit; @@ -286,7 +286,7 @@ int rockchip_drm_atomic_commit(struct drm_device *dev, if (ret) return ret;
- /* serialize outstanding asynchronous commits */ + /* serialize outstanding nonblocking commits */ mutex_lock(&commit->lock); flush_work(&commit->work);
@@ -295,7 +295,7 @@ int rockchip_drm_atomic_commit(struct drm_device *dev, commit->dev = dev; commit->state = state;
- if (async) + if (nonblock) schedule_work(&commit->work); else rockchip_atomic_commit_complete(commit);
The async name is deprecated and should be changed to nonblocking.
Cc: Eric Anholt eric@anholt.net Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/vc4/vc4_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 4718ae5176cc..d423ba10239a 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -93,7 +93,7 @@ static struct vc4_commit *commit_init(struct drm_atomic_state *state) * vc4_atomic_commit - commit validated state object * @dev: DRM device * @state: the driver state object - * @async: asynchronous commit + * @nonblock: nonblocking commit * * 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 @@ -104,7 +104,7 @@ static struct vc4_commit *commit_init(struct drm_atomic_state *state) */ static int vc4_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { struct vc4_dev *vc4 = to_vc4_dev(dev); int ret; @@ -170,7 +170,7 @@ static int vc4_atomic_commit(struct drm_device *dev, * current layout. */
- if (async) { + if (nonblock) { vc4_queue_seqno_cb(dev, &c->cb, wait_seqno, vc4_atomic_complete_commit_seqno_cb); } else {
The async name is deprecated and should be changed to nonblocking.
Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com --- drivers/gpu/drm/i915/intel_display.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 551541b3038c..5d29b838d8d7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -13386,7 +13386,7 @@ static int intel_atomic_check(struct drm_device *dev,
static int intel_atomic_prepare_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { struct drm_i915_private *dev_priv = dev->dev_private; struct drm_plane_state *plane_state; @@ -13395,8 +13395,8 @@ static int intel_atomic_prepare_commit(struct drm_device *dev, struct drm_crtc *crtc; int i, ret;
- if (async) { - DRM_DEBUG_KMS("i915 does not yet support async commit\n"); + if (nonblock) { + DRM_DEBUG_KMS("i915 does not yet support nonblocking commit\n"); return -EINVAL; }
@@ -13414,7 +13414,7 @@ static int intel_atomic_prepare_commit(struct drm_device *dev, return ret;
ret = drm_atomic_helper_prepare_planes(dev, state); - if (!ret && !async && !i915_reset_in_progress(&dev_priv->gpu_error)) { + if (!ret && !nonblock && !i915_reset_in_progress(&dev_priv->gpu_error)) { u32 reset_counter;
reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); @@ -13519,21 +13519,21 @@ static bool needs_vblank_wait(struct intel_crtc_state *crtc_state) * intel_atomic_commit - commit validated state object * @dev: DRM device * @state: the top-level driver state object - * @async: asynchronous commit + * @nonblock: nonblocking commit * * This function commits a top-level state object that has been validated * with drm_atomic_helper_check(). * * FIXME: Atomic modeset support for i915 is not yet complete. At the moment * we can only handle plane-related operations and do not yet support - * asynchronous commit. + * nonblocking commit. * * RETURNS * Zero for success or -errno. */ static int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, - bool async) + bool nonblock) { struct intel_atomic_state *intel_state = to_intel_atomic_state(state); struct drm_i915_private *dev_priv = dev->dev_private; @@ -13545,7 +13545,7 @@ static int intel_atomic_commit(struct drm_device *dev, unsigned long put_domains[I915_MAX_PIPES] = {}; unsigned crtc_vblank_mask = 0;
- ret = intel_atomic_prepare_commit(dev, state, async); + ret = intel_atomic_prepare_commit(dev, state, nonblock); if (ret) { DRM_DEBUG_ATOMIC("Preparing state failed with %i\n", ret); return ret;
On Tue, Apr 26, 2016 at 04:11:33PM +0200, Maarten Lankhorst wrote:
Userspace calls the atomic ioctl with DRM_MODE_ATOMIC_NONBLOCK when it doesn't want the ioctl to block for completion.
In the kernel it's called async commit, which is confusing. The legacy pageflip and atomic ioctl also have a flag DRM_MODE_PAGE_FLIP_ASYNC which means that the flip should happen as soon as possible, even if it causes tearing.
Because of this we should rename async commit to nonblocking commit, which should reduce a lot of the confusion.
This is done partially with a cocci script, and inspection by hand because cocci doesn't patch comments.
Maarten Lankhorst (12): drm/atomic: Rename async parameter to nonblocking. drm/atomic: Rename drm_atomic_async_commit to nonblocking. drm/arm/hdlcd: Rename async to nonblock. drm/exynos: Rename async to nonblock. drm/msm: Rename async to nonblock. drm/omapdrm: Rename async to nonblock. drm/rcar-du: Rename async to nonblock. drm/sti: Rename async to nonblock. drm/tegra: Rename async to nonblock. drm/rockchip: Rename async to nonblock. drm/vc4: Rename async to nonblock. drm/i915: Rename async to nonblock.
Yeah, this clarifies stuff a lot imo. Bit a funny split-up in the first two patches, but meh.
I think I'll apply it all to drm-misc once driver maintainers had some time to ack, but will merge anyway if they miss. -Daniel
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/drm_atomic.c | 12 +++++------ drivers/gpu/drm/drm_atomic_helper.c | 34 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 16 +++++++------- drivers/gpu/drm/msm/msm_atomic.c | 9 ++++---- drivers/gpu/drm/msm/msm_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 +++-- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++--- drivers/gpu/drm/sti/sti_drv.c | 6 +++--- drivers/gpu/drm/tegra/drm.c | 6 +++--- drivers/gpu/drm/vc4/vc4_kms.c | 6 +++--- include/drm/drm_atomic.h | 2 +- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 8 +++---- 17 files changed, 63 insertions(+), 63 deletions(-)
-- 2.5.5
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Tue, Apr 26, 2016 at 04:34:05PM +0200, Daniel Vetter wrote:
On Tue, Apr 26, 2016 at 04:11:33PM +0200, Maarten Lankhorst wrote:
Userspace calls the atomic ioctl with DRM_MODE_ATOMIC_NONBLOCK when it doesn't want the ioctl to block for completion.
In the kernel it's called async commit, which is confusing. The legacy pageflip and atomic ioctl also have a flag DRM_MODE_PAGE_FLIP_ASYNC which means that the flip should happen as soon as possible, even if it causes tearing.
Because of this we should rename async commit to nonblocking commit, which should reduce a lot of the confusion.
This is done partially with a cocci script, and inspection by hand because cocci doesn't patch comments.
Maarten Lankhorst (12): drm/atomic: Rename async parameter to nonblocking. drm/atomic: Rename drm_atomic_async_commit to nonblocking. drm/arm/hdlcd: Rename async to nonblock. drm/exynos: Rename async to nonblock. drm/msm: Rename async to nonblock. drm/omapdrm: Rename async to nonblock. drm/rcar-du: Rename async to nonblock. drm/sti: Rename async to nonblock. drm/tegra: Rename async to nonblock. drm/rockchip: Rename async to nonblock. drm/vc4: Rename async to nonblock. drm/i915: Rename async to nonblock.
Yeah, this clarifies stuff a lot imo. Bit a funny split-up in the first two patches, but meh.
I think I'll apply it all to drm-misc once driver maintainers had some time to ack, but will merge anyway if they miss.
Ok, pulled this all into drm-misc. There's new drivers now in drm-next, can you please re-run the cocci for those?
Thanks, Daniel
-Daniel
drivers/gpu/drm/arm/hdlcd_drv.c | 2 +- drivers/gpu/drm/drm_atomic.c | 12 +++++------ drivers/gpu/drm/drm_atomic_helper.c | 34 +++++++++++++++--------------- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 16 +++++++------- drivers/gpu/drm/msm/msm_atomic.c | 9 ++++---- drivers/gpu/drm/msm/msm_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 +++-- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++--- drivers/gpu/drm/sti/sti_drv.c | 6 +++--- drivers/gpu/drm/tegra/drm.c | 6 +++--- drivers/gpu/drm/vc4/vc4_kms.c | 6 +++--- include/drm/drm_atomic.h | 2 +- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 8 +++---- 17 files changed, 63 insertions(+), 63 deletions(-)
-- 2.5.5
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
dri-devel@lists.freedesktop.org