All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Yannick Fertre <yannick.fertre@foss.st.com>
Cc: Philippe Cornu <philippe.cornu@foss.st.com>,
	Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	dri-devel@lists.freedesktop.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] drm/stm: ltdc: add support of ycbcr pixel formats
Date: Wed, 2 Feb 2022 09:54:55 -0700	[thread overview]
Message-ID: <Yfq3XwozrxYaFhgD@dev-arch.archlinux-ax161> (raw)
In-Reply-To: <20211215214843.20703-1-yannick.fertre@foss.st.com>

Hi Yannick,

On Wed, Dec 15, 2021 at 10:48:43PM +0100, Yannick Fertre wrote:
> This patch adds the following YCbCr input pixel formats on the latest
> LTDC hardware version:
> 
> 1 plane  (co-planar)  : YUYV, YVYU, UYVY, VYUY
> 2 planes (semi-planar): NV12, NV21
> 3 planes (full-planar): YU12=I420=DRM YUV420, YV12=DRM YVU420
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>

<snip>

> +static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fmt)
> +{
> +	struct ltdc_device *ldev = plane_to_ltdc(plane);
> +	struct drm_plane_state *state = plane->state;
> +	u32 lofs = plane->index * LAY_OFS;
> +	u32 val;
> +
> +	switch (drm_pix_fmt) {
> +	case DRM_FORMAT_YUYV:
> +		val = (YCM_I << 4) | LxPCR_YF | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_YVYU:
> +		val = (YCM_I << 4) | LxPCR_YF;
> +		break;
> +	case DRM_FORMAT_UYVY:
> +		val = (YCM_I << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_VYUY:
> +		val = (YCM_I << 4);
> +		break;
> +	case DRM_FORMAT_NV12:
> +		val = (YCM_SP << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_NV21:
> +		val = (YCM_SP << 4);
> +		break;
> +	case DRM_FORMAT_YUV420:
> +	case DRM_FORMAT_YVU420:
> +		val = (YCM_FP << 4);
> +		break;
> +	default:
> +		/* RGB or not a YCbCr supported format */
> +		break;
> +	}
> +
> +	/* Enable limited range */
> +	if (state->color_range == DRM_COLOR_YCBCR_LIMITED_RANGE)
> +		val |= LxPCR_YREN;
> +
> +	/* enable ycbcr conversion */
> +	val |= LxPCR_YCEN;
> +
> +	regmap_write(ldev->regmap, LTDC_L1PCR + lofs, val);
> +}

This patch as commit 484e72d3146b ("drm/stm: ltdc: add support of ycbcr
pixel formats") in -next introduced the following clang warning:

drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
        val |= LxPCR_YCEN;
        ^~~
drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
        u32 val;
               ^
                = 0
1 warning generated.

Would it be okay to just return in the default case (maybe with a
message about an unsupported format?) or should there be another fix?

Cheers,

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: Yannick Fertre <yannick.fertre@foss.st.com>
Cc: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	David Airlie <airlied@linux.ie>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Philippe Cornu <philippe.cornu@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 5/5] drm/stm: ltdc: add support of ycbcr pixel formats
Date: Wed, 2 Feb 2022 09:54:55 -0700	[thread overview]
Message-ID: <Yfq3XwozrxYaFhgD@dev-arch.archlinux-ax161> (raw)
In-Reply-To: <20211215214843.20703-1-yannick.fertre@foss.st.com>

Hi Yannick,

On Wed, Dec 15, 2021 at 10:48:43PM +0100, Yannick Fertre wrote:
> This patch adds the following YCbCr input pixel formats on the latest
> LTDC hardware version:
> 
> 1 plane  (co-planar)  : YUYV, YVYU, UYVY, VYUY
> 2 planes (semi-planar): NV12, NV21
> 3 planes (full-planar): YU12=I420=DRM YUV420, YV12=DRM YVU420
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>

<snip>

> +static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fmt)
> +{
> +	struct ltdc_device *ldev = plane_to_ltdc(plane);
> +	struct drm_plane_state *state = plane->state;
> +	u32 lofs = plane->index * LAY_OFS;
> +	u32 val;
> +
> +	switch (drm_pix_fmt) {
> +	case DRM_FORMAT_YUYV:
> +		val = (YCM_I << 4) | LxPCR_YF | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_YVYU:
> +		val = (YCM_I << 4) | LxPCR_YF;
> +		break;
> +	case DRM_FORMAT_UYVY:
> +		val = (YCM_I << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_VYUY:
> +		val = (YCM_I << 4);
> +		break;
> +	case DRM_FORMAT_NV12:
> +		val = (YCM_SP << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_NV21:
> +		val = (YCM_SP << 4);
> +		break;
> +	case DRM_FORMAT_YUV420:
> +	case DRM_FORMAT_YVU420:
> +		val = (YCM_FP << 4);
> +		break;
> +	default:
> +		/* RGB or not a YCbCr supported format */
> +		break;
> +	}
> +
> +	/* Enable limited range */
> +	if (state->color_range == DRM_COLOR_YCBCR_LIMITED_RANGE)
> +		val |= LxPCR_YREN;
> +
> +	/* enable ycbcr conversion */
> +	val |= LxPCR_YCEN;
> +
> +	regmap_write(ldev->regmap, LTDC_L1PCR + lofs, val);
> +}

This patch as commit 484e72d3146b ("drm/stm: ltdc: add support of ycbcr
pixel formats") in -next introduced the following clang warning:

drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
        val |= LxPCR_YCEN;
        ^~~
drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
        u32 val;
               ^
                = 0
1 warning generated.

Would it be okay to just return in the default case (maybe with a
message about an unsupported format?) or should there be another fix?

Cheers,

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: Yannick Fertre <yannick.fertre@foss.st.com>
Cc: Philippe Cornu <philippe.cornu@foss.st.com>,
	Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	dri-devel@lists.freedesktop.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] drm/stm: ltdc: add support of ycbcr pixel formats
Date: Wed, 2 Feb 2022 09:54:55 -0700	[thread overview]
Message-ID: <Yfq3XwozrxYaFhgD@dev-arch.archlinux-ax161> (raw)
In-Reply-To: <20211215214843.20703-1-yannick.fertre@foss.st.com>

Hi Yannick,

On Wed, Dec 15, 2021 at 10:48:43PM +0100, Yannick Fertre wrote:
> This patch adds the following YCbCr input pixel formats on the latest
> LTDC hardware version:
> 
> 1 plane  (co-planar)  : YUYV, YVYU, UYVY, VYUY
> 2 planes (semi-planar): NV12, NV21
> 3 planes (full-planar): YU12=I420=DRM YUV420, YV12=DRM YVU420
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>

<snip>

> +static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fmt)
> +{
> +	struct ltdc_device *ldev = plane_to_ltdc(plane);
> +	struct drm_plane_state *state = plane->state;
> +	u32 lofs = plane->index * LAY_OFS;
> +	u32 val;
> +
> +	switch (drm_pix_fmt) {
> +	case DRM_FORMAT_YUYV:
> +		val = (YCM_I << 4) | LxPCR_YF | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_YVYU:
> +		val = (YCM_I << 4) | LxPCR_YF;
> +		break;
> +	case DRM_FORMAT_UYVY:
> +		val = (YCM_I << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_VYUY:
> +		val = (YCM_I << 4);
> +		break;
> +	case DRM_FORMAT_NV12:
> +		val = (YCM_SP << 4) | LxPCR_CBF;
> +		break;
> +	case DRM_FORMAT_NV21:
> +		val = (YCM_SP << 4);
> +		break;
> +	case DRM_FORMAT_YUV420:
> +	case DRM_FORMAT_YVU420:
> +		val = (YCM_FP << 4);
> +		break;
> +	default:
> +		/* RGB or not a YCbCr supported format */
> +		break;
> +	}
> +
> +	/* Enable limited range */
> +	if (state->color_range == DRM_COLOR_YCBCR_LIMITED_RANGE)
> +		val |= LxPCR_YREN;
> +
> +	/* enable ycbcr conversion */
> +	val |= LxPCR_YCEN;
> +
> +	regmap_write(ldev->regmap, LTDC_L1PCR + lofs, val);
> +}

This patch as commit 484e72d3146b ("drm/stm: ltdc: add support of ycbcr
pixel formats") in -next introduced the following clang warning:

drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
        val |= LxPCR_YCEN;
        ^~~
drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
        u32 val;
               ^
                = 0
1 warning generated.

Would it be okay to just return in the default case (maybe with a
message about an unsupported format?) or should there be another fix?

Cheers,

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-02-02 16:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15 21:48 [PATCH 5/5] drm/stm: ltdc: add support of ycbcr pixel formats Yannick Fertre
2021-12-15 21:48 ` Yannick Fertre
2022-01-04 10:27 ` Philippe CORNU
2022-01-04 10:27   ` Philippe CORNU
2022-02-02 16:54 ` Nathan Chancellor [this message]
2022-02-02 16:54   ` Nathan Chancellor
2022-02-02 16:54   ` Nathan Chancellor
2022-02-07 10:00   ` yannick Fertre
2022-02-07 10:00     ` yannick Fertre
2022-02-07 10:00     ` yannick Fertre
2022-02-07 16:54     ` Nathan Chancellor
2022-02-07 16:54       ` Nathan Chancellor
2022-02-07 16:54       ` Nathan Chancellor

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=Yfq3XwozrxYaFhgD@dev-arch.archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@foss.st.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=philippe.cornu@foss.st.com \
    --cc=raphael.gallais-pou@foss.st.com \
    --cc=yannick.fertre@foss.st.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.