Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/vt/vt_cpulogos.c
Show All 29 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/cons.h> | #include <sys/cons.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/taskqueue.h> | |||||
#include <sys/terminal.h> | #include <sys/terminal.h> | ||||
#include <dev/vt/vt.h> | #include <dev/vt/vt.h> | ||||
extern const unsigned char vt_beastie_vga16[]; | extern const unsigned char vt_beastie_vga16[]; | ||||
extern const unsigned char vt_beastie2_vga16[]; | extern const unsigned char vt_beastie2_vga16[]; | ||||
extern const unsigned char vt_orb_vga16[]; | extern const unsigned char vt_orb_vga16[]; | ||||
static struct callout vt_splash_cpu_callout; | static struct timeout_task vt_splash_cpu_fini_task; | ||||
static inline unsigned char | static inline unsigned char | ||||
vt_vga2bsd(unsigned char vga) | vt_vga2bsd(unsigned char vga) | ||||
{ | { | ||||
static const unsigned char lut[8] = { | static const unsigned char lut[8] = { | ||||
0, | 0, | ||||
4, /* 1 and 4 swap */ | 4, /* 1 and 4 swap */ | ||||
2, | 2, | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | else if (vd->vd_driver->vd_blank) | ||||
vd->vd_driver->vd_blank(vd, a->ta_bgcolor); | vd->vd_driver->vd_blank(vd, a->ta_bgcolor); | ||||
ncpu = MIN(ncpu, vd->vd_width / vt_logo_sprite_width); | ncpu = MIN(ncpu, vd->vd_width / vt_logo_sprite_width); | ||||
for (i = 0, left = 0; i < ncpu; left += vt_logo_sprite_width, i++) | for (i = 0, left = 0; i < ncpu; left += vt_logo_sprite_width, i++) | ||||
vt_draw_1_logo(vd, 0, left); | vt_draw_1_logo(vd, 0, left); | ||||
} | } | ||||
static void | static void | ||||
vt_fini_logos(void *dummy __unused) | vt_fini_logos(void *dummy __unused, int pending __unused) | ||||
{ | { | ||||
struct vt_device *vd; | struct vt_device *vd; | ||||
struct vt_window *vw; | struct vt_window *vw; | ||||
struct terminal *tm; | struct terminal *tm; | ||||
struct vt_font *vf; | struct vt_font *vf; | ||||
struct winsize wsz; | struct winsize wsz; | ||||
term_pos_t size; | term_pos_t size; | ||||
unsigned int i; | unsigned int i; | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | vt_init_logos(void *dummy) | ||||
VT_LOCK(vd); | VT_LOCK(vd); | ||||
vt_compute_drawable_area(vw); | vt_compute_drawable_area(vw); | ||||
if (vd->vd_curwindow == vw) { | if (vd->vd_curwindow == vw) { | ||||
vd->vd_flags |= VDF_INVALID; | vd->vd_flags |= VDF_INVALID; | ||||
vt_resume_flush_timer(vw, 0); | vt_resume_flush_timer(vw, 0); | ||||
} | } | ||||
callout_init(&vt_splash_cpu_callout, 1); | TIMEOUT_TASK_INIT(taskqueue_thread, &vt_splash_cpu_fini_task, 0, | ||||
callout_reset(&vt_splash_cpu_callout, vt_splash_cpu_duration * hz, | |||||
vt_fini_logos, NULL); | vt_fini_logos, NULL); | ||||
taskqueue_enqueue_timeout(taskqueue_thread, &vt_splash_cpu_fini_task, | |||||
emaste: As an aside I wonder if we have a preference for `taskqueue_enqueue_timeout_sbt` now (and… | |||||
Done Inline ActionsGenerally yes, so that regular tasks can be scheduled with appropriate precision. Here it doesn't really matter since the task runs only once. markj: Generally yes, so that regular tasks can be scheduled with appropriate precision. Here it… | |||||
vt_splash_cpu_duration * hz); | |||||
out: | out: | ||||
VT_UNLOCK(vd); | VT_UNLOCK(vd); | ||||
} | } | ||||
SYSINIT(vt_logos, SI_SUB_CPU + 1, SI_ORDER_ANY, vt_init_logos, NULL); | SYSINIT(vt_logos, SI_SUB_TASKQ, SI_ORDER_ANY, vt_init_logos, NULL); |
As an aside I wonder if we have a preference for taskqueue_enqueue_timeout_sbt now (and vt_splash_cpu_duration * SBT_1S)