Reduce stack size
From: James Simmons <hidden>
Date: 2005-06-06 19:13:14
This patch is against andrew morton's mm2 tree. It works in my local tree but please test and if it is okay I will send it over to Andrew. The purpose is to reduce the amount of data we push on the stack to the buffer alignement functions. Thank you. diff -urN -X /home/jsimmons/dontdiff linux-2.6.12-rc5-mm2-new/drivers/video/console/bitblit.c fbdev-2.6/drivers/video/console/bitblit.c
--- linux-2.6.12-rc5-mm2-new/drivers/video/console/bitblit.c 2005-06-04 14:33:14.000000000 -0700
+++ fbdev-2.6/drivers/video/console/bitblit.c 2005-06-04 10:37:38.000000000 -0700@@ -157,9 +157,9 @@ src = buf; } - fb_sysmove_buf_unaligned(info, &info->pixmap, dst, pitch, - src, idx, image.height, - shift_high, shift_low, mod); + fb_pad_unaligned_buffer(dst, pitch, src, idx, + image.height, shift_high, + shift_low, mod); shift_low += mod; dst += (shift_low >= 8) ? width : width - 1; shift_low &= 7;
@@ -175,8 +175,7 @@ src = buf; } - fb_sysmove_buf_aligned(info, &info->pixmap, dst, pitch, - src, idx, image.height); + fb_pad_aligned_buffer(dst, pitch, src, idx, image.height); dst += width; } }
diff -urN -X /home/jsimmons/dontdiff linux-2.6.12-rc5-mm2-new/drivers/video/fbmem.c fbdev-2.6/drivers/video/fbmem.c
--- linux-2.6.12-rc5-mm2-new/drivers/video/fbmem.c 2005-06-04 14:33:14.000000000 -0700
+++ fbdev-2.6/drivers/video/fbmem.c 2005-06-04 10:37:38.000000000 -0700@@ -78,9 +78,7 @@ /* * Data padding functions. */ -void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, - u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, - u32 height) +void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) { int i;
@@ -90,12 +88,10 @@ dst += d_pitch; } } -EXPORT_SYMBOL(fb_sysmove_buf_aligned); +EXPORT_SYMBOL(fb_pad_aligned_buffer); -void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, - u8 *dst, u32 d_pitch, u8 *src, u32 idx, - u32 height, u32 shift_high, u32 shift_low, - u32 mod) +void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, + u32 shift_high, u32 shift_low, u32 mod) { u8 mask = (u8) (0xfff << shift_high), tmp; int i, j;
@@ -122,7 +118,7 @@ dst += d_pitch; } } -EXPORT_SYMBOL(fb_sysmove_buf_unaligned); +EXPORT_SYMBOL(fb_pad_unaligned_buffer); /* * we need to lock this section since fb_cursor
diff -urN -X /home/jsimmons/dontdiff linux-2.6.12-rc5-mm2-new/drivers/video/nvidia/nvidia.c fbdev-2.6/drivers/video/nvidia/nvidia.c
--- linux-2.6.12-rc5-mm2-new/drivers/video/nvidia/nvidia.c 2005-06-04 14:32:07.000000000 -0700
+++ fbdev-2.6/drivers/video/nvidia/nvidia.c 2005-06-04 10:37:38.000000000 -0700@@ -516,9 +516,9 @@ static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, u16 bg, u16 fg, u32 w, u32 h) { + u32 *data = (u32 *) data8; int i, j, k = 0; u32 b, tmp; - u32 *data = (u32 *) data8; w = (w + 1) & ~1;
@@ -890,11 +890,11 @@ { struct nvidia_par *par = info->par; u8 data[MAX_CURS * MAX_CURS / 8]; - u16 fg, bg; int i, set = cursor->set; - + u16 fg, bg; + if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) - return soft_cursor(info, cursor); + return -ENXIO; NVShowHideCursor(par, 0);
@@ -931,21 +931,18 @@ if (src) { switch (cursor->rop) { case ROP_XOR: - for (i = 0; i < s_pitch * cursor->image.height; - i++) + for (i = 0; i < s_pitch * cursor->image.height; i++) src[i] = dat[i] ^ msk[i]; break; case ROP_COPY: default: - for (i = 0; i < s_pitch * cursor->image.height; - i++) + for (i = 0; i < s_pitch * cursor->image.height; i++) src[i] = dat[i] & msk[i]; break; } - fb_sysmove_buf_aligned(info, &info->pixmap, data, - d_pitch, src, s_pitch, - cursor->image.height); + fb_pad_aligned_buffer(data, d_pitch, src, s_pitch, + cursor->image.height); bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | ((info->cmap.green[bg_idx] & 0xf8) << 2) |
diff -urN -X /home/jsimmons/dontdiff linux-2.6.12-rc5-mm2-new/drivers/video/riva/fbdev.c fbdev-2.6/drivers/video/riva/fbdev.c
--- linux-2.6.12-rc5-mm2-new/drivers/video/riva/fbdev.c 2005-06-04 14:32:07.000000000 -0700
+++ fbdev-2.6/drivers/video/riva/fbdev.c 2005-06-04 10:37:38.000000000 -0700@@ -1582,12 +1582,11 @@ { struct riva_par *par = (struct riva_par *) info->par; u8 data[MAX_CURS * MAX_CURS/8]; - u16 fg, bg; int i, set = cursor->set; - - if (cursor->image.width > MAX_CURS || - cursor->image.height > MAX_CURS) - return soft_cursor(info, cursor); + u16 fg, bg; + + if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) + return -ENXIO; par->riva.ShowHideCursor(&par->riva, 0);
@@ -1625,21 +1624,18 @@ if (src) { switch (cursor->rop) { case ROP_XOR: - for (i = 0; i < s_pitch * cursor->image.height; - i++) + for (i = 0; i < s_pitch * cursor->image.height; i++) src[i] = dat[i] ^ msk[i]; break; case ROP_COPY: default: - for (i = 0; i < s_pitch * cursor->image.height; - i++) + for (i = 0; i < s_pitch * cursor->image.height; i++) src[i] = dat[i] & msk[i]; break; } - fb_sysmove_buf_aligned(info, &info->pixmap, data, - d_pitch, src, s_pitch, - cursor->image.height); + fb_pad_aligned_buffer(data, d_pitch, src, s_pitch, + cursor->image.height); bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | ((info->cmap.green[bg_idx] & 0xf8) << 2) |
diff -urN -X /home/jsimmons/dontdiff linux-2.6.12-rc5-mm2-new/drivers/video/softcursor.c fbdev-2.6/drivers/video/softcursor.c
--- linux-2.6.12-rc5-mm2-new/drivers/video/softcursor.c 2005-06-04 14:33:14.000000000 -0700
+++ fbdev-2.6/drivers/video/softcursor.c 2005-06-04 10:37:38.000000000 -0700@@ -58,13 +58,10 @@ } else memcpy(src, image->data, dsize); - fb_sysmove_buf_aligned(info, &info->pixmap, dst, d_pitch, src, - s_pitch, image->height); - + fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height); image->data = dst; info->fbops->fb_imageblit(info, image); kfree(src); - return 0; } --- linux-2.6.12-rc5-mm2-new/include/linux/fb.h 2005-06-04 14:33:19.000000000 -0700 +++ fbdev-2.6/include/linux/fb.h 2005-06-04 10:37:38.000000000 -0700
@@ -816,12 +816,9 @@ extern int fb_prepare_logo(struct fb_info *fb_info); extern int fb_show_logo(struct fb_info *fb_info); extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); -extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, - u8 *dst, u32 d_pitch, u8 *src, u32 idx, +extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, u32 shift_high, u32 shift_low, u32 mod); -extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, - u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, - u32 height); +extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height); extern void fb_set_suspend(struct fb_info *info, int state); extern int fb_get_color_depth(struct fb_var_screeninfo *var); extern int fb_get_options(char *name, char **option); -------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20