public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Andrew Morton <akpm@osdl.org>,
	Mauro Carvalho Chehab <mchehab@linuxtv.org>,
	v4l-dvb-maintainer@linuxtv.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fix SAA7146_CLIPPING_MEM size
Date: Sat, 17 Feb 2007 00:14:25 +0100	[thread overview]
Message-ID: <20070216231425.GA11836@aepfle.de> (raw)


Limit the pci_alloc_consistent size to 128K
PAGE_SIZE can be 64K, which leads to a 896K allocation.

calculate_clipping_registers_rect() uses not more than 257 bytes
because saa7146_video.c:s_fmt limits ov.nclips to 16

But bttv-driver.c does not allow up to 2048 clips in win->clipcount
btcx_screen_clips() may add 4 more clips.

So a max array size of 131329 is enough.
Right now only 56K get allocated.


Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 include/media/saa7146_vv.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/include/media/saa7146_vv.h
===================================================================
--- linux-2.6.orig/include/media/saa7146_vv.h
+++ linux-2.6/include/media/saa7146_vv.h
@@ -239,7 +239,8 @@ void saa7146_res_free(struct saa7146_fh 
 #define SAA7146_HPS_SYNC_PORT_B		0x01
 
 /* some memory sizes */
-#define SAA7146_CLIPPING_MEM	(14*PAGE_SIZE)
+/* see saa7146_hlp.c:calculate_clipping_registers_rect and bttv-driver.c:setup_window */
+#define SAA7146_CLIPPING_MEM	( ( ( 2048 + 4 ) * ( 2 * (2 * 16) ) ) + 1 )
 
 /* some defines for the various clipping-modes */
 #define SAA7146_CLIPPING_RECT		0x4

             reply	other threads:[~2007-02-16 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 23:14 Olaf Hering [this message]
2007-02-17  8:33 ` [PATCH] fix SAA7146_CLIPPING_MEM size Olaf Hering

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=20070216231425.GA11836@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@linuxtv.org \
    --cc=v4l-dvb-maintainer@linuxtv.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