[libcamera-devel,v2] pipeline: raspberrypi: Fix for staggered write on reset

Message ID 20200529071646.123149-1-naush@raspberrypi.com
State Accepted
Commit 5dfd2bfc0dff958394bf08de104384c56a65f626
Headers show
Series
  • [libcamera-devel,v2] pipeline: raspberrypi: Fix for staggered write on reset
Related show

Commit Message

Naushir Patuck May 29, 2020, 7:16 a.m. UTC
The reset function in staggered write was using the wrong index when
looking for the last updated camera parameters. This would cause
possibly stale exposure values to be written to the camera on a
mode switch for captures.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham June 2, 2020, 9:08 a.m. UTC | #1
Hi Naush,

On 29/05/2020 08:16, Naushir Patuck wrote:
> The reset function in staggered write was using the wrong index when
> looking for the last updated camera parameters. This would cause
> possibly stale exposure values to be written to the camera on a
> mode switch for captures.
> 
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

This looks fine to me,

I'll apply it for you if no one has any issues.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
> index 391e13f5..5ed63a8e 100644
> --- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
> @@ -46,7 +46,7 @@ void StaggeredCtrl::reset()
>  {
>  	std::lock_guard<std::mutex> lock(lock_);
>  
> -	int lastSetCount = std::max<int>(0, setCount_ - 1);
> +	int lastSetCount = setCount_;
>  	std::unordered_map<uint32_t, int32_t> lastVal;
>  
>  	/* Reset the counters. */
>

Patch

diff --git a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
index 391e13f5..5ed63a8e 100644
--- a/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
+++ b/src/libcamera/pipeline/raspberrypi/staggered_ctrl.cpp
@@ -46,7 +46,7 @@  void StaggeredCtrl::reset()
 {
 	std::lock_guard<std::mutex> lock(lock_);
 
-	int lastSetCount = std::max<int>(0, setCount_ - 1);
+	int lastSetCount = setCount_;
 	std::unordered_map<uint32_t, int32_t> lastVal;
 
 	/* Reset the counters. */