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/bridge: it66121: Select HDMI or DVI mode based on sink type
Date: Sat, 16 May 2026 16:11:55 +1000	[thread overview]
Message-ID: <review-patch3-20260510191459.90769-4-javierm@redhat.com> (raw)
In-Reply-To: <20260510191459.90769-4-javierm@redhat.com>

Patch Review

**Status: One concern about state access in mode_set.**

The core logic is correct: checking `conn_state->connector->display_info.is_hdmi` in `atomic_check` and using that to conditionally skip AVI infoframes and write 0 (DVI mode) vs `IT66121_HDMI_MODE_HDMI` to the mode register.

The defensive defaulting is good:
```c
	/* Default to HDMI to preserve legacy behavior. */
	state->sink_is_hdmi = true;

	if (conn_state && conn_state->connector)
		state->sink_is_hdmi = conn_state->connector->display_info.is_hdmi;
```

**Concern: State access in `mode_set` via `bridge->base.state`.**

```c
	struct drm_bridge_state *bridge_state =
		drm_priv_to_bridge_state(bridge->base.state);
	struct it66121_bridge_state *state =
		to_it66121_bridge_state(bridge_state);
```

The `mode_set` callback has the old-style signature without a `drm_atomic_state *` parameter, so accessing the bridge state through `bridge->base.state` is the only option. This works because `mode_set` is called after the state swap during commit. However, this couples the driver to commit ordering assumptions.

**Suggestion:** Consider converting from the legacy `mode_set` callback to `atomic_enable` where the `struct drm_atomic_commit *state` parameter is available. The enable callback already exists — the mode_set logic could be folded into it, and you'd get the state cleanly via `drm_atomic_get_new_bridge_state()`. This would eliminate the fragile `bridge->base.state` access entirely. If that's too much churn for this fix, the current approach works but should have a brief comment noting why `bridge->base.state` is safe here (called post-swap during commit).

**Minor nit:** The AVI packet disable path writes 0 to `IT66121_AVI_INFO_PKT_REG`, which should explicitly clear the AVI info that was previously written. Depending on hardware behavior, you may also want to zero out the AVI infoframe data registers (`IT66121_AVIINFO_DB1_REG`) when switching to DVI mode, to avoid any stale data being accidentally transmitted if the packet enable bit is ever re-asserted without going through `mode_set` again. This is a hardening suggestion, not a correctness issue for the current flow.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-16  6:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 19:14 [PATCH 0/3] drm/bridge: it66121: Fix display output on DVI monitors Javier Martinez Canillas
2026-05-10 19:14 ` [PATCH 1/3] drm/bridge: it66121: Add bridge_to_it66121_ctx() helper Javier Martinez Canillas
2026-05-16  6:11   ` Claude review: " Claude Code Review Bot
2026-05-10 19:14 ` [PATCH 2/3] drm/bridge: it66121: Add bridge-private atomic state Javier Martinez Canillas
2026-05-16  6:11   ` Claude review: " Claude Code Review Bot
2026-05-10 19:14 ` [PATCH 3/3] drm/bridge: it66121: Select HDMI or DVI mode based on sink type Javier Martinez Canillas
2026-05-11  7:08   ` Maxime Ripard
2026-05-11 12:48     ` Javier Martinez Canillas
2026-05-11 13:23       ` Maxime Ripard
2026-05-11 13:44         ` Javier Martinez Canillas
2026-05-12  9:24         ` Javier Martinez Canillas
2026-05-16  6:11   ` Claude Code Review Bot [this message]
2026-05-16  6:11 ` Claude review: drm/bridge: it66121: Fix display output on DVI monitors 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-patch3-20260510191459.90769-4-javierm@redhat.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