Hi Melissa,

Checked this against i915/xe (including intel_load_detect's
drm_atomic_add_affected_planes() call) and it looks good there. A few
small comments inline.

> Only consider affected colorop states those that are part of an active
> color pipeline or a pipeline that is about to be activated or
> deactivated in the same atomic commit, i.e., colorop is in the chain of
> old/new plane color pipeline property. To cover color_pipeline
> deactivation, remove the condition for plane_state->color_pipeline.
>
> Signed-off-by: Melissa Wen <[email protected]>

Should this carry a Fixes tag for the earlier commit adding affected
colorops with affected planes [1]?

> +/*
> + * This function walks old and new plane state color pipelines and adds all
> + * colorops in use by @plane to the atomic configuration @state. This is 
> useful
> + * when an atomic commit needs to check all currently enabled or about to be
> + * enabled colorop on @plane, e.g. when changing the mode. This also avoids
> + * including colorop states that are not part of the atomic state.

"avoids including colorop states that are not part of the atomic state"
reads a bit unclear. Maybe "avoids pulling in colorops from inactive
pipelines"?

> +     /* Same color pipeline as new; no point walking old. */
> +     if (new_plane_state->color_pipeline == old_plane_state->color_pipeline)
> +             return 0;
> +
> +     drm_for_each_colorop_in_pipeline(colorop,
> +                                      old_plane_state->color_pipeline) {
> +             colorop_state = drm_atomic_get_colorop_state(state, colorop);
> +             if (IS_ERR(colorop_state))
> +                     return PTR_ERR(colorop_state);
> +     }

Small question: on deactivation (P1 -> 0) during a modeset, is there
still a consumer that needs the old pipeline's colorop states pulled
here once drivers fall back to committed state?

> +#define drm_for_each_colorop_in_pipeline(colorop, pipeline) \
> +     for ((colorop) = (pipeline); (colorop); (colorop) = (colorop)->next)

Worth adding brief kerneldoc here since drivers (i915, vkms, amdgpu)
will reuse this macro.

[1] 
https://lore.kernel.org/dri-devel/[email protected]/

Assisted-by: Gemini
Assisted-by: Claude:claude-fable-5.2

Thanks,
Gil

Reply via email to