[PATCH] fbdev: prevent drivers that have hardware cursors from calling software curso...
[safe/jmp/linux-2.6] / drivers / video / fbmem.c
index 8cef020..a8eee79 100644 (file)
@@ -76,70 +76,24 @@ int fb_get_color_depth(struct fb_var_screeninfo *var)
 EXPORT_SYMBOL(fb_get_color_depth);
 
 /*
- * Drawing helpers.
+ * Data padding functions.
  */
-void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
-                          u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
-                          u32 height)
-{
-       int i;
-
-       for (i = height; i--; ) {
-               buf->outbuf(info, dst, src, s_pitch);
-               src += s_pitch;
-               dst += d_pitch;
-       }
-}
-
-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, j;
 
        for (i = height; i--; ) {
+               /* s_pitch is a few bytes at the most, memcpy is suboptimal */
                for (j = 0; j < s_pitch; j++)
                        dst[j] = src[j];
                src += s_pitch;
                dst += d_pitch;
        }
 }
+EXPORT_SYMBOL(fb_pad_aligned_buffer);
 
-void fb_iomove_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)
-{
-       u8 mask = (u8) (0xfff << shift_high), tmp;
-       int i, j;
-
-       for (i = height; i--; ) {
-               for (j = 0; j < idx; j++) {
-                       tmp = buf->inbuf(info, dst+j);
-                       tmp &= mask;
-                       tmp |= *src >> shift_low;
-                       buf->outbuf(info, dst+j, &tmp, 1);
-                       tmp = *src << shift_high;
-                       buf->outbuf(info, dst+j+1, &tmp, 1);
-                       src++;
-               }
-               tmp = buf->inbuf(info, dst+idx);
-               tmp &= mask;
-               tmp |= *src >> shift_low;
-               buf->outbuf(info, dst+idx, &tmp, 1);
-               if (shift_high < mod) {
-                       tmp = *src << shift_high;
-                       buf->outbuf(info, dst+idx+1, &tmp, 1);
-               }       
-               src++;
-               dst += d_pitch;
-       }
-}
-
-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;
@@ -166,6 +120,7 @@ void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
                dst += d_pitch;
        }
 }
+EXPORT_SYMBOL(fb_pad_unaligned_buffer);
 
 /*
  * we need to lock this section since fb_cursor
@@ -673,7 +628,7 @@ fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
 int
 fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 {
-       int err;
+       int err, flags = info->flags;
 
        if (var->activate & FB_ACTIVATE_INV_MODE) {
                struct fb_videomode mode1, mode2;
@@ -727,13 +682,15 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
                            !list_empty(&info->modelist))
                                err = fb_add_videomode(&mode, &info->modelist);
 
-                       if (!err && info->flags & FBINFO_MISC_USEREVENT) {
+                       if (!err && (flags & FBINFO_MISC_USEREVENT)) {
                                struct fb_event event;
+                               int evnt = (var->activate & FB_ACTIVATE_ALL) ?
+                                       FB_EVENT_MODE_CHANGE_ALL :
+                                       FB_EVENT_MODE_CHANGE;
 
                                info->flags &= ~FBINFO_MISC_USEREVENT;
                                event.info = info;
-                               notifier_call_chain(&fb_notifier_list,
-                                                   FB_EVENT_MODE_CHANGE,
+                               notifier_call_chain(&fb_notifier_list, evnt,
                                                    &event);
                        }
                }
@@ -1081,7 +1038,7 @@ register_framebuffer(struct fb_info *fb_info)
                        fb_info->pixmap.size = FBPIXMAPSIZE;
                        fb_info->pixmap.buf_align = 1;
                        fb_info->pixmap.scan_align = 1;
-                       fb_info->pixmap.access_align = 4;
+                       fb_info->pixmap.access_align = 32;
                        fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
                }
        }       
@@ -1211,6 +1168,7 @@ static void __exit
 fbmem_exit(void)
 {
        class_destroy(fb_class);
+       unregister_chrdev(FB_MAJOR, "fb");
 }
 
 module_exit(fbmem_exit);
@@ -1357,10 +1315,6 @@ EXPORT_SYMBOL(fb_set_var);
 EXPORT_SYMBOL(fb_blank);
 EXPORT_SYMBOL(fb_pan_display);
 EXPORT_SYMBOL(fb_get_buffer_offset);
-EXPORT_SYMBOL(fb_iomove_buf_unaligned);
-EXPORT_SYMBOL(fb_iomove_buf_aligned);
-EXPORT_SYMBOL(fb_sysmove_buf_unaligned);
-EXPORT_SYMBOL(fb_sysmove_buf_aligned);
 EXPORT_SYMBOL(fb_set_suspend);
 EXPORT_SYMBOL(fb_register_client);
 EXPORT_SYMBOL(fb_unregister_client);