Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D63EC433E6 for ; Tue, 19 Jan 2021 21:29:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0641B22D08 for ; Tue, 19 Jan 2021 21:29:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0641B22D08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dxnnnbTekW+Ot3JDqJ3XhFy4lyU9Re40btUHxp/5fRk=; b=TTuyQ2FpNgmoc/ossaBYovxSR I+fOymdgJqWOrzTM5Hgi3d07RxGEfnOG4sNf2uCDzeXjmAzvhYAU+NwxquZqVvJze+sHqIVLrurU/ GQajjS0uQcz3ZpKntHhtbvVrYB+Kw51xf/ugEOUHB4XQnhOivZ38h03A5c73m5beCCrZZAHGEHcmN N7xXr5xweTgbWFQy1fpaqldEoFg23j1A4oNjU4AAbRltfReWtWJ5y60FHTAW9w4F9TSgeiZoG2lxN XusvsklYK3RDbXAOnLzT0ox6twunPWxaF05GXEouTnPqMoGZ0HjsmCjyGhX7yajv95hdN4p0KPuWF 0RapQ45IA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1v5y-0001ev-Kz; Tue, 19 Jan 2021 17:47:10 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1v5v-0001eG-Ia for linux-rockchip@lists.infradead.org; Tue, 19 Jan 2021 17:47:08 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id BFCBB1F448ED Subject: Re: [PATCH] media: rkisp1: uapi: change hist_bins array type from __u16 to __u32 To: Hans Verkuil , linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, heiko@sntech.de References: <20210119145341.29686-1-dafna.hirschfeld@collabora.com> <2e48068e-fcc4-9288-a9a6-59f71d7f20ce@xs4all.nl> From: Dafna Hirschfeld Message-ID: <65be169f-417f-a1f5-53e7-31f701a04d08@collabora.com> Date: Tue, 19 Jan 2021 18:47:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <2e48068e-fcc4-9288-a9a6-59f71d7f20ce@xs4all.nl> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210119_124707_708103_511E86C1 X-CRM114-Status: GOOD ( 26.91 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, dafna3@gmail.com, tfiga@chromium.org, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Am 19.01.21 um 17:32 schrieb Hans Verkuil: > On 19/01/2021 16:32, Dafna Hirschfeld wrote: >> >> >> Am 19.01.21 um 16:00 schrieb Hans Verkuil: >>> On 19/01/2021 15:53, Dafna Hirschfeld wrote: >>>> Each entry in the array is a 20 bits value composed of 16 >>>> bits unsigned integer and 4 bits fractional part. So the >>>> type should change to __u32. >>>> >>>> Signed-off-by: Dafna Hirschfeld >>>> --- >>>> This patch is applied on top of v6 of the patchset >>>> "Fix the rkisp1 userspace API for later IP versions" >>>> >>>> include/uapi/linux/rkisp1-config.h | 5 +++-- >>>> 1 file changed, 3 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h >>>> index 57ca3eea985f..47f6b84d7c56 100644 >>>> --- a/include/uapi/linux/rkisp1-config.h >>>> +++ b/include/uapi/linux/rkisp1-config.h >>>> @@ -895,7 +895,8 @@ struct rkisp1_cif_isp_af_stat { >>>> /** >>>> * struct rkisp1_cif_isp_hist_stat - statistics histogram data >>>> * >>>> - * @hist_bins: measured bin counters >>>> + * @hist_bins: measured bin counters. Each bin is a 20 bits value >>>> + * composed of a 16-bit unsigned integer and 4 bits fractional part. >>> >>> So bits 0-3 are the fractional part and bits 4-19 contain the integer part? >>> What goes where should be defined! >> >> Actually I don't know, I just copied the docs in the datasheet. >> I can try figure it out. I can meanwhile send a patch without the doc until >> we are sure. Is that OK? > > No, this should be documented properly. I see that indeed bits 0-3 are the fractional part. The measurements are taken over 25 sub-windows and it is possible to give a weight to each window. If I set all weights to 1 then I expect to get an integer value and indeed in that case I see that the last 4 bits are always 0. If I set the weights to other than 1 I get the last 4 bits not only 0. The UAPI is generally not very good documented mainly because there is currently no open source userspace that uses it. > > Is this the only fractional type that is used in the rkisp1 uapi or are there > others? (Just checking). There are other places as well. I see that there are some values in rkisp1_cif_isp_lsc_config that are fractional and not documented. The two other fractional types in the uapi are already documented. I can add a patch that extends the documentation of all the fields in the uapi using the datasheet. But I think such a patch can be added after de-staging. Thanks, Dafna > >> >>> >>> Looking at rkisp1_stats_get_hst_meas() I see this: >>> >>> for (i = 0; i < RKISP1_CIF_ISP_HIST_BIN_N_MAX; i++) >>> pbuf->params.hist.hist_bins[i] = >>> (u8)rkisp1_read(rkisp1, >>> RKISP1_CIF_ISP_HIST_BIN_0 + i * 4); >>> >>> Here this is cast to a u8, so how does this work? >> >> This seems to be a bug. I see that this cast is introduced in v12 of the patch >> "media: staging: rkisp1: add capture device for statistics". >> This cast does not exist in any of the downstream versions. > > Clearly something that needs to be fixed as well. > > Regards, > > Hans > >> >> Thanks, >> Dafna >> >>> >>> There is something fishy here... >>> >>> Regards, >>> >>> Hans >>> >>>> * >>>> * The histogram values divided into 16 bins for V10/V11 and 32 bins >>>> * for V12/V13. It is configured within the struct rkisp1_cif_isp_hst_config. >>>> @@ -909,7 +910,7 @@ struct rkisp1_cif_isp_af_stat { >>>> * RKISP1_CIF_ISP_HIST_BIN_N_MAX is equal to the maximum of the two. >>>> */ >>>> struct rkisp1_cif_isp_hist_stat { >>>> - __u16 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX]; >>>> + __u32 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX]; >>>> }; >>>> >>>> /** >>>> >>> > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip