In atomic path, the crtc_state->async_flip is being used. Its commented in drm_crtc.h that async_flip in crtc_state is to be used with the legacy page_flip ioctl for async flips and not in atomic path. Morever this limits of enabling async flip only on one plane even though hardware supports them on all the planes. Retaining the present implementation, support for using async_flip plane property is added. Further checks for async flip will be done in the driver specific atomic_check()
Signed-off-by: Arun R Murthy <[email protected]> --- drivers/gpu/drm/drm_atomic_uapi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 7773e0057302fccb57df8067f417b23a9cb9fcde..111afc8e07aa531d03d237c61cb4b8216d645fb6 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1075,6 +1075,11 @@ int drm_atomic_set_property(struct drm_atomic_state *state, struct drm_mode_config *config = &plane->dev->mode_config; const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private; + if (async_flip && plane->async_flip_property) { + drm_err(prop->dev, "driver has plane async_flip property, dont use the legacy one\n"); + return -EINVAL; + } + plane_state = drm_atomic_get_plane_state(state, plane); if (IS_ERR(plane_state)) { ret = PTR_ERR(plane_state); @@ -1377,9 +1382,22 @@ static void set_async_flip(struct drm_atomic_state *state) { struct drm_crtc *crtc; + struct drm_plane *plane; struct drm_crtc_state *crtc_state; + struct drm_plane_state *plane_state; int i; + /* + * Async flip is being set with plane async_flip property then bypass + * the legacy async path in atomic_ioctl. + * TODO: the below legacy path should be removed once all drivers + * start using the async_flip plane property. + */ + for_each_new_plane_in_state(state, plane, plane_state, i) { + if (plane_state->async_flip) + return; + } + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { crtc_state->async_flip = true; } -- 2.25.1
