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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 02911C433F5 for ; Fri, 30 Sep 2022 08:05:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D90F510E034; Fri, 30 Sep 2022 08:05:20 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68A7710E034 for ; Fri, 30 Sep 2022 08:05:14 +0000 (UTC) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CD39B47C; Fri, 30 Sep 2022 10:05:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664525112; bh=u6NhrwctNIUuuEOoN7VNYbRkrTwGTy+IgdPYljGIiMw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wZxAeIrkMS9c6uBdysjH80riFT0K83UEa8ywWc9QwoR3Jq/HRGJOybOqVQCv2eWga FCvuJEaaABzXSIHZfpO3LMtWhQMU1YC8wWQ6TtMVRSwPNyDkVD+GDFa4DgbRDbRIqX ChUXHFyn/aefgRqaCKff97nDHzjTuEoAvwI5Yyf0= Date: Fri, 30 Sep 2022 11:05:10 +0300 From: Laurent Pinchart To: Liu Ying Subject: Re: [PATCH v3 4/4] drm: lcdif: Add support for YUV planes Message-ID: References: <20220929204235.773-1-laurent.pinchart@ideasonboard.com> <20220929204235.773-5-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Peng Fan , Alexander Stein , Kieran Bingham , dri-devel@lists.freedesktop.org, Daniel Scally , Robby Cai Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Liu, On Fri, Sep 30, 2022 at 12:01:39PM +0800, Liu Ying wrote: > On Thu, 2022-09-29 at 23:42 +0300, Laurent Pinchart wrote: > > From: Kieran Bingham > > > > The LCDIF includes a color space converter that supports YUV input. Use > > it to support YUV planes, either through the converter if the output > > format is RGB, or in conversion bypass mode otherwise. > > > > Signed-off-by: Kieran Bingham > > Signed-off-by: Laurent Pinchart > > Reviewed-by: Marek Vasut > > Reviewed-by: Kieran Bingham > > --- > > Changes since v2: > > > > - Fix YUV to RGB coefficients > > - List floating point coefficient values in comment > > - Express CSC coefficients with three hex digits > > - Move | to the end of the line > > - Add comment header before RGB formats > > > > Changes since v1: > > > > - Support all YCbCr encodings and quantization ranges > > - Drop incorrect comment > > --- > > drivers/gpu/drm/mxsfb/lcdif_kms.c | 260 ++++++++++++++++++++++++----- > > drivers/gpu/drm/mxsfb/lcdif_regs.h | 5 +- > > 2 files changed, 224 insertions(+), 41 deletions(-) > > Hmmm, 'git am' fails to apply this one to drm-misc-next but it's ok > with v6.0-rc1. I should have tried drm-misc-next with v2. Oops. I'll rebase on top of drm-misc-next. > > diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c > > index 08e4880ec6cf..81454b53936f 100644 > > --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c > > +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c > > @@ -15,6 +15,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -32,13 +33,119 @@ > > /* ----------------------------------------------------------------------------- > > * CRTC > > */ > > + > > +/* > > + * Despite the reference manual stating the opposite, the D1, D2 and D3 offset > > + * values are added to Y, U and V, not subtracted. They must thus be programmed > > + * with negative values. > > Can you add the generic conversion equations with [A-D][1-3] > coefficient symbols as comments in code, like imx-pxp.c does? It will > improve code readability better and tell which coefficient is which. > Also for RGB to YCbCr conversion if you want to do that with this > series. Sorry for not pointing this out in v2 review cycle. I'll fix that. > > + */ > > +static const u32 lcdif_yuv2rgb_coeffs[3][2][6] = { > > [...] > > > + /* YUYV Formats */ > > 'YUV Formats' would be better? Again, failed to catch this in v2... Will fix this too. > > + case DRM_FORMAT_YUYV: > > + writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_VY2UY1, > > + lcdif->base + LCDC_V8_CTRLDESCL0_5); > > + in_yuv = true; > > + break; > > + case DRM_FORMAT_YVYU: > > + writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_UY2VY1, > > + lcdif->base + LCDC_V8_CTRLDESCL0_5); > > + in_yuv = true; > > + break; > > + case DRM_FORMAT_UYVY: > > + writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2VY1U, > > + lcdif->base + LCDC_V8_CTRLDESCL0_5); > > + in_yuv = true; > > + break; > > + case DRM_FORMAT_VYUY: > > + writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2UY1V, > > + lcdif->base + LCDC_V8_CTRLDESCL0_5); > > + in_yuv = true; > > + break; > > + > > + default: > > + dev_err(drm->dev, "Unknown pixel format 0x%x\n", format); > > + break; > > + } -- Regards, Laurent Pinchart