Message ID | 20091209131624.8044.18187.sendpatchset@rxone.opensource.se (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-path: <linux-media-owner@vger.kernel.org> Envelope-to: mchehab@infradead.org Delivery-date: Wed, 09 Dec 2009 13:22:08 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for <mchehab@localhost> (single-drop); Wed, 09 Dec 2009 11:22:37 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NIMUa-0005b9-Dy; Wed, 09 Dec 2009 13:22:08 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755737AbZLINV7 (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Wed, 9 Dec 2009 08:21:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755788AbZLINV6 (ORCPT <rfc822;linux-media-outgoing>); Wed, 9 Dec 2009 08:21:58 -0500 Received: from mail-yw0-f198.google.com ([209.85.211.198]:56170 "EHLO mail-yw0-f198.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755691AbZLINV6 (ORCPT <rfc822; linux-media@vger.kernel.org>); Wed, 9 Dec 2009 08:21:58 -0500 Received: by ywh36 with SMTP id 36so6513681ywh.15 for <linux-media@vger.kernel.org>; Wed, 09 Dec 2009 05:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=UeoV0xFCKmwPrkKgup18uvTMjPxPNKua2xHDabNQ+Do=; b=fc14aW0+qrgRfKtAnJWYwdF4PlCp/s0bfAGXyBw3tadGt1uCvmHiclqmlw1uDhTYHw DDkDo9ZUsTr0A5qrqVPI26Tn2nrUvLKrk1EjNuwN58eGLkMeYb1z5wtTc7PYiWCubapX mZLEDM1G5a/9ZJl3Ir62YYB5H6tNyTvI0LLsw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=RtPaJd9UcMpXw10JACafYwk7lyK32DMIU6pVLeZrWZCu/nr2D2uUpqr5HOmCNpq1U4 6mX3Mx9IqdWExXEaDAQ7GVkxjZ1yoGTqjpzMWh4heZp2rmJxlQOf9JAvdwnkgN5N9mfb TCyPs3oola5CDJiY6QQIGFZVLgVLKwLeumGhI= Received: by 10.150.243.5 with SMTP id q5mr16432718ybh.13.1260364924672; Wed, 09 Dec 2009 05:22:04 -0800 (PST) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 4sm3487675yxd.52.2009.12.09.05.22.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Dec 2009 05:22:04 -0800 (PST) From: Magnus Damm <magnus.damm@gmail.com> To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, Magnus Damm <magnus.damm@gmail.com>, m-karicheri2@ti.com, g.liakhovetski@gmx.de, mchehab@infradead.org Date: Wed, 09 Dec 2009 22:16:24 +0900 Message-Id: <20091209131624.8044.18187.sendpatchset@rxone.opensource.se> Subject: [PATCH] sh_mobile_ceu_camera: Remove frame size page alignment Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Magnus Damm
Dec. 9, 2009, 1:16 p.m. UTC
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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Comments
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/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- 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)--; }