Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp964939pxu; Wed, 2 Dec 2020 07:45:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKFlzexQ/l/1rA1sYuy01NneYymr6YbnxRVAMmqz4ruj9VKQ3hyHqBnVk0cFWld3dRB4mQ X-Received: by 2002:a05:6402:949:: with SMTP id h9mr455526edz.301.1606923945763; Wed, 02 Dec 2020 07:45:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606923945; cv=none; d=google.com; s=arc-20160816; b=Wp0AaGXm3ev+suIagTL7r1XfcU0pDeHyCdjLbD56IiCLC/zhuEsla6JH32w9cM9oQu bFNCZ95DjYn+MMxXaLcFSKK4bAVcAyd4uTQ5ovCdEgAj1/yt4NGGOsmEGEqFs3Y2IiP+ Nc3ZlNqgnfwlx6GN+W5YBawd5vL1OUtjRLjOuSPhcFW0/EV3j9Q719beXnRMBmalp2ZV c+ps3PgsgGz2x782dPU/1PQ7NJKPO/qOVtYl0xzdFnTgVy1MPMnBW0X8OKG3bsr5pjNC sIVGwPnYu/uUdmXoOZqsQhw1RYSrSCLdMfA2bTPdBODgG2OvXWyivfj28sC3Bu2RbIx1 BBWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=1aA8Nz2xyPi1mvaPkaQQxkRNxyn1b5KD/N92L3U5P4A=; b=0pX8Zznq4/e5kNOvKXwe1bg1dPjjpEpTfXxyXkoBgBqcc+83nSyRUmO4Y6VPyPV2BZ jU/PN9wN/qn41KpTC/VmdNcDJZdbrHLc2P+OEPbaGKYxRPt/Wbl8ncADM1eBiNvQUYvJ Wi1WqrC9j/cqAgAqCVjlYyC4cbNO7q9bRrb4yAvttgnd0Mrcf4VbqlSTPttb7Qx3InEW Ab25lcE/docEk5/CHXJTUV25SU4Halx8s8Ze2ATxmy3JC92rZYBKeRc6K9njTaF5SGDA QzRpXxcP/MnhxaxzAMsTsWB8zNokGM6XbsV8HF2wzz8bOl+rnj5fnr7x5+KkHjZKWjD8 RjyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si186768ejb.155.2020.12.02.07.45.22; Wed, 02 Dec 2020 07:45:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728502AbgLBPlv convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Dec 2020 10:41:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbgLBPlu (ORCPT ); Wed, 2 Dec 2020 10:41:50 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D1FC0613D4 for ; Wed, 2 Dec 2020 07:41:10 -0800 (PST) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkUFa-0001mY-Re; Wed, 02 Dec 2020 16:41:02 +0100 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1kkUFZ-0001K4-MD; Wed, 02 Dec 2020 16:41:01 +0100 Message-ID: Subject: Re: [PATCH v5 10/10] media: imx-jpeg: Use v4l2 jpeg helpers in mxc-jpeg From: Philipp Zabel To: "Mirela Rabulea (OSS)" , mchehab@kernel.org, hverkuil-cisco@xs4all.nl, shawnguo@kernel.org, robh+dt@kernel.org Cc: paul.kocialkowski@bootlin.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, s.hauer@pengutronix.de, aisheng.dong@nxp.com, daniel.baluta@nxp.com, robert.chiras@nxp.com, laurentiu.palcu@nxp.com, mark.rutland@arm.com, devicetree@vger.kernel.org, ezequiel@collabora.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, dafna.hirschfeld@collabora.com, Mirela Rabulea Date: Wed, 02 Dec 2020 16:41:01 +0100 In-Reply-To: <20201112030557.8540-11-mirela.rabulea@oss.nxp.com> References: <20201112030557.8540-1-mirela.rabulea@oss.nxp.com> <20201112030557.8540-11-mirela.rabulea@oss.nxp.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-11-12 at 05:05 +0200, Mirela Rabulea (OSS) wrote: > From: Mirela Rabulea > > Use v4l2_jpeg_parse_header in mxc_jpeg_parse, remove the old > parsing way, which was duplicated in other jpeg drivers. > > Signed-off-by: Mirela Rabulea > --- > Changes in v5: > This was patch 11 in previous version > Change triggered by patch 7 (app14 data change struct -> int) > > drivers/media/platform/imx-jpeg/Kconfig | 1 + > drivers/media/platform/imx-jpeg/mxc-jpeg.c | 267 ++++++--------------- > drivers/media/platform/imx-jpeg/mxc-jpeg.h | 26 +- > 3 files changed, 80 insertions(+), 214 deletions(-) > > diff --git a/drivers/media/platform/imx-jpeg/Kconfig b/drivers/media/platform/imx-jpeg/Kconfig > index 7cc89e5eff90..d875f7c88cda 100644 > --- a/drivers/media/platform/imx-jpeg/Kconfig > +++ b/drivers/media/platform/imx-jpeg/Kconfig > @@ -4,6 +4,7 @@ config VIDEO_IMX8_JPEG > depends on VIDEO_DEV && VIDEO_V4L2 > select VIDEOBUF2_DMA_CONTIG > select V4L2_MEM2MEM_DEV > + select V4L2_JPEG_HELPER > default m > help > This is a video4linux2 driver for the i.MX8 QXP/QM integrated > diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c > index 8f297803f2c3..d3b7581ce46e 100644 > --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c > +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c [...] > @@ -1448,12 +1317,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, > * encoded with 3 components have RGB colorspace, see Recommendation > * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour encoding > */ > - if (img_fmt == MXC_JPEG_YUV444 && app14 && app14_transform == 0) > - img_fmt = MXC_JPEG_RGB; > - > - if (mxc_jpeg_imgfmt_to_fourcc(img_fmt, &fourcc)) { > - dev_err(dev, "Fourcc not found for %d", img_fmt); > - return -EINVAL; > + if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc == V4L2_PIX_FMT_RGB24) { > + if (header.app14_tf == 0) This is what I meant in patch 7, I think it would be more clear to have an enum value that says "RGB color coding" than to rely on the reader to know what the value 0 means. > + fourcc = V4L2_PIX_FMT_RGB24; > + else > + fourcc = V4L2_PIX_FMT_YUV24; > } > > /* > Otherwise this patch looks fine to me. regards Philipp