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/amd/display: Fix mem_type change detection for async flips
Date: Fri, 05 Jun 2026 06:42:09 +1000	[thread overview]
Message-ID: <review-patch1-20260604064424.3154796-1-matthew.schwartz@linux.dev> (raw)
In-Reply-To: <20260604064424.3154796-1-matthew.schwartz@linux.dev>

Patch Review

**Bug analysis: Correct.** The existing code at `amdgpu_dm.c:12785-12786`:

```c
new_plane_state = drm_atomic_get_plane_state(state, plane);
old_plane_state = drm_atomic_get_plane_state(state, plane);
```

`drm_atomic_get_plane_state()` is declared `__must_check` and returns an `ERR_PTR` on failure or the (new) plane state pointer on success. Since both calls pass the same `(state, plane)`, the second call finds the plane already added to the atomic state and returns the same `new_state` pointer. So `old_plane_state == new_plane_state` always, and the mem_type comparison is a no-op.

**Fix analysis: Correct.** The replacement:

```c
new_plane_state = drm_atomic_get_new_plane_state(state, plane);
old_plane_state = drm_atomic_get_old_plane_state(state, plane);
```

These are simple inline lookups (confirmed in `drm_atomic.h:808-828`) that return `state->planes[idx].old_state` and `.new_state` respectively, or NULL if the plane is not part of the commit. This correctly retrieves distinct old/new states for comparison.

**NULL handling: Correct.** The change from `IS_ERR()` to a NULL check with `continue`:

```c
if (!old_plane_state || !new_plane_state)
    continue;
```

This is correct because `drm_atomic_get_old/new_plane_state()` returns NULL (not ERR_PTR) when the plane isn't in the commit. Using `continue` rather than `return false` is the right semantic — a plane not participating in this commit can't have a mem_type change, so we skip it and check the remaining planes. The old code's `return false` was also defensively acceptable (since that means "no change detected"), but `continue` is more precise and avoids short-circuiting the loop.

**Iteration scope note (minor).** The loop uses `crtc_state->plane_mask`, which includes all planes currently associated with the CRTC — including planes not being modified in this commit. For those planes, `drm_atomic_get_new_plane_state()` will return NULL, and the `continue` correctly skips them. This is a strict improvement over the old code, which would have *added* every plane in the mask to the atomic state as a side effect of calling `drm_atomic_get_plane_state()` — unnecessarily pulling in unrelated planes during atomic check.

**Commit message quality: Good.** The `[Why]`/`[How]` structure clearly explains both the root cause and the fix. The `Fixes:` tag references the correct introducing commit. The description of the real-world symptom (corruption under gamescope with DCN 3.0.1 when buffers migrate between VRAM and GTT) is helpful.

**No issues found.** The patch is clean, correct, and minimal.

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  6:44 [PATCH] drm/amd/display: Fix mem_type change detection for async flips Matthew Schwartz
2026-06-04  9:49 ` Melissa Wen
2026-06-04 20:42 ` Claude Code Review Bot [this message]
2026-06-04 20:42 ` 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-20260604064424.3154796-1-matthew.schwartz@linux.dev \
    --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