1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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-<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/
|