mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 14:59:44 +03:00
libcamera: v4l2_videodevice: lastUsedCounter_
need not be atomic
The `V4L2BufferCache` type is not thread-safe. Its `lastUsedCounter_` member is not used in contexts where its atomicity would matter. So it does not need to be have an atomic type. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
90208694c8
commit
1df8091e63
2 changed files with 3 additions and 4 deletions
|
@ -8,7 +8,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
|
@ -158,7 +157,7 @@ private:
|
|||
std::vector<Plane> planes_;
|
||||
};
|
||||
|
||||
std::atomic<uint64_t> lastUsedCounter_;
|
||||
uint64_t lastUsedCounter_;
|
||||
std::vector<Entry> cache_;
|
||||
/* \todo Expose the miss counter through an instrumentation API. */
|
||||
unsigned int missCounter_;
|
||||
|
|
|
@ -190,7 +190,7 @@ V4L2BufferCache::V4L2BufferCache(const std::vector<std::unique_ptr<FrameBuffer>>
|
|||
{
|
||||
for (const std::unique_ptr<FrameBuffer> &buffer : buffers)
|
||||
cache_.emplace_back(true,
|
||||
lastUsedCounter_.fetch_add(1, std::memory_order_acq_rel),
|
||||
lastUsedCounter_++,
|
||||
*buffer.get());
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer)
|
|||
return -ENOENT;
|
||||
|
||||
cache_[use] = Entry(false,
|
||||
lastUsedCounter_.fetch_add(1, std::memory_order_acq_rel),
|
||||
lastUsedCounter_++,
|
||||
buffer);
|
||||
|
||||
return use;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue