Re: [PATCH 3/3] drm/sun4i: Fix layer zpos change/atomic modesetting

From: Ondřej Jirman
Date: Wed Feb 21 2024 - 09:22:41 EST


Hi Maxime,

On Wed, Feb 21, 2024 at 02:45:20PM +0100, Maxime Ripard wrote:
> Hi,
>
> On Fri, Feb 16, 2024 at 08:04:26PM +0100, Ondřej Jirman wrote:
> > From: Ondrej Jirman <megi@xxxxxx>
> >
> > Identical configurations of planes can lead to different (and wrong)
> > layer -> pipe routing at HW level, depending on the order of atomic
> > plane changes.
> >
> > For example:
> >
> > - Layer 1 is configured to zpos 0 and thus uses pipe 0. No other layer
> > is enabled. This is a typical situation at boot.
> >
> > - When a compositor takes over and layer 3 is enabled,
> > sun8i_ui_layer_enable() will get called with old_zpos=0 zpos=1, which
> > will lead to incorrect disabling of pipe 0 and enabling of pipe 1.
> >
> > What happens is that sun8i_ui_layer_enable() function may disable
> > blender pipes even if it is no longer assigned to its layer.
> >
> > To correct this, move the routing setup out of individual plane's
> > atomic_update into crtc's atomic_update, where it can be calculated
> > and updated all at once.
> >
> > Remove the atomic_disable callback because it is no longer needed.
> >
> > Signed-off-by: Ondrej Jirman <megi@xxxxxx>
>
> I don't have enough knowledge about the mixers code to comment on your
> patch, so I'll let Jernej review it. However, this feels to me like the
> pipe assignment is typically the sort of things that should be dealt
> with device-wide, and in atomic_check.

Yes, this is what this patch does. It moves blender setup from individual
planes' attomic commits to a single place in crtc atomic commit.

kind regards,
o.

> If I'm talking non-sense, it would be great to mention at least why that
> can't be an option in the commit log.
>
> Maxime