aboutsummaryrefslogtreecommitdiffci

libcamera (Surface Pro 12" Gen 1)

Fedora's libcamera, rebuilt with the patches this board needs.

Used by Fedora KIWI descriptions, modified by me for Surface Pro 12".

Why a rebuild

libcamera compiles its per-sensor knowledge into libcamera.so. A CameraSensorHelper carries the analogue gain model and the black level, and there is no plugin mechanism for either, so a sensor libcamera does not know gets no usable AGC from the software ISP.

The Surface Pro 12"'s front camera is an ov02c10, which upstream libcamera has never heard of:

WARN IPASoft soft_simple.cpp:104 IPASoft: Failed to create camera sensor helper for ov02c10
INFO IPASoft soft_simple.cpp:257 IPASoft: Exposure 4-2320, gain 16-248 (1)

Those numbers are the raw gain register, not a gain: AGC believes the sensor cannot go below 16x, balances exposure against a fiction, and leaves the preview dark under a green-grey veil, because it also has no black level to subtract. With the helper in place the same sensor reports what it really is:

INFO IPASoft soft_simple.cpp:258 IPASoft: Exposure 4-3206, gain 1-15.5 (0.145)

which matches the kernel driver, where OV02C10_REG_ANALOG_GAIN runs from 0x10 to 0xf8 with four fractional bits.

What gets applied

Patch Fixes
patches/0001-libipa-camera_sensor-add-ov02c10.patch Adds the ov02c10 CameraSensorHelper (gain code/16, black level 0x40 at 10 bits) and its camera_sensor_properties entry.
patches/0002-pipeline-simple-capture-bayer-order-from-mbus-code.patch Takes the capture device's Bayer order from the media bus code the pipeline reports instead of deriving it from the transform, so the rear camera streams.
patches/0003-ipa-simple-data-add-ov02c10-tuning-file.patch Adds ov02c10.yaml, enabling a CCM for the front camera. Hand-tuned, not measured against a colour target.
patches/0004-ipa-simple-awb-keep-gains-across-reconfiguration.patch Keeps the AWB gains over a reconfiguration, so a still captured right after one is not rendered with the sensor's raw white balance.

Versioning

The rebuild takes Fedora's release and appends a suffix, so 0.7.2-4.fc45 becomes 0.7.2-4.sp12in1.fc45. That sorts above the build it came from, which is what makes the repository's priority="1" produce the patched package.

Building

Must run on aarch64, and needs the source repositories reachable (dnf download --source comes from dnf5-plugins).

# Resolve only: print the RPMs the build would produce, and exit
./build.sh -n

# Build them into ./RPMS
./build.sh

# Override the release suffix (the pipeline sets it from the tag)
RELEASE_SUFFIX=sp12in2 ./build.sh

build.sh downloads Fedora's source RPM, copies patches/*.patch into it, appends a PatchNN: line for each after the last one Fedora ships (the spec uses %autosetup -p1, so nothing has to call %patch), rewrites Release:, then runs dnf builddep and rpmbuild -bb. The scratch tree is reused between runs, so -n followed by a real build does not download twice.

Publishing

Tagging fedora-<fedora_ver>-libcamera-<release_suffix>, e.g. fedora-45-libcamera-sp12in1, runs the pipeline: the tag picks the build container and supplies RELEASE_SUFFIX, and the resulting packages go to the same repository as the kernel, served at

https://rpm.sayag.it/kernel-sp12in/fedora/45/aarch64/