summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
AgeCommit message (Collapse)Author
2020-12-02android: camera_device: Check capture_request validityJacopo Mondi
Make sure the 'camera3_capture_request_t *' provided to CameraDevice::processCaptureRequest() is valid before attempting to access it. This patch fixes cros_camera_test: Camera3FrameTest/Camera3InvalidRequestTest.NullOrUnconfiguredRequest/* Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-12-02android: camera_mode: Reserve 'data' vectorsJacopo Mondi
The CameraDevice::getStaticMetadata() function populates the entries for Android's static metadata by walking the ControlInfo supported values reported by the libcamera pipeline. The number of entries to be passed to Android is computed using the vector's size which is initialized at vector creation time to the maximum number of available entries. In order to report the correct number of metadata do not create the vector with the largest possible number of elements but only reserve space for them using std::vector::reserve() which does not modify the vector's size. This patch fixes cros_camera_test: Camera3DeviceTest/Camera3DeviceDefaultSettings.ConstructDefaultSettings/1 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-10-28android: camera_device: Mark toPixelFormat() a const functionHirokazu Honda
CameraDevice::toPixelFormat() doesn't change the state of the CameraDevice. Marks it a const function so that it can be called in const functions. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> 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-28android: camera_device: Fix crash of accessing a missing map elementHirokazu Honda
std::map::at() searches std::map by the given key. The commit e1f9fdb8a5bd ("android: camera_device: Remove shadowing FrameBuffer usage") uses it with 0 to intend to accessing the first element of the map, but actually access the element whose key is nullptr. This causes the crash because the map doesn't have the element with nullptr. This fixes the issue by replacing the std::map::at() operation by std::map::begin(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> [Kieran: Updated commit message] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-10-26android: camera_device: Handle LENS_SHADING_MAP_MODESJacopo Mondi
Register the ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES static metadata property inspecting the values retuned by the pipeline handler. Add one entry and reserve in static metadata pack enough space to support all the 2 available lens shading map modes Android defines. 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-26android: camera_device: Handle COLOR_CORRECTION_ABERRATION_MODEJacopo Mondi
Register the ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES static metadata property inspecting the values retuned by the pipeline handler. Reserve in the static metadata pack enough space to support all the 3 available color correction aberration modes Android defines. 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-26android: camera_device: Handle NOISE_REDUCTION_MODESJacopo Mondi
Register the ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES static metadata property inspecting the values retuned by the pipeline handler. Reserve in the static metadata pack enough space to support all the 5 available noise reduction modes Android defines. 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-26android: camera_device: Report PIPELINE_MAX_DEPTHJacopo Mondi
Register the ANDROID_REQUEST_PIPELINE_MAX_DEPTH static property inspecting the value reported by the pipeline handler. If the Camera does not report any suitable value, default the static property to 2. 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-21android: camera_device: Remove shadowing FrameBuffer usageKieran Bingham
A FrameBuffer *buffer is used to obtain the 'first' buffer from a request which is used purely to identify the timestamp from the metadata in two locations. Rather than keep the FrameBuffer instance around, which then causes further usages of FrameBuffers to be shadowed, store the timestamp locally. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-21android: camera_device: use member style on Camera3RequestDescriptorKieran Bingham
Use the postfixed '_' member variable naming style for the Camera3RequestDescriptor structure, which in turn ensures that variable shadowing does not occur in the member initializer list of the constructor. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-21android: camera_device: Use existing variable definitionsKieran Bingham
Prevent variable shadowing by removing the redeclaration of variables with the same name (and type) where the existing variable can be reused. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-20android: Omit extra semicolonsHirokazu Honda
The end semicolons with LOG_DECLARE_CATEGORY and LOG_DEFINE_CATEGORY are unnecessary. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-16android: jpeg: Port to PostProcessor interfaceUmang Jain
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-14android: camera_device: Queue request using WorkerJacopo Mondi
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-12libcamera, android, cam, gstreamer, qcam, v4l2: Reuse RequestPaul Elder
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-07android: camera_device: Clear streams_ at stop timeJacopo Mondi
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-07android: camera_device: Add stream mapping logJacopo Mondi
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-07android: camera_device: Use CameraStream buffersJacopo Mondi
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-07android: camera_stream: Create buffer poolJacopo Mondi
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-07android: camera_device: Make CameraStream configuration nicerJacopo Mondi
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-07android: camera_stream: Fetch format and size from configurationJacopo Mondi
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-07android: camera_stream: Retrieve Stream and ConfigurationJacopo Mondi
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-07android: camera_device: Move processing to CameraStreamJacopo Mondi
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-07android: camera_stream: Construct with Android streamJacopo Mondi
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-07android: camera_stream: Delegate Encoder constructionJacopo Mondi
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-07android: camera_stream: Add CameraStream::TypeJacopo Mondi
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-07android: camera_stream: Break out CameraStreamJacopo Mondi
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-09-30libcamera: stream: Rename StillCaptureRaw to RawNiklas Söderlund
With the buffer copy removed from all pipelines for raw capture rename StillCaptureRaw to Raw to better describe the role. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-09-18android: camera_device: Make CameraStream a classJacopo Mondi
Complete the transformation of CameraStream into a class and provide a read-only interface that allows to access its parameters but not modify them at run-time. No functional changes intended but this change aims to make the code more robust by enforcing a stricter interface in the CameraStream class. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-18android: camera_device: Set Encoder at constructionJacopo Mondi
Make the CameraStream encoder a private unique pointer and require its initialization at construction time. This ties the encoder lifetime to the CameraStream it has been created with, allowing to remove the CameraStream destructor. This change dis-allow creating a CameraStream and set the Encoder later, which shall not happen now that we create CameraStream once we have all the required information in place. No functional changes intended but this change aims to make the code more robust enforcing a stricter CameraStream interface. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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-09-18android: camera_device: Rework CameraStream handlingJacopo Mondi
The CameraDevice::streams_ vector of CameraStream instances is currently mostly accessed by index. The current implementation creates all the CameraStream during the first loop that inspects the camera3_stream instances and then update the index of the StreamConfiguration associated with the CameraStream during a second loop that inspects MJPEG streams. A third loop creates the JPEG encoder associated with camera streams that produce MJPEG format. As the index-based association is hard to follow and rather fragile, rework the creation and handling of CameraStream: 1) Make the StreamConfiguration index a constructor parameter and a private struct member. This disallows the creation of CameraStream without a StreamConfiguration index assigned. 2) Create CameraStream only after the associated StreamConfiguration has been identified. The first loop creates CameraStream for non-JPEG streams, the second for the JPEG ones after having identified the associated StreamConfiguration. Since we have just created the CameraStream, create the JPEG encoder at the same time instead of deferring it. This change removes all accesses by index to the CameraDevice::streams_ vector. No functional changes intended, but this change aims to make the code easier to follow and more robust. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-18android: camera_device: Use Android formatJacopo Mondi
When iterating the camera3_stream_t received from the Android camera framework to identify the MJPEG streams, the format check was performed on the CameraStream created when iterating the non-MJPEG streams and not on the format actually requested by Android. As the next patches will remove the creation of CameraStream instances for MJPEG streams, use the camera3_stream format to prepare for that. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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-09-18android: camera_device: Get rid of stream counterJacopo Mondi
Use the size() method of the CameraConfiguration class to retrieve the index of the StreamConfiguration associated with a CameraStream and get rid of the custom counter. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-18android: camera_device: Generate RAW resolutionsJacopo Mondi
The resolutions supported for the RAW formats cannot be tested from a list of known sizes like the processed ones. This is mainly due to the fact RAW streams are produced by capturing frames at the CSI-2 receiver output and their size corresponds to the sensor's native sizes. In order to obtain the RAW frame size generate a temporary CameraConfiguration for the Role::StillCaptureRAW role and inspect the map of StreamFormats returned by the pipeline handler. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-18android: camera_device: Break out size calculationJacopo Mondi
As the RAW stream sizes needs to be calculated differently from the processed one, break out the procedure to calculate the processed (RGB/YUV) resolutions from initializeStreamConfigurations() in order to prepare for RAW sizes calculation. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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-09-18android: camera_device: Add debug to stream initializationJacopo Mondi
Add debug printouts to the CameraDevice::initializeStreamConfigurations() function that help to follow the process of building the stream configurations map. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> 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-09-18android: camera_device: Generate JPEG sizesJacopo Mondi
When producing the list of image resolutions to claim as supported by the camera HAL, the JPEG stream was assumed to be 'always valid' as, at the time, there was no JPEG support in place at all. With the introduction of support for JPEG compression, reporting non-valid sizes as supported obviously causes troubles. In order to avoid reporting non-supported resolutions as supported, produce the list of available JPEG sizes by using the ones supported by the YCbCr_420_888 format, from which the JPEG stream is encoded. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-18android: camera_device: Refuse unsupported formatsJacopo Mondi
The current implementation of CameraDevice::initializeStreamConfigurations() fails if an image format marked as mandatory is not supported by the libcamera::Camera device, but erroneously accepts non-mandatory non-supported formats in the list of accepted ones. Fix this by ignoring non supported image formats which are not marked as mandatory. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> 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-09-10android: jpeg: Support an initial set of EXIF metadata tagsUmang Jain
Create a Exif object with various metadata tags set, just before the encoder starts to encode the frame. The object is passed directly as libcamera::Span<> to make sure EXIF tags can be set in a single place i.e. in CameraDevice and the encoder only has the job to write the data in the final output. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> 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-09-10android: camera_device: Fix value of orientation metadataUmang Jain
Android's orientation metadata cannot have identical numerical value to libcamera's rotation property. This is due to the fact that libcamera's rotation property specifies the correction angle in anticlockwise direction whereas Android's orientation metadata specifies the value in clockwise direction. Fix that by computing corresponding value for clockwise direction from libcamera's rotation property. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-08android: camera_device: Fix spelling in commentJacopo Mondi
Just a small spelling fix: s/re-allcoation/reallocation 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-08-25meson: Remove -Wno-unused-parameterLaurent Pinchart
We build libcamera with -Wno-unused-parameter and this doesn't cause much issue internally. However, it prevents catching unused parameters in inline functions defined in public headers. This can lead to compilation warnings for applications compiled without -Wno-unused-parameter. To catch those issues, remove -Wno-unused-parameter and fix all the related warnings with [[maybe_unused]]. 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-08-23android: camera_device: Make CameraDevice a shared objectUmang Jain
CameraDevice needs to be wrapper into the std::shared_ptr instead of std::unique_ptr to enable refcounting. The refcounting will help us to support hotplug and hot-unplug CameraHalManager operations in the subsequent commit. Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-14libcamera: request: Declare a using directive for map of buffersNiklas Söderlund
Declare a using directive for the map of Stream to FrameBuffer. Update all users of Request::buffers() to use the new usage directive. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Support MJPEG stream constructionKieran Bingham
MJPEG streams must be created referencing a libcamera stream. This stream may already be provided by the request configuration, in which case the existing stream is utilised. If no compatible stream is available to encode, a new stream is requested from the libcamera configuration. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Generate ResultMetadata earlierKieran Bingham
Generate the ResultMetadata before performing JPEG compression so that JPEG specific metadata can be added to the metadata when it has been processed. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Report configuration changes from validate()Kieran Bingham
When we call validate on a configuration, if there are any adjustments on the configuration, we fail without showing why. Display the stream configuration after the validate stage to aid debugging stream startup failures. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Query plane lengthKieran Bingham
Use lseek to query the length of planes where possible rather than leaving the plane.length as zero, which prevents mapping buffers for software processing. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Only construct required planesKieran Bingham
The camera3buffer describes the number of filedescriptors given. Don't try to construct more planes than that. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06android: camera_device: Report an error in notifyError()Kieran Bingham
If an error is generated, try to be verbose about it in the libcamera logs. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>