Repository navigation
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
… capture plugin First step of the unified camera capture plugin (milestone M0). camera_core tracks which pool slots hold which frame sets and who may still read them. It uses the standard library only and never touches slot memory, so it builds and is tested on every platform. - A group is one or more hardware-synchronised streams published as one frame set. - A reader subscribes with a window (frame sets kept for it at a time) and a delivery order, newest or in order. - A subscription is accepted only when the pool covers it: slots >= ring history + sum of reader windows + backend reserve. - A backend either takes a free slot and writes it, or hands over a slot the camera SDK filled and is told the moment nobody holds it any more. - Every frame event carries its timeline, the group's generation and the number of frame sets the reader skipped. Tests: tests/cpp/core/camera_core (Catch2), run with `ctest -L camera_core`. Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com> Co-Authored-By: Claude <noreply@anthropic.com>
…format H.264 and H.265 are codecs, so they do not belong in PixelFormat. A stream description now has a Codec (NONE for pixels) next to its PixelFormat, and is_encoded() reads the codec. Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com> Co-Authored-By: Claude <noreply@anthropic.com>
Two more places where the stream description and the publisher were too coarse for real cameras: - A stream had a single stride. NV12 has two planes, and on Jetson each plane has its own offset and stride, so a stream now lists its planes. add_group rejects a pixel stream without a size or without one stride per plane of its format, and an encoded stream that lists planes. - Counters were totals over every group. They are now kept per group, so a tool can tell which camera drops frames. Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com> Co-Authored-By: Claude <noreply@anthropic.com>
…ory kind The README explains the terms (stream, group, frame set, window, order, lease, generation), the two ways a backend gets a slot, and the pool budget, so a reviewer does not need anything outside the repository. MemoryKind listed kinds that nothing implements yet. It now has HOST only; each further kind is added together with its pool. Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com> Co-Authored-By: Claude <noreply@anthropic.com>
Core tests carry the unit tag, which becomes the CTest label that `ctest -L unit` selects. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
The tests start threads. Without the link, std::thread fails at run time on C libraries that keep threads in a separate library. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
add_group now checks that every plane of a pixel stream lies inside the slot (row length against stride, last row against the slot size) and that a pool can hold one frame set on top of the backend's reserve. publish refuses an image larger than its slot. EventSink::send_event is noexcept: it runs on the capture path with the publisher's lock held, and a throwing sink would have left a slot held. A group with a slot-free callback hands out its slots with claim_slot only, so a slot cannot be taken again before its callback has run. Adds agent notes for the module. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
HostPool is one stream's slots in shared host memory: a single anonymous memory file with the slots a page-aligned stride apart. The owner maps it writable and then seals it, so a process that is sent the descriptor can map it for reading only and cannot resize it. HostPoolView is that reader's mapping; both sides derive the layout from the slot count and slot size. UniqueFd owns a file descriptor. An anonymous sealed file is used rather than named shared memory: there is no name to collide or to clean up after a crash, and only a process that was handed the descriptor can map it. Linux only, so the module and its tests are added under a platform check. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
1056067 to
7894a11
Compare
d9498aa to
0bd42c2
Compare
7894a11 to
698749b
Compare
Description
Second pull request of the camera interface. It is stacked on #1521 (
camera_core), whose branch is this one's base, so the diff shows only this step.It adds
camera_ipcwithHostPool: one stream's slots in shared host memory. This is how frames in host memory reach other processes without a copy.camera_core(the previous pull request) decides which slot holds which frame; this is the memory behind the slots.src/core/camera_ipc/README.mddescribes it.memfd_create) with the slots a page-aligned stride apart. A stream hands a reader one descriptor, each process maps the pool once, and both sides derive the layout from the slot count and slot size that the stream's description carries.HostPoolViewis the reader's side: a read-only mapping made from the descriptor it was sent. It refuses a descriptor that holds less than the pool needs, which would otherwise fault on first access.UniqueFdowns one file descriptor and closes it.Why an anonymous sealed file and not named shared memory (
shm_open): there is no name to collide with another instance and nothing left in/dev/shmafter a crash, the memory is freed when the last process holding it goes away, and only a process that was handed the descriptor can map it.Linux only (
memfd_createand file seals), so the module and its tests are added underCMAKE_SYSTEM_NAME STREQUAL "Linux".Type of change
Testing
tests/cpp/core/camera_ipc/test_host_pool.cpp(Catch2, 5 cases, taggedunit): a view sees what the owner writes, including later writes; slots start on page boundaries and do not overlap when the slot size is not a whole number of pages; a process holding the pool's descriptor cannot map it writable, write to it or resize it; a view outlives the pool and can be moved; empty pools, slots out of range, and descriptors that are invalid or too small for the claimed slot count or size are rejected. Run withctest -L camera_ipc.clang-format-14reports no changes;SKIP=check-copyright-year pre-commit run --all-filespasses.Checklist
SKIP=check-copyright-year pre-commit run --all-filesgit commit -s) per the DCO🤖 Generated with Claude Code