- C 97.5%
- Shell 1.1%
- CMake 0.9%
- Python 0.4%
| .githooks | ||
| debian | ||
| libtitancam | ||
| scripts | ||
| systemd | ||
| tests | ||
| titancli | ||
| titanserver | ||
| tools | ||
| .clang-format | ||
| .gitignore | ||
| CMakeLists.txt | ||
| Containerfile | ||
| COPYING | ||
| FRAME_PACING.md | ||
| inside-container.sh | ||
| publish.sh | ||
| README.md | ||
| THREADING.md | ||
titan-server
titan-server is the userspace camera service for Qualcomm Titan/Spectra
camera hardware. It owns the downstream cam_req_mgr kernel interface,
allocates the camera dma-buf rings, runs sensor and ISP control, and shares
frames with local clients over an AF_UNIX SOCK_SEQPACKET protocol.
The project currently targets the Samsung Galaxy XR ("Anorak", Snapdragon XR2+ Gen 2 / Titan 636) running Ubuntu on its Android vendor kernel. The low-level stack is plain C11 and has no Android runtime dependency.
Components
libtitancam/: direct camera-kernel client, sensor programming, IFE pipeline, standalone Titan680 IPE P010/NV12 conversion, request pump, software AE/AWB, synchronization, and dma-buf ownership.titanserver/: the multi-client camera daemon plus the fixed wire protocol.titan_client.his the header-only transport API intended for external clients.titancli/: diagnostic CLI. It can use the daemon or open libtitancam directly for hardware bring-up.tools/: low-level Chromatix, sensor-blob, and FSIN diagnostics. Supported IPE conversion/probing lives undertitancli ipe; opt-in research is quarantined underlibtitancam/ipe/experimental.tests/: hardware-independent unit/transport tests plus opt-in live server hold-capacity, exposure-attribution, and receiver-pacing tests.
The protocol and buffer contract are documented in
titanserver/PROTOCOL.md. Threading, ownership,
and scheduling are documented in THREADING.md. The
hardware evidence, semantics, and implementation contract for exact
request-bound exposure timestamps are recorded in
libtitancam/EXPOSURE_TIMESTAMPS.md.
The feedback-driven receiver-rate and camera-phase synchronization design and
its implementation tracker are in FRAME_PACING.md.
Build and test
cmake -S . -B build
cmake --build build -j
ctest --test-dir build --output-on-failure
Server-backed camera tests use -DTITAN_ENABLE_LIVE_TESTS=ON. The standalone
IPE matrix has the opposite ownership requirement, so it is registered
separately with -DTITAN_ENABLE_IPE_LIVE_TESTS=ON and explicitly fails while
titan-server is running. See
libtitancam/ipe/README.md for its invocation and
mandatory coverage through 16K in both format directions.
Captured-IPE inspection/replay is excluded from normal builds and packaging;
developers can opt in with -DTITAN_BUILD_IPE_EXPERIMENTS=ON as documented in
libtitancam/ipe/experimental/README.md.
Clang builds additionally enforce the annotated mutex discipline:
CC=clang cmake -S . -B build-clang
cmake --build build-clang -j
ctest --test-dir build-clang --output-on-failure
The canonical source formatter is clang-format-21. Ubuntu developers can
install it with sudo apt install clang-format-21. Enable the repository's
pre-commit hook once per clone:
git config core.hooksPath .githooks
The hook checks the staged lines in C sources and headers without changing them. If it rejects a commit, format the staged changes and add the resulting working-tree changes back to the index:
scripts/clang-format.sh --staged
git add <changed C sources and headers>
git commit
Formatting is intentionally independent of building and publishing. For periodic whole-tree maintenance, rewrite or check every project-owned C source and header explicitly:
scripts/clang-format.sh --all
scripts/clang-format.sh --check-all
Run a local development server and inspect it with:
./build/titan-server
./build/titancli list
./build/titancli modes --cam 0
./build/titancli capture --cam 0 --frames 120 --server
./build/titancli capture --cam 1 --frames 900 --fps 90 --server
./build/titancli capture --stereo --frames 900 --fps 90 --server
./build/titancli capture --eyes all --raw8 --frames 120 --server
./build/titancli capture --tracking --frames 600 --server
--tracking opens the atomic six-camera hardware-FSIN rig in slot order
2/3/4/5/6/7. --raw8 explicitly requests RAW8 from a RAW10 RDI input;
omitting it requests RAW_NATIVE and preserves the sensor's packing. --fps
makes titancli a periodic FRAME_USED timing authority.
Protocol v12
currently applies its learned rate and phase to standalone colour cams 0/1
and the atomic colour stereo stream; other camera clock domains reject it
until they have hardware-specific actuators.
The server defaults to /run/titan-server.sock as root and to
$XDG_RUNTIME_DIR/titan-server.sock for a session instance.
$TITAN_SERVER_SOCKET or --socket selects another path.
Header-only clients
External clients include only titan_client.h. The header supplies
connect/disconnect, typed validated sends, and recvmsg preparation and
validation. It does not allocate, queue, poll, map buffers, or impose an
event-loop policy.
When this repository is consumed with CMake, link the interface target:
add_subdirectory(titan-server)
target_link_libraries(my-camera-client PRIVATE titan::client)
Installed headers live under include/titan/.
systemd
The installed titan-server.service runs the daemon as the system camera
owner. The service sets TITANCAM_RT_PRIO=20 and grants an RT-priority
limit of 40. libtitancam elevates only frame-pump threads to SCHED_FIFO;
the server event loop, control worker, and log drain remain SCHED_OTHER.
sudo cmake --install build
sudo systemctl enable --now titan-server.service
The unit deliberately requests ordered SIGTERM teardown and disables systemd's final SIGKILL because camera requests and mapped buffers must be retired cleanly.
Ubuntu package and Launchpad
Debian packaging produces three binary packages from the native
titan-server source package:
titan-server: the daemon, systemd unit, and project documentationtitan-server-dev: the header-only client and wire protocol APItitan-server-tools:titancliand the low-leveltc_*utilities
The daemon and tools target arm64; the development headers are architecture independent. The publishing workflow follows the project's other device packages and runs all Debian source tooling in an Ubuntu container:
./publish.sh --unsigned # local source-package validation
./publish.sh --no-upload # signed validation
./publish.sh # sign and upload to ppa:lightofmysoul/gxr
Normal uploads require a clean Git tree and a new unique entry in
debian/changelog. Generated source artifacts are retained in
build-packages/.
License
GPL-2.0-only. See COPYING.