diff options
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 710286b69cba..c345e645f1d7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -4707,6 +4707,7 @@ static int dm_update_planes_state(struct dc *dc, | |||
4707 | *lock_and_validation_needed = true; | 4707 | *lock_and_validation_needed = true; |
4708 | 4708 | ||
4709 | } else { /* Add new planes */ | 4709 | } else { /* Add new planes */ |
4710 | struct dc_plane_state *dc_new_plane_state; | ||
4710 | 4711 | ||
4711 | if (drm_atomic_plane_disabling(plane->state, new_plane_state)) | 4712 | if (drm_atomic_plane_disabling(plane->state, new_plane_state)) |
4712 | continue; | 4713 | continue; |
@@ -4725,35 +4726,45 @@ static int dm_update_planes_state(struct dc *dc, | |||
4725 | 4726 | ||
4726 | WARN_ON(dm_new_plane_state->dc_state); | 4727 | WARN_ON(dm_new_plane_state->dc_state); |
4727 | 4728 | ||
4728 | dm_new_plane_state->dc_state = dc_create_plane_state(dc); | 4729 | dc_new_plane_state = dc_create_plane_state(dc); |
4729 | 4730 | if (!dc_new_plane_state) { | |
4730 | DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n", | ||
4731 | plane->base.id, new_plane_crtc->base.id); | ||
4732 | |||
4733 | if (!dm_new_plane_state->dc_state) { | ||
4734 | ret = -EINVAL; | 4731 | ret = -EINVAL; |
4735 | return ret; | 4732 | return ret; |
4736 | } | 4733 | } |
4737 | 4734 | ||
4735 | DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n", | ||
4736 | plane->base.id, new_plane_crtc->base.id); | ||
4737 | |||
4738 | ret = fill_plane_attributes( | 4738 | ret = fill_plane_attributes( |
4739 | new_plane_crtc->dev->dev_private, | 4739 | new_plane_crtc->dev->dev_private, |
4740 | dm_new_plane_state->dc_state, | 4740 | dc_new_plane_state, |
4741 | new_plane_state, | 4741 | new_plane_state, |
4742 | new_crtc_state); | 4742 | new_crtc_state); |
4743 | if (ret) | 4743 | if (ret) { |
4744 | dc_plane_state_release(dc_new_plane_state); | ||
4744 | return ret; | 4745 | return ret; |
4746 | } | ||
4745 | 4747 | ||
4746 | 4748 | /* | |
4749 | * Any atomic check errors that occur after this will | ||
4750 | * not need a release. The plane state will be attached | ||
4751 | * to the stream, and therefore part of the atomic | ||
4752 | * state. It'll be released when the atomic state is | ||
4753 | * cleaned. | ||
4754 | */ | ||
4747 | if (!dc_add_plane_to_context( | 4755 | if (!dc_add_plane_to_context( |
4748 | dc, | 4756 | dc, |
4749 | dm_new_crtc_state->stream, | 4757 | dm_new_crtc_state->stream, |
4750 | dm_new_plane_state->dc_state, | 4758 | dc_new_plane_state, |
4751 | dm_state->context)) { | 4759 | dm_state->context)) { |
4752 | 4760 | ||
4761 | dc_plane_state_release(dc_new_plane_state); | ||
4753 | ret = -EINVAL; | 4762 | ret = -EINVAL; |
4754 | return ret; | 4763 | return ret; |
4755 | } | 4764 | } |
4756 | 4765 | ||
4766 | dm_new_plane_state->dc_state = dc_new_plane_state; | ||
4767 | |||
4757 | /* Tell DC to do a full surface update every time there | 4768 | /* Tell DC to do a full surface update every time there |
4758 | * is a plane change. Inefficient, but works for now. | 4769 | * is a plane change. Inefficient, but works for now. |
4759 | */ | 4770 | */ |