From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/hibmc: Use gem-shmem with shadow-plane helpers for memory management
Date: Thu, 23 Apr 2026 10:03:23 +1000 [thread overview]
Message-ID: <review-patch4-20260420121130.200133-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20260420121130.200133-5-tzimmermann@suse.de>
Patch Review
**Status: Good**
This is the core conversion. The approach closely follows ast and mgag200, which gives confidence it's well-proven.
**Core API change — exporting `drm_gem_shmem_create_with_handle()`**: This was previously static in `drm_gem_shmem_helper.c`. The export is needed because hibmc needs custom pitch alignment (128 bytes) in `dumb_create`, so it can't use the standard `drm_gem_shmem_dumb_create()`. Good documentation is added. The function is also declared in the header. Clean.
**VRAM management**: The old `drmm_vram_helper_init()` + TTM is replaced with a simple `devm_ioremap_wc()`:
```c
priv->vram = devm_ioremap_wc(dev->dev, vram_base, vram_size);
```
Write-combining is the correct mapping for VRAM that will be written by CPU memcpy.
**Shadow plane damage handling** in `atomic_update`:
```c
if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE) == 0) {
drm_atomic_helper_damage_iter_init(&iter, old_state, new_state);
drm_atomic_for_each_plane_damage(&iter, &damage) {
struct iosys_map dst[DRM_FORMAT_MAX_PLANES] = {
IOSYS_MAP_INIT_VADDR_IOMEM(priv->vram + gpu_addr),
};
iosys_map_incr(&dst[0],
drm_fb_clip_offset(fb->pitches[0], fb->format, &damage));
drm_fb_memcpy(dst, fb->pitches, shadow_plane_state->data, fb, &damage);
}
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
}
```
This follows the ast pattern exactly. The `drm_gem_fb_begin_cpu_access()` / `end_cpu_access()` bracket properly synchronizes dma-buf shared buffers. If `begin_cpu_access` fails, the function silently skips the copy but still programs the hardware registers — this is acceptable since `atomic_update` can't return errors.
**`gpu_addr` is hardcoded to 0**: Since there's no VRAM allocator anymore, all framebuffers are copied to VRAM offset 0. This means no double-buffering in VRAM, so page flips will show tearing during the copy. This is the same tradeoff made by ast/mgag200 and is acceptable for a server BMC display card. Damage clipping (`drm_plane_enable_fb_damage_clips`) minimizes the copy window.
**Mode validation**:
```c
const struct drm_format_info *info =
drm_get_format_info(dev, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR);
```
Using XRGB8888 (the largest format at 4 bpp) gives a conservative check ensuring any supported format will fit. The overflow-safe division `pitch > max_fb_size / mode->vdisplay` is the correct approach.
**Kconfig changes**: Drops `DRM_VRAM_HELPER`, `DRM_TTM`, `DRM_TTM_HELPER`, adds `DRM_GEM_SHMEM_HELPER`. Clean.
No issues found.
---
Generated by Claude Code Patch Reviewer
next prev parent 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 review: " Claude Code Review Bot
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 Code Review Bot [this message]
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-patch4-20260420121130.200133-5-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