drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
Subsystems (2)
PATCH 1/1 drm/atomic: Add sanity checks to drm_atomic_helper_async_commit()
->atomic_async_update() requires that drivers update the plane->state object before returning. Make sure at least common properties have been updated.
---
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(+)
drivers/gpu/drm/drm_atomic_helper.c +11 -0
@@ -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);
Signature · 6 lines
2.14.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Boris Brezillon
->atomic_async_update() requires that drivers update the
plane->stateobject before returning. Make sure at least common properties have been updated.Cc Gustavo Padovan <[email protected]>Signed-off-by Boris Brezillon <[email protected]>---
Hello,
Quoted 8 lines
This is a problem I had when debugging the VC4 ->atomic_async_update() implementation. The function was not updating
plane->fbas it's supposed thus leavingplane->state->fbin 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 haveWARN_ON()orDRM_ERROR()messages.
I'm a huge fan of this kind of safety check. FWIW,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sean Paul
Acked-byQuoted 16 lines · Eric Anholt
Quoted 14 lines · Boris Brezillon
->atomic_async_update() requires that drivers update the
plane->stateobject before returning. Make sure at least common properties have been updated.Cc Gustavo Padovan <[email protected]>Signed-off-by Boris Brezillon <[email protected]>---
Hello,This is a problem I had when debugging the VC4 ->atomic_async_update() implementation. The function was not updating
plane->fbas it's supposed thus leavingplane->state->fbin an inconsistent state after each async update.
Quoted 7 lines
Quoted 3 lines
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 haveWARN_ON()orDRM_ERROR()messages.I'm a huge fan of this kind of safety check. FWIW,
Acked-by Eric Anholt <[email protected]>
Agreed, seems like a useful safety net to me.
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
Reviewed-byQuoted 21 lines · Sean Paul
Quoted 20 lines · Eric Anholt
Quoted 17 lines · Boris Brezillon
->atomic_async_update() requires that drivers update the
plane->stateobject before returning. Make sure at least common properties have been updated.Cc Gustavo Padovan <[email protected]>Signed-off-by Boris Brezillon <[email protected]>---
Hello,This is a problem I had when debugging the VC4 ->atomic_async_update() implementation. The function was not updating
plane->fbas it's supposed thus leavingplane->state->fbin 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 haveWARN_ON()orDRM_ERROR()messages.
Quoted 7 lines
Quoted 3 lines
I'm a huge fan of this kind of safety check. FWIW,
Acked-by Eric Anholt <[email protected]>Agreed, seems like a useful safety net to me.
Acked-by Sean Paul <[email protected]>
Yeah, makes sense.
Quoted 11 lines
Quoted 7 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Boris Brezillon
AppliedQuoted 6 lines · On Fri, 30 Mar 2018 16:55:18 +0200 Boris Brezillon…
->atomic_async_update() requires that drivers update the
plane->stateobject before returning. Make sure at least common properties have been updated.Cc Gustavo Padovan <[email protected]>Signed-off-by Boris Brezillon <[email protected]>
Applied to drm-misc-next.
Quoted 31 lines
---
Hello,This is a problem I had when debugging the VC4 ->atomic_async_update() implementation. The function was not updating
plane->fbas it's supposed thus leavingplane->state->fbin 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 haveWARN_ON()orDRM_ERROR()messages.Regards,
Boris
--- drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/gpu/drm/drm_atomic_helper.c +4
-0@@ -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
drivers/gpu/drm/drm_atomic_helper.c void drm_atomic_helper_async_commit(struct drm_device *dev, · line 1577
Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +7
-0+* 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel