Files
RedBear-OS/local/patches/libdrm/02-ioctl-response-sizes.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

31 lines
874 B
Diff

diff --git a/local/recipes/libs/libdrm/source/xf86drm.c b/local/recipes/libs/libdrm/source/xf86drm.c
index 0379aafd7e..2d3fcd6d3b 100644
--- a/local/recipes/libs/libdrm/source/xf86drm.c
+++ b/local/recipes/libs/libdrm/source/xf86drm.c
@@ -1653,6 +1653,10 @@ static size_t redox_drm_expected_response_size(unsigned long linux_nr, size_t ar
case 0xA9:
case 0xAA:
case 0xAC:
+ case 0xB2:
+ case 0xB4:
+ case 0xBD:
+ case 0xBE:
case 0xB8:
case 0xB9:
case 0xB3:
@@ -4482,7 +4486,13 @@ drm_public int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags,
return -errno;
}
- *prime_fd = response.fd;
+ char path[64];
+ snprintf(path, sizeof(path), "card0/dmabuf/%d", response.fd);
+ int real_fd = openat(fd, path, O_RDWR | O_CLOEXEC);
+ if (real_fd < 0) {
+ return -errno;
+ }
+ *prime_fd = real_fd;
return 0;
#else
struct drm_prime_handle args;