Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1661656pxb; Wed, 9 Feb 2022 01:31:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJynGRTn9ITmOMdVXJ4/ulzC/LmsSofGIRkY8meumkJFELWIxUHxBqLskQKfWuNHlAcSqxln X-Received: by 2002:a17:902:d702:: with SMTP id w2mr1518604ply.17.1644399083423; Wed, 09 Feb 2022 01:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644399083; cv=none; d=google.com; s=arc-20160816; b=F9LkBDGcaeZ8JzOojWfFPvuVUY21K2a2CtpxivsxfG/EVfm/E94b/1LsQgmWkYrFab h1hUICO8a+VdUxLedqGEIqv1MKpu1uW13QIeVHZLTOkPTM9jhhG4NLiVmDU/nNXkBP5t eDDL/mm83Ud3WrCmw42ZTc3hsQ6mCNrCD4OTK04iCvayc0nDG6hbKCgdW+iCR2VZJ4Ky PVA3P6ibvTegDazYFlB8K4ii8VXpmYdGJQIU16gnM+DwqxDVsfn3GnaGF5x/iz/DAShe kSn7BKaGKyF4/CuJk0NG5nQLvS7xc6Fha7yUe4U8EfINFK6MrTkhHz7s3XX+gYHfdvz8 HOng== 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=VfVOlpJNv4UuCuKpXFcTabHodm4YbPLeSQV4lx67uXs=; b=Yi1hrVy0RbToQm91ndYZwSpbM7NOU0we277H1L0ySBJjjoFtzbBFwhvlZyfvfl8s99 3UU09qWgoWKcJ7YHFgROVmJIPK1puwzbQprj+tPDHmIQB7nvWx2aTJNMudEGWys4GI/G fdprt8Q8E7hQkX/vLyGJbtubAlLyE5k82raiDuXn26VGBqqtATC2vpW99ld7CR6aF4BP QN6FD2pKUFqAwEsTjNGYzjmQXVkp04hW5Ee9ORAmCVpI2w14n1cHXxd0JDdT51+mv+J1 BXsyynWlDdPo/T8Ty8MDUln46Akp5dbivbzv3V3Lx+bN7IZqKwCDdojK8kx9/sMGsIBA d/dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EoH0Sklp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m12si16168128pfh.279.2022.02.09.01.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EoH0Sklp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 95E09E056584; Wed, 9 Feb 2022 00:59:44 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357421AbiBGQ7c (ORCPT + 99 others); Mon, 7 Feb 2022 11:59:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344852AbiBGQye (ORCPT ); Mon, 7 Feb 2022 11:54:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136F4C0401D1 for ; Mon, 7 Feb 2022 08:54:34 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id C1F36B812AA for ; 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bd0a0a9-4015-b54c-f745-f813496be61b@foss.st.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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