From 01a5d7692c9de7d505918a5cbd9394ecbbc9b667 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 7 Sep 2026 05:22:19 +0700 Subject: initial commit --- README.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b3b0ca --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +# 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"](https://sayag.it/fedora-linux-surface-pro-12in/kiwi-descriptions). + +## 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. | + +## 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`). + +```bash +# 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--libcamera-`, 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/ -- cgit v1.3.1+17