From patchwork Fri Apr 8 10:42:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kate Hsuan X-Patchwork-Id: 559074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A89DCC4332F for ; Fri, 8 Apr 2022 10:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbiDHKsH (ORCPT ); Fri, 8 Apr 2022 06:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbiDHKsE (ORCPT ); Fri, 8 Apr 2022 06:48:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 621B23381F3 for ; Fri, 8 Apr 2022 03:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649414760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=DNGOrOLahpfdtq4Itt85bojNjsMMU06RvvV1e8kDRUw=; b=PLcRQePP2q5jMeUtDxmXABswEzlXe1vsWksy0hh41odwz/fPmXO67qv6rhFu/bMWvG5DmI q62gDBg08EN7i/gt6FHoxHB1ztaHnZltv44D7Bg7/WnlbisCHLyky4PiSJQEQFbUTbtNkW z2cvhsLW3cYMlXGLUsufHrPhnau/YCk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-k_B2GAPqOK6ewssLM0W8uw-1; Fri, 08 Apr 2022 06:45:55 -0400 X-MC-Unique: k_B2GAPqOK6ewssLM0W8uw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0074C3817493; Fri, 8 Apr 2022 10:45:55 +0000 (UTC) Received: from kate-fedora.redhat.com (unknown [10.2.16.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2193440470D5; Fri, 8 Apr 2022 10:45:51 +0000 (UTC) From: Kate Hsuan To: Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: Jean-Michel Hautbois , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, hdegoede@redhat.com, Kate Hsuan Subject: [PATCH v3] staging: media: ipu3: Fix AWB x_start position when rightmost stripe is used Date: Fri, 8 Apr 2022 18:42:22 +0800 Message-Id: <20220408104222.13893-1-hpa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org An not calibrated x_start setting would result in an incorrect AWB grid configuration on a sensor when only the rightmost stripe is used. If the AWB grid coordinate is set to the rightmost stripe, for example, x_start is greater than 640, the AWB grid will be at the rightmost edge of the sensor. The AWB statistic will be fetched from the wrong place of the sensor and results in an incorrect AWB estimation result. Therefore, stripe offset should subtract from x_start to have a correct grid configuration for the rightmost stripe. Signed-off-by: Kate Hsuan --- drivers/staging/media/ipu3/ipu3-css-params.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 */