diff mbox series

[v2] staging: media: ipu3: Fix AWB x_start position when rightmost stripe is used

Message ID 20220407105724.308930-1-hpa@redhat.com
State Superseded
Headers show
Series [v2] staging: media: ipu3: Fix AWB x_start position when rightmost stripe is used | expand

Commit Message

Kate Hsuan April 7, 2022, 10:57 a.m. UTC
A not calibrated x_start setting would result in an incorrect AWB location
configuration on a sensor when only the rightmost stripe is used. x_start
should be calibrated by subtracting the stripe offset to set the coordinate
to the correct position on the second stripe.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
Correct the patch. The correction should be awb, not awb_fr.
---
 drivers/staging/media/ipu3/ipu3-css-params.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Dan Carpenter April 7, 2022, 11:51 a.m. UTC | #1
On Thu, Apr 07, 2022 at 06:57:24PM +0800, Kate Hsuan wrote:
> A not calibrated x_start setting would result in an incorrect AWB location
> configuration on a sensor when only the rightmost stripe is used. x_start
> should be calibrated by subtracting the stripe offset to set the coordinate
> to the correct position on the second stripe.
> 

I wish the commit description said more about what the bug looks like to
the user.  This is the front facing camera, right?  Is part of the video
blank or what's the deal?

> Signed-off-by: Kate Hsuan <hpa@redhat.com>
> ---
> Correct the patch. The correction should be awb, not awb_fr.

I tried to review the original patch and it was impossible.  I saw
you're from an @redhat.com email address so I decided it must be right.

I kind of get that you need to be a domain expert to review these
patches but this function is such a mess...

regards,
dan carpenter
Kate Hsuan April 8, 2022, 3:07 a.m. UTC | #2
Hi Dan,

On Thu, Apr 7, 2022 at 9:27 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Thu, Apr 07, 2022 at 09:17:38PM +0800, Kate Hsuan wrote:
> > Hi Dan,
> >
> > On Thu, Apr 7, 2022 at 7:52 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > >
> > > On Thu, Apr 07, 2022 at 06:57:24PM +0800, Kate Hsuan wrote:
> > > > A not calibrated x_start setting would result in an incorrect AWB location
> > > > configuration on a sensor when only the rightmost stripe is used. x_start
> > > > should be calibrated by subtracting the stripe offset to set the coordinate
> > > > to the correct position on the second stripe.
> > > >
> >
> > >
> > > I wish the commit description said more about what the bug looks like to
> > > the user.  This is the front facing camera, right?  Is part of the video
> > > blank or what's the deal?
> >
> > This is IPU3 image processor. I tried to fix the configuration issues
> > on stripe 1 coordinate settings.
> >
>
> So in terms of users, if you configure it in a certain way then it
> crashes?  What happens in terms of what the ordinary user sees?
>

It will not crash. Currently, application, such as libcamara only uses
stripe 0 to estimate 3A (AE AWB AF). The grid coordinate can be used
to determine the area on a sensor where we use this area to determine
the 3A status. If we start to move the grid and it crosses the stripe
1 offset. The grid will be at the rightmost edge of the sensor. The
user may only feel the location of AF, AWB, AE of the image is not the
user's expectation.

I'll update them in the v3 patch.

> regards,
> dan carpenter
>
diff mbox series

Patch

diff --git a/drivers/staging/media/ipu3/ipu3-css-params.c b/drivers/staging/media/ipu3/ipu3-css-params.c
index f84cf11358a8..76ad802d694e 100644
--- a/drivers/staging/media/ipu3/ipu3-css-params.c
+++ b/drivers/staging/media/ipu3/ipu3-css-params.c
@@ -2636,6 +2636,17 @@  int imgu_css_cfg_acc(struct imgu_css *css, unsigned int pipe,
 	    acc->stripe.down_scaled_stripes[1].offset + min_overlap) {
 		/* Enable only for rightmost stripe, disable left */
 		acc->awb.stripes[0].rgbs_thr_b &= ~IPU3_UAPI_AWB_RGBS_THR_B_EN;
+
+		acc->awb.stripes[1].grid.x_start =
+			(acc->awb.stripes[1].grid.x_start -
+			 acc->stripe.down_scaled_stripes[1].offset) &
+			IPU3_UAPI_GRID_START_MASK;
+
+		b_w_log2 = acc->awb.stripes[1].grid.block_width_log2;
+		acc->awb.stripes[1].grid.x_end =
+			imgu_css_grid_end(acc->awb.stripes[1].grid.x_start,
+					  acc->awb.stripes[1].grid.width,
+					  b_w_log2);
 	} else if (acc->awb.config.grid.x_end <=
 		   acc->stripe.bds_out_stripes[0].width - min_overlap) {
 		/* Enable only for leftmost stripe, disable right */