DmaBufAllocator: Make DmaSyncer non-copyable

As DmaSyncer does sync start/end in the c'tor/d'tor, copying a DmaSyncer
instance would trigger sync end earlier than expected. This patch makes
it non-copyable to avoid the issue.

Fixes: 39482d59fe ("DmaBufAllocator: Add Dma Buffer synchronization function & helper class")
Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
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>
This commit is contained in:
Harvey Yang 2024-12-11 08:44:27 +00:00 committed by Kieran Bingham
parent 4f9d8a6301
commit 545046a41e
2 changed files with 17 additions and 0 deletions

View file

@ -60,9 +60,14 @@ public:
explicit DmaSyncer(SharedFD fd, SyncType type = SyncType::ReadWrite);
DmaSyncer(DmaSyncer &&other) = default;
DmaSyncer &operator=(DmaSyncer &&other) = default;
~DmaSyncer();
private:
LIBCAMERA_DISABLE_COPY(DmaSyncer)
void sync(uint64_t step);
SharedFD fd_;

View file

@ -311,6 +311,18 @@ DmaSyncer::DmaSyncer(SharedFD fd, SyncType type)
sync(DMA_BUF_SYNC_START);
}
/**
* \fn DmaSyncer::DmaSyncer(DmaSyncer &&other);
* \param[in] other The other instance
* \brief Enable move on class DmaSyncer
*/
/**
* \fn DmaSyncer::operator=(DmaSyncer &&other);
* \param[in] other The other instance
* \brief Enable move on class DmaSyncer
*/
DmaSyncer::~DmaSyncer()
{
sync(DMA_BUF_SYNC_END);