Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v3 10/9] sh_mobile_ceu_camera: Support user-configurable line stride
Date: Fri, 11 May 2012 00:37:19 +0200	[thread overview]
Message-ID: <2953286.QxYqXLRVN6@avalon> (raw)
In-Reply-To: <Pine.LNX.4.64.1205092355260.8599@axis700.grange>

Hi Guennadi,

On Wednesday 09 May 2012 23:56:49 Guennadi Liakhovetski wrote:
> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> In image mode, the CEU allows configurable line strides up to 8188
> pixels.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> [g.liakhovetski@gmx.de: unify sh_mobile_ceu_set_rect() in data-fetch mode]
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 
> Laurent, are you ok with this version?

It looks good to me, thank you.

>  drivers/media/video/sh_mobile_ceu_camera.c |   33 +++++++++++++------------
>  1 files changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/video/sh_mobile_ceu_camera.c
> b/drivers/media/video/sh_mobile_ceu_camera.c index 79bec15..2ffeb21 100644
> --- a/drivers/media/video/sh_mobile_ceu_camera.c
> +++ b/drivers/media/video/sh_mobile_ceu_camera.c
> @@ -342,19 +342,15 @@ static int sh_mobile_ceu_capture(struct
> sh_mobile_ceu_dev *pcdev)
> 
>  	ceu_write(pcdev, top1, phys_addr_top);
>  	if (V4L2_FIELD_NONE != pcdev->field) {
> -		if (planar)
> -			phys_addr_bottom = phys_addr_top + icd->user_width;
> -		else
> -			phys_addr_bottom = phys_addr_top + icd->bytesperline;
> +		phys_addr_bottom = phys_addr_top + icd->bytesperline;
>  		ceu_write(pcdev, bottom1, phys_addr_bottom);
>  	}
> 
>  	if (planar) {
> -		phys_addr_top += icd->user_width *
> -			icd->user_height;
> +		phys_addr_top += icd->bytesperline * icd->user_height;
>  		ceu_write(pcdev, top2, phys_addr_top);
>  		if (V4L2_FIELD_NONE != pcdev->field) {
> -			phys_addr_bottom = phys_addr_top + icd->user_width;
> +			phys_addr_bottom = phys_addr_top + icd->bytesperline;
>  			ceu_write(pcdev, bottom2, phys_addr_bottom);
>  		}
>  	}
> @@ -681,10 +677,7 @@ static void sh_mobile_ceu_set_rect(struct
> soc_camera_device *icd) in_width *= 2;
>  			left_offset *= 2;
>  		}
> -		cdwdr_width = width;
>  	} else {
> -		int bytes_per_line = soc_mbus_bytes_per_line(width,
> -						icd->current_fmt->host_fmt);
>  		unsigned int w_factor;
> 
>  		switch (icd->current_fmt->host_fmt->packing) {
> @@ -697,13 +690,10 @@ static void sh_mobile_ceu_set_rect(struct
> soc_camera_device *icd)
> 
>  		in_width = cam->width * w_factor;
>  		left_offset *= w_factor;
> -
> -		if (bytes_per_line < 0)
> -			cdwdr_width = width;
> -		else
> -			cdwdr_width = bytes_per_line;
>  	}
> 
> +	cdwdr_width = icd->bytesperline;
> +
>  	height = icd->user_height;
>  	in_height = cam->height;
>  	if (V4L2_FIELD_NONE != pcdev->field) {
> @@ -1848,6 +1838,8 @@ static int sh_mobile_ceu_set_fmt(struct
> soc_camera_device *icd, return 0;
>  }
> 
> +#define CEU_CHDW_MAX	8188U	/* Maximum line stride */
> +
>  static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
>  				 struct v4l2_format *f)
>  {
> @@ -1926,10 +1918,20 @@ static int sh_mobile_ceu_try_fmt(struct
> soc_camera_device *icd, pix->width = width;
>  		if (mf.height > height)
>  			pix->height = height;
> +
> +		pix->bytesperline = max(pix->bytesperline, pix->width);
> +		pix->bytesperline = min(pix->bytesperline, CEU_CHDW_MAX);
> +		pix->bytesperline &= ~3;
> +		break;
> +
> +	default:
> +		/* Configurable stride isn't supported in pass-through mode. */
> +		pix->bytesperline  = 0;
>  	}
> 
>  	pix->width	&= ~3;
>  	pix->height	&= ~3;
> +	pix->sizeimage	= 0;
> 
>  	dev_geo(icd->parent, "%s(): return %d, fmt 0x%x, %ux%u\n",
>  		__func__, ret, pix->pixelformat, pix->width, pix->height);
> @@ -2148,6 +2150,7 @@ static int __devinit sh_mobile_ceu_probe(struct
> platform_device *pdev) pcdev->ici.nr = pdev->id;
>  	pcdev->ici.drv_name = dev_name(&pdev->dev);
>  	pcdev->ici.ops = &sh_mobile_ceu_host_ops;
> +	pcdev->ici.capabilities = SOCAM_HOST_CAP_STRIDE;
> 
>  	pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
>  	if (IS_ERR(pcdev->alloc_ctx)) {
-- 
Regards,

Laurent Pinchart


      reply	other threads:[~2012-05-10 22:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 11:03 [PATCH v2 0/9] soc-camera: Add support for configurable line stride Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 1/9] mx2_camera: Fix sizeimage computation in try_fmt() Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 2/9] soc_camera: Use soc_camera_device::sizeimage to compute buffer sizes Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 3/9] soc_camera: Use soc_camera_device::bytesperline to compute line sizes Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 4/9] soc-camera: Add plane layout information to struct soc_mbus_pixelfmt Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 5/9] soc-camera: Fix bytes per line computation for planar formats Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 6/9] soc-camera: Add soc_mbus_image_size Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 7/9] soc-camera: Honor user-requested bytesperline and sizeimage Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 8/9] mx2_camera: Use soc_mbus_image_size() instead of manual computation Laurent Pinchart
2012-03-21 11:03 ` [PATCH v2 9/9] soc-camera: Support user-configurable line stride Laurent Pinchart
2012-03-21 11:16 ` [PATCH v2 10/9] sh_mobile_ceu_camera: " Laurent Pinchart
2012-05-09 21:56   ` [PATCH v3 " Guennadi Liakhovetski
2012-05-10 22:37     ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2953286.QxYqXLRVN6@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox