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)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Wed, 23 Jun 2021 12:25:10 +0000 (13:25 +0100)
commitaab31c03515145a06c71d530d8960bee5ad1717d
tree8f3eb7880927a00ddbe587c452e8708398c81c7f
parent8e806b3f1867b1c4d45c2b9454643bb05bd5479f
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