<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 2, 2015 at 9:16 PM, Daniel Vetter <span dir="ltr"><<a href="mailto:daniel.vetter@ffwll.ch" target="_blank">daniel.vetter@ffwll.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">In<br>
<br>
commit 9f658b7b62e7aefc1ee067136126eca3f58cabfd<br>
Author: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
Date: Fri May 22 13:34:45 2015 +0100<br>
<br>
drm/crtc_helper: Replace open-coded CRTC state helpers<br>
<br>
error handling code was broken, resulting in the first path not being<br>
checked correctly. Fix this by using the same pattern as in the<br>
transitional plane helper function drm_plane_helper_update.<br>
<br>
</span><span class="">v2: Simplify the cleanup code while at it too.<br>
<br>
</span>v3: After some debugging with John we realized that the above patch<br>
from Daniel also accidentally removed the if (crtc_state) check. This<br>
is legal when transitioning to atomic, when the initial state reset<br>
isn't all wired up yet properly. Reinstate that check to fix the bug<br>
John has hit.<br>
<span class=""><br>
Cc: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
CC: Sean Paul <<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>><br>
Cc: John Hunter <<a href="mailto:zhaojunwang@pku.edu.cn">zhaojunwang@pku.edu.cn</a>><br>
</span>Reported-by: John Hunter <<a href="mailto:zhaojunwang@pku.edu.cn">zhaojunwang@pku.edu.cn</a>><br>
<span class="">Signed-off-by: Daniel Vetter <<a href="mailto:daniel.vetter@intel.com">daniel.vetter@intel.com</a>><br></span></blockquote><div>Tested-by: Zhao Junwang <<a href="mailto:zhjwpku@gmail.com">zhjwpku@gmail.com</a>> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
---<br>
</span> drivers/gpu/drm/drm_crtc_helper.c | 24 +++++++++++-------------<br>
1 file changed, 11 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c<br>
index 393114df88a3..93104f3555f5 100644<br>
<span class="">--- a/drivers/gpu/drm/drm_crtc_helper.c<br>
+++ b/drivers/gpu/drm/drm_crtc_helper.c<br>
@@ -927,15 +927,13 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod<br>
<br>
if (crtc->funcs->atomic_duplicate_state)<br>
crtc_state = crtc->funcs->atomic_duplicate_state(crtc);<br>
- else {<br>
+ else if (crtc->state)<br>
+ crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);<br>
+ else<br>
crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);<br>
- if (!crtc_state)<br>
- return -ENOMEM;<br>
- if (crtc->state)<br>
- __drm_atomic_helper_crtc_duplicate_state(crtc, crtc_state);<br>
- else<br>
- crtc_state->crtc = crtc;<br>
- }<br>
+<br>
+ if (!crtc_state)<br>
+ return -ENOMEM;<br>
<br>
crtc_state->planes_changed = true;<br>
crtc_state->mode_changed = true;<br>
</span>@@ -957,11 +955,11 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod<br>
ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb);<br>
<br>
out:<br>
- if (crtc->funcs->atomic_destroy_state)<br>
- crtc->funcs->atomic_destroy_state(crtc, crtc_state);<br>
<span class="">- else {<br>
- __drm_atomic_helper_crtc_destroy_state(crtc, crtc_state);<br>
- kfree(crtc_state);<br>
</span>+ if (crtc_state) {<br>
+ if (crtc->funcs->atomic_destroy_state)<br>
+ crtc->funcs->atomic_destroy_state(crtc, crtc_state);<br>
<span class="im HOEnZb">+ else<br>
+ drm_atomic_helper_crtc_destroy_state(crtc, crtc_state);<br>
}<br>
<br>
return ret;<br>
</span><div class="HOEnZb"><div class="h5">--<br>
2.1.4<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards<br></div><div>Junwang Zhao</div><div>Microprocessor Research and Develop Center</div><div>Department of Computer Science &Technology</div><div>Peking University</div><div>Beijing, 100871, PRC</div></div></div>
</div></div>