Commit graph

996 commits

Author SHA1 Message Date
David Plowman
ddb5e9d37e libcamera: Add ColorSpace class
This class represents a color space by defining its color primaries,
the transfer (gamma) function it uses, the YCbCr encoding and whether
the output is full or limited range.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-13 11:29:01 +02:00
Jacopo Mondi
3fb3c0d791 libcamera: request: Add Request::Private::prepare()
Add a prepare() function to the Private Request representation.

The prepare() function is used by the PipelineHandler class to
prepare a Request to be queued to the hardware.

The current implementation of prepare() handles the fences associated
with the Framebuffers part of a Request. The function starts an event
notifier for each of those and emits the Request::prepared signal when
all fences have been signalled or an optional timeout has expired.

The optional timeout allows to interrupt blocked waits and notify the
Request as failed so that it can be cancelled.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Jacopo Mondi
f6b6f15b54 libcamera: pipeline: Introduce stopDevice()
Since a queue of waiting Requests has been introduced, not all Requests
queued to the PipelineHandler are immediately queued to the device.

As a Camera can be stopped at any time, it is required to complete the
waiting requests after the ones queued to the device had been completed.

Introduce a pure virtual PipelineHandler::stopDevice() function to be
implemented by pipeline handlers and make the PipelineHandler::stop()
function call it before completing pending requests.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Jacopo Mondi
6cd5c958b7 libcamera: pipeline_handler: Split request queueing
In order to prepare to handle synchronization fences at Request
queueing time, split the PipelineHandler::queueRequest() function in
two, by creating a list of waiting requests and introducing the
doQueueRequest() function that queues requests to the device in the
order the pipeline has received them.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Jacopo Mondi
a645898af5 libcamera: request: Add Fence to Request::addBuffer()
Add an optional fence parameter to Request::addBuffer() to allow
associating a Fence with a FrameBuffer.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Jacopo Mondi
7a34707bfd libcamera: framebuffer: Add Fence to FrameBuffer
Add to the FrameBuffer::Private class a unique pointer to a
Fence.

The Fence will be used to signal the availability of the Framebuffer for
incoming data transfer.

The Fence will be associated to a FrameBuffer at Request::addBuffer()
time, and if correctly signalled, reset by the core at Request queue
time.

If a FrameBuffer completes with errors, due to a Fence wait failure, the
Fence will still be owned by the FrameBuffer and it is application
responsibility to correctly reset it before reusing the buffer.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Jacopo Mondi
8ac8ecb1e1 libcamera: fence: Introduce Fence
Introduce a Fence class which models a synchronization primitive that
allows to notify the availability of a resource.

The Fence is modeled as a wrapper of a UniqueFD instance where
read events are used to signal the Fence. The class can be later
extended to support additional signalling mechanisms.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Laurent Pinchart
db37335ee0 libcamera: request: Make Request class Extensible
Implement the D-Pointer design pattern in the Request class to allow
changing internal data without affecting the public ABI.

Move the internal fields that are not needed to implement the public
API to the Request::Private class already. This allows to remove
the friend class declaration for the PipelineHandler class, which can
now use the Request::Private API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Move all internal fields to Request::Private and remove friend  declaration]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-11 17:53:40 +01:00
Laurent Pinchart
f413f944d7 libcamera: base: utils: Add abs_diff() utility function
The abs_diff() function computes the absolute difference of two
elements. This may seem trivial at first, but can lead to unexpected
results when operating on unsigned operands. A common implementation
of the absolute difference of two unsigned int (used through the
libcamera code base) is

	std::abs(static_cast<int>(a - b))

but doesn't return the expected result when either a or b is larger than
UINT_MAX / 2 due to overflows. The abs_diff() function offers a safe
alternative.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-12-07 19:09:31 +02:00
Hirokazu Honda
e1b70e764f libcamera: camera_sensor: Enable to set a test pattern mode
This adds a function to set a camera sensor driver a test pattern
mode. CameraSensor initializes the test pattern mode by Off.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06 17:41:46 +01:00
Hirokazu Honda
5148c0aa7e libcamera: camera_sensor: Reference test pattern modes by enum type
The CameraSensor stores TestPatternModes as an int32_t. This prevents
the compiler from verifying the usage against the defined enum types.

Fix references to the TestPatternMode to store the value as the
TestPatternModeEnum type which is defined by the control generator.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06 17:41:45 +01:00
Hirokazu Honda
99bb610fd1 libcamera: framebuffer: Enable attaching additional data to FrameBuffer
We cannot have a subclass of FrameBuffer because it is marked as final.
This adds a FrameBuffer constructor with FrameBuffer::Private. So we
can attach some additional resources with FrameBuffer through a
customized FrameBuffer::Private class.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06 15:35:13 +01:00
Laurent Pinchart
f8d2f17a3d libcamera: base: shared_fd: Add comparison operators
Add == and != comparison operators between two SharedFD instances, and
use them to replace manuel get() calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:07 +02:00
Laurent Pinchart
560f5cf998 libcamera: base: shared_fd: Rename fd() to get()
For consistency with UniqueFD, rename the fd() function to get().
Renaming UniqueFD::get() to fd() would have been another option, but was
rejected to keep as close as possible to the std::shared_ptr<> and
std::unique_ptr<> APIs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-12-04 23:05:07 +02:00
Laurent Pinchart
5c85e70240 libcamera: base: Rename FileDescriptor to SharedFD
Now that we have a UniqueFD class, the name FileDescriptor is ambiguous.
Rename it to SharedFD.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:05 +02:00
Laurent Pinchart
415ac12399 libcamera: v4l2_videodevice: Pass FileDescriptor to open()
The V4L2VideoDevice::open() function that takes an open file handle
duplicates it internally, and leaves the original handle untouched. This
is documented but not enforced through language constructs. Fix it by
passing a FileDescriptor to the function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:04 +02:00
Hirokazu Honda
a62a886a7d libcamera: v4l2_videodevice: Use fd for a file descriptor
Manages file descriptors owned by V4L2VideoDevice by UniqueFD.
This also changes the return type of exportDmabufFd to UniqueFD
from FileDescriptor in order to represent a caller owns the
returned file file descriptor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:04 +02:00
Hirokazu Honda
cfe4f9622e libcamera: v4l2_device: Use UniqueFD for a file descriptor
Manages a file descriptor owned by V4L2Device for a v4l2 device node
by UniqueFD.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:04 +02:00
Hirokazu Honda
91dcd719d7 libcamera: media_device: Manage fd by UniqueFD
Manages a file descriptor owned by MediaDevice for a media device
node by UniqueFD.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:04 +02:00
Hirokazu Honda
c49e888848 libcamera: process: Manage pipe fds by UniqueFD
Manages the file descriptors owned by Process for pipe by UniqueFDs.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-04 23:05:03 +02:00
Hirokazu Honda
9143668887 libcamera: ipc_unixsocket: Use UniqueFD for a file descriptor
IPCUnixSocket::create() creates two file descriptors. One of
them is stored in IPCUnixSocket and the other is returned to a
caller. This clarifies the ownership using UniqueFD.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04 23:05:03 +02:00
Hirokazu Honda
edd70612e5 libcamera: file: Manage fd by UniqueFD
Manages the file descriptor owned by File by UniqueFD.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-04 23:05:01 +02:00
Hirokazu Honda
a59c471e5a libcamera: event_dispatcher_poll: Manage fd by UniqueFD
Manages the event file descriptor owned by EventDispatcherPoll
by UniqueFD.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-04 23:04:20 +02:00
Laurent Pinchart
fcf98514cb libcamera: base: file_descriptor: Return UniqueFD from dup()
The dup() function returns a duplicate of the file descriptor. Wrapping
it in a FileDescriptor isn't wrong as such, but it prevents from using
it in contexts where a UniqueFD is needed. As the duplicate is
guaranteed to have a single owner when created, return it as a UniqueFD
instead. A FileDescriptor can easily be created from the UniqueFD if
desired.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03 19:20:47 +02:00
Hirokazu Honda
1d0dbc0da8 libcamera: base: file_descriptor: Add constructor from UniqueFD
Add a FileDescriptor constructor that takes a UniqueFD, transfering
ownership of the file descriptor to the FileDescriptor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03 19:20:44 +02:00
Hirokazu Honda
ccdaf8ec90 libcamera: base: Introduce UniqueFD
This introduces UniqueFD. It acts like unique_ptr to a file descriptor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-12-03 19:20:36 +02:00
Laurent Pinchart
1546a74e64 libcamera: base: file_descriptor: Move inode() function to frame_buffer.cpp
The inode() function has always been a bit of an outcast in the
FileDescriptor class, as it's not related to the core feature provided
by FileDescriptor, a shared ownership wrapper around file descriptors.
As it's only used in the FrameBuffer implementation, move it to
frame_buffer.cpp as a static function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03 19:20:32 +02:00
Laurent Pinchart
6c6acaa7ea libcamera: Move file_descriptor.h to base/
The FileDescriptor class is a generic helper that matches the criteria
for the base library. Move it there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03 19:20:31 +02:00
Laurent Pinchart
6b1e256934 libcamera: Move compiler.h to base/
In preparation for usage of __nodiscard in the base API, move the
compiler.h header to base.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03 19:20:29 +02:00
Han-Lin Chen
ad2bcbe5b5 libcamera: camera_lens: add CameraLens as a member of CameraSensor
Add CameraLens as a member of CameraSensor. The patch does not implement how
to link the lens to the specific sensor yet. Only to provide an interface for
pipeline handler's usage.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-03 10:23:26 +00:00
Han-Lin Chen
6e80c1bcf4 libcamera: camera_lens: Add a new class to model a camera lens
The CameraLens class abstracts camera lens and provides helper
functions to ease interactions with them.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-03 10:23:26 +00:00
Han-Lin Chen
5d2aad02e8 libcamera: add model() for retrieving model name in V4L2Subdevice
CameraSensor retrieves model name from media entity. Move the heuristics
method into V4L2Subdevice, so CameraLens can reuse the function.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-03 10:23:26 +00:00
Han-Lin Chen
95937ff189 ipa: ipu3: Extend ipu3 ipa interface for lens controls
IPU3Event and IPU3Action use two fields for both libcamera controls and sensor
V4L2 controls. The patch extend one more field for lens V4L2 controls
for auto focus usage.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-03 10:23:26 +00:00
Hirokazu Honda
7e91f95160 libcamera: Correct include headers for Mutex classes
Mutex classes are defined in mutex.h. This replaces thread.h
include for the Mutex classes with mutex.h.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-01 13:46:48 +02:00
Hirokazu Honda
c17f172842 libcamera: base: Add mutex classes with thread safety annotations
This replaces Mutex and MutexLocker with our own defined classes.
The classes are annotated by clang thread safety annotations.
So we can add annotation to code where the classes are used.

v4l2 code needs to be annotated, which violates Mutex capability.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-01 13:46:47 +02:00
Hirokazu Honda
16efd83f5d libcamera: base: Add thread safety annotation macros
Clang compiler is able to do a thread safety analysis with
annotations [1]. This introduces the thread safety annotation
macros and also enable the analysis by adding -Wthread-safety
if a clang compiler is used.

[1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-01 13:46:45 +02:00
Hirokazu Honda
923cf7f40a libcamera: base: Introduce ConditionVariable
ConditionVariable is alias to std::condition_variable. This replaces
std::condition_variable with the ConditionVariable. It enables
replacing ConditionVariable implementation easily in the following
patches.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-01 13:46:36 +02:00
Jean-Michel Hautbois
431749b399 ipa: rkisp1: Report and use sensor controls
The pipeline handler populates a new sensorControls ControlList, to
have the effective exposure and gain values for the current frame. This
is done when a statistics buffer is received.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29 20:41:37 +01:00
Jean-Michel Hautbois
90da3af347 ipa: rkisp1: Pass IPASettings at init call
When the IPA is initialized, it will need to know the sensor model
used in order to properly call CameraSensorHelper for the analogue gain.
Modify the init definition in the pipeline handler and in the IPA as
well as the mojo interface to pass the IPASettings.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29 20:41:37 +01:00
Laurent Pinchart
0eacde623b libcamera: object: Avoid argument copies in invokeMethod()
Template argument deduction results in the lvalue and lvalue reference
arguments to the invokeMethod() function causing deduction of the Args
template type to a non-reference type. This results in the argument
being passed by value and copied.

Fix this by using a cv-unqualified rvalue reference parameter type. The
type is then deduced to an lvalue reference when the argument is an
lvalue or lvalue reference, due to a combination of the special template
argument deduction rule for rvalue reference parameter types:

  If P is an rvalue reference to a cv-unqualified template parameter
  (so-called forwarding reference), and the corresponding function call
  argument is an lvalue, the type lvalue reference to A is used in place
  of A for deduction.

  (https://en.cppreference.com/w/cpp/language/template_argument_deduction)

and the reference collapsing rule
(https://en.cppreference.com/w/cpp/language/reference#Reference_collapsing).

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>
2021-11-24 15:18:52 +02:00
Kieran Bingham
cc0b245096 libcamera: ipa: Convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-24 12:18:22 +00:00
Kieran Bingham
df131ad088 libcamera: internal: Convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

Tracepoints.h.in is not modified to use the pragma as it requires
self-inclusion.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-24 12:18:17 +00:00
Kieran Bingham
0701f756b9 libcamera: base: Convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-24 12:18:11 +00:00
Kieran Bingham
0a64cf8b76 libcamera: Convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-24 12:17:35 +00:00
Han-Lin Chen
f12efa6730 ipa: ipu3: Extend ipu3 ipa interface for sensor controls
IPU3Event and IPU3Action use single ControlList for both libcamera and
V4L2 controls, and it's content could be either one based on the
context.  Extend IPU3Event and IPU3Action for sensor V4L2 controls, and
preserve the original one for only libcamera Controls to make the
content of an event more specific.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
[Jean-Michel: remove lensControls from the original patch]
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-11-15 10:49:13 +01:00
Naushir Patuck
91bd175c8f libcamera: bayer_format: Add PixelFormat conversion helpers to BayerFormat class
Add BayerFormat::toPixelFormat() and BayerFormat::fromPixelFormat() helper
functions to convert between BayerFormat and PixelFormat types.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Minor checkstyle fix]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-02 12:08:45 +00:00
Laurent Pinchart
364ae3b78d libcamera: bayer_format: Turn BayerFormat::Packing into scoped enum
The unscoped enum BayerFormat::Packing leads to usage of the ambiguous
BayerFormat::None enumerator. Turn the enumeration into a scoped enum to
force usage of BayerFormat::Packing::None, and drop the now redundant
"Packed" suffix for the CSI2 and IPU3 packing.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-02 12:08:44 +00:00
Laurent Pinchart
dc2f47e6e5 include: drm_fourcc: Add R10 and R12 FourCC
Add FourCCs for 10- and 12-bit red format with padding to 16 bits.

This is merged in the upstream kernel as 31fa8cbce466 ("drm: Add R10 and
R12 FourCC")

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-02 12:06:09 +00:00
Kieran Bingham
0a1aaa8d55 libcamera: v4l2_videodevice: provide hasMediaController()
The V4L2Capability has helpers to interogate the capabilities
of a device.

V4L2VideoDevice::enumPixelformats accesses the raw capabilites to check
if the device is supported by a MediaController device.

Provide a helper, and update the usage.

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-27 14:31:49 +01:00
Kieran Bingham
88a90ba2a7 libcamera: request: Use external CameraControlValidator
Each Request is currently creating its own CameraControlValidator
using the Camera instance at construction.

Now that the Camera exposes its own CameraControlValidator on its
private interface, use that one on all Requests.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-25 09:56:50 +01:00