Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/simple-kms: Use drm_atomic_helper_check_crtc_state()

Simple-KMS helpers guarantee that the CRTC and plane enable
flags are synchronized. Implement this with atomic helpers
drm_atomic_helper_check_crtc_state() on the CRTC side, and
drm_atomic_helper_check_plane_state() on the plane side.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220617103226.25617-3-tzimmermann@suse.de

+6 -8
+6 -8
drivers/gpu/drm/drm_simple_kms_helper.c
··· 100 100 static int drm_simple_kms_crtc_check(struct drm_crtc *crtc, 101 101 struct drm_atomic_state *state) 102 102 { 103 - struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, 104 - crtc); 105 - bool has_primary = crtc_state->plane_mask & 106 - drm_plane_mask(crtc->primary); 103 + struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); 104 + int ret; 107 105 108 - /* We always want to have an active plane with an active CRTC */ 109 - if (has_primary != crtc_state->enable) 110 - return -EINVAL; 106 + ret = drm_atomic_helper_check_crtc_state(crtc_state, false); 107 + if (ret) 108 + return ret; 111 109 112 110 return drm_atomic_add_affected_planes(state, crtc); 113 111 } ··· 225 227 ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state, 226 228 DRM_PLANE_HELPER_NO_SCALING, 227 229 DRM_PLANE_HELPER_NO_SCALING, 228 - false, true); 230 + false, false); 229 231 if (ret) 230 232 return ret; 231 233