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/rockchip: vop2: Support setting custom background color
Date: Wed, 04 Mar 2026 06:54:47 +1000	[thread overview]
Message-ID: <review-patch4-20260303-rk3588-bgcolor-v8-4-fee377037ad1@collabora.com> (raw)
In-Reply-To: <20260303-rk3588-bgcolor-v8-4-fee377037ad1@collabora.com>

Patch Review

**Status: Mostly good, one concern**

The register programming using `FIELD_PREP`/`FIELD_MODIFY` with the BPCS (shift-based) helpers is clean:

```c
+	val = FIELD_PREP(RK3568_VP_DSP_BG__DSP_BG_RED, DRM_ARGB64_GETR_BPCS(bgcolor, 10));
+	FIELD_MODIFY(RK3568_VP_DSP_BG__DSP_BG_GREEN, &val, DRM_ARGB64_GETG_BPCS(bgcolor, 10));
+	FIELD_MODIFY(RK3568_VP_DSP_BG__DSP_BG_BLUE, &val, DRM_ARGB64_GETB_BPCS(bgcolor, 10));
```

The register field definitions (three 10-bit fields in bits 29-0) look correct for VOP2 documentation. Using BPCS (shift instead of divide) is justified for a hot path like `vop2_post_config()`.

**Concern — alpha-blending rejection check:**

```c
+	if ((cstate->background_color << 16) &&
+	    (fb->format->has_alpha || pstate->alpha != 0xffff)) {
+		drm_dbg_kms(vop2->drm,
+			    "Alpha-blending with background color is unsupported\n");
+		return -EINVAL;
+	}
```

The `<< 16` trick to strip the alpha and check if RGB is non-zero is clever but somewhat obscure — a named helper or a mask like `bgcolor & 0x0000FFFFFFFFFFFF` would be clearer.

More substantively, this check may be **overly conservative**: it rejects any plane that has alpha (format or property) whenever the background is non-black, regardless of whether that plane's pixels actually interact with the background. For example, if plane A is a fully opaque bottom layer covering the entire screen, and plane B above it has `has_alpha`, the check would reject plane B even though plane B blends with plane A, not the background. I understand this is a hardware limitation being enforced conservatively, but it could break valid compositing scenarios with non-black backgrounds. Is the hardware truly incapable of handling this, or is it just that the background-to-first-plane blending is problematic? If the latter, this could be refined to only reject when the lowest z-order plane has alpha.

The state dump addition is a nice touch for debugging:

```c
+	seq_printf(s, "\tbackground color (10bpc): r=0x%x g=0x%x b=0x%x\n",
```

R-b from Andy Yan (Rockchip maintainer) is appropriate.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-03 20:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 19:24 [PATCH v8 0/4] Introduce BACKGROUND_COLOR DRM CRTC property Cristian Ciocaltea
2026-03-03 19:24 ` [PATCH v8 1/4] uapi: Provide DIV_ROUND_CLOSEST() Cristian Ciocaltea
2026-03-03 20:54   ` Claude review: " Claude Code Review Bot
2026-03-03 19:24 ` [PATCH v8 2/4] drm: Add CRTC background color property Cristian Ciocaltea
2026-03-03 20:54   ` Claude review: " Claude Code Review Bot
2026-03-03 19:24 ` [PATCH v8 3/4] drm/vkms: Support setting custom background color Cristian Ciocaltea
2026-03-03 20:54   ` Claude review: " Claude Code Review Bot
2026-03-03 19:24 ` [PATCH v8 4/4] drm/rockchip: vop2: " Cristian Ciocaltea
2026-03-03 20:54   ` Claude Code Review Bot [this message]
2026-03-03 20:54 ` Claude review: Introduce BACKGROUND_COLOR DRM CRTC property 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-20260303-rk3588-bgcolor-v8-4-fee377037ad1@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