From db55e09b42f87d9a7fde32afc4e0eee90b4c7690 Mon Sep 17 00:00:00 2001 From: David Plowman Date: Wed, 10 Feb 2021 17:58:30 +0000 Subject: ipa: raspberrypi: AWB: Fix race condition setting manual gains Applying the manual_r_ and manual_b_ values is entirely removed from the asynchronous thread where their use constituted a race hazard. The main thread now deals with them entirely, involving the following changes. 1. SetManualGains() applies the new values directly to the "sync_results", meaning that Prepare() will jump to the new values immediately (which is a better behaviour). 2. Process() does not restart the asynchronous thread when manual gains are in force. 3. The asynchronous thread might be running when manual gains are set, so we ignore the results produced in this case. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck Signed-off-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/awb.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ipa/raspberrypi/controller/rpi/awb.hpp') diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp index f113c642..45ba9e25 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp @@ -108,6 +108,7 @@ public: }; private: + bool isAutoEnabled() const; // configuration is read-only, and available to both threads AwbConfig config_; std::thread async_thread_; -- cgit v1.2.1