Commit graph

1217 commits

Author SHA1 Message Date
Niklas Söderlund
0e577cee9d ipa: Add start() and stop() operations
Add two new operations to the IPA interface to start and stop it. The
intention is that these functions shall be used by the IPA to perform
actions when the camera is started and stopped.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-14 00:28:28 +02:00
Kaaira Gupta
72278369b3 libcamera: pixelformats: Replace set of modifiers with single value
DRM fourccs look like they have a per-plane modifier, but in fact each
of them should be same. Hence instead of passing a set of modifiers for
each fourcc in PixelFormat class, we can pass just a single modifier.
So, replace the set with a single value.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Fix compilation error in src/libcamera/pipeline/ipu3/ipu3.cpp]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-04 00:39:44 +03:00
Laurent Pinchart
8f8992e4ee libcamera: pipeline: ipu3: Fix compilation on gcc 5 and 6
Commit 5e7c5d64a6 ("libcamera: ipu3: Do not unconditionally queue
buffers to CIO2") introduced usage of the std::queue default constructor
by using copy-list-initialization from {}. The default constructor was
explicit in C++11, which was fixed retroactively with a defect report
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html).
gcc 5 and 6 are unfortunately affected, requiring explicit usage of the
constructor.

Fixes: 5e7c5d64a6 ("libcamera: ipu3: Do not unconditionally queue buffers to CIO2")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-29 00:02:13 +02:00
Niklas Söderlund
eb4ae9e787 libcamera: ipu3: Add support for a RAW still capture stream
Allow the RAW buffer cycling between CIO2 and IMGU to be memory copied
to a new FrameBuffer in a new RAW stream. This allows users to capture
the raw Bayer format coming from the sensor.

As the RAW frame is memory copied queueing requests with the
StillCaptureRaw stream might impact performance.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
5e7c5d64a6 libcamera: ipu3: Do not unconditionally queue buffers to CIO2
Instead of unconditionally cycling buffers between the CIO2 and IMGU
pick a buffer when a request is queued to the pipeline. This is needed
if operations are to be applied to the buffer coming from CIO2 with
parameters coming from a Request.

The approach to pick a CIO2 buffer when a request is queued is similar
to other pipelines, where parameters and statistic buffers are picked
this way.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
125be3436a libcamera: FrameBuffer: Add a setRequest() interface
Add the ability to set the Request a buffer is associated with. This is
needed for buffers that live inside a pipeline handler and is
temporarily associated with a request as it's being processed inside the
pipeline.

While we are at it delete a stray semicolon.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
417e3143a9 libcamera: FrameBuffer: Add a method to copy buffer content
This method may be used to memory copy a whole FrameBuffer content
from another buffer. The operation is not fast and should not be used
without great care by pipelines.

The intended use-case is to have an option to copy out RAW buffers from
the middle of a pipeline.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
38f2efb05c include: drm_fourcc: Add Bayer FourCC and modifiers
Add Bayer format and modifiers for patch submitted for upstream
inclusion. The formats have not been accepted upstream yet but is needed
to progress with RAW capture support in libcamera.

Intention is to merge this in libcamera and update the header file the
upstream patch is picked up upstream.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
1d51ba93e9 cam: Add option to capture StillCaptureRaw stream
Add a role name 'stillraw' to request a StillCaptureRaw stream.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-27 16:27:28 +01:00
Niklas Söderlund
e9206124cc libcamera: stream: Add StillCaptureRaw role
Add a role for capturing high resolution, low frame rate, still images
in RAW format.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-27 16:27:28 +01:00
Kaaira Gupta
2fbab8b077 libcamera: v4l2PixelFormat: Replace hex with fourCC
Print fourCC characters instead of the hex value in toString() as they are
more informative. Also, write the tests for this in formats.cpp

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-27 15:17:30 +00:00
Niklas Söderlund
6f553040fd test: ipa: Fix path to VIMC IPA
When changing the VIMC IPA source file structure the path in the
ipa_module_test which needs access to the .so file was not updated, fix
that.

The omission was hard to spot as it requires a clean build of the
project as the old .so file is still in the build tree and the test
passes.

Fixes: a25533089b ("ipa: Move vimc to a subdirectory")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-26 17:23:10 +01:00
Laurent Pinchart
8c8fde05ac qcam: Print whole stream configuration when adjusted
When the validate() function adjusts the stream configuration, we print
the adjusted size for debugging purpose. Switch to printing the whole
configuration, as the pixel format may be useful too.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-26 13:37:55 +02:00
Laurent Pinchart
ee7e2c93df libcamera: Make pipeline handlers selectable at compile time
Add a 'pipelines' project option that specifies which pipeline handlers
to compile in. The corresponding IPA modules are automatically selected.
The default is to compile all pipeline handlers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-25 12:21:13 +02:00
Laurent Pinchart
a25533089b ipa: Move vimc to a subdirectory
Give a subdirectory to all IPA modules to make the structure of the
source tree more consistent. This will also simplify the implementation
of IPA module selection at build time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-25 12:21:06 +02:00
Laurent Pinchart
5e8933eeeb libcamera: pipeline: Move uvcvideo and vimc to subdirectories
Give a subdirectory to all pipeline handlers to make the structure of
the source tree more consistent. This will also simplify the
implementation of pipeline handlers selection at build time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-25 12:20:52 +02:00
Laurent Pinchart
e74885c870 qcam: main_window: Prefer stream formats that don't require conversion
Query the viewfinder for the formats it supports natively, and select
one of them for the stream if possible.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 14:51:09 +02:00
Laurent Pinchart
8bd4f20193 qcam: viewfinder: Report the natively supported pixel formats
Expose the pixel formats natively supported by the viewfinder, to allow
selection of stream formats that would minimize usage of software
conversion.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 14:49:52 +02:00
Laurent Pinchart
798b7ac969 qcam: viewfinder: Print message to report format converter usage
Print an info message when initializing the viewfinder to report if the
format converter is used or if zero-copy is enabled. This is useful to
notify of a possible impact on performances.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 14:47:55 +02:00
Laurent Pinchart
f890a57b7a qcam: viewfinder: Add support for more native formats
Qt supports more 24-bit and 32-bit RGB formats for native painting. If
the frame buffer pixel format matches any of them, disable the converter
and create a QImage in the appropriate format.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 11:10:52 +02:00
Laurent Pinchart
cb6395599e qcam: viewfinder: Display icon when stopping capture
When stopping capture, display an icon instead of the last frame. This
is required to be able to release the last buffer when the viewfinder
operators in zero-copy mode.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:12 +02:00
Laurent Pinchart
5816c0c38e qcam: viewfinder: Avoid memory copy when conversion isn't needed
If the frame buffer format is identical to the display format, the
viewfinder still invokes the converter to perform what is essentially a
slow memcpy(). Make it possible to skip that operation by creating a
QImage referencing the buffer memory instead. A reference to the frame
buffer is kept internally, and released when the next buffer is queued,
pushing the current one out.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:08 +02:00
Laurent Pinchart
ac828f937e qcam: viewfinder: Reorder methods to match header file
Reorder the methods in viewfinder.cpp to match the order in
viewfinder.h. No code change.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:07 +02:00
Laurent Pinchart
dc830e0e5f qcam: viewfinder: Use PixelFormat default constructor
There's no need to initialize the PixelFormat stored in ViewFinder
explicitly, as PixelFormat is now a class with a default constructor.
Remove the initialization.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:06 +02:00
Laurent Pinchart
c6cbe507c1 qcam: viewfinder: Embed QImage in ViewFinder
The QImage class is a thin wrapper that uses implicit sharing. We can
thus embed it in the ViewFinder class instead of allocating it
dynamically, and assign it at runtime. This simplifies the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:05 +02:00
Laurent Pinchart
615f7438ad qcam: viewfinder: Make the viewfinder hold a reference to a buffer
The viewfinder is currently expected to render frames to the screen
synchronously in the display() function, or at least to copy data so
that the buffer can be queued in a new request when the function
returns. This prevents optimisations when the capture format is
identical to the display format.

Make the viewfinder take ownership of the buffer, and notify of its
release through a signal. The release is currently still synchronous,
this will be addressed in a subsequent patch.

Rename the ViewFinder::display() function to render() to better describe
its purpose, as it's meant to start the rendering and not display the
frame synchronously.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:04 +02:00
Laurent Pinchart
b73192036d qcam: viewfinder: Move multi-planar check into viewfinder
The lack of support for multiplanar buffers comes from the viewfinder.
Move the corresponding check from MainWindow.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:03 +02:00
Laurent Pinchart
275fd5bd33 qcam: viewfinder: Add MappedBuffer to store memory mapping information
The new MappedBuffer structure replaces the std::pair<> used in the
mapped buffers map, and allows passing data to the ViewFinder::display()
function in a more structured way.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:34:02 +02:00
Laurent Pinchart
494da4467d qcam: Use Qt qInfo() and qWarning() logging facilities
Replace manual usage of std::cout and std::cerr with the Qt logging
facilities. This allows redirection log output if needed, and integrates
better with Qt.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:59 +02:00
Laurent Pinchart
9cec54a4ee qcam: main_window: Remove unneeded debug message
Printing the name of the selected camera to the log doesn't provide any
value. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:58 +02:00
Laurent Pinchart
53dd3594d5 qcam: main_window: Document functions and reorganize member data
The qcam application is our reference implementation of a libcamera GUI
application. Document the code of the MainWindow class to make it easier
to follow, and reorganize the member data in logical groups for clarity.
No code change.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:57 +02:00
Laurent Pinchart
0420a14d75 qcam: main_window: Don't print message when saving a picture
When saving a picture, the application prints a message on cout. This
isn't necessary and doesn't really help with debugging or diagnostics,
remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:56 +02:00
Laurent Pinchart
7536d7d2f8 qcam: main_window: Add shortcuts for toolbar actions
Allow triggering toolbar actions with keyboard shortcuts.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:54 +02:00
Laurent Pinchart
e4c2c60b57 qcam: main_window: Use icons from system icon theme
Use the system icon theme by default, falling back to custom icons if no
theme is available.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:50 +02:00
Laurent Pinchart
15273b38df qcam: main_window: Replace start and stop actions with a toggle action
The main window toolbar contains a start button and a stop button. This
allows starting an already started camera (which is currently not
handled and results in an error) or stopping an already stopped camera.
Replace the two actions with a single start/stop toggle action,
preventing UI misuse and reducing confusion.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:47 +02:00
Laurent Pinchart
77ea51820a qcam: main_window: Move capture event processing to main thread
To avoid blocking the camera manager for a long amount of time, move
capture event processing to the main thread. Captured buffers are added
to a queue and an event is posted to the main window to signal
availability of a buffer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:44 +02:00
Laurent Pinchart
8e7d1bbe9b qcam: main_window: Move request queuing to a separate function
Requests are requeued synchronously from the completion handler. To
prepare for delayed requeuing, move the queuing to a separate function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:43 +02:00
Laurent Pinchart
acd02afab0 qcam: Use QSize through the code base
Qt has a QSize class to store sizes. Use it to replace width and height
where applicable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:42 +02:00
Laurent Pinchart
ac02d741dc qcam: Ensure headers are self-contained
Include the headers corresponding to each compile unit at the very first
line to ensure they are self-contained.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:41 +02:00
Laurent Pinchart
01590c3f78 qcam: Remove custom event dispatcher
The qcam application installs a custom event dispatcher based on the Qt
event loop. As the camera manager now creates an internal thread, it
doesn't use that event dispatcher of the application thread at all.

Furthermore, the custom event dispatcher is buggy, as it doesn't
dispatch messages posted to the main thread's event loop. This isn't an
issue as no messages are posted there in the first place, but would
cause incorrect behaviour if we were to use that feature (for instance
to deliver signals from the camera manager thread to the application
thread).

Fixing the event dispatcher requires a change in the libcamera public
API, as there's currently no way to dispatch messages using the public
API (Thread::dispatchMessages() is not exposed). This isn't worth it at
the moment, so just remove the custom event dispatcher. If qcam later
needs the libcamera request and buffer completion signals to be
delivered in the application thread, it will need to handle that
internally, using Qt's cross-thread signal delivery.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-24 10:33:40 +02:00
Laurent Pinchart
45f248da7d libcamera: v4l2_videodevice: Add support for all 32-bit ARGB formats
The V4L2VideoDevice class implements conversion between PixelFormat and
V4L2PixelFormat for a single flavour of the 32-bit ARGB formats. Add the
three missing ones.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-24 10:33:37 +02:00
Laurent Pinchart
422e3e92ad cam: main: Cache lookup of role property
The code handling the stream role option retrieves the role property and
converts it to a string in every branch. Cache it and use the cached
value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-24 01:38:25 +02:00
Jacopo Mondi
c153be4fec test: v4l2_videodevice: Test U8 array controls
Test V4L2 array control using vivid control VIVID_CID_U8_4D_ARRAY.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-23 16:45:31 +02:00
Jacopo Mondi
9b838b87c7 libcamera: v4l2_device: Enable enumeration of U8 controls
Enable the enumeration of V4L2 array controls with V4L2_CTRL_TYPE_U8
type.

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>
2020-03-23 16:45:30 +02:00
Jacopo Mondi
55ead46477 libcamera: v4l2_controls: Support U8 array controls
Add support for array controls of type V4L2_CTRL_TYPE_U8.

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>
2020-03-23 16:45:29 +02:00
Jacopo Mondi
3786b6c84b libcamera: v4l2_device: Support reading U8 array controls
Add support to retrieve the value of array controls of type
V4L2_CTRL_TYPE_U8.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-23 16:45:25 +02:00
Jacopo Mondi
0aa8e09775 libcamera: v4l2_device: Support writing array U8 controls
Add support to write array controls of type V4L2_CTRL_TYPE_U8.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-23 16:45:21 +02:00
Jacopo Mondi
2c6e6fbc96 libcamera: v4l2_controls: Cache query control information
Cache the V4L2 control info retrieved with VIDIOC_QUERY_EXT_CTRL
at control listing time for later use.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-23 16:45:18 +02:00
Laurent Pinchart
8daf20485b libcamera: controls: Add zero-copy set API for ControlValue
Extend the ControlValue class with a reserve() function to set the value
without actually copying data, and a non-const data() function that
allows writing data directly to the ControlValue storage. This allows
allocating memory directly in ControlValue, potentially removing a data
copy.

Note that this change was implemented before ByteStreamBuffer gained the
zero-copy read() variant, and doesn't actually save a copy in the
control serializer. It however still simplifies
ControlSerializer::loadControlValue().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-03-23 16:45:16 +02:00
Laurent Pinchart
9ab024f7c2 libcamera: device_enumerator: Convey device ownership through unique_ptr
Replace usage of shared_ptr with unique_ptr to convey media device
ownership internally in the enumerators when creating the media device.
Once a media device has all its dependencies met, it is converted to a
shared_ptr to keep the external API unchanged.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-23 16:30:48 +02:00