• Thomas Zimmermann's avatar
    drm/atomic-helper: Don't allocate new plane state in CRTC check · dbbf933d
    Thomas Zimmermann authored
    In drm_atomic_helper_check_crtc_state(), do not add a new plane state
    to the global state if it does not exist already. Adding a new plane
    state will result in overhead for the plane during the atomic-commit
    step.
    
    For the test in drm_atomic_helper_check_crtc_state() to succeed, it
    is important that the CRTC has an enabled primary plane after the
    commit. Simply testing the CRTC state's plane_mask for a primary plane
    is sufficient.
    
    Note that the helper still only tests for an attached primary plane.
    Drivers have to ensure that the plane contains valid pixel information.
    
    v5:
    	* fix commit description (Javier)
    v3:
    	* test for a primary plane in plane_mask (Ville)
    v2:
    	* remove unnecessary test for plane->crtc (Ville)
    	* inline drm_atomic_get_next_plane_state() (Ville)
    	* acquire plane lock before accessing plane->state (Ville)
    Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
    Fixes: d6b9af10 ("drm/atomic-helper: Add helper drm_atomic_helper_check_crtc_state()")
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Cc: Jocelyn Falempe <jfalempe@redhat.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: dri-devel@lists.freedesktop.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20221007124338.24152-2-tzimmermann@suse.de
    dbbf933d
drm_atomic_helper.c 112 KB