drm/i915: Rework joiner and Y plane dependency handling
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 12 Feb 2025 16:43:23 +0000 (18:43 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Sat, 15 Feb 2025 07:28:40 +0000 (09:28 +0200)
commit00c8e0dd3dcd7016584ca131d26a88e4fbabe001
treef78f87ccafeccaba0f763a2e680640dfdb0c925b
parent58456143cc849ebd2e338d28d64747179e220a40
drm/i915: Rework joiner and Y plane dependency handling

The current code tries to handle joiner vs. Y planes completely
independently. That does not really work since each pipe selects
its Y planes completely independently, and any plane pulled into
the state by one of the secondary pipes needs to have the plane
on the primary pipe also included in the state (for the uapi
state copy). The current code sometimes forgets to pull in planes
that we need, leading to weird things like the Y<->UV plane link
only getting torn down from one side but not the other.

Remedy the situation by pulling in the exact same set planes
on all the joined pipes. To calculate the set we simply
look through each joined crtc and any plane in the state gets
added to the set. However due to the way the Y plane selection
works we may not be able to determine the set in one go. One
plane on one pipe may pull in a Y plane, which may have to pull
in another plane because it's not acting in the same role on
another pipe, etc. The simple approach taken here is to keep
looping and adding planes to the set until it stops growing.

I suppose if we tracked more of this Y plane stuff in the
crtc state rather than the plane state we might be able to
do it in one go. But this works, and it's not going to loop
for long anyway since we only have so many pipes and Y planes
to consider.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250212164330.16891-4-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_display.c