* [PATCH resend] drm: uapi: Add macro for chipset specific event ID region
@ 2026-05-19 14:05 Bence Csokas
2026-05-25 12:50 ` Claude review: " Claude Code Review Bot
2026-05-25 12:50 ` Claude Code Review Bot
0 siblings, 2 replies; 5+ messages in thread
From: Bence Csokas @ 2026-05-19 14:05 UTC (permalink / raw)
To: dri-devel, linux-kernel, linux-arm-kernel, linux-samsung-soc
Cc: Bence Csokas, Daniel Kiss, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
Zack Rusin, Broadcom internal kernel review list
uapi/drm/drm.h states:
Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
up are chipset specific.
However, this distinction was not put in the code. To elevate the contract
between the generic DRM framework and the driver from the comment to code,
put this in a macro for clarity and convenience.
Cc: Daniel Kiss <Daniel.Kiss@arm.com>
Signed-off-by: Bence Csokas <bence.csokas@arm.com>
---
Link to v1:
https://lore.kernel.org/lkml/20260408163608.361826-2-bence.csokas@arm.com
include/uapi/drm/drm.h | 8 ++++++++
include/uapi/drm/exynos_drm.h | 4 ++--
include/uapi/drm/virtgpu_drm.h | 2 +-
include/uapi/drm/vmwgfx_drm.h | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 27cc159c1d27..aa745e643ef4 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -1419,6 +1419,14 @@ struct drm_event {
* The event payload is a struct drm_event_crtc_sequence.
*/
#define DRM_EVENT_CRTC_SEQUENCE 0x03
+/**
+ * DRM_EVENT_VENDOR_SPECIFIC - vendor/chipset specific event
+ *
+ * These event IDs are reserved for chipset and driver specific events.
+ *
+ * Refer to the chipset driver's header for details and payload struct.
+ */
+#define DRM_EVENT_VENDOR_SPECIFIC(_v) ((_v) | 0x80000000)
struct drm_event_vblank {
struct drm_event base;
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index a51aa1c618c1..8d3156fb129c 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -395,8 +395,8 @@ struct drm_exynos_ioctl_ipp_commit {
DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit)
/* Exynos specific events */
-#define DRM_EXYNOS_G2D_EVENT 0x80000000
-#define DRM_EXYNOS_IPP_EVENT 0x80000002
+#define DRM_EXYNOS_G2D_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x0)
+#define DRM_EXYNOS_IPP_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x2)
struct drm_exynos_g2d_event {
struct drm_event base;
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 9debb320c34b..03e8a0c7f778 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -224,7 +224,7 @@ struct drm_virtgpu_context_init {
* effect. The event size is sizeof(drm_event), since there is no additional
* payload.
*/
-#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
+#define VIRTGPU_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x10000000)
#define DRM_IOCTL_VIRTGPU_MAP \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index 7d786a0cc835..5e5878384e60 100644
--- a/include/uapi/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
@@ -715,7 +715,7 @@ struct drm_vmw_fence_arg {
/*
* The event type
*/
-#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
+#define DRM_VMW_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x0)
struct drm_vmw_event_fence {
struct drm_event base;
base-commit: ab5fce87a778cb780a05984a2ca448f2b41aafbf
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Claude review: drm: uapi: Add macro for chipset specific event ID region
2026-05-19 14:05 [PATCH resend] drm: uapi: Add macro for chipset specific event ID region Bence Csokas
@ 2026-05-25 12:50 ` Claude Code Review Bot
2026-05-25 12:50 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 12:50 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm: uapi: Add macro for chipset specific event ID region
Author: Bence Csokas <bence.csokas@arm.com>
Patches: 1
Reviewed: 2026-05-25T22:50:39.045663
---
This is a single-patch cleanup to the DRM UAPI headers. It introduces a `DRM_EVENT_VENDOR_SPECIFIC(_v)` macro that codifies the existing convention documented in the `struct drm_event` comment: event types `>= 0x80000000` are chipset-specific. It then converts the three existing in-tree users (exynos, virtgpu, vmwgfx) from raw hex constants to the new macro.
The patch is straightforward, correct, and all resulting values are bit-identical to the originals:
- `DRM_EXYNOS_G2D_EVENT`: `0x80000000` → `DRM_EVENT_VENDOR_SPECIFIC(0x0)` = `0x80000000` ✓
- `DRM_EXYNOS_IPP_EVENT`: `0x80000002` → `DRM_EVENT_VENDOR_SPECIFIC(0x2)` = `0x80000002` ✓
- `VIRTGPU_EVENT_FENCE_SIGNALED`: `0x90000000` → `DRM_EVENT_VENDOR_SPECIFIC(0x10000000)` = `0x90000000` ✓
- `DRM_VMW_EVENT_FENCE_SIGNALED`: `0x80000000` → `DRM_EVENT_VENDOR_SPECIFIC(0x0)` = `0x80000000` ✓
No UAPI ABI break. All three driver headers already `#include "drm.h"`, so the macro resolves correctly.
**Minor observations (not blocking):**
1. The macro uses bitwise OR (`|`), which means a caller passing a value that already has bit 31 set (e.g., `DRM_EVENT_VENDOR_SPECIFIC(0x80000001)`) would silently produce a "vendor" event indistinguishable from `DRM_EVENT_VENDOR_SPECIFIC(0x1)`. This is unlikely to happen in practice, but the macro doesn't guard against it. A comment or `BUILD_BUG_ON` for kernel-internal usage could prevent future mistakes, but for a UAPI header macro this is probably acceptable as-is.
2. `DRM_VMW_EVENT_FENCE_SIGNALED` and `DRM_EXYNOS_G2D_EVENT` share the same value `0x80000000`. This is pre-existing — different drivers handle their own event space, so there's no actual conflict. But the conversion to the macro makes this more visible. Worth noting, not a bug.
**Verdict:** Looks good. Clean mechanical conversion with no value changes.
---
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm: uapi: Add macro for chipset specific event ID region
2026-05-19 14:05 [PATCH resend] drm: uapi: Add macro for chipset specific event ID region Bence Csokas
2026-05-25 12:50 ` Claude review: " Claude Code Review Bot
@ 2026-05-25 12:50 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-05-25 12:50 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Commit message:** Clear and well-written. It explains the motivation (elevating the comment-level contract to code) and references the v1 link. Good.
**`include/uapi/drm/drm.h` changes:**
```c
+#define DRM_EVENT_VENDOR_SPECIFIC(_v) ((_v) | 0x80000000)
```
Placed correctly right after `DRM_EVENT_CRTC_SEQUENCE` (the last generic event define) and before `struct drm_event_vblank`. The kerneldoc comment is appropriate for a UAPI header. The parenthesization of `_v` in `(_v)` and the outer parens are correct macro hygiene.
One nit: the name `DRM_EVENT_VENDOR_SPECIFIC` reads like a single event rather than a constructor/range macro. Names like `DRM_EVENT_CHIPSET` or `DRM_EVENT_DRIVER` might match the existing comment wording ("chipset specific") more closely, but this is subjective and the current name is perfectly clear in context.
**`include/uapi/drm/exynos_drm.h` changes:**
```c
-#define DRM_EXYNOS_G2D_EVENT 0x80000000
-#define DRM_EXYNOS_IPP_EVENT 0x80000002
+#define DRM_EXYNOS_G2D_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x0)
+#define DRM_EXYNOS_IPP_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x2)
```
Values preserved. `drm.h` is included at line 19 of this file. Correct.
**`include/uapi/drm/virtgpu_drm.h` changes:**
```c
-#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
+#define VIRTGPU_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x10000000)
```
`0x10000000 | 0x80000000` = `0x90000000`. Value preserved. `drm.h` is included at line 27 of this file. Correct.
**`include/uapi/drm/vmwgfx_drm.h` changes:**
```c
-#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
+#define DRM_VMW_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x0)
```
Value preserved. `drm.h` is included at line 32 of this file. Correct.
**No issues found.** This is a clean, correct, ABI-preserving patch.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] drm: uapi: Add macro for chipset specific event ID region
@ 2026-04-08 16:36 Bence Csokas
2026-04-12 2:13 ` Claude review: " Claude Code Review Bot
2026-04-12 2:13 ` Claude Code Review Bot
0 siblings, 2 replies; 5+ messages in thread
From: Bence Csokas @ 2026-04-08 16:36 UTC (permalink / raw)
To: dri-devel, linux-kernel, linux-arm-kernel, linux-samsung-soc
Cc: Bence Csokas, Daniel Kiss, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Inki Dae,
Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
Zack Rusin, Broadcom internal kernel review list
uapi/drm/drm.h states:
Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
up are chipset specific.
However, this distinction was not put in the code. To elevate the contract
between the generic DRM framework and the driver from the comment to code,
put this in a macro for clarity and convenience.
Cc: Daniel Kiss <Daniel.Kiss@arm.com>
Signed-off-by: Bence Csokas <bence.csokas@arm.com>
---
include/uapi/drm/drm.h | 8 ++++++++
include/uapi/drm/exynos_drm.h | 4 ++--
include/uapi/drm/virtgpu_drm.h | 2 +-
include/uapi/drm/vmwgfx_drm.h | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 27cc159c1d27..aa745e643ef4 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -1419,6 +1419,14 @@ struct drm_event {
* The event payload is a struct drm_event_crtc_sequence.
*/
#define DRM_EVENT_CRTC_SEQUENCE 0x03
+/**
+ * DRM_EVENT_VENDOR_SPECIFIC - vendor/chipset specific event
+ *
+ * These event IDs are reserved for chipset and driver specific events.
+ *
+ * Refer to the chipset driver's header for details and payload struct.
+ */
+#define DRM_EVENT_VENDOR_SPECIFIC(_v) ((_v) | 0x80000000)
struct drm_event_vblank {
struct drm_event base;
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index a51aa1c618c1..8d3156fb129c 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -395,8 +395,8 @@ struct drm_exynos_ioctl_ipp_commit {
DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit)
/* Exynos specific events */
-#define DRM_EXYNOS_G2D_EVENT 0x80000000
-#define DRM_EXYNOS_IPP_EVENT 0x80000002
+#define DRM_EXYNOS_G2D_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x0)
+#define DRM_EXYNOS_IPP_EVENT DRM_EVENT_VENDOR_SPECIFIC(0x2)
struct drm_exynos_g2d_event {
struct drm_event base;
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 9debb320c34b..03e8a0c7f778 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -224,7 +224,7 @@ struct drm_virtgpu_context_init {
* effect. The event size is sizeof(drm_event), since there is no additional
* payload.
*/
-#define VIRTGPU_EVENT_FENCE_SIGNALED 0x90000000
+#define VIRTGPU_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x10000000)
#define DRM_IOCTL_VIRTGPU_MAP \
DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index 7d786a0cc835..5e5878384e60 100644
--- a/include/uapi/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
@@ -715,7 +715,7 @@ struct drm_vmw_fence_arg {
/*
* The event type
*/
-#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
+#define DRM_VMW_EVENT_FENCE_SIGNALED DRM_EVENT_VENDOR_SPECIFIC(0x0)
struct drm_vmw_event_fence {
struct drm_event base;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Claude review: drm: uapi: Add macro for chipset specific event ID region
2026-04-08 16:36 [PATCH] " Bence Csokas
@ 2026-04-12 2:13 ` Claude Code Review Bot
2026-04-12 2:13 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-12 2:13 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Value correctness — OK**
All conversions are value-preserving:
- `DRM_EXYNOS_G2D_EVENT`: `0x0 | 0x80000000 = 0x80000000` (was `0x80000000`) ✓
- `DRM_EXYNOS_IPP_EVENT`: `0x2 | 0x80000000 = 0x80000002` (was `0x80000002`) ✓
- `VIRTGPU_EVENT_FENCE_SIGNALED`: `0x10000000 | 0x80000000 = 0x90000000` (was `0x90000000`) ✓
- `DRM_VMW_EVENT_FENCE_SIGNALED`: `0x0 | 0x80000000 = 0x80000000` (was `0x80000000`) ✓
**Missing conversion — nouveau_drm.h**
```c
/* nouveau_drm.h line 28 */
#define DRM_NOUVEAU_EVENT_NVIF 0x80000000
```
This is a vendor-specific event at `0x80000000` that was not converted. The cause is likely the include ordering in `nouveau_drm.h`:
```c
/* line 28 */ #define DRM_NOUVEAU_EVENT_NVIF 0x80000000
/* line 30 */ #include "drm.h"
```
The macro isn't defined yet at line 28. The fix would be to move the `#include "drm.h"` above the define, or move the define below the include. Either way, this omission should be mentioned in the commit message, or better yet, fixed as part of this patch.
**Comment update opportunity**
The existing comment at `drm.h:1387`:
```c
* Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and
* up are chipset specific.
```
could be updated to reference the new `DRM_EVENT_VENDOR_SPECIFIC()` macro, reinforcing the link between the comment and the code it describes. This is optional but would improve discoverability.
**Macro design — minor concern**
```c
#define DRM_EVENT_VENDOR_SPECIFIC(_v) ((_v) | 0x80000000)
```
The OR operation doesn't guard against a caller passing a value that already has bit 31 set (e.g., `DRM_EVENT_VENDOR_SPECIFIC(0x80000000)` would produce `0x80000000`, silently masking a likely error). For UAPI this is probably fine — adding `BUILD_BUG_ON` style validation would be impractical in a header — but it's worth noting.
**Naming**
`DRM_EVENT_VENDOR_SPECIFIC` reads somewhat like a constant rather than a function-like macro. Names like `DRM_EVENT_VENDOR(_v)` or `DRM_VENDOR_EVENT(_v)` might be slightly more conventional, but this is a subjective style point and the current name is descriptive enough.
**Summary**: The patch is a net improvement in code clarity. The missing `nouveau_drm.h` conversion is the main issue — it should either be included (with the necessary include reorder) or explicitly explained in the commit message. With that addressed, the patch looks ready.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: drm: uapi: Add macro for chipset specific event ID region
2026-04-08 16:36 [PATCH] " Bence Csokas
2026-04-12 2:13 ` Claude review: " Claude Code Review Bot
@ 2026-04-12 2:13 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-12 2:13 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm: uapi: Add macro for chipset specific event ID region
Author: Bence Csokas <bence.csokas@arm.com>
Patches: 1
Reviewed: 2026-04-12T12:13:17.431218
---
This is a single patch that introduces a `DRM_EVENT_VENDOR_SPECIFIC(_v)` macro to codify the existing convention that DRM event types `>= 0x80000000` are reserved for chipset/driver-specific use. The concept is sound — elevating a comment-only contract into a code-enforced convention is good practice for UAPI headers.
However, the patch has one notable omission: `nouveau_drm.h` defines `DRM_NOUVEAU_EVENT_NVIF` as `0x80000000` (line 28) but was not converted. This appears to be because in `nouveau_drm.h` the define appears *before* the `#include "drm.h"` (line 30), so the macro wouldn't be available at the point of use. This is a valid technical obstacle, but it should be explicitly called out in the commit message. Silently skipping one of the four vendor-specific event definitions without explanation undermines the goal of making the conversion comprehensive.
The macro values are all numerically correct — every converted definition produces the same value as before.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-25 12:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 14:05 [PATCH resend] drm: uapi: Add macro for chipset specific event ID region Bence Csokas
2026-05-25 12:50 ` Claude review: " Claude Code Review Bot
2026-05-25 12:50 ` Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-04-08 16:36 [PATCH] " Bence Csokas
2026-04-12 2:13 ` Claude review: " Claude Code Review Bot
2026-04-12 2:13 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox