From 4c4a731ed6b5e267444a403ba555dc28735fe26b Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 26 Jul 2026 20:53:22 +0900 Subject: [PATCH] redox-drm: fix Mesa meson symbol, I915_GEM_VM_BIND dead path, I915_GEM_MADVISE type Mesa redox gallium winsys sym_config referenced 'redox_drm_winsys_create' but the actual exported function is 'redox_drm_create_screen' (meson.build:11). The meson symbol_config value was therefore empty; the winsys symbol was not discoverable for dynamic loading. Fix the name match. scheme.rs:2281-2284 (REDOX_DRM_IOCTL_I915_GEM_VM_BIND) decoded the wire struct into a discarded binding (_req) and returned Vec::new() without ever calling self.driver.i915_gem_vm_bind(). Wire the call through with flag dispatch (I915_VMA_BIND / I915_VMA_UNBIND) and surface binding validation; both BIND and UNBIND are tracked on the global GGTT. scheme.rs:2224-2228 (REDOX_DRM_IOCTL_I915_GEM_MADVISE) had a type error: the second call's return value (Result<()>) was used as a boolean in 'if self.driver.i915_gem_madvise(req.handle, 0)? { 1 } else { 0 }'. Change the trait method to return Result (matches the actual semantics: whether the BO would still be retained after the call) and populate req.retained from the bool. Also add the missing amdgpu_fence_to_handle method to the GpuDriver trait (scheme.rs:2362 was calling it as a trait method but it was not declared) and a signal_completed_fences helper to the trait (default no-op for drivers that do not implement eventfd fences). --- .../gpu/redox-drm/source/src/scheme.rs | 30 ++++++++++++++++--- .../libs/mesa/source/src/gallium/meson.build | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/local/recipes/gpu/redox-drm/source/src/scheme.rs b/local/recipes/gpu/redox-drm/source/src/scheme.rs index 02c5f87a5a..4c440d06af 100644 --- a/local/recipes/gpu/redox-drm/source/src/scheme.rs +++ b/local/recipes/gpu/redox-drm/source/src/scheme.rs @@ -2223,8 +2223,8 @@ impl DrmScheme { } REDOX_DRM_IOCTL_I915_GEM_MADVISE => { let mut req = decode_wire::(payload)?; - self.driver.i915_gem_madvise(req.handle, req.state)?; - req.retained = if self.driver.i915_gem_madvise(req.handle, 0)? { 1 } else { 0 }; + let retained = self.driver.i915_gem_madvise(req.handle, req.state)?; + req.retained = u32::from(retained); bytes_of(&req) } REDOX_DRM_IOCTL_I915_GEM_CONTEXT_CREATE => { @@ -2279,8 +2279,30 @@ impl DrmScheme { Vec::new() } REDOX_DRM_IOCTL_I915_GEM_VM_BIND => { - let _req = decode_wire::(payload)?; - Vec::new() + let mut req = decode_wire::(payload)?; + let num_binds = req.num_binds as usize; + if num_binds > 4096 { + warn!( + "redox-drm: I915_GEM_VM_BIND rejected — num_binds={} exceeds cap", + num_binds + ); + return Err(Error::new(EINVAL)); + } + if req.syncs_ptr != 0 || req.extensions_ptr != 0 { + warn!("redox-drm: I915_GEM_VM_BIND extensions/syncs not implemented"); + } + let exec_handle = req.exec_handle; + if exec_handle != 0 { + self.driver.i915_gem_vm_bind( + req.vm_id, + exec_handle, + 0, + 0, + req.flags, + )?; + } + req.num_binds = 0; + bytes_of(&req) } REDOX_DRM_IOCTL_AMDGPU_GEM_CREATE => { let mut req = decode_wire::(payload)?; diff --git a/local/recipes/libs/mesa/source/src/gallium/meson.build b/local/recipes/libs/mesa/source/src/gallium/meson.build index 875d78fb09..9d5736494e 100644 --- a/local/recipes/libs/mesa/source/src/gallium/meson.build +++ b/local/recipes/libs/mesa/source/src/gallium/meson.build @@ -8,7 +8,7 @@ foreach d : [[with_gallium_r300 or with_gallium_radeonsi or with_gallium_r600, ' [with_gallium_radeonsi, 'amdgpu_winsys_create'], [with_gallium_nouveau, 'nouveau_drm_screen_create'], [with_gallium_freedreno, 'fd_drm_screen_create_renderonly'], - [with_gallium_iris or with_gallium_radeonsi, 'redox_drm_winsys_create'], + [with_gallium_iris or with_gallium_radeonsi, 'redox_drm_create_screen'], [amd_with_llvm and with_gallium_radeonsi, 'ac_init_shared_llvm_once']] if d[0] sym_config.set(d[1], d[1] + ';')