Commit graph

2951 commits

Author SHA1 Message Date
Tomi Valkeinen
7a0a464dd1 py: Rename 'efd' to 'event_fd'
Perhaps it's better to have a more descriptive name here. I also
considered just renaming 'efd' to 'fd', but 'event_fd' won.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:03:41 +03:00
Tomi Valkeinen
1698442aa8 py: Re-structure the controls API
Add ControlInfo class and change the controls related methods to
resemble the C++ API (e.g. no more string based control methods).

We don't implement ControlList or ControlInfoMap but just expose the
same data via standard Python dict.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:03:38 +03:00
Tomi Valkeinen
3c82ae3821 py: Re-implement controls geneneration
The Python bindings controls generation was not very good. It only
covered the enums and they were in the main namespace.

This adds the controls somewhat similarly to the C++ side. We will have
e.g.:

libcamera.controls.Brightness
libcamera.controls.AeMeteringModeEnum.CentreWeighted

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:03:34 +03:00
Tomi Valkeinen
6eb1143e27 py: cam: Convert ctx and state to classes
Convert ctx and state dicts to classes. No functional changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:03:30 +03:00
Tomi Valkeinen
bb1cbd53d2 py: cam: Drop WA_ShowWithoutActivating
Drop WA_ShowWithoutActivating from the Qt renderers. I added the flag
during development phase as I didn't want the window to take the focus,
but it should be removed now.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:47 +03:00
Tomi Valkeinen
19d870d6d8 py: MappedFrameBuffer: Add type hints & docs
Add a few type hints and (minimal) docs to MappedFrameBuffer.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:44 +03:00
Tomi Valkeinen
9e4388cca5 py: Move MappedFrameBuffer to libcamera.utils
Move MappedFrameBuffer to libcamera.utils, instead of extending
FrameBuffer class with a new mmap() method. This keeps us more aligned
to the C++ API.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:41 +03:00
Tomi Valkeinen
210ce547a4 py: Add CameraManager.read_event()
Add CameraManager.read_event() so that the user does not need to call
os.read().

We use eventfd, and we must always read 8 bytes. Hiding that inside
read_event() makes sense.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:31 +03:00
Tomi Valkeinen
ccfcf5f235 py: Fix None value in ControlType enum
"None" is not a valid name for an enum value, so change it to "Null".

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:29 +03:00
Tomi Valkeinen
0381b09f89 py: Fix SceneFlicker enum values
Stripping 'SceneFlicker' prefix from the enum value names leads to
'50Hz' and '60Hz', which are not valid names. So add another heuristics
to keep the prefix for SceneFlicker.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:27 +03:00
Tomi Valkeinen
ed0d3a9d71 py: cam: Cleanups
No functional changes. Drop unused variables, reduce typechecker
warnings.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:25 +03:00
Tomi Valkeinen
56f9de149f py: cam_qt: Use libcamera.formats
Use the new libcamera.formats in cam_qt.py.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:22 +03:00
Tomi Valkeinen
9ecf311375 py: Generate pixel formats list
Generate a list of pixel formats under 'libcamera.formats'.

The 'formats' is a "dummy" container class, the only purpose of which is
to contain the read-only pixel format properties.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 22:02:16 +03:00
Laurent Pinchart
c3515cf6e5 libcamera: ipa: Move IPA control serialization structures to libcamera namespace
The C structures used to serialize controls are currently defined in the
root namespace, which places them at the root level in the class list
generated by Doxygen. Move them to the libcamera namespace to fix that.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-27 16:07:01 +03:00
Laurent Pinchart
b50718928d libcamera: pipeline: uvcvideo: Infer camera location from removable attribute
Use the removable attribute exposed by the USB device in sysfs to infer
if the camera is an external (when removable) or front (when
non-removable) camera. This is likely not perfect as the removable
attribute is derived from ACPI data which may not always be accurate,
and non-ACPI platforms likely report all devices as removable. Still,
this is a first step upon which a better method could be built.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-27 16:06:25 +03:00
Naushir Patuck
b7ce7e1d34 libipa: camera_sensor_helper: Add Sony IMX477 helper
Add support for the Sony IMX477 sensor in the camera helper database.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 09:12:08 +03:00
Naushir Patuck
6f53f01409 libcamera: camera_sensor: Add IMX477 sensor properties
Add an entry to the sensor properties for Sony IMX477. Currently
no test pattern modes are supported by the device driver.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-27 09:12:02 +03:00
Laurent Pinchart
f8e4649680 ipa: camera_sensor_helper: Fix equation in exponential gain documentation
The exponential gain documentation is missing a '\' in the equation. Fix
t.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-26 12:22:32 +03:00
David Plowman
3e7f54a312 libcamera: controls: Controls for driving AF (autofocus) algorithms
This patch describes a series of controls that allow applications to
drive AF algorithms:

AfMode - manual, auto or continuous
AfRange - full, macro or normal
AfSpeed - fast or slow
AfMetering - how to choose where to measure focus
AfWindows - AF window locations
AfTrigger - start (trigger) an AF scan or cancel
AfPause - pause continuous AF
LensPosition - set or retrieve position of lens
AfState - reports whether scanning/success/failure
AfPauseState - reports whether continuous AF paused or not

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-25 11:29:05 +03:00
Eric Curtin
153b468930 cam: sdl_sink: Add MJPG support to SDL sink
So we have at least two supported capturing pixel formats (although
many possible output pixel formats thanks to SDL conversion). MJPG
support only built in if SDL2_image is available, provides
decompression.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-23 12:49:44 +03:00
Eric Curtin
11554a259f cam: sdl_sink: Add SDL sink with initial YUYV support
This adds more portability to existing cam sinks. You can pass a
YUYV camera buffer and SDL will handle the pixel buffer conversion
to the display. This allows cam reference implementation to display
images on VMs, Mac M1, Raspberry Pi, etc. This also enables cam
reference implementation, to run as a desktop application in Wayland or
X11. SDL also has support for Android and ChromeOS which has not been
tested. Also tested on simpledrm Raspberry Pi 4 framebuffer
successfully where existing kms sink did not work. Can also be used as
kmsdrm sink. Only supports one camera stream at present.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-23 12:49:44 +03:00
Eric Curtin
a5844adb7b cam: event_loop: Add timer events to event loop
Extend the EventLoop class to support periodic timer events. This can be
used to run tasks periodically, such as handling the event loop of SDL.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-23 12:49:41 +03:00
Eric Curtin
48e991476d cam: event_loop: Rename addEvent to addFdEvent
With the addition of addTimerEvent, the naming of addEvent is specific
to the management of an fd, while the naming is generic.

Update the name to make the naming scheme consistent in specifying the
type of event to be added.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-23 11:23:59 +03:00
Naushir Patuck
2ebce32cf6 pipeline: raspberrypi: Fix possible null dereference
The freeBuffers() cleanup code calls into the IPA to unmap and free
shared buffers. However, this function could be called before the IPA
has opened (via registerCamera()), causing a segmentation fault. Fix
this by guarding against calling the IPA if it has not been opened.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-23 10:50:16 +03:00
Jacopo Mondi
568865a6c1 cam: Use script parser to set controls
Add a "--script" option to the cam test application to allow specify a
capture script to be used to drive the capture session. Add to the
CameraSession class a script parser instance, created conditionally to
the OptCaptureScript option.

If the script parser has been created, use it at queueRequest time to
retrieve the list of controls that has to be associated with a Request,
and populate Request::controls() with it before queueing it to the
Camera.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-22 12:52:13 +03:00
Jacopo Mondi
3a91e37bb8 cam: Queue requests through CameraSession::queueRequest()
The CameraSession::processRequest() frame completion handler currently
re-queues completed requests by calling Camera::queueRequests()
explicitely.

In order to maintain the CameraSession::queuedRequest_ counter up to
date with the actual number of queued requests, call the
CameraSession::queueRequest() instead of operating the Camera directly.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-22 12:52:10 +03:00
Jacopo Mondi
38bff0c82b cam: Add a parser for capture scripts
Add a parser class to the cam test application to control the capture
operations through a yaml script.

The capture script currently allow to specify a list of controls and
their associated values to be applied per-frame.

Also add a trivial capture script example to showcase the intended
script structure.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-05-22 12:52:02 +03:00
Laurent Pinchart
0c1b3f5e4c android: Drop gcc 7 compatibility
Now that we have dropped gcc 7 support, remove the compatibility with
gcc versions older than 8 that implemented the filesystem API in the
std::experimental namespace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-20 10:40:38 +03:00
Tomi Valkeinen
4a7e5d3b8b libcamera: formats: Add missing RGBX8888 info
Add missing RGBX8888 PixelFormatInfo.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-19 13:56:54 +03:00
Tomi Valkeinen
1d49b39994 libcamera: formats: Fix warning print
Remove extra "0x" from the print.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-19 13:56:51 +03:00
Tomi Valkeinen
dc03440cb5 py: Clean up control enums generation
Try to be more consistent with the names, and include "control" in all
the names.

Also drop a useless "using namespace libcamera" and only include
"control_ids.h".

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:32 +03:00
Tomi Valkeinen
b2ada6f3ec py: Rename pyxyz to py_xyz
Having the underscore makes the names more readable, especially when
there are multiple words in the name.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:31 +03:00
Tomi Valkeinen
2bb6c9fbd2 py: Use geometry classes
Now that we have proper geometry classes in the Python bindings, change
the existing bindings and the .py files accordingly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:31 +03:00
Tomi Valkeinen
e0a8517b27 py: Add geometry classes
Add libcamera's geometry classes to the Python bindings.

Note that this commit only adds the classes, but they are not used
anywhere yet.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:31 +03:00
Tomi Valkeinen
fa7bda46f8 py: Implement PixelFormat class
Implement PixelFormat bindings properly with a PixelFormat class. Change
the bindings to use the new class instead of a string.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:30 +03:00
Tomi Valkeinen
11a271b292 py: cam_qt: Cosmetic cleanups
Drop irrelevant or wrong comments, merge separate_components() into
demosaic(), and add mfb_to_rgb().

No functional changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:29 +03:00
Tomi Valkeinen
b7c78879cc py: cam_kms: Fix multistream display
Instead of doing an atomic commit for each stream, do a single commit
for the two planes. This fixes the issue that only the first plane was
actually shown.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:29 +03:00
Tomi Valkeinen
a4964c5df1 py: cam_kms: Support multiplanar formats
Support multiplanar formats in the kms renderer. Tested with RPi and
NV12.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:29 +03:00
Tomi Valkeinen
1384cedf50 py: cam.py: Exit on exception
Catch exceptions in the event_handler, as they would get ignored
otherwise. Print the exception and return False so that the main loop
exits.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:29 +03:00
Tomi Valkeinen
e40fbdf855 py: pymain: Fix indent
Fix two minor mis-indents.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:28 +03:00
Tomi Valkeinen
4de9539f51 py: Add comment about the symlinks
Add comment about the symlinks to clarify the purpose.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:28 +03:00
Tomi Valkeinen
1d72eca347 py: meson: Fix comment about stubs
At least pyright seems to be able to use the stubs from the
libcamera-stubs directory, so no need to copy the generated files.
Adjust the comment accordingly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:27 +03:00
Tomi Valkeinen
ed3a440177 py: meson: Use files() for custom_target input files
Use files() for the input files for the custom_target(). I believe the
current code works, but perhaps it is safer to use files() here.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-18 17:52:27 +03:00
Umang Jain
f4783e6899 ipa: ipu3: Put IPAFrameContext(s) in a ring buffer
Instead of having one frame context constantly being updated,
this patch aims to introduce per-frame IPAFrameContext which
are stored in a ring buffer. Whenever a request is queued, a new
IPAFrameContext is created and inserted into the ring buffer.

The IPAFrameContext structure itself has been slightly extended
to store a frame id and a ControlList for incoming frame
controls (sent in by the application). The next step would be to
read and set these controls whenever the request is actually queued
to the hardware.

Since now we are working in multiples of IPAFrameContext, the
Algorithm::process() will actually take in a IPAFrameContext pointer
(as opposed to a nullptr while preparing for this change).

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-18 15:27:33 +01:00
Umang Jain
8b291bce82 ipa: libipa: Add frame context pointer in process()
Currently we have a single structure of IPAFrameContext but
subsequently, we shall have a ring buffer (or similar) container
to keep IPAFrameContext structures for each frame.

It would be a hassle to query out the frame context required for
process() (since they will reside in a ring buffer) by the IPA
for each process. Hence, prepare the process() libipa template to
accept a particular IPAFrameContext early on.

As for this patch, we shall pass in the pointer as nullptr, so
that the changes compile and keep working as-is.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-18 15:27:32 +01:00
Umang Jain
bab437df1f ipa: ipu3: Rework IPAFrameContext
Currently, IPAFrameContext consolidates the values computed by the
active state of the algorithms, along with the values applied on
the sensor.

Moving ahead, we want to have a frame context associated with each
incoming request (or frame to be captured). This shouldn't necessarily
be tied to "active state" of the algorithms hence:

- Rename current IPAFrameContext -> IPAActiveState
  This will now reflect the latest active state of the algorithms and
  has nothing to do with any frame-related ops/values.

- Re-instate IPAFrameContext with a sub-structure 'sensor' currently
  storing the exposure and gain value.

Adapt the various access to the frame context to the new changes
as described above.

Subsequently, the re-instated IPAFrameContext will be extended to
contain a frame number and ControlList to remember the incoming
request controls provided by the application. A ring-buffer will
be introduced to store these frame contexts for a certain number
of frames.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-18 15:27:32 +01:00
Laurent Pinchart
e0766fa205 meson: Compile libyaml as a subproject if not available on the system
AOSP doesn't ship libyaml, making it more difficult to compile libcamera
for Android. Use a meson wrap to compile libyaml as a subproject if the
dependency is not found.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-05-18 14:29:16 +03:00
Laurent Pinchart
9f00e78bf5 py: Fix link generation to __init__.py
The command to create a symlink to the __init__.py file in the source
directory uses a relative path from the build directory, which hardcodes
the assumption that the build directory is a direct child of the source
directory. This isn't always true. Fix it by using the files() function.

Fixes: 8aa02271fd ("Add Python bindings")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2022-05-17 20:30:30 +03:00
Quentin Schulz
5efb6c8e2a libipa: camera_sensor_helper: Add OV5675 helper
The OV5675 is an OmniVision sensor with a linear gain model, expressed
in 1/128 steps.

Cc: Quentin Schulz <foss+libcamera@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-13 06:57:43 +03:00
Quentin Schulz
d3d7bc433e libcamera: camera_sensor: Add OV5675 sensor properties
Add an entry to the sensor properties for OmniVision OV5675. Only the
first test pattern is included as the others that are exposed by the
kernel aren't supported by libcamera control yet.

Cc: Quentin Schulz <foss+libcamera@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-13 06:57:06 +03:00