Commit f1ab5dac authored by James Simmons's avatar James Simmons Committed by Linus Torvalds

[PATCH] fbdev: stack reduction

Shrink the stack when calling the drawing alignment functions.
Signed-off-by: default avatarJames Simmons <jsimmons@www.infradead.org>
Cc: "Antonino A. Daplas" <adaplas@hotpop.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 303b86d9
...@@ -157,9 +157,9 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info, ...@@ -157,9 +157,9 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
src = buf; src = buf;
} }
fb_sysmove_buf_unaligned(info, &info->pixmap, dst, pitch, fb_pad_unaligned_buffer(dst, pitch, src, idx,
src, idx, image.height, image.height, shift_high,
shift_high, shift_low, mod); shift_low, mod);
shift_low += mod; shift_low += mod;
dst += (shift_low >= 8) ? width : width - 1; dst += (shift_low >= 8) ? width : width - 1;
shift_low &= 7; shift_low &= 7;
...@@ -175,8 +175,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info, ...@@ -175,8 +175,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
src = buf; src = buf;
} }
fb_sysmove_buf_aligned(info, &info->pixmap, dst, pitch, fb_pad_aligned_buffer(dst, pitch, src, idx, image.height);
src, idx, image.height);
dst += width; dst += width;
} }
} }
......
...@@ -78,9 +78,7 @@ EXPORT_SYMBOL(fb_get_color_depth); ...@@ -78,9 +78,7 @@ EXPORT_SYMBOL(fb_get_color_depth);
/* /*
* Data padding functions. * Data padding functions.
*/ */
void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
u32 height)
{ {
int i; int i;
...@@ -90,12 +88,10 @@ void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, ...@@ -90,12 +88,10 @@ void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
dst += d_pitch; 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, void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 shift_high, u32 shift_low, u32 mod)
u32 height, u32 shift_high, u32 shift_low,
u32 mod)
{ {
u8 mask = (u8) (0xfff << shift_high), tmp; u8 mask = (u8) (0xfff << shift_high), tmp;
int i, j; int i, j;
...@@ -122,7 +118,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, ...@@ -122,7 +118,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
dst += d_pitch; dst += d_pitch;
} }
} }
EXPORT_SYMBOL(fb_sysmove_buf_unaligned); EXPORT_SYMBOL(fb_pad_unaligned_buffer);
/* /*
* we need to lock this section since fb_cursor * we need to lock this section since fb_cursor
......
...@@ -516,9 +516,9 @@ static struct backlight_controller nvidia_backlight_controller = { ...@@ -516,9 +516,9 @@ static struct backlight_controller nvidia_backlight_controller = {
static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8,
u16 bg, u16 fg, u32 w, u32 h) u16 bg, u16 fg, u32 w, u32 h)
{ {
u32 *data = (u32 *) data8;
int i, j, k = 0; int i, j, k = 0;
u32 b, tmp; u32 b, tmp;
u32 *data = (u32 *) data8;
w = (w + 1) & ~1; w = (w + 1) & ~1;
...@@ -890,11 +890,11 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -890,11 +890,11 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ {
struct nvidia_par *par = info->par; struct nvidia_par *par = info->par;
u8 data[MAX_CURS * MAX_CURS / 8]; u8 data[MAX_CURS * MAX_CURS / 8];
u16 fg, bg;
int i, set = cursor->set; int i, set = cursor->set;
u16 fg, bg;
if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
return soft_cursor(info, cursor); return -ENXIO;
NVShowHideCursor(par, 0); NVShowHideCursor(par, 0);
...@@ -931,20 +931,17 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -931,20 +931,17 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
if (src) { if (src) {
switch (cursor->rop) { switch (cursor->rop) {
case ROP_XOR: case ROP_XOR:
for (i = 0; i < s_pitch * cursor->image.height; for (i = 0; i < s_pitch * cursor->image.height; i++)
i++)
src[i] = dat[i] ^ msk[i]; src[i] = dat[i] ^ msk[i];
break; break;
case ROP_COPY: case ROP_COPY:
default: default:
for (i = 0; i < s_pitch * cursor->image.height; for (i = 0; i < s_pitch * cursor->image.height; i++)
i++)
src[i] = dat[i] & msk[i]; src[i] = dat[i] & msk[i];
break; break;
} }
fb_sysmove_buf_aligned(info, &info->pixmap, data, fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
d_pitch, src, s_pitch,
cursor->image.height); cursor->image.height);
bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
......
...@@ -1582,12 +1582,11 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1582,12 +1582,11 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ {
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
u8 data[MAX_CURS * MAX_CURS/8]; u8 data[MAX_CURS * MAX_CURS/8];
u16 fg, bg;
int i, set = cursor->set; int i, set = cursor->set;
u16 fg, bg;
if (cursor->image.width > MAX_CURS || if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
cursor->image.height > MAX_CURS) return -ENXIO;
return soft_cursor(info, cursor);
par->riva.ShowHideCursor(&par->riva, 0); par->riva.ShowHideCursor(&par->riva, 0);
...@@ -1625,20 +1624,17 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1625,20 +1624,17 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
if (src) { if (src) {
switch (cursor->rop) { switch (cursor->rop) {
case ROP_XOR: case ROP_XOR:
for (i = 0; i < s_pitch * cursor->image.height; for (i = 0; i < s_pitch * cursor->image.height; i++)
i++)
src[i] = dat[i] ^ msk[i]; src[i] = dat[i] ^ msk[i];
break; break;
case ROP_COPY: case ROP_COPY:
default: default:
for (i = 0; i < s_pitch * cursor->image.height; for (i = 0; i < s_pitch * cursor->image.height; i++)
i++)
src[i] = dat[i] & msk[i]; src[i] = dat[i] & msk[i];
break; break;
} }
fb_sysmove_buf_aligned(info, &info->pixmap, data, fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
d_pitch, src, s_pitch,
cursor->image.height); cursor->image.height);
bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
......
...@@ -58,13 +58,10 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -58,13 +58,10 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
} else } else
memcpy(src, image->data, dsize); memcpy(src, image->data, dsize);
fb_sysmove_buf_aligned(info, &info->pixmap, dst, d_pitch, src, fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
s_pitch, image->height);
image->data = dst; image->data = dst;
info->fbops->fb_imageblit(info, image); info->fbops->fb_imageblit(info, image);
kfree(src); kfree(src);
return 0; return 0;
} }
......
...@@ -816,12 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info); ...@@ -816,12 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info);
extern int fb_prepare_logo(struct fb_info *fb_info); extern int fb_prepare_logo(struct fb_info *fb_info);
extern int fb_show_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 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, extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
u8 *dst, u32 d_pitch, u8 *src, u32 idx,
u32 height, u32 shift_high, u32 shift_low, u32 mod); u32 height, u32 shift_high, u32 shift_low, u32 mod);
extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
u32 height);
extern void fb_set_suspend(struct fb_info *info, int state); 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_color_depth(struct fb_var_screeninfo *var);
extern int fb_get_options(char *name, char **option); extern int fb_get_options(char *name, char **option);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment