Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ce1e575
Support for v0.6.0
SoZ0 Nov 29, 2025
ec5ad6f
colour space exposed
SoZ0 Nov 29, 2025
087157b
vendor feature flag and fence buffer
SoZ0 Nov 29, 2025
1b7866b
Control/property docs surfacing
SoZ0 Nov 29, 2025
be44f0a
Hotplug and logging
SoZ0 Nov 29, 2025
0021790
examples
SoZ0 Nov 29, 2025
0912faf
logging parity
SoZ0 Nov 29, 2025
34454a4
configuration helper and clarifications
SoZ0 Nov 29, 2025
08e6cd8
better feature flag macros for vendor groups and fence robustness
SoZ0 Nov 29, 2025
3c2deed
improving hot plug safety
SoZ0 Nov 29, 2025
cc56383
helpers and consts
SoZ0 Nov 29, 2025
2ae2d2d
colour spaces linked to libcamera directly
SoZ0 Nov 29, 2025
baaa8ff
Sensor configuration parity
SoZ0 Nov 29, 2025
e024c72
DMABUF support and buffer cookies
SoZ0 Nov 29, 2025
219f680
more camera signals
SoZ0 Nov 29, 2025
be50f14
camera look up helper
SoZ0 Nov 29, 2025
32ac7be
get camera example and pixel format helpers
SoZ0 Nov 29, 2025
7495ed3
v0.6 sensor configuration
SoZ0 Nov 29, 2025
e85420d
DMABUF allocator/import enhancements
SoZ0 Nov 29, 2025
b48e3ca
libcamera logging, helpers, stream parity fixes
SoZ0 Nov 29, 2025
39e81ff
clippy fixes
SoZ0 Nov 29, 2025
d62c4cc
parity and buffer improvements
SoZ0 Nov 29, 2025
179439f
safety issue and optimizations
SoZ0 Nov 29, 2025
12d98d0
colour space fixes
SoZ0 Nov 29, 2025
351371e
added fence improvements and C shim
SoZ0 Nov 29, 2025
c7954b7
version info and configuration parity
SoZ0 Nov 29, 2025
c82ccc8
queuing error handling
SoZ0 Nov 29, 2025
67e48de
double free and use after free issue fixed, format mod and improved c…
SoZ0 Nov 29, 2025
3af525e
better async and examples
SoZ0 Nov 29, 2025
1cb5b90
control value string array issue fixed
SoZ0 Nov 29, 2025
0b4d697
double free fixed
SoZ0 Nov 29, 2025
0f26891
expose controlIdmap from control list
SoZ0 Nov 29, 2025
b7d1457
oversights, transform bitmask/helpers, vendor guard builds
SoZ0 Nov 29, 2025
087df7a
lots of stale / unsafe fixes and continued parity
SoZ0 Nov 29, 2025
5062916
fix ups
SoZ0 Nov 29, 2025
2071f2f
pixel format now generated instead
SoZ0 Nov 29, 2025
357563c
camera lifecycle, helpers and runtime version
SoZ0 Nov 29, 2025
61f3c4d
IPA work started
SoZ0 Nov 29, 2025
dd81dbd
missing controls added
SoZ0 Nov 29, 2025
6b996c7
Revert "IPA work started"
SoZ0 Nov 29, 2025
88ae436
removed pr.md
SoZ0 Nov 29, 2025
2a692b1
ci and fmt
SoZ0 Nov 29, 2025
3a5a6ba
ci and fmt fixes
SoZ0 Nov 29, 2025
3fbbb34
compile time gating issue fixed
SoZ0 Nov 29, 2025
29e25f3
local ci testing
SoZ0 Nov 29, 2025
684b1df
general ci fixes
SoZ0 Nov 29, 2025
dc2ce80
cargo fmt
SoZ0 Nov 29, 2025
3f2e241
Update transform.cpp
SoZ0 Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Build and test
strategy:
matrix:
libcamera_version: ["v0.4.0", "v0.5.0", "v0.5.1"]
libcamera_version: ["v0.4.0", "v0.5.0", "v0.5.1", "v0.5.2", "v0.6.0"]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
33 changes: 31 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project structure:
- [libcamera-meta](./libcamera-meta/) - Scripts for generating C and Rust code from libcamera controls, properties and formats YAMLs. Mostly used by the [regenerate.sh](./regenerate.sh) script.
- [libcamera](./libcamera/) - Safe libcamera Rust interface on top of `libcamera-sys`.

Code generation uses a cached clone under `libcamera-git`; run `cargo run --bin generate_from_git` (or `./regenerate.sh`) occasionally to fetch the latest upstream tags before regenerating `versioned_files`. These bindings intentionally track libcamera’s public, application-facing API; pipeline-handler internals aren’t surfaced.

Unreleased documentation for `main`: [here](https://lit-robotics.github.io/libcamera-rs/libcamera/index.html)

## Building
Expand Down Expand Up @@ -133,6 +135,21 @@ FrameBuffer metadata: Immutable(
Written 4147789 bytes to target/image.jpg
```

Inspect generated pixel format constants and layout info ([code](./libcamera/examples/formats_constants.rs)):
```console
$ cargo run --example formats_constants
Using constant formats::NV12 => NV12 (NV12)
bits_per_pixel=12 planes=2 pixels_per_group=2
frame size for 640x480 (align=0): 460800 bytes
```

Apply a generated pixel format constant to a stream configuration ([code](./libcamera/examples/configure_formats.rs)):
```console
$ cargo run --example configure_formats
validate status: Valid
configured: StreamConfigurationRef { pixel_format: NV12, size: Size { width: 640, height: 480 }, stride: 640, frame_size: 460800, buffer_count: 4, color_space: None }, stride=640 frame_size=460800
```

## Notes on safety

`libcamera-rs` is intended to be a fully memory-safe wrapper, however, due to `libcamera`'s complexity and many cross-references between objects it is quite hard to ensure total safety so there is very likely to be bugs. Issues and pull requests are welcome.
Expand Down
44 changes: 44 additions & 0 deletions docker/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Minimal CI runner image that matches the GitHub Actions workflow.
# Build per libcamera version:
# docker build -f docker/ci/Dockerfile --build-arg LIBCAMERA_VERSION=v0.5.1 -t libcamera-ci:v0.5.1 .
#
# Then run against your workspace:
# docker run --rm -v "$PWD:/workspace" -w /workspace libcamera-ci:v0.5.1 ./docker/ci/entrypoint.sh

ARG UBUNTU_VERSION=22.04
FROM ubuntu:${UBUNTU_VERSION}

ARG LIBCAMERA_VERSION=v0.6.0
ENV DEBIAN_FRONTEND=noninteractive

# Install build prerequisites for libcamera and Rust.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential git ninja-build pkg-config clang \
python3 python3-pip python3-jinja2 python3-yaml python3-ply \
libyaml-dev libssl-dev curl ca-certificates && \
rm -rf /var/lib/apt/lists/*

# Meson from apt on 22.04 is too old for older libcamera tags; upgrade via pip.
RUN pip3 install --no-cache-dir --upgrade pip meson

# Install libcamera (matching the workflow: only vimc pipeline for speed).
RUN git clone --depth 1 --branch ${LIBCAMERA_VERSION} https://git.libcamera.org/libcamera/libcamera.git /tmp/libcamera && \
cd /tmp/libcamera && \
meson build -Dipas=vimc -Dpipelines=vimc && \
ninja -C build install && \
rm -rf /tmp/libcamera

# Install Rust toolchain (stable) with rustfmt/clippy.
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal --component rustfmt,clippy && \
. "$HOME/.cargo/env" && \
rustc --version && cargo --version

ENV PATH="/root/.cargo/bin:${PATH}"
# Ensure pkg-config can find the installed libcamera.
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}"

WORKDIR /workspace
COPY docker/ci/entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
23 changes: 23 additions & 0 deletions docker/ci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail

# Allow skipping doc build for speed/debugging.
: "${RUN_DOCS:=true}"

LIBCAMERA_VERSION=$(pkg-config --modversion libcamera || true)
echo "Using libcamera from pkg-config: ${LIBCAMERA_VERSION}"

# Keep build artifacts separate per libcamera version to avoid cross-version cache issues.
if [ -z "${CARGO_TARGET_DIR:-}" ] && [ -n "${LIBCAMERA_VERSION}" ]; then
export CARGO_TARGET_DIR="target/${LIBCAMERA_VERSION}"
fi
echo "Using CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-target}"

cargo build
cargo fmt --all -- --check
cargo test
cargo clippy --no-deps -- -D warnings

if [ "$RUN_DOCS" = "true" ]; then
RUSTDOCFLAGS="-Dwarnings" cargo doc --no-deps --lib
fi
18 changes: 18 additions & 0 deletions docker/ci/run-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

# Run the CI steps locally for each libcamera version (same matrix as GitHub Actions).
VERSIONS=(
v0.4.0
v0.5.0
v0.5.1
v0.5.2
v0.6.0
)

for ver in "${VERSIONS[@]}"; do
echo "=== Building CI image for libcamera ${ver} ==="
docker build -f docker/ci/Dockerfile --build-arg LIBCAMERA_VERSION="${ver}" -t "libcamera-ci:${ver}" .
echo "=== Running CI steps for libcamera ${ver} ==="
docker run --rm -v "$PWD:/workspace" -w /workspace "libcamera-ci:${ver}" ./docker/ci/entrypoint.sh
done
1 change: 1 addition & 0 deletions libcamera-meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ prettyplease = "0.2.17"
semver = "1.0.22"
syn = "2.0.58"
yaml-rust = "0.4"
regex = "1"
Loading