From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43766C433EF for ; Mon, 7 Feb 2022 16:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vLISYy1W5NyMG63G/G++3IE+tQIILq974gZDqZtlfjs=; b=nrPiE5/QzAXjpc GysQu+SYExDccQRVdjdoEQ8hvBfw+kBqPrfwqZNiZ3COpeIDCCYe1lVKt0OBV5lw1RDR/dQF6NjUy UIqqVG5cTpB7IGzd4e8nc/uTqpvlJ3HJEbFjMCZEK+7dgEGc427NLlL0c7GUAAjegcpExGUzKXPDN I1o/w5p2D7Goshy0xM55oBqNAQjGJ6k2v07eu4JRCAWiXnOzatYIMqGcNEFZhlyoTLUgwh0UFNNCw VLIsByYxr2v9nutlxJQxELzf8m2GJH+eBMtA5aODxqd3YMLUdN6r+stWdgxqbyYaWQRbHIYGUuw8F k60gEdXYsLWiRdHOql0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7Hg-00BE4p-BQ; Mon, 07 Feb 2022 16:54:36 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH7Hc-00BE48-G3 for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 16:54:34 +0000 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 09C9560AE7; Mon, 7 Feb 2022 16:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FE54C004E1; Mon, 7 Feb 2022 16:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644252871; bh=ZhCOMln0Zt5onmq74lvlwpZ3OfaHsYGRSVchu6lO+i0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EoH0Sklp/HpYS+1O2MEju3lzMw6MFoHYmoNUVkt7h71Xc3kOgUsdt/MF3jE9qG/fh SpPvDrOPpM1nSKu3WbxkPhHxacfSBUomPbOkV6CWJ5ytSZ0Oes7z7xsIssV+TJT+g0 7fn0OCTGl6IwBlXyqimlw19GqhMQodQYmpib6mnxJVca5Bb3e4fjB+cbDlDP7ylDEZ L/VEY4S5jrlU3/7SVPpAkrbseOMB1sy2hBABFDe+hC6pNHAqmwr6UDmvDZFRniIrux DsADCI7jjJ9ZawX77pU3m4V6vWufLfmsdDVKy0O+D0xKr+Mx2GFOPyXrt5uPPXM//O SAHEwT093ecGg== Date: Mon, 7 Feb 2022 09:54:26 -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> <7bd0a0a9-4015-b54c-f745-f813496be61b@foss.st.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7bd0a0a9-4015-b54c-f745-f813496be61b@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_085432_638072_4DF2E1E9 X-CRM114-Status: GOOD ( 27.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 07, 2022 at 11:00:34AM +0100, yannick Fertre wrote: > Hi Nathan, > > On 2/2/22 17:54, Nathan Chancellor wrote: > > 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, > > > Thanks for your help. > It'okay for a message for unsupported format with a return in the default > case. > Do you want create & push the patch? Thank you for the input! I have sent a fix now, please take a look. https://lore.kernel.org/r/20220207165304.1046867-1-nathan@kernel.org/ Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel