summaryrefslogtreecommitdiff
path: root/src/android
AgeCommit message (Collapse)Author
2024-04-20android: camera_device: Always clear descriptors_ in stop()Anle Pan
When flush() is called and then a new stream configuration is set, the descriptors_ queue might have a chance to be not cleared in stop(), as the Camera is already in Stopped state. This will prevent further requests from being completed in sendCaptureResults() as the descriptors_ queue is not empty. To fix the issue, clear the descriptors_ even if the Camera State is Stopped. As a drawback the libcamera::Camera::stop() function might be called twice, but this is allowed by the Camera state machine, and the second call is guaranteed to be a nop. Signed-off-by: Anle Pan <anle.pan@nxp.com> Signed-off-by: Fang Hui <hui.fang@nxp.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-03-22android: camera_device: Save capture settings unconditionallyFang Hui
As the Android framework sends to the camera device settings incrementally (only the ones that change are updated), the CameraDevice class in the Android camera HAL keeps a copy of the last received settings to be able to apply controls to the libcamera Camera and to populate metadata correctly. When a valid 'camera3Request->settings' is provided, it gets saved to 'lastSettings_' but 'descriptor->settings_' is not initialized until the next frame (assuming it does not contain more settings). Fix this by assigning to 'descriptor->settings_' the last saved settings unconditionally. Signed-off-by: Fang Hui <hui.fang@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-21android: camera_device: Fix requestedStream handlingHarvey Yang
The Android CameraDevice class adds a sourceStream for each Mapped stream requested by the framework. When mapping multiple framework streams to the same sourceStream, the implementation of CameraDevice::processCaptureRequest wrongly erases the just added sourceStream from the list of streams to request to libcamera. Fix this by adding the stream instead of erasing it. Fixes: 7ea83eba0df6 ("android: camera_device: Postpone mapped streams handling") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-05-30android: mm: Stub libhardware for build testsLaurent Pinchart
Commit 66c618f378aa ("android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID") made libhardware a required dependency for the Android camera HAL on non-Chrome OS platforms. This isn't an issue for real devices, as Android provides libhardware, but it prevents compile-testing the camera HAL on traditional Linux systems. To restore the compile-test coverage, stub the libhardware function used by the camera HAL when libhardware isn't found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # meson build test Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-05-30android: mm: generic: use GRALLOC_HARDWARE_MODULE_IDMattijs Korpershoek
PlatformFrameBufferAllocator is an abstraction over gralloc. Right now hardwareModule_ points towards a CAMERA_HARDWARE_MODULE_ID. When gralloc_open() is called we observe: libcamera: DEBUG HAL camera3_hal.cpp:75 Open camera gpu0 libcamera: ERROR Camera camera.cpp:524 Camera in Configured state trying acquire() requiring state Available 01-23 14:14:04.742 370 416 E libcamera: FATAL HAL generic_frame_buffer_allocator.cpp:105 gralloc_open() failed: -87 Which is wrong, gralloc_open() is attempting to re-open the camera HAL, instead of the gralloc HAL. Point to a GRALLOC_HARDWARE_MODULE_ID instead so that we can request buffers from gralloc in android. Note: this adds new dependencies on android's libhardware [1] and on libdl. [1] https://android.googlesource.com/platform/hardware/libhardware Fixes: c58662c5770e ("android: Introduce PlatformFrameBufferAllocator") Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-02-10android: jpeg: Add JEA implementationHarvey Yang
This patch adds JEA implementation to replace libjpeg in CrOS platform, where hardware accelerator is available. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-02-10android: jpeg: Pass StreamBuffer to Encoder::encoderHarvey Yang
To prepare for support of the JEA encoder in a following commit, which will need to access the buffer_handle_t of the destination buffer, pass the StreamBuffer to the Encoder::encoder() function. As the StreamBuffer contains the source FrameBuffer and the destination Span, drop them from the function arguments and access them directly from the StreamBuffer. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-02-10android: jpeg: Add meson.build in src/android/jpegHarvey Yang
To further control sources in jpeg to build based on the platform, this patch adds meson.build in src/android/jpeg directory. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-02-10android: framebuffer: Add HALFrameBuffer and replace FrameBufferHarvey Yang
HALFrameBuffer is derived from FrameBuffer with access to buffer_handle_t, which is needed for JEA usage. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-07android: Fix missing space in error messageJacopo Mondi
Add whitespace to correct the error message. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-11-25libcamera: stream: Turn StreamRole into scoped enumerationLaurent Pinchart
The StreamRole enum has enumerators such as 'Raw' that are too generic to be in the global libcamera namespace. Turn it into a scoped enum to avoid namespace clashes, and update users accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-28android: libcamera: add useful debug printsNicholas Roth
I identified opportunities to make libcamera's log output easier to understand while working to get it working on my Android device as a HAL. These additional logging statements came out of that and will hopefully prove useful to Android distribution maintainers with the same goal as mine and to users who attempt to debug tools like Waydroid. Signed-off-by: Nicholas Roth <nicholas@rothemail.net> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-28android: remove references to std::filesystemNicholas Roth
Android 11's toolchain does not support std::filesystem, but camera_hal_config.cpp currently uses it. Remove references to std::filesystem in order to support Android <= 11. This adds a very small difference in behaviour, as File::exist() will return true for special files (pipes, character or block devices, ...) while std::filesystem::is_regular_file() doesn't, but I consider this to be a corner case that doesn't matter much. Signed-off-by: Nicholas Roth <nicholas@rothemail.net> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-10libcamera: framebuffer: Move remaining private data to Private classLaurent Pinchart
Private members of the FrameBuffer class are split between FrameBuffer and FrameBuffer::Private. There was no real justification for this split, and keeping some members private in the FrameBuffer class causes multiple issues: - Future modifications of the FrameBuffer class without breaking the ABI may be more difficult. - Mutable access to members that should not be modified by applications require a friend statement, or going through the Private class. Move all remaining private members to the Private class to address the first issue, and add a Private::metadata() function to address the second problem. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Naushir Patuck <naush@raspberrypi.com>
2022-09-30libcamera: Add missing SPDX headers for miscellaneous CC0-1.0 contentsLaurent Pinchart
Miscellaneous files that are not considered copyrightable are missing an SPDX-License-Identifier header. Fix this by adding a header listing the CC0-1.0 license. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-07-25android: camera_capabilities: Adjust minimum frame duration to match FPSHan-Lin Chen
CTS calculates FPS with a rounding formula: See Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration() fps = floor(1e9 / minFrameDuration + 0.05f) The android adapter reports it as the AE target FPS. The patch adjusts the reported minimum frame duration to match the reported FPS. Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-25android: camera_capabilities: Add (1600x1200) and (1280x960) resolutionsHan-Lin Chen
Although resolutions (1600x1200) and (1280x960) are not mandatory to be supported by the Android Camera3 specification, they are commonly used by Android devices as viewfinder streams for 4:3 still capture. Add them into stream resolution candidates. Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-24android: exif: Fix thumbnail buffer lifetimeCheng-Hao Yang
Previously the thumbnail buffer is destructed before even being used in Exif. This patch moves the buffer into class Exif, so that the developer won't need to worry about its lifetime. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-19libcamera: controls: Avoid double lookupsLaurent Pinchart
Now that the ControlList::get() function returns an instance of std::optional<>, we can replace the ControlList::contains() calls with a nullopt check on the return value of get(). This avoids double lookups of controls through the code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-19libcamera: controls: Use std::optional to handle invalid control valuesChristian Rauch
Previously, ControlList::get<T>() would use default constructed objects to indicate that a ControlList does not have the requested Control. This has several disadvantages: 1) It requires types to be default constructible, 2) it does not differentiate between a default constructed object and an object that happens to have the same state as a default constructed object. std::optional<T> additionally stores the information if the object is valid or not, and therefore is more expressive than a default constructed object. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-20android: Use the YamlObject iterator APILaurent Pinchart
Replace usage of YamlObject::memberNames() with the more efficient iterator API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-16libcamera: yaml_parser: Switch from FILE to FileLaurent Pinchart
THe FILE object isn't very user-friendly as it requires manual close. Replace it with File to provide RAII-style resource management in the YamlParser API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-10android: camera_device: Print the correct number of completed streamsJacopo Mondi
When a request completes, a debug message is generated to help identify the request and the number of streams it contains. The printed number of streams is however the number of output buffers requested by the camera framework, not the number of streams generated by libcamera. In facts, some output buffers are generated by post-processing, and not directly from the camera. As the debug message prints the libcamera identifier for the Request, it is more logical to print the number of streams generated by the camera instead of the total number of streams. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10android: camera_device: Use YUV post-processorHirokazu Honda
When creating the list of StreamConfiguration to be requested to the camera, map NV12 streams of equal size and format together, so that they will be generated by using the YUV post-processor. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10android: camera_device: Postpone mapped streams handlingJacopo Mondi
Mapped streams are generated by post-processing and always require a source buffer to process image data from. In case a Mapped stream is requested but its source stream is not, it is required to allocate a buffer on the fly and add it to the libcamera::Request. Make sure a source stream is available for all mapped streams, and if that's not the case, add a dedicated buffer to the request for that purpose. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10android: camera_stream: Create allocator unconditionallyJacopo Mondi
Originally buffer allocation was only required for Internal streams which are not backed by a frame buffer provided by the Android framework. Now that mapped streams can be generated without the corresponding source stream being part of the Android's provided stream list, also buffers of type Mapped can be required to allocate buffers on demand. Create CameraStream::allocator_ and the associated mutex unconditionally for all types of stream. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10android: camera_stream: Add sourceStreamHirokazu Honda
Add a sourceStream field to the CameraStream class, meant to contain a reference to the direct stream which produces actual image data for streams of type CameraStream::Mapped. The sourceStream of mapped streams will be used in later patches to make sure for each Mapped stream at least one libcamera::Stream is queued to the libcamera::Camera. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-01libcamera: Use "..." instead of <...> consistently for internal headersLaurent Pinchart
libcamera uses double quotes for #include directives for internal headers. A few <...> have found their way in the code base over time. Fix them. While at it, move an Android header include to the right location. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-20android: Drop gcc 7 compatibilityLaurent Pinchart
Now that we have dropped gcc 7 support, remove the compatibility with gcc versions older than 8 that implemented the filesystem API in the std::experimental namespace. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-10android: camera_hal_config: Use YamlParser to parse android HAL configHan-Lin Chen
Use YamlParser to parse android HAL config files, instead of handling YAML tokens directly, as a preparation for the further parameter extension. Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-04libcamera: Replace toString with operator<<() for format classesLaurent Pinchart
Now that format classes implement the stream formatting operator<<(), use it instead of the toString() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-05-04libcamera: Replace toString with operator<<() for geometry classesLaurent Pinchart
Now that geometry classes implement the stream formatting operator<<(), use it instead of the toString() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-03android: camera_request: Lifetime of a Camera3RequestDescriptorUmang Jain
This commit provides a sketch regarding Camera3RequestDescriptor which aids tracking each capture reuqest placed by the android framework to libcamera HAL. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-03android: Document the structures and functions for post-processingUmang Jain
Specifically document: - CameraDevice::sendCaptureResults() - CameraDevice::completeDescriptor() - CameraDevice::streamProcessingComplete() - CameraStream::PostProcessorWorker class - Camera3RequestDescriptor::StreamBuffer structure Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-22android: Increase result metadata sizePaul Elder
Increase the initial size of the result metadata, as we will be adding more entries in the near future. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-22android: camera_capabilities: Fix the type of the capability vectorPaul Elder
The type of elements of the capability vector that is set in the static metadata must be uint8_t. The enum will not suffice, as it is int32_t. Fix this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-22android: camera_metadata: Add setEntry helperPaul Elder
Add setEntry() helper, that automatically detects if updateEntry() or addEntry() should be used. Note that updateEntry() will fail if the entry was not yet added, and addEntry() will fail is the entry was already added. They are silent failures that cause unexpected values to find their way into the android metadata instance. Previously this helper was not necessary, as (with respect to the current use case) the preview template generator would always add a key so the other template generators that used the preview template as boilerplate could reliably use updateEntry(). The preview template generator will soon decide based on capabilities whether or not to add keys, so the other template generators need a helper to decide whether to use updateEntry() or addEntry(). For now only implement it for enums and arithmetic values, as they will mainly be used in populating templates. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-22android: camera_capabilities: Set read sensor settings capabilityPaul Elder
A libcamera camera that supports the manual sensor capability also satisfies all the requirements for the read sensor settings capability. Set it. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-22android: camera_capabilities: Add messages for lack of FULL supportPaul Elder
Print messages when some feature is missing that causes hardware level FULL to not be supported. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-11android: Remove CameraWorkerJacopo Mondi
The CameraWorker class purpose was to handle acquire fences for incoming capture requests directed to libcamera. Now that fences are handled by the core library, it is not required to handle them in the HAL and the CameraWorker and CaptureRequest classes can be dropped. Update the core in CameraDevice class accordingly to queue Requests directly to the libcamera::Camera and set the release_fence to the value of the FrameBuffer::fence() for streams of type ::Direct. While at it make CameraRequest::StreamBuffer::fence a UniqueFD to ease the management of the fences file descriptor values. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-07android: Apply 1% tolerance to minFrameDuration cappingUmang Jain
We have some stream resolution which can provide slightly better frame duration than what we cap (i.e. 1/30 fps). The problem with this is CTS complains if the camera goes faster during the test than minFrameDuration reported for that resolution. For instance, 1080p minFrameDuration: - Nautilus : 33282000ns - Soraka : 33147000ns Both are less than capped minFrameDuration 1/30 fps (33333333.33ns). This patch considers this situation and doesn't cap the minFrameDuration if the hardware can provide frame durations slightly better. The tolerance considered is 1% only from the cap. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-12-06android: camera_stream: Use PlatformFrameBufferAllocatorHirokazu Honda
CameraStream originally creates FrameBuffers by FrameBufferAllocator and thus buffers are allocated in V4L2 API. This replaces the allocator in CameraStream with PlatformFrameBufferAllocator. It allocates a buffer in a platform dependent graphic buffer allocation API. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-06android: Introduce PlatformFrameBufferAllocatorHirokazu Honda
The existing FrameBufferAllocator is not allowed to allocate a new buffer while Camera is running. This introduces PlatformFrameBufferAllocator. It allocates FrameBuffer using cros::CameraBufferManager on ChromeOS and gralloc on non ChromeOS platform. The allocated FrameBuffer owns the underlying buffer but must be destroyed before PlatformFrameBufferAllocator is destroyed. 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: Jacopo Mondi <jacopo@jmondi.org>
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
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-01android: camera_request: Add thread safety annotationHirokazu Honda
This applies clang thread safety annotation to Camera3RequestDescriptor. 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-01android: camera_device: Add thread safety annotationHirokazu Honda
This applies clang thread safety annotation to CameraDevice. 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-01android: camera_device: Fix variables access without protectionHirokazu Honda
This fixes the code accessing descriptors and Camera3RequestDescriptor::pendingStreamsToProcess_ without holding descriptorsMutex_ and Camera3RequestDescriptor::streamProcessMutex_ in CameraDevice. 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-01android: camera_stream: Add thread safety annotationHirokazu Honda
This applies clang thread safety annotation to CameraStream. 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-01android: camera_stream: Protect buffers initialization by mutex_Hirokazu Honda
The initialization on buffers_ in CameraStrean::configure() is not protected by mutex_. It is no problem because configure() is not invoked simultaneously while other functions are called. This protects it to keep the thread safety consistency for buffers access. 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-01android: camera_hal_manager: Add thread safety annotationHirokazu Honda
This applies clang thread safety annotation to CameraHalManager. 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>