From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Todor Tomov <todor.tomov@linaro.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Sakari Ailus <sakari.ailus@iki.fi>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v4 12/21] camss: vfe: Format conversion support using PIX interface
Date: Mon, 11 Sep 2017 09:45:04 +0200 [thread overview]
Message-ID: <CAMuHMdV2XZZjaLdQZ90voyE9AinZy3+Zpg0C0-N+AkADk7768A@mail.gmail.com> (raw)
In-Reply-To: <5fdb0554-51b7-29e3-34ee-d79c46194253@linaro.org>
Hi Todor,
On Mon, Sep 11, 2017 at 8:56 AM, Todor Tomov <todor.tomov@linaro.org> wrote:
> On 10.09.2017 12:58, Geert Uytterhoeven wrote:
>> On Tue, Aug 8, 2017 at 3:30 PM, Todor Tomov <todor.tomov@linaro.org> wrote:
>>> Use VFE PIX input interface and do format conversion in VFE.
>>>
>>> Supported input format is UYVY (single plane YUV 4:2:2) and
>>> its different sample order variations.
>>>
>>> Supported output formats are:
>>> - NV12/NV21 (two plane YUV 4:2:0)
>>> - NV16/NV61 (two plane YUV 4:2:2)
>>>
>>> Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
>>
>> This is now commit 9b5833f7b82f1431 upstream.
>>
>>> @@ -355,6 +471,38 @@ static void vfe_bus_disconnect_wm_from_rdi(struct vfe_device *vfe, u8 wm,
>>> vfe_reg_clr(vfe, VFE_0_BUS_XBAR_CFG_x(wm), reg);
>>> }
>>>
>>> +static void vfe_set_xbar_cfg(struct vfe_device *vfe, struct vfe_output *output,
>>> + u8 enable)
>>> +{
>>> + struct vfe_line *line = container_of(output, struct vfe_line, output);
>>> + u32 p = line->video_out.active_fmt.fmt.pix_mp.pixelformat;
>>> + u32 reg;
>>
>> With gcc 4.1.2:
>>
>> drivers/media/platform/qcom/camss-8x16/camss-vfe.c: In function
>> ‘vfe_set_xbar_cfg’:
>> drivers/media/platform/qcom/camss-8x16/camss-vfe.c:614: warning:
>> ‘reg’ may be used uninitialized in this function
>>
>> This is a false positive, as output->wm_num is always either 1 or 2, hence the
>> index i can never have a value different from 0 or 1, and reg is thus always
>> initialized.
>>
>>> + unsigned int i;
>>> +
>>> + for (i = 0; i < output->wm_num; i++) {
>>> + if (i == 0) {
>>> + reg = VFE_0_BUS_XBAR_CFG_x_M_SINGLE_STREAM_SEL_LUMA <<
>>> + VFE_0_BUS_XBAR_CFG_x_M_SINGLE_STREAM_SEL_SHIFT;
>>> + } else if (i == 1) {
>>> + reg = VFE_0_BUS_XBAR_CFG_x_M_PAIR_STREAM_EN;
>>> + if (p == V4L2_PIX_FMT_NV12 || p == V4L2_PIX_FMT_NV16)
>>> + reg |= VFE_0_BUS_XBAR_CFG_x_M_PAIR_STREAM_SWAP_INTER_INTRA;
>>> + }
>>
>>> @@ -458,6 +728,10 @@ static void vfe_init_outputs(struct vfe_device *vfe)
>>> output->buf[0] = NULL;
>>> output->buf[1] = NULL;
>>> INIT_LIST_HEAD(&output->pending_bufs);
>>> +
>>> + output->wm_num = 1;
>>> + if (vfe->line[i].id == VFE_LINE_PIX)
>>> + output->wm_num = 2;
>>> }
>>> }
>>>
>>
>>> --- a/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
>>> +++ b/drivers/media/platform/qcom/camss-8x16/camss-vfe.h
>>> @@ -30,8 +30,9 @@
>>> #define MSM_VFE_PAD_SRC 1
>>> #define MSM_VFE_PADS_NUM 2
>>>
>>> -#define MSM_VFE_LINE_NUM 3
>>> +#define MSM_VFE_LINE_NUM 4
>>> #define MSM_VFE_IMAGE_MASTERS_NUM 7
>>> +#define MSM_VFE_COMPOSITE_IRQ_NUM 4
>>>
>>> #define MSM_VFE_VFE0_UB_SIZE 1023
>>> #define MSM_VFE_VFE0_UB_SIZE_RDI (MSM_VFE_VFE0_UB_SIZE / 3)
>>> @@ -51,11 +52,13 @@ enum vfe_line_id {
>>> VFE_LINE_NONE = -1,
>>> VFE_LINE_RDI0 = 0,
>>> VFE_LINE_RDI1 = 1,
>>> - VFE_LINE_RDI2 = 2
>>> + VFE_LINE_RDI2 = 2,
>>> + VFE_LINE_PIX = 3
>>> };
>>>
>>> struct vfe_output {
>>> - u8 wm_idx;
>>> + u8 wm_num;
>>> + u8 wm_idx[3];
>>
>> However, wm_idx[] reserves space for 3 entries, while currently only 2 are
>> needed. Why?
>>
>> If this is meant to accommodate for a future extension, the false positive
>> will become a real issue.
>
> The third entry will be needed if we add any three planar pixel format support
> to the driver.
OK.
> If this happens this will involve also changes in
> vfe_set_xbar_cfg() to support it. It is fine to change wm_idx[3] to wm_idx[2]
> until then. However this will not remove the false positive warning. I suppose
> it is best to also change vfe_set_xbar_cfg() now so that there is no warning -
> init reg to 0 in all cases?
Initializing reg to 0 in all cases will kill the warning, but won't prevent
future bugs (e.g. someone forgets to update vfe_set_xbar_cfg()).
Keeping the warning also doesn't help to protect against that, as I only look
at newly introduced warnings (all old unfixed ones are supposed to be false
positives).
Well, just don't make mistakes when extending the code ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2017-09-11 7:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 13:29 [PATCH v4 00/21] Qualcomm 8x16 Camera Subsystem driver Todor Tomov
2017-08-08 13:29 ` [PATCH v4 01/21] v4l: Add packed Bayer raw12 pixel formats Todor Tomov
2017-08-08 13:29 ` [PATCH v4 02/21] dt-bindings: media: Binding document for Qualcomm Camera subsystem driver Todor Tomov
2017-08-08 13:30 ` [PATCH v4 03/21] MAINTAINERS: Add " Todor Tomov
2017-08-08 13:30 ` [PATCH v4 04/21] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document Todor Tomov
2017-08-18 7:45 ` Hans Verkuil
2017-08-18 7:53 ` Todor Tomov
2017-08-25 14:10 ` Daniel Mack
2017-08-28 7:10 ` Todor Tomov
2017-08-29 17:02 ` Daniel Mack
2017-10-16 15:01 ` Daniel Mack
2017-10-25 12:07 ` Todor Tomov
2017-10-25 12:18 ` Daniel Mack
2017-08-08 13:30 ` [PATCH v4 05/21] media: camss: Add CSIPHY files Todor Tomov
2017-08-08 13:30 ` [PATCH v4 06/21] media: camss: Add CSID files Todor Tomov
2017-08-08 13:30 ` [PATCH v4 07/21] media: camss: Add ISPIF files Todor Tomov
2017-08-08 13:30 ` [PATCH v4 08/21] media: camss: Add VFE files Todor Tomov
2017-08-08 13:30 ` [PATCH v4 09/21] media: camss: Add files which handle the video device nodes Todor Tomov
2017-08-08 14:44 ` Sakari Ailus
2017-08-08 13:30 ` [PATCH v4 10/21] media: camms: Add core files Todor Tomov
2017-08-08 13:30 ` [PATCH v4 11/21] media: camss: Enable building Todor Tomov
2017-08-08 13:30 ` [PATCH v4 12/21] camss: vfe: Format conversion support using PIX interface Todor Tomov
2017-09-10 9:58 ` Geert Uytterhoeven
2017-09-11 6:56 ` Todor Tomov
2017-09-11 7:45 ` Geert Uytterhoeven [this message]
2017-08-08 13:30 ` [PATCH v4 13/21] doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface Todor Tomov
2017-08-08 13:30 ` [PATCH v4 14/21] camss: vfe: Support for frame padding Todor Tomov
2017-08-08 13:30 ` [PATCH v4 15/21] camss: vfe: Add interface for scaling Todor Tomov
2017-08-08 13:30 ` [PATCH v4 16/21] camss: vfe: Configure scaler module in VFE Todor Tomov
2017-08-08 13:30 ` [PATCH v4 17/21] camss: vfe: Add interface for cropping Todor Tomov
2017-08-08 13:30 ` [PATCH v4 18/21] camss: vfe: Configure crop module in VFE Todor Tomov
2017-08-08 13:30 ` [PATCH v4 19/21] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop Todor Tomov
2017-08-08 13:30 ` [PATCH v4 20/21] camss: Use optimal clock frequency rates Todor Tomov
2017-08-08 13:30 ` [PATCH v4 21/21] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Media graph Todor Tomov
2017-08-08 14:53 ` [PATCH v4 00/21] Qualcomm 8x16 Camera Subsystem driver Sakari Ailus
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=CAMuHMdV2XZZjaLdQZ90voyE9AinZy3+Zpg0C0-N+AkADk7768A@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=arnd@arndb.de \
--cc=hans.verkuil@cisco.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
--cc=todor.tomov@linaro.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).