How quic/fastrpc works
Project type and purpose
• FastRPC is a cross-processor RPC framework written in C for Qualcomm devices. It lets a CPU process call functions on a DSP by hiding all the marshalling, transport, and dispatch logic.
• It comprises stub code (for CPU), skeleton code (for DSP), plus a lightweight FastRPC framework on both sides to queue, send, receive, and dispatch RPC messages.
File structure
• Top level:
• .github/ – CI workflows (Linux, Android builds, CodeQL, PR checks)
• inc/ – all public and internal headers for stubs, skels, FastRPC core, utilities
• src/ – C implementations: generated stubs/skels, FastRPC core modules (async, perf, mem, notif, procbuf, log, pm), transport (dspqueue, dspsignal), platform shims, RPC memory, atomic, std libs
• test/ – unit tests and platform-specific test drivers (android, linux, v68, v75)
• Autotools files: autogen.sh, configure.ac, Makefile.am, gitcompile
• This is a monolithic C library with a clear separation between CPU side and DSP side code, generated code vs. core framework modules.
Main components
a. Build‐time / Toolchain layer
• IDL compiler (QAIC) → generates stub (.c/.h) and skeleton (.c/.h) code
• Autotools wrapper (gitcompile, configure, Makefiles) for native/ARM/Android cross-compilation
b. CPU side
• Application process (user mode)
• Stub library (generated code linked into the app)
• FastRPC CPU framework modules (e.g., fastrpc_async, fastrpc_mem, fastrpc_notif, fastrpc_log, fastrpc_pm)
• Underlying transport: dspqueue and dspsignal CPU drivers or platform shims
c. Interconnect / Transport
• Shared memory buffers (rpcmem) + signaling (DSP interrupts or mailbox)
• dspqueue for message queuing and notification
d. DSP side
• FastRPC DSP framework modules (counterparts to CPU modules)
• Skeleton library (generated code linked into DSP binary)
• Algorithm implementations or DSP services invoked by skeletons
e. Hardware
• CPU (ARM/AArch64) with OS user process
• DSP subsystem with its own firmware/RTOS
f. External dependencies
• Hexagon SDK (for DSP services and HVX)
• Platform libraries (mutex, atomics, pthread-rw, std utilities)
Relationships and interactions (work flow)
1. CPU app calls stub function
2. Stub marshals parameters → RPC message
3. Stub invokes CPU FastRPC framework → enqueues message via dspqueue
4. Transport layer sends message to DSP (shared memory + interrupt)
5. DSP FastRPC framework dequeues message → dispatches to skeleton
6. Skeleton unmarshals → calls DSP implementation
7. Skeleton marshals return value → enqueues return message via DSP framework
8. Transport layer notifies CPU framework
9. CPU FastRPC framework dequeues return message → delivers to stub
10. Stub unmarshals return data → returns to calling process
Architectural patterns and design principles
• Layered architecture: build/toolchain → CPU framework → transport → DSP framework → implementation
• Modular C design: each fastrpc_* module handles one concern (memory, async, perf, power management)
• Code generation (IDL → stub/skel) to keep API contracts in-sync
• Shared-memory + signaling transport abstraction (dspqueue / dspsignal) to isolate hardware details
Detail checklist
• Major modules (fastrpc_mem, fastrpc_notif, dspqueue, dspsignal, rpcmem, atomics, logging, perf)
• Relationship between IDL, stub, skeleton, and actual DSP function implementations
• OS or driver boundary on CPU (user vs. kernel/driver for dspqueue) if desired