Commit cd252356 authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi Committed by Daniel Vetter

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.
Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170216164442.28704-1-krisman@collabora.co.uk
parent 3c6d6e0f
...@@ -772,6 +772,9 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p, ...@@ -772,6 +772,9 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p,
drm_plane_state_to_atmel_hlcdc_plane_state(s); drm_plane_state_to_atmel_hlcdc_plane_state(s);
int ret; int ret;
if (!new_state->fb)
return 0;
ret = atmel_hlcdc_layer_update_start(&plane->layer); ret = atmel_hlcdc_layer_update_start(&plane->layer);
if (!ret) if (!ret)
state->prepared = true; state->prepared = true;
......
...@@ -450,8 +450,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, ...@@ -450,8 +450,7 @@ int drm_plane_helper_commit(struct drm_plane *plane,
goto out; goto out;
} }
if (plane_funcs->prepare_fb && plane_state->fb && if (plane_funcs->prepare_fb && plane_state->fb != old_fb) {
plane_state->fb != old_fb) {
ret = plane_funcs->prepare_fb(plane, ret = plane_funcs->prepare_fb(plane,
plane_state); plane_state);
if (ret) if (ret)
......
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