<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 2, 2015 at 10:33 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">Transitional drivers might not have all the state frobbing lined up<br>
yet. But since the initial code has been merged a lot more state was<br>
added, so we really need this.<br>
<br>
Cc: Daniel Stone <<a href="mailto:daniels@collabora.com" target="_blank">daniels@collabora.com</a>><br>
Signed-off-by: Daniel Vetter <<a href="mailto:daniel.vetter@intel.com" target="_blank">daniel.vetter@intel.com</a>><br></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">
---<br>
 drivers/gpu/drm/drm_crtc_helper.c  |  8 +++++---<br>
 drivers/gpu/drm/drm_plane_helper.c | 16 ++++++++++------<br>
 2 files changed, 15 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c<br>
index 93104f3555f5..d3dfb0ebbeb2 100644<br>
--- a/drivers/gpu/drm/drm_crtc_helper.c<br>
+++ b/drivers/gpu/drm/drm_crtc_helper.c<br>
@@ -927,10 +927,12 @@ 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 if (crtc->state)<br>
+       else {<br>
+               if (!crtc->state)<br>
+                       drm_atomic_helper_crtc_reset(crtc);<br>
+<br>
                crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);<br>
-       else<br>
-               crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);<br>
+       }<br>
<br>
        if (!crtc_state)<br>
                return -ENOMEM;<br>
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c<br>
index 2f0ed11024eb..b07a213f5655 100644<br>
--- a/drivers/gpu/drm/drm_plane_helper.c<br>
+++ b/drivers/gpu/drm/drm_plane_helper.c<br>
@@ -525,10 +525,12 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,<br>
<br>
        if (plane->funcs->atomic_duplicate_state)<br>
                plane_state = plane->funcs->atomic_duplicate_state(plane);<br>
-       else if (plane->state)<br>
+       else {<br>
+               if (!plane->state)<br>
+                       drm_atomic_helper_plane_reset(plane);<br>
+<br>
                plane_state = drm_atomic_helper_plane_duplicate_state(plane);<br>
-       else<br>
-               plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);<br>
+       }<br>
        if (!plane_state)<br>
                return -ENOMEM;<br>
        plane_state->plane = plane;<br>
@@ -572,10 +574,12 @@ int drm_plane_helper_disable(struct drm_plane *plane)<br>
<br>
        if (plane->funcs->atomic_duplicate_state)<br>
                plane_state = plane->funcs->atomic_duplicate_state(plane);<br>
-       else if (plane->state)<br>
+       else {<br>
+               if (!plane->state)<br>
+                       drm_atomic_helper_plane_reset(plane);<br>
+<br>
                plane_state = drm_atomic_helper_plane_duplicate_state(plane);<br>
-       else<br>
-               plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);<br>
+       }<br>
        if (!plane_state)<br>
                return -ENOMEM;<br>
        plane_state->plane = plane;<br>
<span><font color="#888888">--<br>
2.1.4<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank">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>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><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>