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/scdc-helper: Implement parsing and printing HDMI 2.1 fields
Date: Wed, 27 May 2026 15:01:45 +1000	[thread overview]
Message-ID: <review-patch4-20260526-scdc-link-health-v3-4-59e4a4aaead1@collabora.com> (raw)
In-Reply-To: <20260526-scdc-link-health-v3-4-59e4a4aaead1@collabora.com>

Patch Review

This patch extends the HDMI 2.0 code for HDMI 2.1 FRL (Fixed Rate Link) support. Good approach of not requiring a version check since HDMI 2.0 sinks have reserved fields defined as 0.

**Error counter checksum with 4 lanes:** For 4-lane mode, the code reads 9 bytes (0x50-0x58) and checksums all of them:

```c
case 4:
    buf_sz = 9;
    break;
...
for (i = 0; i < buf_sz; i++)
    sum = wrapping_add(u8, sum, buf[i]);
```

The checksum register is at 0x56 (buf[6]). This assumes the HDMI 2.1 checksum at 0x56 covers registers 0x50-0x55 *and* 0x57-0x58 (all error detection registers). Please confirm this matches the CTA-861-H spec. If the checksum only covers 0x50-0x55 (the HDMI 2.0 range), the validation would fail when lane 3 has non-zero data, as bytes 0x57-0x58 would be summed but not included in the checksum calculation by the sink.

**Enum bitfield:**

```c
enum drm_scdc_frl_rate rate : 4;
u8 ffe_levels : 4;
```

Enum bitfields are a GCC/Clang extension, not standard C. This works in the kernel build environment but is worth noting. The 4-bit width is sufficient for the 0-15 value range since GCC treats this enum's underlying type as unsigned (all values are non-negative).

**`scdc_err_cnt_buf_idx` function:** This works correctly but is more complex than needed. Since the registers are at known offsets, a simpler computation would be `lane * 2` for lanes 0-2 and 7 for lane 3. The switch statement is clearer about the non-contiguous register layout though (checksum sits between lane 2 and lane 3), so it's a reasonable choice.

**`drm_scdc_frl_rate_str` has a `default: return NULL` case:**

```c
default:
    return NULL;
```

All 16 possible 4-bit values are covered by the switch cases (0-6 named, 7-15 reserved), so the `default` is unreachable. Returning `NULL` from a function whose result is passed directly to `seq_printf` via `scdc_print_str` would cause a NULL dereference if it were ever reached. Consider returning `"(Unknown)"` instead, or removing the default case entirely.

**FRL rate 0 → 3 lanes fallback:** The handling in `drm_scdc_read_state` is correct:

```c
num_lanes = drm_scdc_num_frl_lanes(state->rate);
if (num_lanes < 0)
    return num_lanes;
if (!num_lanes)
    num_lanes = 3;
```

When FRL is off (TMDS mode), defaulting to 3 lanes for the HDMI 2.0 error counters makes sense.

**Status register 1 bitfield name:** The field is called `flags` but now contains 4-bit training pattern values rather than individual boolean flags:

```c
struct {
    u8 ln0_training_pattern : 4;
    u8 ln1_training_pattern : 4;
} flags __packed;
```

Consider renaming it to something like `fields` to better reflect the content, since these are multi-bit values, not flags.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-27  5:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 10:19 [PATCH v3 0/4] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-26 10:19 ` [PATCH v3 1/4] drm/scdc-helper: Don't use ssize_t return type for scdc_read/write Nicolas Frattaroli
2026-05-26 11:35   ` Luca Ceresoli
2026-05-27  5:01   ` Claude review: " Claude Code Review Bot
2026-05-26 10:19 ` [PATCH v3 2/4] drm/scdc-helper: Add scdc_status debugfs entry Nicolas Frattaroli
2026-05-26 10:48   ` Jani Nikula
2026-05-27  5:01   ` Claude review: " Claude Code Review Bot
2026-05-26 10:19 ` [PATCH v3 3/4] drm/display: bridge_connector: init scdc debugfs for HDMI Nicolas Frattaroli
2026-05-27  5:01   ` Claude review: " Claude Code Review Bot
2026-05-26 10:20 ` [PATCH v3 4/4] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-26 10:52   ` Jani Nikula
2026-05-26 12:25     ` Nicolas Frattaroli
2026-05-26 13:56       ` Jani Nikula
2026-05-27  5:01   ` Claude Code Review Bot [this message]
2026-05-27  5:01 ` Claude review: Add SCDC information to connector debugfs Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-27 14:03 [PATCH v4 0/4] " Nicolas Frattaroli
2026-05-27 14:03 ` [PATCH v4 4/4] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-28  2:16   ` Claude review: " Claude Code Review Bot
2026-05-20 13:35 [PATCH v2 0/3] Add SCDC information to connector debugfs Nicolas Frattaroli
2026-05-20 13:35 ` [PATCH v2 3/3] drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields Nicolas Frattaroli
2026-05-25 11:49   ` 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-patch4-20260526-scdc-link-health-v3-4-59e4a4aaead1@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