Commit f02ad907 authored by Daniel Vetter's avatar Daniel Vetter

drm/atomic-helpers: Recover full cursor plane behaviour

Cursor plane updates have historically been fully async and mutliple
updates batched together for the next vsync. And userspace relies upon
that. Since implementing a full queue of async atomic updates is a bit
of work lets just recover the cursor specific behaviour with a hint
flag and some hacks to drop the vblank wait.

v2: Fix kerneldoc, reported by Wu Fengguang.
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent b486e0e6
...@@ -909,6 +909,11 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, ...@@ -909,6 +909,11 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
if (!crtc->state->enable) if (!crtc->state->enable)
continue; continue;
/* Legacy cursor ioctls are completely unsynced, and userspace
* relies on that (by doing tons of cursor updates). */
if (old_state->legacy_cursor_update)
continue;
if (!framebuffer_changed(dev, old_state, crtc)) if (!framebuffer_changed(dev, old_state, crtc))
continue; continue;
...@@ -1335,6 +1340,9 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane, ...@@ -1335,6 +1340,9 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
if (ret != 0) if (ret != 0)
goto fail; goto fail;
if (plane == crtc->cursor)
state->legacy_cursor_update = true;
/* Driver takes ownership of state on successful commit. */ /* Driver takes ownership of state on successful commit. */
return 0; return 0;
fail: fail:
...@@ -1410,6 +1418,9 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane) ...@@ -1410,6 +1418,9 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane)
plane_state->src_h = 0; plane_state->src_h = 0;
plane_state->src_w = 0; plane_state->src_w = 0;
if (plane == plane->crtc->cursor)
state->legacy_cursor_update = true;
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
if (ret != 0) if (ret != 0)
goto fail; goto fail;
......
...@@ -909,6 +909,7 @@ struct drm_bridge { ...@@ -909,6 +909,7 @@ struct drm_bridge {
* struct struct drm_atomic_state - the global state object for atomic updates * struct struct drm_atomic_state - the global state object for atomic updates
* @dev: parent DRM device * @dev: parent DRM device
* @allow_modeset: allow full modeset * @allow_modeset: allow full modeset
* @legacy_cursor_update: hint to enforce legacy cursor ioctl semantics
* @planes: pointer to array of plane pointers * @planes: pointer to array of plane pointers
* @plane_states: pointer to array of plane states pointers * @plane_states: pointer to array of plane states pointers
* @crtcs: pointer to array of CRTC pointers * @crtcs: pointer to array of CRTC pointers
...@@ -921,6 +922,7 @@ struct drm_bridge { ...@@ -921,6 +922,7 @@ struct drm_bridge {
struct drm_atomic_state { struct drm_atomic_state {
struct drm_device *dev; struct drm_device *dev;
bool allow_modeset : 1; bool allow_modeset : 1;
bool legacy_cursor_update : 1;
struct drm_plane **planes; struct drm_plane **planes;
struct drm_plane_state **plane_states; struct drm_plane_state **plane_states;
struct drm_crtc **crtcs; struct drm_crtc **crtcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment