Commit graph

2025 commits

Author SHA1 Message Date
Naushir Patuck
696aefe0c9 include: linux: Update V4L2_CID_USER_BCM2835_ISP_BASE to match upstream tree
The V4L2_CID_USER_BCM2835_ISP_BASE has changed in the downstream
Raspberry Pi 5.9 kernel to match the upstream defines, see here:
https://github.com/raspberrypi/linux/pull/3897.

Note, that this will cause an ABI breakage with the current downstream
Raspberry Pi 5.4 kernel until both this change and the following PR has
been merged: https://github.com/raspberrypi/linux/pull/3897

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-19 05:18:51 +03:00
Umang Jain
b2b8c4dc94 android: jpeg: Port to PostProcessor interface
Port the CameraStream's JPEG-encoding bits to PostProcessorJpeg.
This encapsulates the encoder and EXIF generation code into the
PostProcessorJpeg layer and removes these specifics related to JPEG,
from the CameraStream itself.

Signed-off-by: Umang Jain <email@uajain.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
Change-Id: Id9e6e9b2bec83493a90e5e126298a2bb2ed2232a
2020-10-16 10:23:10 +01:00
Umang Jain
3d946a2e60 android: post_processor: Introduce a PostProcessor interface
Introduce a PostProcessor interface for the streams that require any
kind of processing (refer to CameraStream::Type) for their consumption
by the HAL layer. The PostProcessor interface can be configured via
configure() and the actual processing can be initiated using process().

The post-processing layer can be extended to have multiple post
processors for various stream configurations. As of now, we only have
one post processor (JPEG), hence the subsequent commit will port its
function to this interface.

Signed-off-by: Umang Jain <email@uajain.com>
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-10-16 10:22:33 +01:00
Umang Jain
4221ffbc4b android: CameraStream: Fix nitpick indentation for mutex_
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-16 07:27:48 +03:00
Jacopo Mondi
212417bfe1 android: camera_stream: Add documentation
Add a brief documentation block to the CameraStream class.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-14 20:12:51 +02:00
Jacopo Mondi
4b1aa21db0 android: camera_device: Queue request using Worker
Add a CameraWorker class member to the CameraDevice class and
queue capture requests to it to delegate its handling. Start and
stop the CameraWorker when the libcamera::Camera is started or
stopped.

Tie the CaptureRequest lifetime to the Camera3RequestDescriptor's one
by storing it as unique_ptr<> in the descriptor to simplify handling
of request creation and deletion.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-14 20:11:26 +02:00
Jacopo Mondi
8806863b0b android: camera_worker: Introduce CameraWorker
The Android camera framework provides for each buffer part of a capture
request an acquisition fence the camera HAL is supposed to wait on
before using the buffer. As the libcamera HAL runs in the camera service
thread, it is not possible to perform a synchronous wait there.

Introduce a CameraWorker class that runs an internal thread to wait
on a set of fences before queueing a capture request to the
libcamera::Camera.

Fences completion is handled through a simple poll, similar in
implementation to the sync_wait() function provided by libdrm.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-14 20:10:06 +02:00
Jacopo Mondi
a55fb80901 libcamera: controls: Define AwbLocked control
Define a control to report the AWB algorithm locking state.
The control definition is copied from the AeLocked one.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-14 20:00:15 +02:00
Tomi Valkeinen
8e6ca49687 cam: options: fix access to uninit variable
operator[] doesn't check if the option exists in the values_ map, so it
can return a pointer to location outside the map.

Fix by returning an empty OptionValue if the option is not found.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Kieran: Adjust s_empty naming to 'empty']
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-12 16:15:08 +01:00
Tomi Valkeinen
265daf6e59 vimc: fix close(-1)
~IPAVimc() checks if fd != 0, but it should check if fd != -1.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
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-10-12 16:13:57 +01:00
Tomi Valkeinen
503d61fc83 cam: fix use of uninitialized field
Initialize last_ to 0 to avoid uninitialized use.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-12 16:13:57 +01:00
Tomi Valkeinen
9183d21842 meson: Enable -Wno-psabi for gcc 9+
I get the warnings related to psabi with:

gcc 9.3.0 "arm-buildroot-linux-gnueabihf-g++.br_real (Buildroot 2020.08-24-gc5c5f1fa46) 9.3.0"

Remove the check for gcc-9, so that -Wno-psabi is used on all gcc
versions over 7.1.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-12 14:27:18 +03:00
Andrey Konovalov
c29d565704 libcamera: pipeline: simple: enable qcom-camss
qcom-camss driver supports MIPI CSI2 receivers on APQ8016 and APQ8096
Application processors from Qualcomm, which are used on e.g. DragonBoard
410c and DragonBoard 820c dev boards respectively.

The simple pipeline handler provides basic support for these devices.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-12 14:27:18 +03:00
Paul Elder
c753223ad6 libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request
Allow reuse of the Request object by implementing reuse(). This means
the applications now have the responsibility of freeing the Request
objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer,
android) do so.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-12 11:32:40 +09:00
Andrey Konovalov
05cdef27ab libcamera: pipeline: simple: enable mplane devices using contiguous memory
The current simple pipeline handler refuses to work with capture devices
which have V4L2_CAP_VIDEO_CAPTURE_MPLANE flag set in the device capabilities
field. This is too restrictive, as devices supporting the multi-planar API
can be using contiguous memory for semi-planar and planar formats, and this
would just work without any changes to libcamera.

Drop the guard against MPLANE devices, and replace it with the check of
the number of planes in the format the simple pipeline handler is going to
use for capture. This will let MPLANE devices which don't use non-contiguous
memory for frame buffers to work with the simple pipeline handler.

The following code in SimpleCameraData::init() filters out the pixel formats
libcamera doesn't support:

	PixelFormat pixelFormat = videoFormat.first.toPixelFormat();
	if (!pixelFormat)
		continue;

So the check for the number of memory planes this patch adds would not
trigger until non-contiguous planar formats becomes supported in libcamera,
and video devices using these formats are enabled in the simple pipeline
handler. Then this check will remind one to review the simple pipeline
handler code.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-10 01:42:44 +03:00
Umang Jain
48d304392b android: jpeg: Use LGPL-2.1 license
The jpeg components are licensed under GPL-2.0-or-later. This is an
oversight and unvoluntary. License them under the LGPL-2.1-or-later as
the rest of the camera HAL implementation.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-10 01:37:36 +03:00
Paul Elder
4d4a8862b2 test: span: Fix typo describing the dynamic span test
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-09 08:37:10 +09:00
Jacopo Mondi
6c4999e6a4 android: camera_device: Clear streams_ at stop time
When the CameraDevice is stopped, we need to clear the vector
of CameraStream instances to make sure they get deleted and all the
resources they have acquired get released.

Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:09:22 +02:00
Jacopo Mondi
35f726d4da android: camera_device: Add stream mapping log
To ease following how Android streams get mapped to libcamera ones
add a (quite verbose) printout before queueing a request to libcamera.

The output looks like:
 0 -  (320x240)[0x00000022] -> (320x240)[NV12] (direct)
 1 -  (640x480)[0x00000021] -> (640x480)[NV12] (internal)

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:09:22 +02:00
Jacopo Mondi
de8304b116 android: camera_device: Use CameraStream buffers
Now that CameraStream that require internal memory allocation
have been instrumented with a FrameBuffer pool, use them to create
intermediate buffers in the CameraDevice.

Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:09:22 +02:00
Jacopo Mondi
b84e35dc97 android: camera_stream: Create buffer pool
Add a FrameBufferAllocator class member to the CameraStream class.
The allocator is constructed for CameraStream instances that needs
internal allocation and automatically deleted.

Allocate FrameBuffers using the allocator_ class member in the
CameraStream class at CameraStream::configure() time and add two
methods to the CameraStream class to get and put FrameBuffer pointers
from the pool of allocated buffers. As buffer allocation can take place
only after the Camera has been configured, move the CameraStream
configuration loop in the CameraDevice class after camera_->configure()
call.

The newly created pool will be used to provide buffers to CameraStream
that need to provide memory to libcamera where to deliver frames.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:09:20 +02:00
Jacopo Mondi
6c8837da5e android: camera_device: Make CameraStream configuration nicer
Loop over the CameraStream instances and use their interface to perform
CameraStream configuration.

Modify CameraStream::configure() to configure the android stream buffer
count and to retrieve the StreamConfiguration by index instead of
receiving it as a parameter.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:45 +02:00
Jacopo Mondi
fc1fcb5bc9 android: camera_device: Return Camera as shared_ptr
Return the Camera wrapped by the CameraDevice as a shared_ptr.
This will be required to construct the FrameBuffer allocator in
the CameraStream class.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
e3393f147e android: camera_stream: Fetch format and size from configuration
Fetch the format and size of the libcamera::StreamConfiguration
associated with a CameraStream by accessing the configuration by
index.

This removes the need to store the libcamera stream format and sizes
as class members and avoid duplicating information that might get out
of sync.

It also allows to remove the StreamConfiguration from the constructor
parameters list, as it can be identified by its index. While at it,
re-order the constructor parameters order.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
216030aa9d android: camera_stream: Retrieve Stream and Configuration
It's a common pattern to access the libcamera::Stream and
libcamera::StreamConfiguration using the CameraStream instance's
index.

Add two methods to the CameraStream to shorten access to the
two fields. This allows removing the index() method from the class
interface.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
9e95d5e453 android: camera_device: Move processing to CameraStream
Move the JPEG processing procedure to the individual CameraStream
by augmenting the class with a CameraStream::process() method.

This allows removing the CameraStream::encoder() method.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
160bb0998b android: camera_stream: Construct with Android stream
Pass the android camera3_stream_t, and a libcamera::StreamConfiguration
to identify the source and destination parameters of this stream.

Pass a CameraDevice pointer to the CameraStream constructor to allow
retrieval of the StreamConfiguration associated with the CameraStream.

Also change the format on which the CameraDevice performs checks to
decide if post-processing is required, as the libcamera facing format is
not meaningful anymore, but the Android requested format should be used
instead.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
3c84d88193 android: camera_stream: Delegate Encoder construction
Delegate the construction of the encoder to the CameraStream class
for streams that need post-processing.

Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
94c4d49ebe android: camera_stream: Add CameraStream::Type
Define the CameraStream::Type enumeration and assign it to
each CameraStream instance at construction time.

The CameraStream type will be used to decide if memory needs to be
allocated on its behalf or if the stream is backed by memory externally
allocated by the Android framework.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:44 +02:00
Jacopo Mondi
5cf64b26a2 android: camera_stream: Break out CameraStream
Break CameraStream out of the CameraDevice class.

No functional changes, only the code is moved.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 16:07:43 +02:00
Tomi Valkeinen
5fbda0dfda ipa: raspberrypi: fix access to uninitialized variables
Set span_r and span_b to -1 so that when they are passed to Pwl::Eval()
they won't cause access to uninitialized memory.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-07 14:46:38 +01:00
Tomi Valkeinen
5f1f3092a1 ipa: raspberrypi: fix bin_x calculation
I presume this code is supposed to set bin_x and bin_y, and not bin_y
two times. This caused use of uninitialized variable later when bin_x
was used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-07 14:46:38 +01:00
Umang Jain
6feebf297e android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()
Use the newly introduced utils::toAscii() utility to remove all
non-ASCII characters for EXIF_FORMAT_ASCII strings.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-07 14:42:10 +01:00
Paul Elder
c57622d95f libcamera: PipelineHandler: Move printing pipeline names to CameraManager
Since pipeline registration is done with declaring static factory
objects, there is a risk that pipeline factories will be constructed
before libcamera facilities are ready. For example, logging in the
constructor of a pipeline handler factory may cause a segfault if
threading isn't ready yet. Avoid this issue by moving printing the
registration of the pipeline handler to the camera manager.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 19:17:31 +09:00
Paul Elder
1469d5e26e libcamera: ProcessManager: make ProcessManager lifetime explicitly managed
If any Process instances are destroyed after the ProcessManager is
destroyed, then a segfault will occur.

Fix this by making the lifetime of the ProcessManager explicit, and make
the CameraManager construct and deconstruct (automatically, via a member
variable) the ProcessManager.

Update the tests accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 19:17:31 +09:00
Paul Elder
7e59bccb35 Documentation: coding-style: Document global variable guidelines
Document the issue related to global variable dependencies and how to
avoid them.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-07 19:17:31 +09:00
Jacopo Mondi
6193e9c252 libcamera: file_descriptor: Remove spurious 'is'
Remove a spurious 'is' is a comment block.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-07 10:12:28 +02:00
Naushir Patuck
bb6167873e pipeline: ipa: raspberrypi: Switch to use C++17 features where possible
With the recent change to use C++17, the following code changes can be
made:
- Use C++17 [[fallthough]] attribute instead of /* Fall through */.
- Swap boost::any to std::any.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-07 04:58:39 +03:00
Laurent Pinchart
dcc47ff715 qcam: viewfinder_gl: Add shader to render packed YUV formats
The shader supports all 4 packed 8-bit YUV variants.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
ae9e7fbf3a qcam: viewfinder_gl: Merge the semi-planar UV and VU shaders
Use macros to select the U and V pattern, to avoid code duplication
between the two semi-planar shaders.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
0bc03960da qcam: viewfinder_gl: Support #define in shaders
Prepare the infrastructure to support defining preprocessor macros in
shaders:

- Rename the fragmentShaderSrc_ member to fragmentShaderFile_ to reflect
  better that it contains a file name, not shader source code
- Add a new fragmentShaderDefines_ member to store preprocessor macros
- Prepend the macros to the shader source before compiling it

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
440028d6c9 qcam: viewfinder_gl: Rename shader files
Rename shader files to prepare for packed YUYV support:

- The NV prefix isn't a good match for packed (or for 3-planar) formats,
  replace it with a YUV prefix
- Use .frag and .vert extensions to differentiate between fragment and
  vertex shaders

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
079afd17e7 qcam: viewfinder_gl: Hardcode the vertex shader file name
The GL renderer uses the same vertex shader for all formats. Hardcode
the file name instead of storing it in a member variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
52f2581709 qcam: viewfinder_gl: Don't store texture IDs in class members
The texture IDs can easily and cheaply be retrieved from the textures,
there's no need to store them in class members.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Laurent Pinchart
11abf52a8a qcam: Remove unneeded './' file prefix in *.qrc
There's no need to prefix files in the local directory with './'. Drop
it.

While at it, add indentation to make the *.qrc files more readable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-04 22:51:45 +03:00
Naushir Patuck
0b427b8ecf pipeline: raspberrypi: Sensor flips should be applied unconditionally
The code in pipeline_handler::start() that applies the flips were in a
block that was conditional on the RPi::IPA_CONFIG_STAGGERED_WRITE return
result. This should be applied unconditionally.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-02 16:01:21 +01:00
Niklas Söderlund
68c55b49c4 qcam: dng_writer: Record camera model
Record the model property of the camera if available.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-02 15:04:41 +02:00
Niklas Söderlund
78fcf8e17c cam: Print user-friendly camera names
Instead of only printing the camera ID which is not intended for humans
to read and parse create a more user-friendly string when printing
camera names. The ID is still printed as it is one option used to select
camera using the --camera option.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-02 15:04:41 +02:00
Niklas Söderlund
93401c036d libcamera: pipeline: uvcvideo: Set sensor model property
Set the sensor model property from the model reported in the media
graph.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-02 15:04:41 +02:00
Niklas Söderlund
a60020c3c3 libcamera: pipeline: uvcvideo: Initialize CameraData from MediaDevice
The UVCCameraData::init() is the only consumer of the default entry in
the media graph, move the lookup of it into the init() function and pass
it the MediaDevice. This is done in preparation to extend the CameraData
initialization to consume more information from the MediaDevice.

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-10-02 15:04:41 +02:00