diff mbox series

[v2,08/14] media: staging: rkisp1: params: set vb.sequence to be the isp's frame_sequence + 1

Message ID 20200815103734.31153-9-dafna.hirschfeld@collabora.com
State New
Headers show
Series [v2,01/14] media: staging: rkisp1: call params isr only upon frame out | expand

Commit Message

Dafna Hirschfeld Aug. 15, 2020, 10:37 a.m. UTC
The params isr is called when a frame is out of the isp. The parameters
are applied immediately since the isr updates the shadow registers.
Therefore the params are first applied on the next frame.
We want the vb.sequence to be the frame that the params are applied to.
So we set vb.sequence to be the isp's frame_sequence + 1

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/staging/media/rkisp1/rkisp1-params.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
index 134b5c9a94c1..4b4391c0a2a0 100644
--- a/drivers/staging/media/rkisp1/rkisp1-params.c
+++ b/drivers/staging/media/rkisp1/rkisp1-params.c
@@ -1220,7 +1220,14 @@  void rkisp1_params_apply_params_cfg(struct rkisp1_params *params, unsigned int f
 
 void rkisp1_params_isr(struct rkisp1_device *rkisp1)
 {
-	unsigned int frame_sequence = atomic_read(&rkisp1->isp.frame_sequence);
+	/*
+	 * The params isr is called when a frame is out of the isp. The parameters
+	 * are applied immediately since the isr updates the shadow registers.
+	 * Therefore the params are first applied on the next frame.
+	 * We want the vb.sequence to be the frame that the params are applied to.
+	 * So we set vb.sequence to be the isp's frame_sequence + 1
+	 */
+	unsigned int frame_sequence = atomic_read(&rkisp1->isp.frame_sequence) + 1;
 	struct rkisp1_params *params = &rkisp1->params;
 
 	spin_lock(&params->config_lock);