mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
The client side of the Linux-file RPC for a macOS process: mlg_open, mlg_close, mlg_ioctl, mlg_mmap and mlg_munmap on /dev/dri/renderD128 and /dev/kfd, mirroring the system calls, for a Mesa winsys or libdrm shim. Requests are Linux ones: the Linux uapi headers are built through libmlg_drm/compat with Linux ioctl encodings on any host, and mlg_ioctl_from_bsd converts what a macOS build of the same headers produces. Each request is described with the shared tables (lx_describe.c), framed (lx_frame.c), and its reply copied back; waits with a deadline go through LX_IOCTL_ASYNC and complete on a per-thread notification port, deadlines travel as time left, mmaps go through IOConnectMapMemory64 with the cache mode the driver reports, and errors come back as this platform's errno (mlg_last_linux_errno keeps the Linux one). The default transport is the dext's Linux-file user client (type 2); tests install their own. make libmlg_drm builds a static and a shared library. Tests: the library alone against a recording transport, and a RADV-like client end to end through the core into upstream DRM/amdgpu on the CS fixture: INFO, contexts, GEM, a BO list, AMDGPU_CS, WAIT_CS, WAIT_FENCES and SYNCOBJ_WAIT on async workers, syncobj and fence export as descriptors of the driver process.