Files
RedBear-OS/local/recipes/gpu
vasilito 76313e1e49 redox-drm AMD: real amdgpu UAPI bridge implementations
Replace the stub no-op amdgpu bridge methods with real implementations:

* amdgpu_gem_create: now mirrors the Intel driver and calls
  ensure_gem_gpu_mapping(handle) so the BO has a real GPU page-table
  entry (previous version only allocated the GEM handle but left BOs
  without GPU visibility, page-faulting on any GPU access).
* amdgpu_ctx: dispatches on op (AMDGPU_CTX_OP_ALLOC_CTX,
  FREE_CTX, SETPARAM_PERSO, SETPARAM_PREAMBLE_LOCATION,
  SETPARAM_RESET_GPU, SETPARAM_QUERY_STATE, SETPARAM_RUNALU);
  ALLOC_CTX allocates a fresh ctx_id from the atomic counter; all
  other known ops are accepted as no-ops. Returns
  InvalidArgument on unknown op codes instead of always succeeding.
* amdgpu_cs: validates dword count (1..=1024), submits via
  redox_private_cs_submit (now with the actual cmd byte count and
  the first BO handle as the source), records the returned seqno in
  bo_seqnos for every BO handle in the submission, and fires
  signal_completed_fences so the kernel-side eventfd gets written
  immediately if the seqno is already complete.
* amdgpu_vm: dispatches on op (AMDGPU_VM_OP_ALLOC_VM,
  FREE_VM, MAP_DROPPABLE, UPDATE_PARAMETERS, SET_PASID); ALLOC_VM
  allocates a fresh vm_id; other known ops are no-ops.
* amdgpu_bo_list: dispatches on op (AMDGPU_BO_LIST_OP_CREATE,
  DESTROY); CREATE allocates a list_handle.
* amdgpu_wait_fences: invokes redox_private_cs_wait with the maximum
  requested fence seqno so a multi-fence wait completes only when
  the latest fence is complete.
* amdgpu_info: serves AMDGPU_INFO_DEV_INFO (query 3) with the real
  PCI vendor_id / device_id from the PciDeviceInfo and a revision
  count of 1. Unknown query ids return a zero-filled buffer.
* amdgpu_fence_to_handle: validates flags
  (AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ / _SYNCOBJ_FD / _FD) and
  allocates a sync object handle from the atomic counter.
* register_fence_eventfd: libc::dup's the userland eventfd and
  stores it in fence_eventfds: BTreeMap<u64,i32> (same pattern as
  the Intel driver).
* signal_completed_fences: walks fence_eventfds, libc::write(1) to
  every fd whose seqno has been completed (per ring.last_seqno()
  after sync_from_hw), then libc::close the fd.

Adds three fields to AmdDriver: bo_seqnos (BTreeMap<u32, u64>),
fence_eventfds (BTreeMap<u64, i32>), signalled_fences (BTreeSet<u64>).
All Mutex-protected.
2026-07-26 20:55:33 +09:00
..