drm/vc4: crtc: Rework the encoder retrieval code (again)
authorMaxime Ripard <maxime@cerno.tech>
Mon, 21 Jun 2021 14:07:22 +0000 (16:07 +0200)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:03:44 +0000 (16:03 +0000)
commitdeca45e86bf0c8910e4026381c5760985eff8976
tree3f93e8af92b7bc4ed7deed28405ca7d2f9bee954
parent96786da9ed40ce7b0acf536af6d2ae148f698437
drm/vc4: crtc: Rework the encoder retrieval code (again)

It turns out the encoder retrieval code, in addition to being
unnecessarily complicated, has a bug when only the planes and crtcs are
affected by a given atomic commit.

Indeed, in such a case, either drm_atomic_get_old_connector_state or
drm_atomic_get_new_connector_state will return NULL and thus our encoder
retrieval code will not match on anything.

We can however simplify the code by using drm_for_each_encoder_mask, the
drm_crtc_state storing the encoders a given CRTC is connected to
directly and without relying on any other state.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_crtc.c
drivers/gpu/drm/vc4/vc4_drv.h