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<bool> (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).
This commit is contained in:
2026-07-26 20:53:22 +09:00
parent db5f289d46
commit 4c4a731ed6
2 changed files with 27 additions and 5 deletions
@@ -2223,8 +2223,8 @@ impl DrmScheme {
}
REDOX_DRM_IOCTL_I915_GEM_MADVISE => {
let mut req = decode_wire::<DrmI915GemMadviseWire>(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::<DrmI915GemVmBindWire>(payload)?;
Vec::new()
let mut req = decode_wire::<DrmI915GemVmBindWire>(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::<DrmAmdgpuGemCreateWire>(payload)?;
@@ -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] + ';')