aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r--drivers/video/fbmem.c77
1 files changed, 13 insertions, 64 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 7705070191d9..2222de6ad844 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -76,70 +76,22 @@ int fb_get_color_depth(struct fb_var_screeninfo *var)
76EXPORT_SYMBOL(fb_get_color_depth); 76EXPORT_SYMBOL(fb_get_color_depth);
77 77
78/* 78/*
79 * Drawing helpers. 79 * Data padding functions.
80 */ 80 */
81void fb_iomove_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
87 for (i = height; i--; ) { 85 for (i = height; i--; ) {
88 buf->outbuf(info, dst, src, s_pitch); 86 memcpy(dst, src, s_pitch);
89 src += s_pitch; 87 src += s_pitch;
90 dst += d_pitch; 88 dst += d_pitch;
91 } 89 }
92} 90}
91EXPORT_SYMBOL(fb_pad_aligned_buffer);
93 92
94void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf, 93void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height,
95 u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, 94 u32 shift_high, u32 shift_low, u32 mod)
96 u32 height)
97{
98 int i, j;
99
100 for (i = height; i--; ) {
101 for (j = 0; j < s_pitch; j++)
102 dst[j] = src[j];
103 src += s_pitch;
104 dst += d_pitch;
105 }
106}
107
108void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
109 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
110 u32 height, u32 shift_high, u32 shift_low,
111 u32 mod)
112{
113 u8 mask = (u8) (0xfff << shift_high), tmp;
114 int i, j;
115
116 for (i = height; i--; ) {
117 for (j = 0; j < idx; j++) {
118 tmp = buf->inbuf(info, dst+j);
119 tmp &= mask;
120 tmp |= *src >> shift_low;
121 buf->outbuf(info, dst+j, &tmp, 1);
122 tmp = *src << shift_high;
123 buf->outbuf(info, dst+j+1, &tmp, 1);
124 src++;
125 }
126 tmp = buf->inbuf(info, dst+idx);
127 tmp &= mask;
128 tmp |= *src >> shift_low;
129 buf->outbuf(info, dst+idx, &tmp, 1);
130 if (shift_high < mod) {
131 tmp = *src << shift_high;
132 buf->outbuf(info, dst+idx+1, &tmp, 1);
133 }
134 src++;
135 dst += d_pitch;
136 }
137}
138
139void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
140 u8 *dst, u32 d_pitch, u8 *src, u32 idx,
141 u32 height, u32 shift_high, u32 shift_low,
142 u32 mod)
143{ 95{
144 u8 mask = (u8) (0xfff << shift_high), tmp; 96 u8 mask = (u8) (0xfff << shift_high), tmp;
145 int i, j; 97 int i, j;
@@ -166,6 +118,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
166 dst += d_pitch; 118 dst += d_pitch;
167 } 119 }
168} 120}
121EXPORT_SYMBOL(fb_pad_unaligned_buffer);
169 122
170/* 123/*
171 * we need to lock this section since fb_cursor 124 * we need to lock this section since fb_cursor
@@ -1040,7 +993,7 @@ static struct file_operations fb_fops = {
1040#endif 993#endif
1041}; 994};
1042 995
1043static struct class_simple *fb_class; 996static struct class *fb_class;
1044 997
1045/** 998/**
1046 * register_framebuffer - registers a frame buffer device 999 * register_framebuffer - registers a frame buffer device
@@ -1066,7 +1019,7 @@ register_framebuffer(struct fb_info *fb_info)
1066 break; 1019 break;
1067 fb_info->node = i; 1020 fb_info->node = i;
1068 1021
1069 fb_info->class_device = class_simple_device_add(fb_class, MKDEV(FB_MAJOR, i), 1022 fb_info->class_device = class_device_create(fb_class, MKDEV(FB_MAJOR, i),
1070 fb_info->device, "fb%d", i); 1023 fb_info->device, "fb%d", i);
1071 if (IS_ERR(fb_info->class_device)) { 1024 if (IS_ERR(fb_info->class_device)) {
1072 /* Not fatal */ 1025 /* Not fatal */
@@ -1081,7 +1034,7 @@ register_framebuffer(struct fb_info *fb_info)
1081 fb_info->pixmap.size = FBPIXMAPSIZE; 1034 fb_info->pixmap.size = FBPIXMAPSIZE;
1082 fb_info->pixmap.buf_align = 1; 1035 fb_info->pixmap.buf_align = 1;
1083 fb_info->pixmap.scan_align = 1; 1036 fb_info->pixmap.scan_align = 1;
1084 fb_info->pixmap.access_align = 4; 1037 fb_info->pixmap.access_align = 32;
1085 fb_info->pixmap.flags = FB_PIXMAP_DEFAULT; 1038 fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
1086 } 1039 }
1087 } 1040 }
@@ -1134,7 +1087,7 @@ unregister_framebuffer(struct fb_info *fb_info)
1134 registered_fb[i]=NULL; 1087 registered_fb[i]=NULL;
1135 num_registered_fb--; 1088 num_registered_fb--;
1136 fb_cleanup_class_device(fb_info); 1089 fb_cleanup_class_device(fb_info);
1137 class_simple_device_remove(MKDEV(FB_MAJOR, i)); 1090 class_device_destroy(fb_class, MKDEV(FB_MAJOR, i));
1138 return 0; 1091 return 0;
1139} 1092}
1140 1093
@@ -1197,7 +1150,7 @@ fbmem_init(void)
1197 if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) 1150 if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
1198 printk("unable to get major %d for fb devs\n", FB_MAJOR); 1151 printk("unable to get major %d for fb devs\n", FB_MAJOR);
1199 1152
1200 fb_class = class_simple_create(THIS_MODULE, "graphics"); 1153 fb_class = class_create(THIS_MODULE, "graphics");
1201 if (IS_ERR(fb_class)) { 1154 if (IS_ERR(fb_class)) {
1202 printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class)); 1155 printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class));
1203 fb_class = NULL; 1156 fb_class = NULL;
@@ -1210,7 +1163,7 @@ module_init(fbmem_init);
1210static void __exit 1163static void __exit
1211fbmem_exit(void) 1164fbmem_exit(void)
1212{ 1165{
1213 class_simple_destroy(fb_class); 1166 class_destroy(fb_class);
1214} 1167}
1215 1168
1216module_exit(fbmem_exit); 1169module_exit(fbmem_exit);
@@ -1357,10 +1310,6 @@ EXPORT_SYMBOL(fb_set_var);
1357EXPORT_SYMBOL(fb_blank); 1310EXPORT_SYMBOL(fb_blank);
1358EXPORT_SYMBOL(fb_pan_display); 1311EXPORT_SYMBOL(fb_pan_display);
1359EXPORT_SYMBOL(fb_get_buffer_offset); 1312EXPORT_SYMBOL(fb_get_buffer_offset);
1360EXPORT_SYMBOL(fb_iomove_buf_unaligned);
1361EXPORT_SYMBOL(fb_iomove_buf_aligned);
1362EXPORT_SYMBOL(fb_sysmove_buf_unaligned);
1363EXPORT_SYMBOL(fb_sysmove_buf_aligned);
1364EXPORT_SYMBOL(fb_set_suspend); 1313EXPORT_SYMBOL(fb_set_suspend);
1365EXPORT_SYMBOL(fb_register_client); 1314EXPORT_SYMBOL(fb_register_client);
1366EXPORT_SYMBOL(fb_unregister_client); 1315EXPORT_SYMBOL(fb_unregister_client);