Files
RedBear-OS/local/patches/libdrm/04-drm-get-version-driver-name.patch
T
vasilito 5f5eec1c49 libdrm: migrate to upstream git + external patches (Rule 2 policy fix, v6.0 2026)
Per local/AGENTS.md Rule 2 (NO OVERLAY-STYLE PATCHES — AMENDED 2026), big
external projects must NOT have source forks in local/sources/. libdrm's
Red Bear edits now live as external patches in local/patches/libdrm/,
matching the established pipewire and wireplumber migration pattern
(commits 8ff9da2ff, 722f0c452).

The 5 patches were recovered from git history (commit 89d1306c8^ —
the migration that deleted them) and renamed to the modern Rule 2
NN-prefix naming for lexical-order application:

  01-drm-ioctl-bridge.patch            (P1 from old series, 278 lines)
  02-ioctl-response-sizes.patch       (P1 from old series,  30 lines)
  03-drm-get-pci-info.patch           (P2 from old series, 153 lines)
  04-drm-get-version-driver-name.patch (P3 from old series,  34 lines)
  05-drmGetDeviceFromDevId-redox.patch (P4 from old series,  68 lines)

These patches add the Redox-side ioctl/ioctl-com and scheme: dispatch
path needed by redox-drm and Mesa radeonsi/iris.

The recipe now points at upstream libdrm 2.4.125
(https://gitlab.freedesktop.org/mesa/libdrm, tag libdrm-2.4.125) and
applies the patches via a [source].script hook (the cookbook's
"Optional script to run to prepare the source" field) with a
REDBEAR_PATCHES_DIR computed from COOKBOOK_RECIPE.

Fixes the broken state where the recipe referenced the now-deleted
local/sources/libdrm/ fork.
2026-06-09 23:24:01 +03:00

35 lines
1.1 KiB
Diff

diff --git a/xf86drm.c b/xf86drm.c
index 1b206ccd4..c3904caa3 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -1774,0 +1775,23 @@ drm_public drmVersionPtr drmGetVersion(int fd)
+
+ /* The scheme returns a NUL-terminated driver name in version.name.
+ * KWin drm_gpu.cpp dereferences version->name unconditionally
+ * (strstr checks for "i915", "amdgpu", "virtio" etc.) so it must
+ * never be NULL.
+ */
+ version.name[sizeof(version.name) - 1] = '\0';
+ if (version.name[0] != '\0') {
+ size_t len = strlen(version.name);
+ retval->name = drmMalloc(len + 1);
+ if (retval->name) {
+ memcpy(retval->name, version.name, len + 1);
+ retval->name_len = len;
+ }
+ } else {
+ const char fallback[] = "redox-drm";
+ retval->name = drmMalloc(sizeof(fallback));
+ if (retval->name) {
+ memcpy(retval->name, fallback, sizeof(fallback));
+ retval->name_len = sizeof(fallback) - 1;
+ }
+ }
+
diff --git a/xf86drm_redox.h b/xf86drm_redox.h
index c1abe8256..7f9d252fa 100644
--- a/xf86drm_redox.h
+++ b/xf86drm_redox.h
@@ -140,0 +141 @@ struct redox_drm_version_wire {
+ char name[64];