* [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment
@ 2009-12-09 13:16 Magnus Damm
2009-12-10 13:06 ` Guennadi Liakhovetski
0 siblings, 1 reply; 3+ messages in thread
From: Magnus Damm @ 2009-12-09 13:16 UTC (permalink / raw)
To: linux-media; +Cc: hverkuil, Magnus Damm, m-karicheri2, g.liakhovetski, mchehab
From: Magnus Damm <damm@opensource.se>
This patch updates the SuperH Mobile CEU driver to
not page align the frame size. Useful in the case of
USERPTR with non-page aligned frame sizes and offsets.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
drivers/media/video/sh_mobile_ceu_camera.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- 0010/drivers/media/video/sh_mobile_ceu_camera.c
+++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-12-09 17:54:37.000000000 +0900
@@ -199,14 +199,13 @@ static int sh_mobile_ceu_videobuf_setup(
struct sh_mobile_ceu_dev *pcdev = ici->priv;
int bytes_per_pixel = (icd->current_fmt->depth + 7) >> 3;
- *size = PAGE_ALIGN(icd->user_width * icd->user_height *
- bytes_per_pixel);
+ *size = icd->user_width * icd->user_height * bytes_per_pixel;
if (0 == *count)
*count = 2;
if (pcdev->video_limit) {
- while (*size * *count > pcdev->video_limit)
+ while (PAGE_ALIGN(*size) * *count > pcdev->video_limit)
(*count)--;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment
2009-12-09 13:16 [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment Magnus Damm
@ 2009-12-10 13:06 ` Guennadi Liakhovetski
2009-12-11 3:26 ` Magnus Damm
0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2009-12-10 13:06 UTC (permalink / raw)
To: Magnus Damm
Cc: Linux Media Mailing List, Hans Verkuil, m-karicheri2,
Mauro Carvalho Chehab
On Wed, 9 Dec 2009, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> This patch updates the SuperH Mobile CEU driver to
> not page align the frame size. Useful in the case of
> USERPTR with non-page aligned frame sizes and offsets.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
>
> drivers/media/video/sh_mobile_ceu_camera.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> --- 0010/drivers/media/video/sh_mobile_ceu_camera.c
> +++ work/drivers/media/video/sh_mobile_ceu_camera.c 2009-12-09 17:54:37.000000000 +0900
> @@ -199,14 +199,13 @@ static int sh_mobile_ceu_videobuf_setup(
> struct sh_mobile_ceu_dev *pcdev = ici->priv;
> int bytes_per_pixel = (icd->current_fmt->depth + 7) >> 3;
>
> - *size = PAGE_ALIGN(icd->user_width * icd->user_height *
> - bytes_per_pixel);
> + *size = icd->user_width * icd->user_height * bytes_per_pixel;
>
> if (0 == *count)
> *count = 2;
>
> if (pcdev->video_limit) {
> - while (*size * *count > pcdev->video_limit)
> + while (PAGE_ALIGN(*size) * *count > pcdev->video_limit)
> (*count)--;
> }
Please, correct me if I'm wrong. Currently most (all?) sh platforms, using
this driver, and wishing to use V4L2_MEMORY_MMAP, reserve contiguous
memory in their platform code. In this case pcdev->video_limit is set to
the size of that area. videobuf-dma-contig.c::__videobuf_mmap_mapper()
will anyway allocate page-aligned buffers for V4L2_MEMORY_MMAP, so, even
for the case of a platform, not reserving RAM at boot-time, it should
work. Similarly it should work for the V4L2_MEMORY_USERPTR case. So, looks
ok to me, queued, thanks.
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment
2009-12-10 13:06 ` Guennadi Liakhovetski
@ 2009-12-11 3:26 ` Magnus Damm
0 siblings, 0 replies; 3+ messages in thread
From: Magnus Damm @ 2009-12-11 3:26 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Linux Media Mailing List, Hans Verkuil, m-karicheri2,
Mauro Carvalho Chehab
On Thu, Dec 10, 2009 at 10:06 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> On Wed, 9 Dec 2009, Magnus Damm wrote:
>
>> From: Magnus Damm <damm@opensource.se>
>>
>> This patch updates the SuperH Mobile CEU driver to
>> not page align the frame size. Useful in the case of
>> USERPTR with non-page aligned frame sizes and offsets.
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>
> Please, correct me if I'm wrong. Currently most (all?) sh platforms, using
> this driver, and wishing to use V4L2_MEMORY_MMAP, reserve contiguous
> memory in their platform code. In this case pcdev->video_limit is set to
> the size of that area. videobuf-dma-contig.c::__videobuf_mmap_mapper()
> will anyway allocate page-aligned buffers for V4L2_MEMORY_MMAP, so, even
> for the case of a platform, not reserving RAM at boot-time, it should
> work. Similarly it should work for the V4L2_MEMORY_USERPTR case. So, looks
> ok to me, queued, thanks.
Correct. On SuperH Mobile the amount of reserved physically contiguous
memory for the CEU can be overridden on the kernel command line, and
in the case of systems only using USERPTR it is wise to set it to the
reserved memory to zero since the memory will be unused anyway when
the V4L2 buffers come from elsewhere.
If there is no physically contiguous memory reserved for the CEU and
V4L2 MMAP is used then there is a risk of physically contiguous memory
allocation failure due to memory fragmentation. Nothing out of the
ordinary, to play it safe just reserve physically contiguous memory
during boot up time and be done with it.
/ magnus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-11 3:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 13:16 [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment Magnus Damm
2009-12-10 13:06 ` Guennadi Liakhovetski
2009-12-11 3:26 ` Magnus Damm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox