All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix SAA7146_CLIPPING_MEM size
@ 2007-02-16 23:14 Olaf Hering
  2007-02-17  8:33 ` Olaf Hering
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2007-02-16 23:14 UTC (permalink / raw)
  To: Andrew Morton, Mauro Carvalho Chehab, v4l-dvb-maintainer, linux-kernel


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix SAA7146_CLIPPING_MEM size
  2007-02-16 23:14 [PATCH] fix SAA7146_CLIPPING_MEM size Olaf Hering
@ 2007-02-17  8:33 ` Olaf Hering
  0 siblings, 0 replies; 2+ messages in thread
From: Olaf Hering @ 2007-02-17  8:33 UTC (permalink / raw)
  To: Andrew Morton, Mauro Carvalho Chehab, v4l-dvb-maintainer, linux-kernel

On Sat, Feb 17, Olaf Hering wrote:

> So a max array size of 131329 is enough.

Since the referenced array is u32, should it be 4 * 131329?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-17  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16 23:14 [PATCH] fix SAA7146_CLIPPING_MEM size Olaf Hering
2007-02-17  8:33 ` Olaf Hering

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.