aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@pentafluge.infradead.org>2005-06-21 20:17:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 22:07:41 -0400
commitf1ab5dac251bb4514607918b0019a3b3f5f5fb48 (patch)
tree65d7912b1d407b1dc12b9e2f67b4311a153a41e5
parent303b86d9913eca0cbfc3c5cb41e7006f6e13b755 (diff)
[PATCH] fbdev: stack reduction
Shrink the stack when calling the drawing alignment functions. Signed-off-by: James Simmons <jsimmons@www.infradead.org> Cc: "Antonino A. Daplas" <adaplas@hotpop.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/console/bitblit.c9
-rw-r--r--drivers/video/fbmem.c14
-rw-r--r--drivers/video/nvidia/nvidia.c17
-rw-r--r--drivers/video/riva/fbdev.c18
-rw-r--r--drivers/video/softcursor.c5
-rw-r--r--include/linux/fb.h7
6 files changed, 26 insertions, 44 deletions
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index 4eef20790c3e..3c731577fed6 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -157,9 +157,9 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
157 src = buf; 157 src = buf;
158 } 158 }
159 159
160 fb_sysmove_buf_unaligned(info, &info->pixmap, dst, pitch, 160 fb_pad_unaligned_buffer(dst, pitch, src, idx,
161 src, idx, image.height, 161 image.height, shift_high,
162 shift_high, shift_low, mod); 162 shift_low, mod);
163 shift_low += mod; 163 shift_low += mod;
164 dst += (shift_low >= 8) ? width : width - 1; 164 dst += (shift_low >= 8) ? width : width - 1;
165 shift_low &= 7; 165 shift_low &= 7;
@@ -175,8 +175,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
175 src = buf; 175 src = buf;
176 } 176 }
177 177
178 fb_sysmove_buf_aligned(info, &info->pixmap, dst, pitch, 178 fb_pad_aligned_buffer(dst, pitch, src, idx, image.height);
179 src, idx, image.height);
180 dst += width; 179 dst += width;
181 } 180 }
182 } 181 }
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 78907a873493..6f871a8b9058 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -78,9 +78,7 @@ EXPORT_SYMBOL(fb_get_color_depth);
78/* 78/*
79 * Data padding functions. 79 * Data padding functions.
80 */ 80 */
81void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
82 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
83 u32 height)
84{ 82{
85 int i; 83 int i;
86 84
@@ -90,12 +88,10 @@ void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
90 dst += d_pitch; 88 dst += d_pitch;
91 } 89 }
92} 90}
93EXPORT_SYMBOL(fb_sysmove_buf_aligned); 91EXPORT_SYMBOL(fb_pad_aligned_buffer);
94 92
95void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, 93void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
96 u8 *dst, u32 d_pitch, u8 *src, u32 idx, 94 u32 shift_high, u32 shift_low, u32 mod)
97 u32 height, u32 shift_high, u32 shift_low,
98 u32 mod)
99{ 95{
100 u8 mask = (u8) (0xfff << shift_high), tmp; 96 u8 mask = (u8) (0xfff << shift_high), tmp;
101 int i, j; 97 int i, j;
@@ -122,7 +118,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
122 dst += d_pitch; 118 dst += d_pitch;
123 } 119 }
124} 120}
125EXPORT_SYMBOL(fb_sysmove_buf_unaligned); 121EXPORT_SYMBOL(fb_pad_unaligned_buffer);
126 122
127/* 123/*
128 * we need to lock this section since fb_cursor 124 * we need to lock this section since fb_cursor
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 47733f58153b..266ff5d7ac36 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -516,9 +516,9 @@ static struct backlight_controller nvidia_backlight_controller = {
516static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8, 516static void nvidiafb_load_cursor_image(struct nvidia_par *par, u8 * data8,
517 u16 bg, u16 fg, u32 w, u32 h) 517 u16 bg, u16 fg, u32 w, u32 h)
518{ 518{
519 u32 *data = (u32 *) data8;
519 int i, j, k = 0; 520 int i, j, k = 0;
520 u32 b, tmp; 521 u32 b, tmp;
521 u32 *data = (u32 *) data8;
522 522
523 w = (w + 1) & ~1; 523 w = (w + 1) & ~1;
524 524
@@ -890,11 +890,11 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
890{ 890{
891 struct nvidia_par *par = info->par; 891 struct nvidia_par *par = info->par;
892 u8 data[MAX_CURS * MAX_CURS / 8]; 892 u8 data[MAX_CURS * MAX_CURS / 8];
893 u16 fg, bg;
894 int i, set = cursor->set; 893 int i, set = cursor->set;
894 u16 fg, bg;
895 895
896 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS) 896 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
897 return soft_cursor(info, cursor); 897 return -ENXIO;
898 898
899 NVShowHideCursor(par, 0); 899 NVShowHideCursor(par, 0);
900 900
@@ -931,21 +931,18 @@ static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
931 if (src) { 931 if (src) {
932 switch (cursor->rop) { 932 switch (cursor->rop) {
933 case ROP_XOR: 933 case ROP_XOR:
934 for (i = 0; i < s_pitch * cursor->image.height; 934 for (i = 0; i < s_pitch * cursor->image.height; i++)
935 i++)
936 src[i] = dat[i] ^ msk[i]; 935 src[i] = dat[i] ^ msk[i];
937 break; 936 break;
938 case ROP_COPY: 937 case ROP_COPY:
939 default: 938 default:
940 for (i = 0; i < s_pitch * cursor->image.height; 939 for (i = 0; i < s_pitch * cursor->image.height; i++)
941 i++)
942 src[i] = dat[i] & msk[i]; 940 src[i] = dat[i] & msk[i];
943 break; 941 break;
944 } 942 }
945 943
946 fb_sysmove_buf_aligned(info, &info->pixmap, data, 944 fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
947 d_pitch, src, s_pitch, 945 cursor->image.height);
948 cursor->image.height);
949 946
950 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | 947 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
951 ((info->cmap.green[bg_idx] & 0xf8) << 2) | 948 ((info->cmap.green[bg_idx] & 0xf8) << 2) |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index b0c886de0404..7540f60af948 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1582,12 +1582,11 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1582{ 1582{
1583 struct riva_par *par = (struct riva_par *) info->par; 1583 struct riva_par *par = (struct riva_par *) info->par;
1584 u8 data[MAX_CURS * MAX_CURS/8]; 1584 u8 data[MAX_CURS * MAX_CURS/8];
1585 u16 fg, bg;
1586 int i, set = cursor->set; 1585 int i, set = cursor->set;
1586 u16 fg, bg;
1587 1587
1588 if (cursor->image.width > MAX_CURS || 1588 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
1589 cursor->image.height > MAX_CURS) 1589 return -ENXIO;
1590 return soft_cursor(info, cursor);
1591 1590
1592 par->riva.ShowHideCursor(&par->riva, 0); 1591 par->riva.ShowHideCursor(&par->riva, 0);
1593 1592
@@ -1625,21 +1624,18 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1625 if (src) { 1624 if (src) {
1626 switch (cursor->rop) { 1625 switch (cursor->rop) {
1627 case ROP_XOR: 1626 case ROP_XOR:
1628 for (i = 0; i < s_pitch * cursor->image.height; 1627 for (i = 0; i < s_pitch * cursor->image.height; i++)
1629 i++)
1630 src[i] = dat[i] ^ msk[i]; 1628 src[i] = dat[i] ^ msk[i];
1631 break; 1629 break;
1632 case ROP_COPY: 1630 case ROP_COPY:
1633 default: 1631 default:
1634 for (i = 0; i < s_pitch * cursor->image.height; 1632 for (i = 0; i < s_pitch * cursor->image.height; i++)
1635 i++)
1636 src[i] = dat[i] & msk[i]; 1633 src[i] = dat[i] & msk[i];
1637 break; 1634 break;
1638 } 1635 }
1639 1636
1640 fb_sysmove_buf_aligned(info, &info->pixmap, data, 1637 fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
1641 d_pitch, src, s_pitch, 1638 cursor->image.height);
1642 cursor->image.height);
1643 1639
1644 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | 1640 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
1645 ((info->cmap.green[bg_idx] & 0xf8) << 2) | 1641 ((info->cmap.green[bg_idx] & 0xf8) << 2) |
diff --git a/drivers/video/softcursor.c b/drivers/video/softcursor.c
index a6c5ca88d6b0..229c4bc35079 100644
--- a/drivers/video/softcursor.c
+++ b/drivers/video/softcursor.c
@@ -58,13 +58,10 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
58 } else 58 } else
59 memcpy(src, image->data, dsize); 59 memcpy(src, image->data, dsize);
60 60
61 fb_sysmove_buf_aligned(info, &info->pixmap, dst, d_pitch, src, 61 fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
62 s_pitch, image->height);
63
64 image->data = dst; 62 image->data = dst;
65 info->fbops->fb_imageblit(info, image); 63 info->fbops->fb_imageblit(info, image);
66 kfree(src); 64 kfree(src);
67
68 return 0; 65 return 0;
69} 66}
70 67
diff --git a/include/linux/fb.h b/include/linux/fb.h
index e14942805dbd..bc24beeed971 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -816,12 +816,9 @@ extern int unregister_framebuffer(struct fb_info *fb_info);
816extern int fb_prepare_logo(struct fb_info *fb_info); 816extern int fb_prepare_logo(struct fb_info *fb_info);
817extern int fb_show_logo(struct fb_info *fb_info); 817extern int fb_show_logo(struct fb_info *fb_info);
818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 818extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
819extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf, 819extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
820 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
821 u32 height, u32 shift_high, u32 shift_low, u32 mod); 820 u32 height, u32 shift_high, u32 shift_low, u32 mod);
822extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 821extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
823 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
824 u32 height);
825extern void fb_set_suspend(struct fb_info *info, int state); 822extern void fb_set_suspend(struct fb_info *info, int state);
826extern int fb_get_color_depth(struct fb_var_screeninfo *var); 823extern int fb_get_color_depth(struct fb_var_screeninfo *var);
827extern int fb_get_options(char *name, char **option); 824extern int fb_get_options(char *name, char **option);