public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/atomic: only add states of active or transient active colorops
Date: Fri, 05 Jun 2026 06:13:39 +1000	[thread overview]
Message-ID: <review-patch1-20260604180457.1110110-2-mwen@igalia.com> (raw)
In-Reply-To: <20260604180457.1110110-2-mwen@igalia.com>

Patch Review

**Purpose:** Replace the broad `drm_atomic_add_affected_colorops()` call (which walks ALL colorops for a plane) with the new `drm_atomic_add_pipeline_colorops()` that only adds colorops from the old and new color pipelines.

**New macro (`drm_for_each_colorop_in_pipeline`):**

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

This is clean and straightforward. It safely handles `pipeline == NULL` (the loop body simply never executes). Good addition from the v2 feedback.

**`drm_atomic_add_pipeline_colorops()` function:**

```c
static int
drm_atomic_add_pipeline_colorops(struct drm_atomic_commit *state,
				 struct drm_plane *plane)
```

The function signature uses `struct drm_atomic_commit *state` rather than `struct drm_atomic_state *state` — this is fine if the codebase has already renamed the struct (I can see the existing code also uses `drm_atomic_commit`), so this is consistent.

The WARN_ON check:

```c
if (WARN_ON(!new_plane_state || !old_plane_state))
    return -EINVAL;
```

This is reasonable defensive coding. Since `drm_atomic_add_affected_planes()` always calls `drm_atomic_get_plane_state()` first, both states should always exist when this is called. The WARN_ON is appropriate to flag programming errors.

**Optimization with pointer comparison:**

```c
if (new_plane_state->color_pipeline == old_plane_state->color_pipeline)
    return 0;
```

This is correct — if both old and new point to the same pipeline head, walking old would add the exact same colorop states that were already added from the new walk (since `drm_atomic_get_colorop_state` is idempotent for already-tracked colorops). Good optimization.

**Concern: `drm_atomic_add_affected_planes` behavior change:**

The existing code:
```c
if (plane_state->color_pipeline) {
    ret = drm_atomic_add_affected_colorops(state, plane);
```

is replaced with:
```c
ret = drm_atomic_add_pipeline_colorops(state, plane);
```

The old code called `drm_atomic_add_affected_colorops` which adds ALL colorops for the plane (not just those in the pipeline). The new code only adds pipeline-linked colorops. This is a behavioral narrowing — if a plane has colorops that aren't currently part of any pipeline chain, they'll no longer be pulled into the atomic state here. This seems intentional and correct for the stated goal, but it's worth confirming: are there any drivers that rely on non-pipeline colorops being pulled in through `drm_atomic_add_affected_planes()`?

**Doc update for `drm_atomic_add_affected_colorops`:**

The patch updates the doc comment to narrow the stated purpose to "re-enabling a plane to avoid special code to force-enable all colorops." This is appropriate since `drm_atomic_add_affected_planes()` no longer calls it.

**Minor nit:** The function comment block for `drm_atomic_add_pipeline_colorops` is quite verbose for a static helper. Not a problem, just an observation — the detail is welcome for this kind of subtle semantic change.

Overall: **Looks good.** Clean implementation.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-06-04 20:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 17:59 [PATCH v2 0/3] don't allow changes to inactive colorops Melissa Wen
2026-06-04 17:59 ` [PATCH v2 1/3] drm/atomic: only add states of active or transient active colorops Melissa Wen
2026-06-04 18:24   ` sashiko-bot
2026-06-04 20:13   ` Claude Code Review Bot [this message]
2026-06-04 17:59 ` [PATCH v2 2/3] drm/atomic: duplicate state of all colorops Melissa Wen
2026-06-04 20:13   ` Claude review: " Claude Code Review Bot
2026-06-04 17:59 ` [PATCH v2 3/3] drm/atomic: reject colorop update from inactive color pipeline Melissa Wen
2026-06-04 20:13   ` Claude review: " Claude Code Review Bot
2026-06-04 20:13 ` Claude review: don't allow changes to inactive colorops Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-26 14:17 [PATCH 0/3] " Melissa Wen
2026-05-26 14:17 ` [PATCH 1/3] drm/atomic: only add states of active or transient active colorops Melissa Wen
2026-05-27  4:45   ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260604180457.1110110-2-mwen@igalia.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox