Claude review: drm: verisilicon: fill plane's vs_format in atomic_check

Claude Code Review Bot
2026-03-31T06:44:30Z

Patch Review

**Status: Good**

This is the payoff patch. It:

1. Adds `struct vs_format format` to `vs_plane_state`.
2. Copies the format in `vs_plane_duplicate_state()` so it persists across state duplication.
3. In `atomic_check`, after `drm_atomic_helper_check_plane_state()` succeeds and confirms visibility, converts the format and stores it in the vs_plane_state.
4. In `atomic_update`, reads from `vs_state->format` instead of calling `drm_format_to_vs_format()` inline.

The `drm_WARN_ON_ONCE` around the format conversion failure in `atomic_check` is appropriate — since the format list is controlled by the driver, an unsupported format reaching this point indicates a driver bug (the format should have been rejected earlier), so a warning + error return is the right response.

The early return on `!new_plane_state->visible` before the format conversion is correct — if the plane isn't visible, there's no framebuffer to convert, and `fb` could be NULL.

The `memcpy` of `vs_format` in `vs_plane_duplicate_state()` could alternatively just assign `vs_state->format = vs_state_old->format` (struct assignment), but `memcpy` is fine and common in kernel code.