diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-08-05 14:26:01 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-08-09 16:38:10 +0200 |
commit | 9fb4d454d2b747cd1e97de363e16dda16934f2e2 (patch) | |
tree | e121f3ab541b32db85161833895838432f897e1e /include | |
parent | 5bcd5bb6ca6a0101d767192d53d1bfb62b82df49 (diff) |
HACK: acquire media device non-exclusiveleymulticontext/rpi/v3
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/device_enumerator.h | 1 | ||||
-rw-r--r-- | include/libcamera/internal/media_device.h | 10 | ||||
-rw-r--r-- | include/libcamera/internal/pipeline_handler.h | 2 |
3 files changed, 13 insertions, 0 deletions
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h index db3532a9..4bc3a27d 100644 --- a/include/libcamera/internal/device_enumerator.h +++ b/include/libcamera/internal/device_enumerator.h @@ -42,6 +42,7 @@ public: virtual int enumerate() = 0; std::shared_ptr<MediaDevice> search(const DeviceMatch &dm); + std::shared_ptr<MediaDevice> searchNonExclusive(const DeviceMatch &dm); Signal<> devicesAdded; diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h index 992184ed..bcbedf5c 100644 --- a/include/libcamera/internal/media_device.h +++ b/include/libcamera/internal/media_device.h @@ -29,9 +29,14 @@ public: ~MediaDevice(); bool acquire(); + bool acquireNonExclusive(); void release(); bool busy() const { return acquired_; } + /* HACKS */ + unsigned int get() { return ++users_; } + unsigned int put() { return --users_; } + bool lock(); void unlock(); @@ -55,6 +60,8 @@ public: int disableLinks(); int fd() const { return fd_.get(); } + int fd(unsigned int context) const { return fds_[context - 1].get(); } + unsigned int numContexts() const { return fds_.size(); } Signal<> disconnected; @@ -63,6 +70,7 @@ protected: private: int open(); + int openMultiple(); void close(); MediaObject *object(unsigned int id); @@ -86,8 +94,10 @@ private: unsigned int hwRevision_; UniqueFD fd_; + std::vector<UniqueFD> fds_; bool valid_; bool acquired_; + unsigned int users_; std::map<unsigned int, MediaObject *> objects_; std::vector<MediaEntity *> entities_; diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 746a34f8..7c316cb9 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -44,6 +44,8 @@ public: virtual bool match(DeviceEnumerator *enumerator) = 0; MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator, const DeviceMatch &dm); + MediaDevice *acquireMediaDeviceNonExclusive(DeviceEnumerator *enumerator, + const DeviceMatch &dm); bool acquire(); void release(Camera *camera); |