Re: [PATCH 28/28] drm/atomic-helper: Reject legacy flips on a disabled pipe

Thierry Reding
2015-12-07T15:25:49Z

[-- Attachment #1.1: Type: text/plain, Size: 2270 bytes --]

On Fri, Dec 04, 2015 at 09:46:09AM +0100, Daniel Vetter wrote:
> We want this for consistency with existing page_flip semantics.
>
> Since this spurred quite a discussion on IRC also document why we
> reject even generation when the pipe is off: It's not that it's hard
> to implement, but userspace has a track recording proofing that it's
> way too easy to accidentally abuse and cause havoc. We want to make
> sure userspace doesn't get away with that.
>
> Cc: Daniel Stone <daniels@collabora.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_atomic.c | 9 +++++++++
> drivers/gpu/drm/drm_atomic_helper.c | 8 ++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 7426d40017a0..06cdb52907da 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1265,6 +1265,15 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
> if (config->funcs->atomic_check)
> ret = config->funcs->atomic_check(state->dev, state);
>
> + /*
> + * Reject event generation for when a CRTC is off and stays off. It
> + * wouldn't be hard to implement this, but userspace has a track record
> + * of happily burning through 100% cpu (or worse, crash) when the
> + * display pipe is suspended. To avoid all that fun just reject updates
> + * that ask for events since likely that indicates a bug in the
> + * compositors drawing loop. This is consistent with the vblank ioctl

"compositor's".

> + * which also rejects service on a disabled pipe.
> + */
> if (!state->allow_modeset) {
> for_each_crtc_in_state(state, crtc, crtc_state, i) {
> if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 110f3db8dd05..8e281a96c35f 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2283,6 +2283,14 @@ retry:
> goto fail;
> drm_atomic_set_fb_for_plane(plane_state, fb);
>
> + state->allow_modeset = false;

Perhaps explain the reason for setting this?

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]