提交 ce14ec20 编写于 作者: D Daniel Vetter

drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set

In

commit 9f658b7b
Author: Daniel Stone <daniels@collabora.com>
Date:   Fri May 22 13:34:45 2015 +0100

    drm/crtc_helper: Replace open-coded CRTC state helpers

error handling code was broken, resulting in the first path not being
checked correctly. Fix this by using the same pattern as in the
transitional plane helper function drm_plane_helper_update.

v2: Simplify the cleanup code while at it too.

v3: After some debugging with John we realized that the above patch
from Daniel also accidentally removed the if (crtc_state) check. This
is legal when transitioning to atomic, when the initial state reset
isn't all wired up yet properly. Reinstate that check to fix the bug
John has hit.

Cc: Daniel Stone <daniels@collabora.com>
CC: Sean Paul <seanpaul@chromium.org>
Cc: John Hunter <zhaojunwang@pku.edu.cn>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Reviewed-by: NDaniel Stone <daniels@collabora.com>
Reported-and-tested-by: NJohn Hunter <zhaojunwang@pku.edu.cn>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 a9cc54ee
...@@ -927,15 +927,13 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod ...@@ -927,15 +927,13 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod
if (crtc->funcs->atomic_duplicate_state) if (crtc->funcs->atomic_duplicate_state)
crtc_state = crtc->funcs->atomic_duplicate_state(crtc); crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
else { else if (crtc->state)
crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);
else
crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL); crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
if (!crtc_state) if (!crtc_state)
return -ENOMEM; return -ENOMEM;
if (crtc->state)
__drm_atomic_helper_crtc_duplicate_state(crtc, crtc_state);
else
crtc_state->crtc = crtc;
}
crtc_state->planes_changed = true; crtc_state->planes_changed = true;
crtc_state->mode_changed = true; crtc_state->mode_changed = true;
...@@ -957,11 +955,11 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod ...@@ -957,11 +955,11 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod
ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb); ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb);
out: out:
if (crtc_state) {
if (crtc->funcs->atomic_destroy_state) if (crtc->funcs->atomic_destroy_state)
crtc->funcs->atomic_destroy_state(crtc, crtc_state); crtc->funcs->atomic_destroy_state(crtc, crtc_state);
else { else
__drm_atomic_helper_crtc_destroy_state(crtc, crtc_state); drm_atomic_helper_crtc_destroy_state(crtc, crtc_state);
kfree(crtc_state);
} }
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册