Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4872662ybl; Wed, 22 Jan 2020 06:15:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxoG21zn5cYH7rUCgFFeJ0T0clyYo5SaDD6rEExz6UcsWan1kSzGD/fxA0YCVLyaHJHWgFZ X-Received: by 2002:a9d:5888:: with SMTP id x8mr7101395otg.361.1579702538099; Wed, 22 Jan 2020 06:15:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579702538; cv=none; d=google.com; s=arc-20160816; b=AMt7j2y6GTu0VXRxDE5V9Kw4twgrtluItJcREjst2syn9pIa92cFJ4kguBCRND57od CCXI4cwKykvpGM5BVr8DlGO2U/BbCxX87j0cVJegK5lyfgNh9y+RhMXEuBudkH7cjuWY WTObcuOaCJYDMt5j7qZ9K22qPY6/TIBVYf8VtQQOOke82zlW5/wTM9TfSbAeEnbNK1lu z+SromMtGo4RhmSO7YriKQfG9ZRqGlyjHAGpxlBEvFEIOi1byQsZFY91P23Q89U/uLQj LXEg4vYVMoNd8Tef+hi9xk3JzQJ7txg2siFjVTqUTf6ufx1LH7IRhiGueUFE2Tz8N5wK r71A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:to:subject; bh=bDRbTJyg8x+4AIofwCf2fc+W09SdEzLZTziboyA/Wus=; b=y6wWP/i2ym0r7LlvZQ6L4fZSZXx3xNlyBwpPBva94L8xWR9i0qohAuemteGUWoxYvp 6DWUUWLvTrK/CFIWq4Qv7H5cich7jKN4rcjcy/7KX4yeMqEd0wy7w84QplMqgFGlMBSv 0pS6lsxpXu/qwHsXAJT1Arhc+hrpqWGnXiMGrZUWEWB/en55LGGMHa2fugo/WWMCgI88 WlKT959bp5Ly5aiFXA63o/of54vtuJ30ZeOcvCcFHHgwBWzPKU1KkUOum+CUG9KUyHbl j/FzuwFH/2A/4CdaX2F6qbDroWg1Tmw2Yvl6fvnT2PpFKX+xpuJQnH292MCUoZbTf5Ip 6z8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si20816364oiy.9.2020.01.22.06.15.22; Wed, 22 Jan 2020 06:15:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbgAVOOZ (ORCPT + 99 others); Wed, 22 Jan 2020 09:14:25 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33658 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgAVOOZ (ORCPT ); Wed, 22 Jan 2020 09:14:25 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 0B2232927C8 Subject: Re: [PATCH v2] media: vimc: get pixformat info from v4l2_format_info To: "Carlos E. C. Barbosa" , Shuah Khan , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org References: <20200122084025.628462-1-carlosecb@tutanota.com> From: Helen Koike Autocrypt: addr=helen.koike@collabora.com; keydata= mQINBFmOMD4BEADb2nC8Oeyvklh+ataw2u/3mrl+hIHL4WSWtii4VxC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L95DIVZT C6STvDNL6kpys4sOe2AMmQGv2MMcJB3aYLzH8f1sEQ9S0UMX7/6CifEG6JodG6Y/W/lLo1Vv DxeDA+u4Lgq6qxlksp8M78FjcmxFVlf4cpCi2ucbZxurhlBkjtZZ8MVAEde3hlqjcBl2Ah6Q D826FTxscOGlHEfNABEBAAGJAjwEGAEKACYCGwwWIQSofQA6zrItXEgHWTzAfqwo9yFiXQUC XEz31QUJBKaOuQAKCRDAfqwo9yFiXUvnEACBWe8wSnIvSX+9k4LxuLq6GQTOt+RNfliZQkCW 5lT3KL1IJyzzOm4x+/slHRBl8bF7KEZyOPinXQXyJ/vgIdgSYxDqoZ7YZn3SvuNe4aT6kGwL EYYEV8Ecj4ets15FR2jSUNnVv5YHWtZ7bP/oUzr2LT54fjRcstYxgwzoj8AREtHQ4EJWAWCO ZuEHTSm5clMFoi41CmG4DlJbzbo4YfilKYm69vwh50Y8WebcRN31jh0g8ufjOJnBldYYBLwN Obymhlfy/HKBDIbyCGBuwYoAkoJ6LR/cqzl/FuhwhuDocCGlXyYaJOwXgHaCvVXI3PLQPxWZ +vPsD+TSVHc9m/YWrOiYDnZn6aO0Uk1Zv/m9+BBkWAwsreLJ/evn3SsJV1omNBTITG+uxXcf JkgmmesIAw8mpI6EeLmReUJLasz8QkzhZIC7t5rGlQI94GQG3Jg2dC+kpaGWOaT5G4FVMcBj iR1nXfMxENVYnM5ag7mBZyD/kru5W1Uj34L6AFaDMXFPwedSCpzzqUiHb0f+nYkfOodf5xy0 46+3THy/NUS/ZZp/rI4F7Y77+MQPVg7vARfHHX1AxYUKfRVW5j88QUB70txn8Vgi1tDrOr4J eD+xr0CvIGa5lKqgQacQtGkpOpJ8zY4ObSvpNubey/qYUE3DCXD0n2Xxk4muTvqlkFpOYA== Message-ID: Date: Wed, 22 Jan 2020 11:14:14 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200122084025.628462-1-carlosecb@tutanota.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Carlos, Thanks for the patch, just some small comments below. On 1/22/20 6:40 AM, Carlos E. C. Barbosa wrote: > From: "Carlos E.C. Barbosa" > > There is overlapping code over two distinct lists. This repurposes one > of vimc_pix_map for strictly mapping formats and remaps other calls to > the matching v4l2_format_info. > > Signed-off-by: Carlos E. C. Barbosa > --- > Changes in v2: > As advised by Helen Koike and Hans Verkuil, the const qualifiers are not > removed, the bayer flag is kept and the unnecessary changes are not > made. > > v4l2-compliance message: > https://pastebin.com/1XF45aCA > > --- > drivers/media/platform/vimc/vimc-capture.c | 19 ++++++++++++------ > drivers/media/platform/vimc/vimc-common.c | 23 ---------------------- > drivers/media/platform/vimc/vimc-common.h | 2 -- > drivers/media/platform/vimc/vimc-debayer.c | 7 +++++-- > drivers/media/platform/vimc/vimc-scaler.c | 12 +++++++++-- > drivers/media/platform/vimc/vimc-sensor.c | 12 ++++++++--- > 6 files changed, 37 insertions(+), 38 deletions(-) > > diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c > index 76c015898cfd..30659e934cfb 100644 > --- a/drivers/media/platform/vimc/vimc-capture.c > +++ b/drivers/media/platform/vimc/vimc-capture.c > @@ -86,6 +86,7 @@ static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, > { > struct v4l2_pix_format *format = &f->fmt.pix; > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; Could you please declare vinfo before vpix? I was trying to keep bigger lines first in the declaration order, but not a big deal. Same in other places of this patch. > > format->width = clamp_t(u32, format->width, VIMC_FRAME_MIN_WIDTH, > VIMC_FRAME_MAX_WIDTH) & ~1; > @@ -94,12 +95,13 @@ static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, > > /* Don't accept a pixelformat that is not on the table */ > vpix = vimc_pix_map_by_pixelformat(format->pixelformat); > - if (!vpix) { > + if (!vpix) > format->pixelformat = fmt_default.pixelformat; > - vpix = vimc_pix_map_by_pixelformat(format->pixelformat); > - } > + > + vinfo = v4l2_format_info(format->pixelformat); > + > /* TODO: Add support for custom bytesperline values */ > - format->bytesperline = format->width * vpix->bpp; > + format->bytesperline = format->width * vinfo->bpp[0]; > format->sizeimage = format->bytesperline * format->height; > > if (format->field == V4L2_FIELD_ANY) > @@ -166,6 +168,7 @@ static int vimc_cap_enum_framesizes(struct file *file, void *fh, > > /* Only accept code in the pix map table */ > vpix = vimc_pix_map_by_code(fsize->pixel_format); > + You don't need to add a new line here, please, remember to review the patch yourself before sending it :) > if (!vpix) > return -EINVAL; > > @@ -386,10 +389,11 @@ struct vimc_ent_device *vimc_cap_add(struct vimc_device *vimc, > const char *vcfg_name) > { > struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; > - const struct vimc_pix_map *vpix; No need to change this if you are just adding vinfo. > struct vimc_cap_device *vcap; > struct video_device *vdev; > struct vb2_queue *q; > + const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > int ret; > > /* Allocate the vimc_cap_device struct */ > @@ -434,8 +438,11 @@ struct vimc_ent_device *vimc_cap_add(struct vimc_device *vimc, > > /* Set default frame format */ > vcap->format = fmt_default; > + > vpix = vimc_pix_map_by_pixelformat(vcap->format.pixelformat); > - vcap->format.bytesperline = vcap->format.width * vpix->bpp; > + vinfo = v4l2_format_info(vpix->pixelformat); > + > + vcap->format.bytesperline = vcap->format.width * vinfo->bpp[0]; > vcap->format.sizeimage = vcap->format.bytesperline * > vcap->format.height; > > diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c > index 16ce9f3b7c75..8327ada1b461 100644 > --- a/drivers/media/platform/vimc/vimc-common.c > +++ b/drivers/media/platform/vimc/vimc-common.c > @@ -21,19 +21,16 @@ static const struct vimc_pix_map vimc_pix_map_list[] = { > { > .code = MEDIA_BUS_FMT_BGR888_1X24, > .pixelformat = V4L2_PIX_FMT_BGR24, > - .bpp = 3, > .bayer = false, > }, > { > .code = MEDIA_BUS_FMT_RGB888_1X24, > .pixelformat = V4L2_PIX_FMT_RGB24, > - .bpp = 3, > .bayer = false, > }, > { > .code = MEDIA_BUS_FMT_ARGB8888_1X32, > .pixelformat = V4L2_PIX_FMT_ARGB32, > - .bpp = 4, > .bayer = false, > }, > > @@ -41,49 +38,41 @@ static const struct vimc_pix_map vimc_pix_map_list[] = { > { > .code = MEDIA_BUS_FMT_SBGGR8_1X8, > .pixelformat = V4L2_PIX_FMT_SBGGR8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGBRG8_1X8, > .pixelformat = V4L2_PIX_FMT_SGBRG8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGRBG8_1X8, > .pixelformat = V4L2_PIX_FMT_SGRBG8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SRGGB8_1X8, > .pixelformat = V4L2_PIX_FMT_SRGGB8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SBGGR10_1X10, > .pixelformat = V4L2_PIX_FMT_SBGGR10, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGBRG10_1X10, > .pixelformat = V4L2_PIX_FMT_SGBRG10, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGRBG10_1X10, > .pixelformat = V4L2_PIX_FMT_SGRBG10, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SRGGB10_1X10, > .pixelformat = V4L2_PIX_FMT_SRGGB10, > - .bpp = 2, > .bayer = true, > }, > > @@ -91,25 +80,21 @@ static const struct vimc_pix_map vimc_pix_map_list[] = { > { > .code = MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, > .pixelformat = V4L2_PIX_FMT_SBGGR10ALAW8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, > .pixelformat = V4L2_PIX_FMT_SGBRG10ALAW8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, > .pixelformat = V4L2_PIX_FMT_SGRBG10ALAW8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, > .pixelformat = V4L2_PIX_FMT_SRGGB10ALAW8, > - .bpp = 1, > .bayer = true, > }, > > @@ -117,49 +102,41 @@ static const struct vimc_pix_map vimc_pix_map_list[] = { > { > .code = MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, > .pixelformat = V4L2_PIX_FMT_SBGGR10DPCM8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, > .pixelformat = V4L2_PIX_FMT_SGBRG10DPCM8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, > .pixelformat = V4L2_PIX_FMT_SGRBG10DPCM8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, > .pixelformat = V4L2_PIX_FMT_SRGGB10DPCM8, > - .bpp = 1, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SBGGR12_1X12, > .pixelformat = V4L2_PIX_FMT_SBGGR12, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGBRG12_1X12, > .pixelformat = V4L2_PIX_FMT_SGBRG12, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SGRBG12_1X12, > .pixelformat = V4L2_PIX_FMT_SGRBG12, > - .bpp = 2, > .bayer = true, > }, > { > .code = MEDIA_BUS_FMT_SRGGB12_1X12, > .pixelformat = V4L2_PIX_FMT_SRGGB12, > - .bpp = 2, > .bayer = true, > }, > }; > diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h > index 87eb8259c2a8..dd1c45334705 100644 > --- a/drivers/media/platform/vimc/vimc-common.h > +++ b/drivers/media/platform/vimc/vimc-common.h > @@ -62,7 +62,6 @@ do { \ > * struct vimc_pix_map - maps media bus code with v4l2 pixel format > * > * @code: media bus format code defined by MEDIA_BUS_FMT_* macros > - * @bbp: number of bytes each pixel occupies > * @pixelformat: pixel format devined by V4L2_PIX_FMT_* macros > * > * Struct which matches the MEDIA_BUS_FMT_* codes with the corresponding > @@ -70,7 +69,6 @@ do { \ > */ > struct vimc_pix_map { > unsigned int code; > - unsigned int bpp; > u32 pixelformat; > bool bayer; > }; > diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c > index 5d1b67d684bb..0df44b8bb7d0 100644 > --- a/drivers/media/platform/vimc/vimc-debayer.c > +++ b/drivers/media/platform/vimc/vimc-debayer.c > @@ -304,6 +304,7 @@ static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable) > > if (enable) { > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > unsigned int frame_size; > > if (vdeb->src_frame) > @@ -311,12 +312,14 @@ static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable) > > /* Calculate the frame size of the source pad */ > vpix = vimc_pix_map_by_code(vdeb->src_code); > + vinfo = v4l2_format_info(vpix->pixelformat); > frame_size = vdeb->sink_fmt.width * vdeb->sink_fmt.height * > - vpix->bpp; > + vinfo->bpp[0]; > > /* Save the bytes per pixel of the sink */ > vpix = vimc_pix_map_by_code(vdeb->sink_fmt.code); > - vdeb->sink_bpp = vpix->bpp; > + vinfo = v4l2_format_info(vpix->pixelformat); > + vdeb->sink_bpp = vinfo->bpp[0]; > > /* Get the corresponding pixel map from the table */ > vdeb->sink_pix_map = > diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c > index e2e551bc3ded..9fcca5b1f0b7 100644 > --- a/drivers/media/platform/vimc/vimc-scaler.c > +++ b/drivers/media/platform/vimc/vimc-scaler.c > @@ -126,6 +126,7 @@ static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd, > struct v4l2_subdev_frame_size_enum *fse) > { > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > > if (fse->index) > return -EINVAL; > @@ -134,6 +135,7 @@ static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd, > vpix = vimc_pix_map_by_code(fse->code); > if (!vpix || vpix->bayer) > return -EINVAL; new line here. > + vinfo = v4l2_format_info(vpix->pixelformat); > > fse->min_width = VIMC_FRAME_MIN_WIDTH; > fse->min_height = VIMC_FRAME_MIN_HEIGHT; > @@ -177,11 +179,15 @@ static int vimc_sca_get_fmt(struct v4l2_subdev *sd, > static void vimc_sca_adjust_sink_fmt(struct v4l2_mbus_framefmt *fmt) > { > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > > /* Only accept code in the pix map table in non bayer format */ > vpix = vimc_pix_map_by_code(fmt->code); > - if (!vpix || vpix->bayer) > + if (!vpix || vpix->bayer) { > fmt->code = sink_fmt_default.code; > + vpix = vimc_pix_map_by_code(fmt->code); > + } > + vinfo = v4l2_format_info(vpix->pixelformat); > > fmt->width = clamp_t(u32, fmt->width, VIMC_FRAME_MIN_WIDTH, > VIMC_FRAME_MAX_WIDTH) & ~1; > @@ -332,6 +338,7 @@ static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable) > > if (enable) { > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > unsigned int frame_size; > > if (vsca->src_frame) > @@ -339,7 +346,8 @@ static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable) > > /* Save the bytes per pixel of the sink */ > vpix = vimc_pix_map_by_code(vsca->sink_fmt.code); > - vsca->bpp = vpix->bpp; > + vinfo = v4l2_format_info(vpix->pixelformat); > + vsca->bpp = vinfo->bpp[0]; > > /* Calculate the width in bytes of the src frame */ > vsca->src_line_size = vsca->crop_rect.width * > diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c > index 32380f504591..849658d0bade 100644 > --- a/drivers/media/platform/vimc/vimc-sensor.c > +++ b/drivers/media/platform/vimc/vimc-sensor.c > @@ -100,12 +100,16 @@ static int vimc_sen_get_fmt(struct v4l2_subdev *sd, > > static void vimc_sen_tpg_s_format(struct vimc_sen_device *vsen) > { > - const struct vimc_pix_map *vpix = > + const struct vimc_pix_map *vpix = > vimc_pix_map_by_code(vsen->mbus_format.code); > + const struct v4l2_format_info *vinfo = > + v4l2_format_info(vpix->pixelformat); > + > There are two new lines here (I throught checkpatch.pl should complain about this). Thanks Helen > tpg_reset_source(&vsen->tpg, vsen->mbus_format.width, > vsen->mbus_format.height, vsen->mbus_format.field); > - tpg_s_bytesperline(&vsen->tpg, 0, vsen->mbus_format.width * vpix->bpp); > + tpg_s_bytesperline(&vsen->tpg, 0, > + vsen->mbus_format.width * vinfo->bpp[0]); > tpg_s_buf_height(&vsen->tpg, vsen->mbus_format.height); > tpg_s_fourcc(&vsen->tpg, vpix->pixelformat); > /* TODO: add support for V4L2_FIELD_ALTERNATE */ > @@ -199,11 +203,13 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable) > > if (enable) { > const struct vimc_pix_map *vpix; > + const struct v4l2_format_info *vinfo; > unsigned int frame_size; > > /* Calculate the frame size */ > vpix = vimc_pix_map_by_code(vsen->mbus_format.code); > - frame_size = vsen->mbus_format.width * vpix->bpp * > + vinfo = v4l2_format_info(vpix->pixelformat); > + frame_size = vsen->mbus_format.width * vinfo->bpp[0] * > vsen->mbus_format.height; > > /* >