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/i915/color: Program Pre-CSC registers for SDR
Date: Mon, 09 Mar 2026 08:26:53 +1000	[thread overview]
Message-ID: <review-patch7-20260306165307.3233194-8-chaitanya.kumar.borah@intel.com> (raw)
In-Reply-To: <20260306165307.3233194-8-chaitanya.kumar.borah@intel.com>

Patch Review

**BUG — Wrong LUT extract function for SDR pre-CSC.** The function receives `const struct drm_color_lut32 *pre_csc_lut` (32-bit per-channel values) but uses `drm_color_lut_extract()`:

```c
lut_val = drm_color_lut_extract(pre_csc_lut[i].green, 16);
```

`drm_color_lut_extract` expects a 16-bit input (from `struct drm_color_lut`), scaling from `[0, 2^16-1]` to `[0, 2^precision-1]`. But `drm_color_lut32.green` is a `u32` in the range `[0, 2^32-1]`. This will produce incorrect values for any input above 65535. Should use `drm_color_lut32_extract(pre_csc_lut[i].green, 16)` instead.

**Concern — Hardcoded plane offset `plane = plane - 3`:**

```c
/*
 * First 3 planes are HDR, so reduce by 3 to get to the right
 * SDR plane offset
 */
plane = plane - 3;
```

This hardcodes the assumption that exactly 3 HDR planes precede SDR planes. While this matches current hardware (`PLANE_1`, `PLANE_2`, `PLANE_3` are HDR per `icl_hdr_plane_mask()`), it's fragile. The `_MMIO_PLANE_GAMC` macro uses `_PIPE(plane, a, b)` which only supports two planes (plane 0 and plane 1). After subtracting 3, `PLANE_4` becomes index 1, `PLANE_5` becomes index 2, etc. But `_PIPE` only handles index 0 and 1. If there are more than 2 SDR planes, this will access wrong registers. The code should add a comment explaining which SDR planes this supports and add a `WARN_ON` for unexpected plane IDs.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-08 22:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 16:52 [PATCH 00/10] drm/i915/color: Enable SDR plane color pipeline Chaitanya Kumar Borah
2026-03-06 16:52 ` [PATCH 01/10] drm/colorop: Add DRM_COLOROP_CSC_FF Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:52 ` [PATCH 02/10] drm/i915/color: Add CSC on SDR plane color pipeline Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 03/10] drm/i915/color: Program fixed-function CSC on SDR planes Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 04/10] drm/i915/color: Add support for 1D LUT in " Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 05/10] drm/i915/color: Fix HDR pre-CSC LUT programming loop Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 06/10] drm/i915/color: Extract HDR pre-CSC LUT programming to helper function Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 07/10] drm/i915/color: Program Pre-CSC registers for SDR Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude Code Review Bot [this message]
2026-03-06 16:53 ` [PATCH 08/10] drm/i915/color: Extract HDR post-CSC LUT programming to helper function Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 09/10] drm/i915/color: Program Plane Post CSC registers for SDR planes Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-06 16:53 ` [PATCH 10/10] drm/i915/color: Add color pipeline support " Chaitanya Kumar Borah
2026-03-08 22:26   ` Claude review: " Claude Code Review Bot
2026-03-08 22:26 ` Claude review: drm/i915/color: Enable SDR plane color pipeline 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-patch7-20260306165307.3233194-8-chaitanya.kumar.borah@intel.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