summaryrefslogtreecommitdiff
path: root/src/libcamera/base
AgeCommit message (Collapse)Author
2021-07-12libcamera: Drop the LIBCAMERA_D_PTR macro in favour of the _d() functionLaurent Pinchart
Now that all Extensible classes expose a _d() function that performs appropriate casts, the LIBCAMERA_D_PTR brings no real additional value. Replace it with direct calls to the _d() 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>
2021-07-11base: thread: Fix recursive calls to dispatchMessages()Laurent Pinchart
There are use cases for calling the dispatchMessages() function recursively, from within a message handler. This can be used, for instance, to force delivery of messages posted to a thread concurrently to stopping the thread. This currently causes access, in the outer dispatchMessages() call, to iterators that have been invalidated by erasing list elements in the recursive call, leading to undefined behaviour (most likely double-free or other crashes). Fix it by only erasing messages from the list at the end of the outer call, identified using a recursion counter. Bug: https://bugs.libcamera.org/show_bug.cgi?id=26 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-07-11base: thread: Document the postMessage() function as thread-safeLaurent Pinchart
The Thread::postMessage() function is thread-safe, document it as such. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Validate internal headers as privateKieran Bingham
Headers which must not be exposed as part of the public libcamera API should include base/private.h. Any interface which includes the private.h header will only be able to build if the libcamera_private dependency is used (or the libcamera_base_private dependency directly). Build targets which are intended to use the private API's will use the libcamera_private to handle the automatic definition of the inclusion guard. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move event_notifier to baseKieran Bingham
Move the event notifier, and associated header updates. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move File to base libraryKieran Bingham
The File abstraction is a base helper and not part of the libcamera API. Move it to to allow usage by users of the base library. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move extended base functionalityKieran Bingham
Move the functionality for the following components to the new base support library: - BoundMethod - EventDispatcher - EventDispatcherPoll - Log - Message - Object - Signal - Semaphore - Thread - Timer While it would be preferable to see these split to move one component per commit, these components are all interdependent upon each other, which leaves us with one big change performing the move for all of them. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move class helpers to the base libraryKieran Bingham
Move the class support infrastructure to the base library. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Move utils to the base libraryKieran Bingham
Move the utils functionality to the libcamera/base library. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25libcamera/base: Introduce new base libraryKieran Bingham
The libcamera-base.so will feature internal support functionality that is utilised by libcamera, and can be shared in other places. This new library provides a layer beneath libcamera which provides common abstractions to internal objects. A pkg-config file is generated and named libcamera-base.pc which allows components such as external IPA modules to link directly to this library if they need. Normal applications will reference this library through the Requires: statement provided by the libcamera.pc package configuration, and linkage will be handled automatically through the pkg-config mechanisms. No code is moved to this library yet, this patch only introduces the framework, construction and linkage. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>