drm: Always prepare null framebuffer in transitional helper
PATCH 1/1 drm: Always prepare null framebuffer in transitional helper
Despite the documentation claim that cleanup_fb will match prior calls to prepare_fb, in case of NULL framebuffers in the transitional helpers, the code will skip the call to prepare_fb but not the corresponding cleanup_fb call. This asymmetry in semantics is unnecessarily surprising for developers transitioning drivers to atomic model, specially because the final atomic handlers don't have the issue - the prepare_fb is always called, despite the new state framebuffer being null.
The only current user of the transitional helper that doesn't take care of null framebuffers explicitly inside the prepare_fb hook is atmel_hlcdc, so we take special care to make sure we don't break anything there.
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++ drivers/gpu/drm/drm_plane_helper.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +3 -0
@@ -772,6 +772,9 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p,drm_plane_state_to_atmel_hlcdc_plane_state (s);int ret; +if (!new_state->fb) +return 0 ; + ret =atmel_hlcdc_layer_update_start (&plane->layer);if (!ret) state->prepared = true;
drivers/gpu/drm/drm_plane_helper.c +1 -2
@@ -450,8 +450,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, goto out; } -if (plane_funcs->prepare_fb && plane_state->fb && - plane_state->fb != old_fb) { +if (plane_funcs->prepare_fb && plane_state->fb != old_fb) { ret = plane_funcs->prepare_fb (plane, plane_state);if (ret)
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Gabriel Krisman Bertazi
Despite the documentation claim that
cleanup_fbwill match prior calls toprepare_fb, in case of NULL framebuffers in the transitional helpers, the code will skip the call toprepare_fbbut not the correspondingcleanup_fbcall. This asymmetry in semantics is unnecessarily surprising for developers transitioning drivers to atomic model, specially because the final atomic handlers don't have the issue - theprepare_fbis always called, despite the new state framebuffer being null.
Quoted 4 lines
The only current user of the transitional helper that doesn't take care of null framebuffers explicitly inside the
prepare_fbhook isatmel_hlcdc, so we take special care to make sure we don't break anything there.
Oh dear, I noticed all the callers to drm_plane_helper_disable :( What they really all want to do is shut down the entire display pipe on driver unload, with drm_atomic_helper_disable_all().
A bit more work to do in a simple cleanup, but care to at least do a small patch to Documentation/gpu/todo.rst to note it?
Thanks, Daniel
Quoted 42 lines
Signed-off-by Gabriel Krisman Bertazi <[email protected]>--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++ drivers/gpu/drm/drm_plane_helper.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +3
-0@@ -772,6 +772,9 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p,drm_plane_state_to_atmel_hlcdc_plane_state (s);int ret; +if (!new_state->fb) +return 0 ; + ret =atmel_hlcdc_layer_update_start (&plane->layer);if (!ret) state->prepared = true;drivers/gpu/drm/drm_plane_helper.c +1
-2@@ -450,8 +450,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, goto out; } -if (plane_funcs->prepare_fb && plane_state->fb && - plane_state->fb != old_fb) { +if (plane_funcs->prepare_fb && plane_state->fb != old_fb) { ret = plane_funcs->prepare_fb (plane, plane_state);if (ret)Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
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
Quoted 14 lines · Daniel Vetter
Quoted 8 lines · Gabriel Krisman Bertazi
Despite the documentation claim that
cleanup_fbwill match prior calls toprepare_fb, in case of NULL framebuffers in the transitional helpers, the code will skip the call toprepare_fbbut not the correspondingcleanup_fbcall. This asymmetry in semantics is unnecessarily surprising for developers transitioning drivers to atomic model, specially because the final atomic handlers don't have the issue - theprepare_fbis always called, despite the new state framebuffer being null.Quoted 4 lines
The only current user of the transitional helper that doesn't take care of null framebuffers explicitly inside the
prepare_fbhook isatmel_hlcdc, so we take special care to make sure we don't break anything there.
Quoted 6 lines
Oh dear, I noticed all the callers to
drm_plane_helper_disable:( What they really all want to do is shut down the entire display pipe on driver unload, withdrm_atomic_helper_disable_all().A bit more work to do in a simple cleanup, but care to at least do a small patch to
Documentation/gpu/todo.rstto note it?
Patch itself applied to drm-misc, thanks.
-Daniel
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