Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1719540pxb; Wed, 2 Feb 2022 10:58:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR3NDKvdFYSBsmLSxiDjCxnnCOn3Yr9hXHN/unUriLRqnvDjRks/FGYnQwBnxkTH09rJYm X-Received: by 2002:a63:2c46:: with SMTP id s67mr22827339pgs.430.1643828282885; Wed, 02 Feb 2022 10:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643828282; cv=none; d=google.com; s=arc-20160816; b=0vZmJNDo0nKfaJr2/w+emQdoAJ1DKwSexXJvA9niyL8sE1rmjLSeq6uU4WsCb7nTws tUgUiCW5w8BXeTtGzT1ot3x04IV+IOO4hQCCLslb3bIMnND2MAtzBhBQLsh+CTCzD3Ro 9o0RYYN0vW/8IIbQmzDjAL60zrxvpgER1n5eaKGDYh9K8Gu/58eAUxMG1B/RoNHgCY/q k/BofSIdSkXLpBRSioq1urZUUad5CQmm97aDTYBvHUINFVRrBM5sCARg7m+1/+iSPk/M dvn5Y/po5B5+dDRsr+LeFpc/lYzgrdNlfYsJooMpF8TKWiPwIEyjpl2E9KYkb6/LLYw7 H1BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yG5gS4GZfPDdGqID8keIVpIORhi1dRanNuy3cZ98Bbs=; b=SGXpIkcGdo7bXfnWH+MpKFZEtNhNdN4uXs6xuts4o69kW6x+uXdsPtLA1UN0kQK9qy sTolp4V0nx9Qmo7vlCcVomlaKB1C7VyzdLtedx3bb+VgCha0h6U3TeyxAiqM/J9+2hMw pYPK0ckhE1gx78zG0fCakgZ38wVbyHkWqRSsYPiUpFui61scboXT9LwI1IIYatWt3RP6 TCWN01AfTHtaD2Wy8361Zd/BgwK+vf3cU2bdKBeN90XDe8CSF+7BDAeoYAK/carHXFX8 3drekx63cAkPFrPOxAvC15Np6KCUlECPDiG5WTdrCmWiNhQa/fxbrhIAtEpuwVr4GH1l JVJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MLDcYJAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22si5626673pjn.126.2022.02.02.10.57.50; Wed, 02 Feb 2022 10:58:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MLDcYJAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346041AbiBBQzQ (ORCPT + 99 others); Wed, 2 Feb 2022 11:55:16 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34178 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231706AbiBBQzB (ORCPT ); Wed, 2 Feb 2022 11:55:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D83161776 for ; Wed, 2 Feb 2022 16:55:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4E46C004E1; Wed, 2 Feb 2022 16:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643820900; bh=+Mw3UqSA9RW9lVv7cMeO4kcmAotMs1Y2FfPXU4FBX0w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MLDcYJAZvsv0XjxsuicWh3967mYmwunkokbmM+LwLId1hMsSp9rl1N3omNdCRHynH BXyvlTGymC3VchPCaetwp6qPoimzewJphziaYPKVoMe7RBiYK7aBEwXg79ysMnq1by 4YIxFZe1wIiKqNoQvUoR+Lea7Qga6Ai4DA7mAkmFJkafEfDSvyXEflnnfVunelFB8M W8UnHi+FVqr2zmpCDBRw1TJkIwsiRYJXog7IVacvNlpd0zDWp/ctF/3gRU+/maemd7 kEmmGNuEx7RUhG2h0KO2KEeV4FC6natUldJrgVB9m5DQj8W9NPGFCLTFy3Tr4s1KDy YkX+82ZIKJoxA== Date: Wed, 2 Feb 2022 09:54:55 -0700 From: Nathan Chancellor To: Yannick Fertre Cc: Philippe Cornu , Raphael Gallais-Pou , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , 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 Message-ID: References: <20211215214843.20703-1-yannick.fertre@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211215214843.20703-1-yannick.fertre@foss.st.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > +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,