From: Conor Dooley <conor@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
llvm@lists.linux.dev
Subject: Re: [PATCH v8 3/6] staging: media: Add support for the Allwinner A31 ISP
Date: Wed, 7 Dec 2022 10:06:02 +0000 [thread overview]
Message-ID: <Y5BlisjV8Zi5fGWC@spud> (raw)
In-Reply-To: <Y4RVzSM4FQ/tYQAV@dev-arch.thelio-3990X>
[-- Attachment #1: Type: text/plain, Size: 7531 bytes --]
On Sun, Nov 27, 2022 at 11:31:41PM -0700, Nathan Chancellor wrote:
> Hi Paul,
>
> On Thu, Nov 03, 2022 at 05:37:14PM +0100, Paul Kocialkowski wrote:
> > Some Allwinner platforms come with an Image Signal Processor, which
> > supports various features in order to enhance and transform data
> > received by image sensors into good-looking pictures. In most cases,
> > the data is raw bayer, which gets internally converted to RGB and
> > finally YUV, which is what the hardware produces.
> >
> > This driver supports ISPs that are similar to the A31 ISP, which was
> > the first standalone ISP found in Allwinner platforms. Simpler ISP
> > blocks were found in the A10 and A20, where they are tied to a CSI
> > controller. Newer generations of Allwinner SoCs (starting with the
> > H6, H616, etc) come with a new camera subsystem and revised ISP.
> > Even though these previous and next-generation ISPs are somewhat
> > similar to the A31 ISP, they have enough significant differences to
> > be out of the scope of this driver.
> >
> > While the ISP supports many features, including 3A and many
> > enhancement blocks, this implementation is limited to the following:
> > - V3s (V3/S3) platform support;
> > - Bayer media bus formats as input;
> > - Semi-planar YUV (NV12/NV21) as output;
> > - Debayering with per-component gain and offset configuration;
> > - 2D noise filtering with configurable coefficients.
> >
> > Since many features are missing from the associated uAPI, the driver
> > is aimed to integrate staging until all features are properly
> > described.
> >
> > On the technical side, it uses the v4l2 and media controller APIs,
> > with a video node for capture, a processor subdev and a video node
> > for parameters submission. A specific uAPI structure and associated
> > v4l2 meta format are used to configure parameters of the supported
> > modules.
> >
> > One particular thing about the hardware is that configuration for
> > module registers needs to be stored in a DMA buffer and gets copied
> > to actual registers by the hardware at the next vsync, when instructed
> > by a flag. This is handled by the "state" mechanism in the driver.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
>
> This patch is now in -next as commit e3185e1d7c14 ("media: staging:
> media: Add support for the Allwinner A31 ISP"), where it causes the
> following clang warnings:
FWIW, this is (as yet) unfixed & thus breaking allmodconfig w/ clang.
I had a quick look on lore but could not see a proposed fix other than
what Nathan has pasted below.
> > +void sun6i_isp_capture_configure(struct sun6i_isp_device *isp_dev)
> > +{
> > + unsigned int width, height;
> > + unsigned int stride_luma, stride_chroma = 0;
> > + unsigned int stride_luma_div4, stride_chroma_div4;
> > + const struct sun6i_isp_capture_format *format;
> > + const struct v4l2_format_info *info;
> > + u32 pixelformat;
> > +
> > + sun6i_isp_capture_dimensions(isp_dev, &width, &height);
> > + sun6i_isp_capture_format(isp_dev, &pixelformat);
> > +
> > + format = sun6i_isp_capture_format_find(pixelformat);
> > + if (WARN_ON(!format))
> > + return;
> > +
> > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_SIZE_CFG_REG,
> > + SUN6I_ISP_MCH_SIZE_CFG_WIDTH(width) |
> > + SUN6I_ISP_MCH_SIZE_CFG_HEIGHT(height));
> > +
> > + info = v4l2_format_info(pixelformat);
> > + if (WARN_ON(!info))
> > + return;
> > +
> > + stride_luma = width * info->bpp[0];
> > + stride_luma_div4 = DIV_ROUND_UP(stride_luma, 4);
> > +
> > + if (info->comp_planes > 1) {
> > + stride_chroma = width * info->bpp[1] / info->hdiv;
> > + stride_chroma_div4 = DIV_ROUND_UP(stride_chroma, 4);
> > + }
> > +
> > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_CFG_REG,
> > + SUN6I_ISP_MCH_CFG_EN |
> > + SUN6I_ISP_MCH_CFG_OUTPUT_FMT(format->output_format) |
> > + SUN6I_ISP_MCH_CFG_STRIDE_Y_DIV4(stride_luma_div4) |
> > + SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4(stride_chroma_div4));
> > +}
>
>
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c:135:6: error: variable 'stride_chroma_div4' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> if (info->comp_planes > 1) {
> ^~~~~~~~~~~~~~~~~~~~~
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c:144:42: note: uninitialized use occurs here
> SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4(stride_chroma_div4));
> ^~~~~~~~~~~~~~~~~~
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_reg.h:249:48: note: expanded from macro 'SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4'
> #define SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4(v) (((v) << 20) & GENMASK(30, 20))
> ^
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c:135:2: note: remove the 'if' if its condition is always true
> if (info->comp_planes > 1) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_capture.c:112:51: note: initialize the variable 'stride_chroma_div4' to silence this warning
> unsigned int stride_luma_div4, stride_chroma_div4;
> ^
> = 0
>
> Does stride_chroma_div4 want to just be initialized to zero?
>
> > +static int sun6i_isp_proc_notifier_bound(struct v4l2_async_notifier *notifier,
> > + struct v4l2_subdev *remote_subdev,
> > + struct v4l2_async_subdev *async_subdev)
> > +{
> > + struct sun6i_isp_device *isp_dev =
> > + container_of(notifier, struct sun6i_isp_device, proc.notifier);
> > + struct sun6i_isp_proc_async_subdev *proc_async_subdev =
> > + container_of(async_subdev, struct sun6i_isp_proc_async_subdev,
> > + async_subdev);
> > + struct sun6i_isp_proc *proc = &isp_dev->proc;
> > + struct sun6i_isp_proc_source *source = proc_async_subdev->source;
> > + bool enabled;
> > +
> > + switch (source->endpoint.base.port) {
> > + case SUN6I_ISP_PORT_CSI0:
> > + source = &proc->source_csi0;
> > + enabled = true;
> > + break;
> > + case SUN6I_ISP_PORT_CSI1:
> > + source = &proc->source_csi1;
> > + enabled = !proc->source_csi0.expected;
> > + break;
> > + default:
> > + break;
> > + }
> > +
> > + source->subdev = remote_subdev;
> > +
> > + return sun6i_isp_proc_link(isp_dev, SUN6I_ISP_PROC_PAD_SINK_CSI,
> > + remote_subdev, enabled);
> > +}
>
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c:418:2: error: variable 'enabled' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
> default:
> ^~~~~~~
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c:425:23: note: uninitialized use occurs here
> remote_subdev, enabled);
> ^~~~~~~
> drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c:407:14: note: initialize the variable 'enabled' to silence this warning
> bool enabled;
> ^
> = 0
>
> Should there be an early return in the default case?
>
> I do not mind sending patches if you are unable to, assuming I have the
> right fixes.
>
> Cheers,
> Nathan
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-12-07 10:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 16:37 [PATCH v8 0/6] Allwinner A31/A83T MIPI CSI-2 and A31 ISP / ISP Driver Paul Kocialkowski
2022-11-03 16:37 ` [PATCH v8 1/6] dt-bindings: media: Add Allwinner A31 ISP bindings documentation Paul Kocialkowski
2022-11-03 16:37 ` [PATCH v8 2/6] dt-bindings: media: sun6i-a31-csi: Add internal output port to the ISP Paul Kocialkowski
2022-11-03 16:37 ` [PATCH v8 3/6] staging: media: Add support for the Allwinner A31 ISP Paul Kocialkowski
2022-11-06 9:12 ` Jernej Škrabec
2022-11-28 6:31 ` Nathan Chancellor
2022-12-07 10:06 ` Conor Dooley [this message]
2022-12-08 13:57 ` Paul Kocialkowski
2022-11-03 16:37 ` [PATCH v8 4/6] MAINTAINERS: Add entry for the Allwinner A31 ISP driver Paul Kocialkowski
2022-11-03 16:37 ` [PATCH v8 5/6] media: sun6i-csi: Detect the availability of the ISP Paul Kocialkowski
2022-11-06 9:12 ` Jernej Škrabec
2022-11-03 16:37 ` [PATCH v8 6/6] media: sun6i-csi: Add support for hooking to the isp devices Paul Kocialkowski
2022-11-06 9:13 ` Jernej Škrabec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y5BlisjV8Zi5fGWC@spud \
--to=conor@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hans.verkuil@cisco.com \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=llvm@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=nathan@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=samuel@sholland.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).