diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-04-25 00:35:04 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-06-03 11:53:04 +0300 |
commit | 13dcc7fc5f662a8c00eff5dce689c81231b5216e (patch) | |
tree | ca48381eec14ff93b20afdb08612bfe44172971e /src/v4l2/v4l2_compat_manager.cpp | |
parent | c44457957e04b4aba18849c94b51c6a69e6801b3 (diff) |
test: fence: Fix race condition
The fence test is racy, as it relies on the main loop being executed
between completion of request signalledRequestId_ and
signalledRequestId_ + 1. This usually happens, but is not guaranteed.
To fix the race condition, change the request identification logic by
replacing usage of the cookie value, which is zero-based and wraps
around at nbuffers_ - 1, with a completed request counter that is
one-based and doesn't wrap. The completedRequestId_, expiredRequestId_
and signalledRequestId_ variables now track the identifier of the last
request that has completed, the request whose fence will time out, and
the request whose fence will be signalled.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/v4l2/v4l2_compat_manager.cpp')
0 files changed, 0 insertions, 0 deletions