Skip to content

Commit

Permalink
drm: reset empty state in transitional helpers
Browse files Browse the repository at this point in the history
Transitional drivers might not have all the state frobbing lined up
yet. But since the initial code has been merged a lot more state was
added, so we really need this.

Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reported-and-tested-by: John Hunter <zhaojunwang@pku.edu.cn>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Daniel Vetter committed Jul 3, 2015
1 parent ce14ec2 commit e4f31ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions drivers/gpu/drm/drm_crtc_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,10 +927,12 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod

if (crtc->funcs->atomic_duplicate_state)
crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
else if (crtc->state)
else {
if (!crtc->state)
drm_atomic_helper_crtc_reset(crtc);

crtc_state = drm_atomic_helper_crtc_duplicate_state(crtc);
else
crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
}

if (!crtc_state)
return -ENOMEM;
Expand Down
16 changes: 10 additions & 6 deletions drivers/gpu/drm/drm_plane_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,12 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,

if (plane->funcs->atomic_duplicate_state)
plane_state = plane->funcs->atomic_duplicate_state(plane);
else if (plane->state)
else {
if (!plane->state)
drm_atomic_helper_plane_reset(plane);

plane_state = drm_atomic_helper_plane_duplicate_state(plane);
else
plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
}
if (!plane_state)
return -ENOMEM;
plane_state->plane = plane;
Expand Down Expand Up @@ -572,10 +574,12 @@ int drm_plane_helper_disable(struct drm_plane *plane)

if (plane->funcs->atomic_duplicate_state)
plane_state = plane->funcs->atomic_duplicate_state(plane);
else if (plane->state)
else {
if (!plane->state)
drm_atomic_helper_plane_reset(plane);

plane_state = drm_atomic_helper_plane_duplicate_state(plane);
else
plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL);
}
if (!plane_state)
return -ENOMEM;
plane_state->plane = plane;
Expand Down

0 comments on commit e4f31ad

Please sign in to comment.