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: Add support for 'link bpc' property
Date: Sun, 22 Mar 2026 04:19:40 +1000	[thread overview]
Message-ID: <review-patch3-20260319-link-bpc-v5-3-5306cd04a708@collabora.com> (raw)
In-Reply-To: <20260319-link-bpc-v5-3-5306cd04a708@collabora.com>

Patch Review

**Unchecked return value:**

```c
		drm_connector_attach_link_bpc_property(&aconnector->base, 16);
```

The return value is not checked. While the existing `drm_connector_attach_max_bpc_property()` call on the line above is also not checked (and that function also returns `int`), this is still a pattern to avoid. If property creation fails (e.g., memory allocation failure), it will silently continue with a NULL `link_bpc_property`. The `drm_connector_update_link_bpc_property` does have a NULL guard, so it won't crash, but the connector will silently lack the property. Consider checking the return value, or at least adding a `drm_warn` on failure.

**Double clamping:**

```c
static void amdgpu_dm_update_link_bpc(struct drm_connector_state *conn_state,
				      enum dc_color_depth depth)
{
	/* 6 bpc is an experimental internal format only, use 8 as minimum */
	conn_state->link_bpc = clamp(convert_dc_color_depth_into_bpc(depth), 8,
				     conn_state->max_bpc);
}
```

This clamps link_bpc at assignment time. Then `drm_connector_update_link_bpc_property()` (from patch 1) clamps again:

```c
	u8 bpc = clamp(state->link_bpc, 8, state->max_bpc);
```

The double clamping is harmless but redundant. The core helper already handles clamping, so the driver could just do a straight assignment (only filtering out the 6bpc case with a `max()`). Either way it works, but it adds unnecessary complexity.

**Same clamp() type concern** applies here: `convert_dc_color_depth_into_bpc()` returns `int`, `8` is `int`, and `conn_state->max_bpc` is `u8` — mixed types in `clamp()`.

**`convert_dc_color_depth_into_bpc` can return 0:** If `display_color_depth` hits the `default` case, the function returns 0. The `clamp` will push it to 8, which is a reasonable fallback, but it might be worth a `drm_warn` in that scenario rather than silently assuming 8 bpc.

**Placement of the update call:** The `amdgpu_dm_update_link_bpc()` call is in `dm_update_crtc_state()`, which is called from `amdgpu_dm_atomic_check()`. This means the value is computed during the check phase and stored in the connector state, which is consistent with the HDMI helper approach. Good.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-21 18:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 12:28 [PATCH v5 0/3] Add "link bpc" DRM property Nicolas Frattaroli
2026-03-19 12:28 ` [PATCH v5 1/3] drm/connector: Add a 'link bpc' property Nicolas Frattaroli
2026-03-21 18:19   ` Claude review: " Claude Code Review Bot
2026-03-19 12:28 ` [PATCH v5 2/3] drm/connector: hdmi: Add support for " Nicolas Frattaroli
2026-03-21 18:19   ` Claude review: " Claude Code Review Bot
2026-03-19 12:28 ` [PATCH v5 3/3] drm/amd/display: " Nicolas Frattaroli
2026-03-21 18:19   ` Claude Code Review Bot [this message]
2026-03-20 14:32 ` [PATCH v5 0/3] Add "link bpc" DRM property Michel Dänzer
2026-03-20 18:02   ` Nicolas Frattaroli
2026-03-21  2:33     ` Mario Kleiner
2026-03-21 18:19 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-11 11:30 [PATCH v4 0/2] " Nicolas Frattaroli
2026-03-11 11:30 ` [PATCH v4 2/2] drm/amd/display: Add support for 'link bpc' property Nicolas Frattaroli
2026-03-11 20:57   ` 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-patch3-20260319-link-bpc-v5-3-5306cd04a708@collabora.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