- Examine the error code from the screen saver and act accordingly.
0 success EAGAIN try again later other don't call this screen saver again - Test flags consistently to examine the status of the screen saver. scrn_blanked: the screen saver is running scp->status & SAVER_RUNNING: the saver is running in this vty - Correctlyu preserve status flag bits in set/restore_scrn_saver_mdoe().
This commit is contained in:
parent
bc27c8dcdc
commit
6d479db3c3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42748
@ -25,7 +25,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: syscons.c,v 1.290 1999/01/11 03:18:27 yokota Exp $
|
* $Id: syscons.c,v 1.291 1999/01/13 01:14:26 yokota Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
@ -162,6 +162,7 @@ static long scrn_time_stamp;
|
|||||||
static int saver_mode = CONS_LKM_SAVER; /* LKM/user saver */
|
static int saver_mode = CONS_LKM_SAVER; /* LKM/user saver */
|
||||||
static int run_scrn_saver = FALSE; /* should run the saver? */
|
static int run_scrn_saver = FALSE; /* should run the saver? */
|
||||||
static int scrn_idle = FALSE; /* about to run the saver */
|
static int scrn_idle = FALSE; /* about to run the saver */
|
||||||
|
static int scrn_saver_failed;
|
||||||
u_char scr_map[256];
|
u_char scr_map[256];
|
||||||
u_char scr_rmap[256];
|
u_char scr_rmap[256];
|
||||||
static int initial_video_mode; /* initial video mode # */
|
static int initial_video_mode; /* initial video mode # */
|
||||||
@ -274,7 +275,7 @@ static void scsplash_saver(int show);
|
|||||||
static int add_scrn_saver(void (*this_saver)(int));
|
static int add_scrn_saver(void (*this_saver)(int));
|
||||||
static int remove_scrn_saver(void (*this_saver)(int));
|
static int remove_scrn_saver(void (*this_saver)(int));
|
||||||
static int set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border);
|
static int set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border);
|
||||||
static int restore_scrn_saver_mode(scr_stat *scp);
|
static int restore_scrn_saver_mode(scr_stat *scp, int changemode);
|
||||||
static void stop_scrn_saver(void (*saver)(int));
|
static void stop_scrn_saver(void (*saver)(int));
|
||||||
static int wait_scrn_saver_stop(void);
|
static int wait_scrn_saver_stop(void);
|
||||||
#define scsplash_stick(stick) (sticky_splash = (stick))
|
#define scsplash_stick(stick) (sticky_splash = (stick))
|
||||||
@ -1942,7 +1943,7 @@ sccnupdate(scr_stat *scp)
|
|||||||
if (!run_scrn_saver)
|
if (!run_scrn_saver)
|
||||||
scrn_idle = FALSE;
|
scrn_idle = FALSE;
|
||||||
if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle)
|
if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle)
|
||||||
if (scp->status & SAVER_RUNNING)
|
if (scrn_blanked)
|
||||||
stop_scrn_saver(current_saver);
|
stop_scrn_saver(current_saver);
|
||||||
|
|
||||||
if (scp != cur_console || blink_in_progress || switch_in_progress)
|
if (scp != cur_console || blink_in_progress || switch_in_progress)
|
||||||
@ -2004,8 +2005,6 @@ scrn_timer(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scp = cur_console;
|
|
||||||
|
|
||||||
/* should we stop the screen saver? */
|
/* should we stop the screen saver? */
|
||||||
getmicrouptime(&tv);
|
getmicrouptime(&tv);
|
||||||
if (panicstr || shutdown_in_progress)
|
if (panicstr || shutdown_in_progress)
|
||||||
@ -2019,7 +2018,7 @@ scrn_timer(void *arg)
|
|||||||
run_scrn_saver = TRUE;
|
run_scrn_saver = TRUE;
|
||||||
}
|
}
|
||||||
if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle)
|
if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle)
|
||||||
if (scp->status & SAVER_RUNNING)
|
if (scrn_blanked)
|
||||||
stop_scrn_saver(current_saver);
|
stop_scrn_saver(current_saver);
|
||||||
|
|
||||||
/* should we just return ? */
|
/* should we just return ? */
|
||||||
@ -2031,12 +2030,13 @@ scrn_timer(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update the screen */
|
/* Update the screen */
|
||||||
|
scp = cur_console;
|
||||||
if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING))
|
if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING))
|
||||||
scrn_update(scp, TRUE);
|
scrn_update(scp, TRUE);
|
||||||
|
|
||||||
/* should we activate the screen saver? */
|
/* should we activate the screen saver? */
|
||||||
if ((saver_mode == CONS_LKM_SAVER) && scrn_idle)
|
if ((saver_mode == CONS_LKM_SAVER) && scrn_idle)
|
||||||
if (!ISGRAPHSC(scp) || (scp->status & SAVER_RUNNING))
|
if (!ISGRAPHSC(scp) || scrn_blanked)
|
||||||
(*current_saver)(TRUE);
|
(*current_saver)(TRUE);
|
||||||
|
|
||||||
if (arg)
|
if (arg)
|
||||||
@ -2122,6 +2122,7 @@ scsplash_callback(int event)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SPLASH_INIT:
|
case SPLASH_INIT:
|
||||||
|
scrn_saver_failed = FALSE;
|
||||||
if (add_scrn_saver(scsplash_saver) == 0) {
|
if (add_scrn_saver(scsplash_saver) == 0) {
|
||||||
run_scrn_saver = TRUE;
|
run_scrn_saver = TRUE;
|
||||||
if (cold && !(boothowto & (RB_VERBOSE | RB_CONFIG))) {
|
if (cold && !(boothowto & (RB_VERBOSE | RB_CONFIG))) {
|
||||||
@ -2149,7 +2150,6 @@ static void
|
|||||||
scsplash_saver(int show)
|
scsplash_saver(int show)
|
||||||
{
|
{
|
||||||
static int busy = FALSE;
|
static int busy = FALSE;
|
||||||
static int failed = FALSE;
|
|
||||||
scr_stat *scp;
|
scr_stat *scp;
|
||||||
|
|
||||||
if (busy)
|
if (busy)
|
||||||
@ -2158,21 +2158,27 @@ scsplash_saver(int show)
|
|||||||
|
|
||||||
scp = cur_console;
|
scp = cur_console;
|
||||||
if (show) {
|
if (show) {
|
||||||
if (!failed) {
|
if (!scrn_saver_failed) {
|
||||||
if (!scrn_blanked)
|
if (!scrn_blanked)
|
||||||
set_scrn_saver_mode(scp, -1, NULL, 0);
|
set_scrn_saver_mode(scp, -1, NULL, 0);
|
||||||
if (splash(scp->adp, TRUE) == 0) {
|
switch (splash(scp->adp, TRUE)) {
|
||||||
|
case 0: /* succeeded */
|
||||||
scrn_blanked = TRUE;
|
scrn_blanked = TRUE;
|
||||||
} else {
|
break;
|
||||||
failed = TRUE;
|
case EAGAIN: /* try later */
|
||||||
|
restore_scrn_saver_mode(scp, FALSE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
scrn_saver_failed = TRUE;
|
||||||
scsplash_stick(FALSE);
|
scsplash_stick(FALSE);
|
||||||
printf("scsplash_saver(): failed to put up the image\n");
|
printf("scsplash_saver(): failed to put up the image\n");
|
||||||
restore_scrn_saver_mode(scp);
|
restore_scrn_saver_mode(scp, TRUE);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!sticky_splash) {
|
} else if (!sticky_splash) {
|
||||||
if (scrn_blanked && (splash(scp->adp, FALSE) == 0)) {
|
if (scrn_blanked && (splash(scp->adp, FALSE) == 0)) {
|
||||||
restore_scrn_saver_mode(scp);
|
restore_scrn_saver_mode(scp, TRUE);
|
||||||
scrn_blanked = FALSE;
|
scrn_blanked = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2224,7 +2230,7 @@ set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border)
|
|||||||
s = spltty();
|
s = spltty();
|
||||||
scp->splash_save_mode = scp->mode;
|
scp->splash_save_mode = scp->mode;
|
||||||
scp->splash_save_status = scp->status & (GRAPHICS_MODE | PIXEL_MODE);
|
scp->splash_save_status = scp->status & (GRAPHICS_MODE | PIXEL_MODE);
|
||||||
scp->status &= ~PIXEL_MODE;
|
scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE);
|
||||||
scp->status |= (UNKNOWN_MODE | SAVER_RUNNING);
|
scp->status |= (UNKNOWN_MODE | SAVER_RUNNING);
|
||||||
splx(s);
|
splx(s);
|
||||||
if (mode < 0)
|
if (mode < 0)
|
||||||
@ -2248,7 +2254,7 @@ set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
restore_scrn_saver_mode(scr_stat *scp)
|
restore_scrn_saver_mode(scr_stat *scp, int changemode)
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
int status;
|
int status;
|
||||||
@ -2259,8 +2265,12 @@ restore_scrn_saver_mode(scr_stat *scp)
|
|||||||
mode = scp->mode;
|
mode = scp->mode;
|
||||||
status = scp->status;
|
status = scp->status;
|
||||||
scp->mode = scp->splash_save_mode;
|
scp->mode = scp->splash_save_mode;
|
||||||
scp->status &= ~(UNKNOWN_MODE | GRAPHICS_MODE | SAVER_RUNNING);
|
scp->status &= ~(UNKNOWN_MODE | SAVER_RUNNING);
|
||||||
scp->status |= scp->splash_save_status;
|
scp->status |= scp->splash_save_status;
|
||||||
|
if (!changemode) {
|
||||||
|
splx(s);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (set_mode(scp) == 0) {
|
if (set_mode(scp) == 0) {
|
||||||
load_palette(scp->adp, palette);
|
load_palette(scp->adp, palette);
|
||||||
splx(s);
|
splx(s);
|
||||||
@ -2328,8 +2338,8 @@ switch_scr(scr_stat *scp, u_int next_scr)
|
|||||||
{
|
{
|
||||||
/* delay switch if actively updating screen */
|
/* delay switch if actively updating screen */
|
||||||
if (scrn_blanked || write_in_progress || blink_in_progress) {
|
if (scrn_blanked || write_in_progress || blink_in_progress) {
|
||||||
sc_touch_scrn_saver();
|
|
||||||
delayed_next_scr = next_scr+1;
|
delayed_next_scr = next_scr+1;
|
||||||
|
sc_touch_scrn_saver();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user