[Intel-gfx] [PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Nov 6 16:20:50 UTC 2017


On Mon, Nov 06, 2017 at 04:43:17PM +0100, Maarten Lankhorst wrote:
> Op 06-11-17 om 15:06 schreef Ville Syrjälä:
> > On Mon, Nov 06, 2017 at 04:01:20PM +0200, Ville Syrjälä wrote:
> >> On Thu, Nov 02, 2017 at 09:55:40AM +0100, Maarten Lankhorst wrote:
> >>> Op 01-11-17 om 18:00 schreef Ville Syrjälä:
> >>>> On Wed, Nov 01, 2017 at 04:55:06PM +0100, Maarten Lankhorst wrote:
> >>>>> Op 01-11-17 om 16:29 schreef Ville Syrjälä:
> >>>>>> On Wed, Nov 01, 2017 at 04:04:33PM +0100, Maarten Lankhorst wrote:
> >>>>>>> This introduces a slight behavioral change to rmfb. Instead of
> >>>>>>> disabling a crtc when the primary plane is disabled, we try to
> >>>>>>> preserve it.
> >>>>>>>
> >>>>>>> Apart from old versions of the vmwgfx xorg driver, there is
> >>>>>>> nothing depending on rmfb disabling a crtc.
> >>>>>>>
> >>>>>>> Vmwgfx' and simple kms helper atomic implementation rejects CRTC
> >>>>>>> enabled without plane, so we can do this safely.
> >>>> The code for those seems a bit inconsistent. The crtc check requires
> >>>> that the crtc state and plane state match. But the plane check allows
> >>>> the plane to be enabled w/o the crtc being enabled. I guess it doesn't
> >>>> matter really since you can't enable the plane without a crtc, and the
> >>>> crtc check would then catch the case where the crtc would be disabled.
> >>> Exactly. :-) Only when a plane is unbound and stays unbound, the crtc check won't
> >>> be invoked. Hence it's the most accurate way of making sure that
> >>> crtc enabled <=> primary plane bound.
> >>>
> >>> If the check was done in the primary plane, an atomic modeset could enable
> >>> the crtc without enabling the primary plane, which shouldn't be allowed but
> >>> a plane check won't catch it.
> >>> This has been a bug in simple-kms-helper, fixed in the below commit:
> >>>
> >>> commit 765831dc27ab141b3a0be1ab55b922b012427902
> >>> Author: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> >>> Date:   Wed Jul 12 10:13:29 2017 +0200
> >>>
> >>>     drm/simple-kms-helper: Fix the check for the mismatch between plane and CRTC enabled.
> >> Hmm. OK that part looks OK. What does seem a bit inconsistent is the
> >> fact that we pass can_update_disabled=true, but later on we reject the
> >> update when visible==false. The old code would have accepted that
> >> because it didn't even call drm_plane_helper_check_state() when the
> >> crtc (and thus also the plane) was disabled.
> > Actually how does this work at all? If you turn off both the crtc and
> > plane, then the plane check will always return -EINVAL on account of
> > visible==false?
> >
> If the crtc is turned off, enabled = false and the primary plane is not in crtc_state->plane_mask.
>
> Visibility is ignored in this check, that part is handled in plane check that the framebuffer has to span the entire crtc if enabled.

Hmm. I thought the !crtc->enabled check disappeared from
drm_simple_kms_plane_atomic_check() but looks like I was wrong and it's
still there. OK, just totally ignore what I wrote before. I guess one
shouldn't try to figure out what the code is going to be doing while in
the middle of an unrelated bisect.

Though for some extra consistency we might want to change that to check
to look for !fb after calling drm_plane_helper_check_state(). That way
we wouldn't have to change drivers/simple_kms_helper if come up with
something that has to be checked even for disabled planes
in drm_plane_helper_check_state().

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list