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/hibmc: Do not use cpp from struct drm_format_info
Date: Thu, 23 Apr 2026 10:03:23 +1000	[thread overview]
Message-ID: <review-patch3-20260420121130.200133-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20260420121130.200133-4-tzimmermann@suse.de>

Patch Review

**Status: Good, one minor observation**

Two changes:

1. Replaces `width * cpp[0]` with `drm_format_info_min_pitch()`:
```c
reg = drm_format_info_min_pitch(fb->format, 0, fb->width);
```
This is the preferred API for computing line widths and handles multi-plane formats correctly.

2. Replaces the `cpp[0] * 8 / 16` formula with an explicit switch on the fourcc:
```c
switch (fb->format->format) {
case DRM_FORMAT_XRGB8888:
    reg |= HIBMC_FIELD(HIBMC_CRT_DISP_CTL_FORMAT, 2);
    break;
case DRM_FORMAT_RGB565:
    reg |= HIBMC_FIELD(HIBMC_CRT_DISP_CTL_FORMAT, 1);
    break;
}
```

The magic values 2 and 1 match the old formula's results (`4*8/16=2`, `2*8/16=1`) and are presumably the hardware register encoding. This is cleaner and eliminates the problematic dependency on cpp.

**Minor observation**: The switch has no `default` case. Since patch 2 restricts formats to only XRGB8888 and RGB565, an unhandled format reaching this point would be a framework bug. However, a `default: WARN_ONCE(...)` or `default: break;` could be added for defensive programming. Not blocking — the mask is cleared before the switch, so the worst case is the format field being left at 0, which may represent an undefined or 8bpp mode. Given that `atomic_check` validates the format list, this is fine in practice.

There's a minor inconsistency where `line_l = new_state->fb->pitches[0]` still uses `new_state->fb` instead of the newly-introduced `fb` local variable, but patch 4 cleans this up.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-23  0:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 12:09 [PATCH v2 0/4] drm/hibmc: Fix plane helpers and convert to gem-shmem Thomas Zimmermann
2026-04-20 12:09 ` [PATCH v2 1/4] drm/hibmc: Use drm_atomic_helper_check_plane_state() Thomas Zimmermann
2026-04-21  7:56   ` Yongbang Shi
2026-04-23  0:03   ` Claude review: " Claude Code Review Bot
2026-04-20 12:09 ` [PATCH v2 2/4] drm/hibmc: Fix list of formats on the primary plane Thomas Zimmermann
2026-04-23  0:03   ` Claude review: " Claude Code Review Bot
2026-04-20 12:09 ` [PATCH v2 3/4] drm/hibmc: Do not use cpp from struct drm_format_info Thomas Zimmermann
2026-04-23  0:03   ` Claude Code Review Bot [this message]
2026-04-20 12:10 ` [PATCH v2 4/4] drm/hibmc: Use gem-shmem with shadow-plane helpers for memory management Thomas Zimmermann
2026-04-23  0:03   ` Claude review: " Claude Code Review Bot
2026-04-23  0:03 ` Claude review: drm/hibmc: Fix plane helpers and convert to gem-shmem 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-20260420121130.200133-4-tzimmermann@suse.de \
    --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