#include <minix/chardriver.h>
#include <minix/drivers.h>
#include <minix/ds.h>
+#include <minix/sysutil.h>
#include <minix/type.h>
#include <minix/vm.h>
#include <sys/ioc_fb.h>
static int do_put_varscreeninfo(int minor, endpoint_t ep, cp_grant_id_t gid);
static int do_get_fixscreeninfo(int minor, endpoint_t ep, cp_grant_id_t gid);
static int do_pan_display(int minor, endpoint_t ep, cp_grant_id_t gid);
+static int keep_displaying_restarted(void);
/* SEF functions and variables. */
static void sef_local_startup(void);
/** Represents the /dev/fb device. */
static struct device fb_device[FB_DEV_NR];
static int fb_minor, has_restarted = 0;
+static u64_t has_restarted_t1, has_restarted_t2;
static int open_counter[FB_DEV_NR]; /* Open count */
open_counter[m->DEVICE]++;
if (!initialized) {
if (has_restarted) {
+ read_frclock_64(&has_restarted_t1);
paint_restartlogo(m->DEVICE);
- has_restarted = 0;
} else {
paint_bootlogo(m->DEVICE);
}
int r;
struct fb_var_screeninfo fbvs_copy;
+ if (has_restarted && keep_displaying_restarted()) {
+ return EAGAIN;
+ }
+
if ((r = sys_safecopyfrom(ep, gid, 0, (vir_bytes) &fbvs_copy,
sizeof(fbvs_copy))) != OK) {
return r;
int r;
struct fb_var_screeninfo fbvs_copy;
+ if (has_restarted && keep_displaying_restarted()) {
+ return EAGAIN;
+ }
+
if ((r = sys_safecopyfrom(ep, gid, 0, (vir_bytes) &fbvs_copy,
sizeof(fbvs_copy))) != OK) {
return r;
return OK;
}
+ if (has_restarted && keep_displaying_restarted()) {
+ return EAGAIN;
+ }
+
return sys_safecopyfrom(ep, (cp_grant_id_t) iov->iov_addr, 0,
(vir_bytes) (dev.dv_base + ex64lo(pos)),
*io_bytes);
return OK;
}
+static int
+keep_displaying_restarted()
+{
+ u64_t delta;
+ u32_t micro_delta;
+
+ read_frclock_64(&has_restarted_t2);
+ delta = delta_frclock_64(has_restarted_t1, has_restarted_t2);
+ micro_delta = frclock_64_to_micros(delta);
+
+#define DISPLAY_1SEC 1000000 /* 1 second in microseconds */
+ if (micro_delta < DISPLAY_1SEC) {
+ return 1;
+ }
+
+ has_restarted = 0;
+ return 0;
+}
+
static void
paint_bootlogo(int minor)
{
{
paint_centered(minor, restartlogo_data, restartlogo_width,
restartlogo_height);
- micro_delay(1 * 1000000); /* 1 second */
}
static void