This is for the screen burner, which turns off the screen after

        # wsconsctl -n display.screen_off
        60000

milliseconds (60 seconds) as documented in wsconsctl.conf(5).

Trivial conversion from ticks to milliseconds where macros already
come in milliseconds and timeout values only need reduction by hz
to use the new API.

Tested on a X250 as well as a PowerBook G4 both with xenodm stopped,
where setting it to 3000 makes the screen turn off reliably after three
seconds.

OK?

Index: sys/dev/wscons//wsdisplay.c
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.132
diff -u -p -r1.132 wsdisplay.c
--- sys/dev/wscons//wsdisplay.c 4 May 2019 11:34:48 -0000       1.132
+++ sys/dev/wscons//wsdisplay.c 29 Jun 2019 12:07:48 -0000
@@ -162,9 +162,9 @@ struct wsdisplay_softc {
 
 #ifdef HAVE_BURNER_SUPPORT
        struct timeout sc_burner;
-       int     sc_burnoutintvl;        /* delay before blanking */
-       int     sc_burninintvl;         /* delay before unblanking */
-       int     sc_burnout;             /* current sc_burner delay */
+       int     sc_burnoutintvl;        /* delay before blanking (milliseconds) 
*/
+       int     sc_burninintvl;         /* delay before unblanking 
(milliseconds) */
+       int     sc_burnout;             /* current sc_burner delay 
(milliseconds) */
        int     sc_burnman;             /* nonzero if screen blanked */
        int     sc_burnflags;
 #endif
@@ -766,8 +766,8 @@ wsdisplay_common_attach(struct wsdisplay
                wsdisplay_addscreen_print(sc, start, i-start);
 
 #ifdef HAVE_BURNER_SUPPORT
-       sc->sc_burnoutintvl = (hz * WSDISPLAY_DEFBURNOUT) / 1000;
-       sc->sc_burninintvl = (hz * WSDISPLAY_DEFBURNIN) / 1000;
+       sc->sc_burnoutintvl = WSDISPLAY_DEFBURNOUT_MSEC;
+       sc->sc_burninintvl = WSDISPLAY_DEFBURNIN_MSEC;
        sc->sc_burnflags = WSDISPLAY_BURN_OUTPUT | WSDISPLAY_BURN_KBD |
            WSDISPLAY_BURN_MOUSE;
        timeout_set(&sc->sc_burner, wsdisplay_burner, sc);
@@ -1196,8 +1196,8 @@ wsdisplay_internal_ioctl(struct wsdispla
 
        case WSDISPLAYIO_GBURNER:
 #define d ((struct wsdisplay_burner *)data)
-               d->on  = sc->sc_burninintvl  * 1000 / hz;
-               d->off = sc->sc_burnoutintvl * 1000 / hz;
+               d->on  = sc->sc_burninintvl;
+               d->off = sc->sc_burnoutintvl;
                d->flags = sc->sc_burnflags;
                return (0);
 
@@ -1223,7 +1223,7 @@ wsdisplay_internal_ioctl(struct wsdispla
                        active = scr;
 
                if (d->on) {
-                       sc->sc_burninintvl = hz * d->on / 1000;
+                       sc->sc_burninintvl = d->on;
                        if (sc->sc_burnman) {
                                sc->sc_burnout = sc->sc_burninintvl;
                                /* reinit timeout if changed */
@@ -1232,7 +1232,7 @@ wsdisplay_internal_ioctl(struct wsdispla
                        }
                }
                if (d->off) {
-                       sc->sc_burnoutintvl = hz * d->off / 1000;
+                       sc->sc_burnoutintvl = d->off;
                        if (!sc->sc_burnman) {
                                sc->sc_burnout = sc->sc_burnoutintvl;
                                /* reinit timeout if changed */
@@ -2332,7 +2332,7 @@ wsdisplay_burn(void *v, u_int flags)
            WSDISPLAY_BURN_KBD | WSDISPLAY_BURN_MOUSE)) &&
            sc->sc_accessops->burn_screen) {
                if (sc->sc_burnout)
-                       timeout_add(&sc->sc_burner, sc->sc_burnout);
+                       timeout_add_msec(&sc->sc_burner, sc->sc_burnout);
                if (sc->sc_burnman)
                        sc->sc_burnout = 0;
        }
@@ -2350,7 +2350,7 @@ wsdisplay_burner(void *v)
                s = spltty();
                if (sc->sc_burnman) {
                        sc->sc_burnout = sc->sc_burnoutintvl;
-                       timeout_add(&sc->sc_burner, sc->sc_burnout);
+                       timeout_add_msec(&sc->sc_burner, sc->sc_burnout);
                } else
                        sc->sc_burnout = sc->sc_burninintvl;
                sc->sc_burnman = !sc->sc_burnman;
Index: sys/dev/wscons//wsdisplayvar.h
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsdisplayvar.h,v
retrieving revision 1.32
diff -u -p -r1.32 wsdisplayvar.h
--- sys/dev/wscons//wsdisplayvar.h      4 May 2019 11:34:48 -0000       1.32
+++ sys/dev/wscons//wsdisplayvar.h      26 Jun 2019 21:34:44 -0000
@@ -253,6 +253,5 @@ void wsscrollback(void *v, int op);
 /*
  * screen burner
  */
-#define        WSDISPLAY_DEFBURNOUT    0       /* disabled */
-#define        WSDISPLAY_DEFBURNIN     250     /* ms */
-
+#define        WSDISPLAY_DEFBURNOUT_MSEC       0       /* disabled */
+#define        WSDISPLAY_DEFBURNIN_MSEC        250     /* milliseconds */

Reply via email to