* [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
@ 2018-03-30 14:55 Boris Brezillon
2018-03-30 18:39 ` Eric Anholt
2018-04-18 7:07 ` Boris Brezillon
0 siblings, 2 replies; 5+ messages in thread
From: Boris Brezillon @ 2018-03-30 14:55 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, dri-devel; +Cc: Boris Brezillon
->atomic_async_update() requires that drivers update the plane->state
object before returning. Make sure at least common properties have been
updated.
Cc: Gustavo Padovan <gustavo@padovan.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
Hello,
This is a problem I had when debugging the VC4 ->atomic_async_update()
implementation. The function was not updating plane->fb as it's
supposed thus leaving plane->state->fb in an inconsistent state after
each async update.
Not sure if such WARN_ON_ONCE() are accepted in the core though, so
I'll maintainers decide whether this is relevant or not and whether
they prefer to have WARN_ON() or DRM_ERROR() messages.
Regards,
Boris
---
drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c35654591c12..d2b2583487ee 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1561,6 +1561,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev,
for_each_new_plane_in_state(state, plane, plane_state, i) {
funcs = plane->helper_private;
funcs->atomic_async_update(plane, plane_state);
+
+ /*
+ * ->atomic_async_update() is supposed to update the
+ * plane->state in-place, make sure at least common
+ * properties have been properly updated.
+ */
+ WARN_ON_ONCE(plane->state->fb != plane_state->fb);
+ WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x);
+ WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y);
+ WARN_ON_ONCE(plane->state->src_x != plane_state->src_x);
+ WARN_ON_ONCE(plane->state->src_y != plane_state->src_y);
}
}
EXPORT_SYMBOL(drm_atomic_helper_async_commit);
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
2018-03-30 14:55 [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit() Boris Brezillon
@ 2018-03-30 18:39 ` Eric Anholt
2018-04-02 15:45 ` Sean Paul
2018-04-18 7:07 ` Boris Brezillon
1 sibling, 1 reply; 5+ messages in thread
From: Eric Anholt @ 2018-03-30 18:39 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, dri-devel; +Cc: Boris Brezillon
[-- Attachment #1.1: Type: text/plain, Size: 863 bytes --]
Boris Brezillon <boris.brezillon@bootlin.com> writes:
> ->atomic_async_update() requires that drivers update the plane->state
> object before returning. Make sure at least common properties have been
> updated.
>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> Hello,
>
> This is a problem I had when debugging the VC4 ->atomic_async_update()
> implementation. The function was not updating plane->fb as it's
> supposed thus leaving plane->state->fb in an inconsistent state after
> each async update.
>
> Not sure if such WARN_ON_ONCE() are accepted in the core though, so
> I'll maintainers decide whether this is relevant or not and whether
> they prefer to have WARN_ON() or DRM_ERROR() messages.
I'm a huge fan of this kind of safety check. FWIW,
Acked-by: Eric Anholt <eric@anholt.net>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
2018-03-30 18:39 ` Eric Anholt
@ 2018-04-02 15:45 ` Sean Paul
2018-04-03 9:23 ` Daniel Vetter
0 siblings, 1 reply; 5+ messages in thread
From: Sean Paul @ 2018-04-02 15:45 UTC (permalink / raw)
To: Eric Anholt; +Cc: David Airlie, Boris Brezillon, dri-devel
On Fri, Mar 30, 2018 at 11:39:05AM -0700, Eric Anholt wrote:
> Boris Brezillon <boris.brezillon@bootlin.com> writes:
>
> > ->atomic_async_update() requires that drivers update the plane->state
> > object before returning. Make sure at least common properties have been
> > updated.
> >
> > Cc: Gustavo Padovan <gustavo@padovan.org>
> > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > ---
> > Hello,
> >
> > This is a problem I had when debugging the VC4 ->atomic_async_update()
> > implementation. The function was not updating plane->fb as it's
> > supposed thus leaving plane->state->fb in an inconsistent state after
> > each async update.
> >
> > Not sure if such WARN_ON_ONCE() are accepted in the core though, so
> > I'll maintainers decide whether this is relevant or not and whether
> > they prefer to have WARN_ON() or DRM_ERROR() messages.
>
> I'm a huge fan of this kind of safety check. FWIW,
>
> Acked-by: Eric Anholt <eric@anholt.net>
Agreed, seems like a useful safety net to me.
Acked-by: Sean Paul <seanpaul@chromium.org>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
2018-04-02 15:45 ` Sean Paul
@ 2018-04-03 9:23 ` Daniel Vetter
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2018-04-03 9:23 UTC (permalink / raw)
To: Sean Paul; +Cc: David Airlie, dri-devel, Boris Brezillon
On Mon, Apr 02, 2018 at 11:45:31AM -0400, Sean Paul wrote:
> On Fri, Mar 30, 2018 at 11:39:05AM -0700, Eric Anholt wrote:
> > Boris Brezillon <boris.brezillon@bootlin.com> writes:
> >
> > > ->atomic_async_update() requires that drivers update the plane->state
> > > object before returning. Make sure at least common properties have been
> > > updated.
> > >
> > > Cc: Gustavo Padovan <gustavo@padovan.org>
> > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > ---
> > > Hello,
> > >
> > > This is a problem I had when debugging the VC4 ->atomic_async_update()
> > > implementation. The function was not updating plane->fb as it's
> > > supposed thus leaving plane->state->fb in an inconsistent state after
> > > each async update.
> > >
> > > Not sure if such WARN_ON_ONCE() are accepted in the core though, so
> > > I'll maintainers decide whether this is relevant or not and whether
> > > they prefer to have WARN_ON() or DRM_ERROR() messages.
> >
> > I'm a huge fan of this kind of safety check. FWIW,
> >
> > Acked-by: Eric Anholt <eric@anholt.net>
>
> Agreed, seems like a useful safety net to me.
>
> Acked-by: Sean Paul <seanpaul@chromium.org>
Yeah, makes sense.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
>
>
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
2018-03-30 14:55 [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit() Boris Brezillon
2018-03-30 18:39 ` Eric Anholt
@ 2018-04-18 7:07 ` Boris Brezillon
1 sibling, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2018-04-18 7:07 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, dri-devel
On Fri, 30 Mar 2018 16:55:18 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> ->atomic_async_update() requires that drivers update the plane->state
> object before returning. Make sure at least common properties have been
> updated.
>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Applied to drm-misc-next.
> ---
> Hello,
>
> This is a problem I had when debugging the VC4 ->atomic_async_update()
> implementation. The function was not updating plane->fb as it's
> supposed thus leaving plane->state->fb in an inconsistent state after
> each async update.
>
> Not sure if such WARN_ON_ONCE() are accepted in the core though, so
> I'll maintainers decide whether this is relevant or not and whether
> they prefer to have WARN_ON() or DRM_ERROR() messages.
>
> Regards,
>
> Boris
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index c35654591c12..d2b2583487ee 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1561,6 +1561,17 @@ void drm_atomic_helper_async_commit(struct drm_device *dev,
> for_each_new_plane_in_state(state, plane, plane_state, i) {
> funcs = plane->helper_private;
> funcs->atomic_async_update(plane, plane_state);
> +
> + /*
> + * ->atomic_async_update() is supposed to update the
> + * plane->state in-place, make sure at least common
> + * properties have been properly updated.
> + */
> + WARN_ON_ONCE(plane->state->fb != plane_state->fb);
> + WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x);
> + WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y);
> + WARN_ON_ONCE(plane->state->src_x != plane_state->src_x);
> + WARN_ON_ONCE(plane->state->src_y != plane_state->src_y);
> }
> }
> EXPORT_SYMBOL(drm_atomic_helper_async_commit);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-18 7:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-30 14:55 [PATCH] drm/atomic: Add sanity checks to drm_atomic_helper_async_commit() Boris Brezillon
2018-03-30 18:39 ` Eric Anholt
2018-04-02 15:45 ` Sean Paul
2018-04-03 9:23 ` Daniel Vetter
2018-04-18 7:07 ` Boris Brezillon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.