Skip to content

Commit 36cc549

Browse files
Shirish Salexdeucher
authored andcommitted
drm/amd/display: disable CRTCs with NULL FB on their primary plane (V2)
The below commit "drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2" introduces a slight behavioral change to rmfb. Instead of disabling a crtc when the primary plane is disabled, it now preserves it. This change leads to BUG hit while performing atomic commit on amd driver. As a fix this patch ensures that we disable the CRTC's with NULL FB by returning -EINVAL and hence triggering fall back to the old behavior and turning off the crtc in atomic_remove_fb(). V2: Added error check for plane_state and removed sanity check for crtc. Signed-off-by: Shirish S <[email protected]> Signed-off-by: Pratik Vishwakarma <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3c27b3f commit 36cc549

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4746,6 +4746,30 @@ static int dm_update_planes_state(struct dc *dc,
47464746
return ret;
47474747
}
47484748

4749+
static int dm_atomic_check_plane_state_fb(struct drm_atomic_state *state,
4750+
struct drm_crtc *crtc)
4751+
{
4752+
struct drm_plane *plane;
4753+
struct drm_crtc_state *crtc_state;
4754+
4755+
WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc));
4756+
4757+
drm_for_each_plane_mask(plane, state->dev, crtc->state->plane_mask) {
4758+
struct drm_plane_state *plane_state =
4759+
drm_atomic_get_plane_state(state, plane);
4760+
4761+
if (IS_ERR(plane_state))
4762+
return -EDEADLK;
4763+
4764+
crtc_state = drm_atomic_get_crtc_state(plane_state->state, crtc);
4765+
if (crtc->primary == plane && crtc_state->active) {
4766+
if (!plane_state->fb)
4767+
return -EINVAL;
4768+
}
4769+
}
4770+
return 0;
4771+
}
4772+
47494773
static int amdgpu_dm_atomic_check(struct drm_device *dev,
47504774
struct drm_atomic_state *state)
47514775
{
@@ -4769,6 +4793,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
47694793
goto fail;
47704794

47714795
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
4796+
ret = dm_atomic_check_plane_state_fb(state, crtc);
4797+
if (ret)
4798+
goto fail;
4799+
47724800
if (!drm_atomic_crtc_needs_modeset(new_crtc_state) &&
47734801
!new_crtc_state->color_mgmt_changed)
47744802
continue;

0 commit comments

Comments
 (0)