[0/4] Support the OV9734 on the IPU3 (Surface Laptop 1)
mbox series

Message ID 20261105230708.14601-1-afonso.figuinha@gmail.com
Headers show
Series
  • Support the OV9734 on the IPU3 (Surface Laptop 1)
Related show

Message

Afonso Figuinha Nov. 5, 2026, 11:07 p.m. UTC
This series makes the front camera of the Microsoft Surface Laptop 1,
an OmniVision OV9734 behind the IPU3, usable with libcamera. It needs
the kernel series that adds the sensor to ipu-bridge and handles its
power [1].

Patches 1 and 2 add the OV9734 camera sensor helper and its static
properties. Without the helper the IPU3 IPA fails to start.

Patch 3 fixes an uninitialized testPatternMode_ in the sensor classes.
For a sensor without test pattern modes, Camera::start() on the IPU3
pipeline failed with -EINVAL at random. It affects any sensor missing
from the properties database, not only this one.

Patch 4 makes the IPU3 viewfinder size advertised by
generateConfiguration() match what validate() accepts. The OV9734
(1296x734) was advertised at 1280x720 but produced 1280x704.

Tested on a Surface Laptop 1 (6.19.8-surface-3 with the kernel
series):
- this series on top of 25cb6cd274d3, built with werror: cam captures
  1280x704 NV12 at 30 fps, three runs in a row with no start failure,
  and lists 1280x704 as the maximum viewfinder size;
- the same changes applied to v0.7.0: GNOME Snapshot through PipeWire
  1.6.2 and a v4l2-relayd loopback both stream with no start error and
  no green band.

Not tested: other IPU3 sensors. By computation, patch 4 does not
change the default size for sensors of at least 1281x737, which
includes the OV5693 and the OV8865.

Tool disclosure: this series was developed with an AI coding
assistant (Claude Code, model Claude Opus 5.5) in an interactive
session on the laptop. I asked it to get the front camera working. It
read the libcamera sources and logs, wrote the patches, drafted the
commit messages and this cover letter, and ran the builds and tests
listed above on the laptop. I reviewed every change and can answer
review comments on it.

[1] https://lore.kernel.org/all/20261105230327.10852-1-afonso.figuinha@gmail.com/


Afonso Figuinha (4):
  libipa: camera_sensor_helper: Add OV9734
  libcamera: camera_sensor_properties: Add OV9734
  libcamera: sensor: Initialize the test pattern mode
  pipeline: ipu3: Apply the output margins to the default viewfinder
    size

 src/ipa/libipa/camera_sensor_helper.cpp           | 14 ++++++++++++++
 src/libcamera/pipeline/ipu3/ipu3.cpp              | 14 +++++++++-----
 src/libcamera/sensor/camera_sensor_legacy.cpp     |  1 +
 src/libcamera/sensor/camera_sensor_properties.cpp | 14 ++++++++++++++
 src/libcamera/sensor/camera_sensor_raw.cpp        |  4 +++-
 5 files changed, 41 insertions(+), 6 deletions(-)


base-commit: 25cb6cd274d3112d03d9a825e47eb2c15c70da24

Comments

Barnabás Pőcze Nov. 6, 2026, 12:46 p.m. UTC | #1
2026. 11. 06. 0:07 keltezéssel, Afonso Figuinha írta:
>   series makes the front camera of the Microsoft Surface Laptop 1,
> an OmniVision OV9734 behind the IPU3, usable with libcamera. It needs
> the kernel series that adds the sensor to ipu-bridge and handles its
> power [1].
> 
> Patches 1 and 2 add the OV9734 camera sensor helper and its static
> properties. Without the helper the IPU3 IPA fails to start.
> 
> Patch 3 fixes an uninitialized testPatternMode_ in the sensor classes.
> For a sensor without test pattern modes, Camera::start() on the IPU3
> pipeline failed with -EINVAL at random. It affects any sensor missing
> from the properties database, not only this one.
> 
> Patch 4 makes the IPU3 viewfinder size advertised by
> generateConfiguration() match what validate() accepts. The OV9734
> (1296x734) was advertised at 1280x720 but produced 1280x704.
> 
> Tested on a Surface Laptop 1 (6.19.8-surface-3 with the kernel
> series):
> - this series on top of 25cb6cd274d3, built with werror: cam captures
>    1280x704 NV12 at 30 fps, three runs in a row with no start failure,
>    and lists 1280x704 as the maximum viewfinder size;
> - the same changes applied to v0.7.0: GNOME Snapshot through PipeWire
>    1.6.2 and a v4l2-relayd loopback both stream with no start error and
>    no green band.
> 
> Not tested: other IPU3 sensors. By computation, patch 4 does not
> change the default size for sensors of at least 1281x737, which
> includes the OV5693 and the OV8865.
> 
> Tool disclosure: this series was developed with an AI coding
> assistant (Claude Code, model Claude Opus 5.5) in an interactive
> session on the laptop. I asked it to get the front camera working. It
> read the libcamera sources and logs, wrote the patches, drafted the
> commit messages and this cover letter, and ran the builds and tests
> listed above on the laptop. I reviewed every change and can answer
> review comments on it.

Is this supposed to be a "better" version of https://patchwork.libcamera.org/project/libcamera/list/?series=6330 ?
Have you seen those proposed changes? Could you instead review/test them?
Or is there something important missing?