From: Aivils S. <ai...@us...> - 2004-02-20 07:03:15
|
Update of /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7020/ruby-2.6/drivers/video/console Modified Files: fbcon.c fbcon.h Log Message: sync to 2.6.3 Index: fbcon.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/fbcon.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- fbcon.c 12 Feb 2004 06:33:04 -0000 1.6 +++ fbcon.c 20 Feb 2004 06:52:18 -0000 1.7 @@ -197,10 +197,13 @@ struct fb_info *info = (struct fb_info *) private; /* Test to see if the cursor is erased but still on */ - if (!info || (info->cursor.rop == ROP_COPY)) + if (!info || info->state != FBINFO_STATE_RUNNING || + (info->cursor.rop == ROP_COPY)) return; + acquire_console_sem(); info->cursor.enable ^= 1; info->fbops->fb_cursor(info, &info->cursor); + release_console_sem(); } #if (defined(__arm__) && defined(IRQ_VSYNCPULSE)) || defined(CONFIG_ATARI) || defined(CONFIG_MAC) @@ -227,8 +230,7 @@ struct fb_info *info = (struct fb_info *) dev_addr; schedule_work(&info->queue); - cursor_timer.expires = jiffies + HZ / 5; - add_timer(&cursor_timer); + mod_timer(&cursor_timer, jiffies + HZ/5); } int __init fb_console_setup(char *this_opt) @@ -340,8 +342,6 @@ info->fbops->fb_imageblit(info, image); image->dx += cnt * vc->vc_font.width; count -= cnt; - atomic_dec(&info->pixmap.count); - smp_mb__after_atomic_dec(); } } @@ -380,8 +380,6 @@ info->fbops->fb_imageblit(info, image); image->dx += cnt * vc->vc_font.width; count -= cnt; - atomic_dec(&info->pixmap.count); - smp_mb__after_atomic_dec(); } } @@ -452,8 +450,6 @@ move_buf_aligned(info, dst, src, pitch, width, image.height); info->fbops->fb_imageblit(info, &image); - atomic_dec(&info->pixmap.count); - smp_mb__after_atomic_dec(); } void accel_putcs(struct vc_data *vc, struct fb_info *info, @@ -660,7 +656,7 @@ if (!done && !info->queue.func) { INIT_WORK(&info->queue, fb_flashcursor, info); - cursor_timer.expires = jiffies + HZ / 50; + cursor_timer.expires = jiffies + HZ / 5; cursor_timer.data = (unsigned long ) info; add_timer(&cursor_timer); } @@ -930,6 +926,8 @@ if (!info->fbops->fb_blank && vc->display_fg->vt_blanked) return; + if (info->state != FBINFO_STATE_RUNNING) + return; if (!height || !width) return; @@ -954,6 +952,8 @@ if (!info->fbops->fb_blank && vc->display_fg->vt_blanked) return; + if (info->state != FBINFO_STATE_RUNNING) + return; if (vc->vc_mode != KD_TEXT) return; @@ -969,6 +969,8 @@ if (!info->fbops->fb_blank && vc->display_fg->vt_blanked) return; + if (info->state != FBINFO_STATE_RUNNING) + return; if (vc->vc_mode != KD_TEXT) return; @@ -1812,8 +1814,10 @@ vc->vc_font.height = h; if (vc->vc_hi_font_mask && cnt == 256) { vc->vc_hi_font_mask = 0; - if (vc->vc_can_do_color) + if (vc->vc_can_do_color) { vc->vc_complement_mask >>= 1; + vc->vc_s_complement_mask >>= 1; + } /* ++Edmund: reorder the attribute bits */ if (vc->vc_can_do_color) { @@ -1833,8 +1837,10 @@ } } else if (!vc->vc_hi_font_mask && cnt == 512) { vc->vc_hi_font_mask = 0x100; - if (vc->vc_can_do_color) - vc->vc_complement_mask <<= 1; + if (vc->vc_can_do_color) { + vc->vc_complement_mask >>= 1; + vc->vc_s_complement_mask >>= 1; + } /* ++Edmund: reorder the attribute bits */ { @@ -1982,8 +1988,10 @@ font length must be multiple of 256, at least. And 256 is multiple of 4 */ k = 0; - while (p > new_data) - k += *--(u32 *) p; + while (p > new_data) { + p = (u8 *)((u32 *)p - 1); + k += *(u32 *) p; + } FNTSUM(new_data) = k; /* Check if the same font is on some other console already */ for (i = 0; i < vt->vc_count; i++) { @@ -2246,6 +2254,24 @@ return 0; } +static void fbcon_suspended(struct fb_info *info) +{ + /* Clear cursor, restore saved data */ + info->cursor.enable = 0; + info->fbops->fb_cursor(info, &info->cursor); +} + +static void fbcon_resumed(struct fb_info *info) +{ + struct vt_struct *vt = info->display_fg; + + if (!vt) + return; + + if (vt->fg_console) + update_screen(vt->fg_console); +} + /* * The console `switch' structure for the frame buffer based console */ @@ -2272,14 +2298,19 @@ .con_resize = fbcon_resize, }; -int fbcon_add(int unit, int vc_count) +int fbcon_add(struct fb_info *info) { const char *display_desc = NULL; struct vt_struct *vt; struct vc_data *vc; + int unit; + + for(unit = 0; unit < num_registered_fb; unit++) + if (registered_fb[unit] == info) + break; if(vt2fb[unit] == TAKE_OVER_CONSOLE) { - admin_vt->data_hook = (void *)registered_fb[unit]; + admin_vt->data_hook = (void *)info; take_over_console(admin_vt, &fb_con); return 0; } @@ -2300,8 +2331,8 @@ vt->default_mode = vc; vt->vt_kmalloced = 1; vt->vt_sw = &fb_con; - vt->data_hook = (void *)registered_fb[unit]; - display_desc = vt_map_display(vt, 1, vc_count); + vt->data_hook = (void *)info; + display_desc = vt_map_display(vt, 1, vt2fb[unit]); if (!display_desc) { kfree(vt); kfree(vc); @@ -2316,6 +2347,33 @@ return 0; } +static int fbcon_event_notify(struct notifier_block *self, + unsigned long action, void *data) +{ + struct fb_info *info = (struct fb_info *) data; + + switch(action) { + case FB_EVENT_SUSPEND: + fbcon_suspended(info); + break; + case FB_EVENT_RESUME: + fbcon_resumed(info); + break; + case FB_EVENT_ADD_CONSOLE: + fbcon_add(info); + break; + case FB_EVENT_DELETE_CONSOLE: + break; + } + return 0; +} + +static struct notifier_block fbcon_event_notifer = { + .notifier_call = fbcon_event_notify, +}; + +static int fbcon_event_notifier_registered; + int __init fb_console_init(void) { int unit; @@ -2323,23 +2381,35 @@ if(!vt2fb[0]) vt2fb[0] = TAKE_OVER_CONSOLE; - for(unit = 1; unit < num_registered_fb; unit++) + for(unit = 1; unit < FB_MAX; unit++) if(!vt2fb[unit]) vt2fb[unit] = MAX_NR_USER_CONSOLES; - fb_console_active(1); if (!num_registered_fb) return -ENODEV; for(unit = 0; unit < num_registered_fb; unit++) - fbcon_add(unit, vt2fb[unit]); + fbcon_add(registered_fb[unit]); + + acquire_console_sem(); + if (!fbcon_event_notifier_registered) { + fb_register_client(&fbcon_event_notifer); + fbcon_event_notifier_registered = 1; + } + release_console_sem(); + return 0; } void __exit fb_console_exit(void) { + acquire_console_sem(); + if (fbcon_event_notifier_registered) { + fb_unregister_client(&fbcon_event_notifer); + fbcon_event_notifier_registered = 0; + } + release_console_sem(); // give_up_console(&fb_con); - fb_console_active(0); } module_init(fb_console_init); Index: fbcon.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/ruby-2.6/drivers/video/console/fbcon.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- fbcon.h 12 Feb 2004 06:33:04 -0000 1.2 +++ fbcon.h 20 Feb 2004 06:52:18 -0000 1.3 @@ -106,9 +106,5 @@ extern int fb_console_init(void); extern const struct consw fb_con; -extern int fbcon_add(int unit, int vc_count); - -/* drivers/video/fbmem.c */ -extern void fb_console_active(int active); #endif /* _VIDEO_FBCON_H */ |