Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hpcmips/dev Refresh screen when the system resume.



details:   https://anonhg.NetBSD.org/src/rev/a79dd77a56ce
branches:  trunk
changeset: 495518:a79dd77a56ce
user:      takemura <takemura%NetBSD.org@localhost>
date:      Sun Jul 30 11:16:54 2000 +0000

description:
Refresh screen when the system resume.

diffstat:

 sys/arch/hpcmips/dev/hpcfb.c |  52 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diffs (101 lines):

diff -r c0ecbb0438d6 -r a79dd77a56ce sys/arch/hpcmips/dev/hpcfb.c
--- a/sys/arch/hpcmips/dev/hpcfb.c      Sun Jul 30 10:41:29 2000 +0000
+++ b/sys/arch/hpcmips/dev/hpcfb.c      Sun Jul 30 11:16:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpcfb.c,v 1.9 2000/07/22 03:46:53 takemura Exp $       */
+/*     $NetBSD: hpcfb.c,v 1.10 2000/07/30 11:16:54 takemura Exp $      */
 
 /*-
  * Copyright (c) 1999
@@ -45,7 +45,7 @@
 static const char _copyright[] __attribute__ ((unused)) =
     "Copyright (c) 1999 Shin Takemura.  All rights reserved.";
 static const char _rcsid[] __attribute__ ((unused)) =
-    "$Id: hpcfb.c,v 1.9 2000/07/22 03:46:53 takemura Exp $";
+    "$Id: hpcfb.c,v 1.10 2000/07/30 11:16:54 takemura Exp $";
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -138,6 +138,7 @@
        const struct hpcfb_accessops    *sc_accessops;
        void *sc_accessctx;
        int nscreens;
+       void                    *sc_powerhook;  /* power management hook */
 };
 /*
  *  function prototypes
@@ -148,6 +149,7 @@
 
 int    hpcfb_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
 paddr_t        hpcfb_mmap __P((void *, off_t, int));
+static void    hpcfb_refresh_screen __P((struct hpcfb_softc *sc));
 static int     hpcfb_init __P((struct hpcfb_fbconf *fbconf,
                                struct hpcfb_devconfig *dc));
 static int     hpcfb_alloc_screen __P((void *, const struct wsscreen_descr *,
@@ -155,6 +157,7 @@
 static void    hpcfb_free_screen __P((void *, void *));
 static int     hpcfb_show_screen __P((void *, void *, int,
                                    void (*) (void *, int, int), void *));
+static void    hpcfb_power __P((int, void *));
 
 static int     pow __P((int, int));
 
@@ -350,6 +353,12 @@
                                          &hpcfb_console_dc.dc_rinfo);
        }
 
+       /* Add a power hook to power management */
+       sc->sc_powerhook = powerhook_establish(hpcfb_power, sc);
+       if (sc->sc_powerhook == NULL)
+               printf("%s: WARNING: unable to establish power hook\n",
+                       sc->sc_dev.dv_xname);
+
        wa.console = hpcfbconsole;
        wa.scrdata = &hpcfb_screenlist;
        wa.accessops = &hpcfb_accessops;
@@ -559,6 +568,45 @@
        return (*sc->sc_accessops->mmap)(sc->sc_accessctx, offset, prot);
 }
 
+static void 
+hpcfb_power(why, arg)
+       int why;
+       void *arg;
+{
+       struct hpcfb_softc *sc = arg;
+
+       switch (why) {
+       case PWR_SUSPEND:
+       case PWR_STANDBY:
+               break;
+       case PWR_RESUME:
+               hpcfb_refresh_screen(sc);
+               break;
+       }
+}
+
+void
+hpcfb_refresh_screen(sc)
+       struct hpcfb_softc *sc;
+{
+#ifdef HPCFB_TVRAM
+       struct hpcfb_devconfig *dc = sc->sc_dc;
+       int x, y;
+
+       /*
+        * refresh screen
+        */
+       x = dc->dc_curx;
+       y = dc->dc_cury;
+       if (0 <= x && 0 <= y)
+               hpcfb_cursor(dc, 0,  y, x); /* disable cursor */
+       /* redraw all text */
+       hpcfb_redraw(dc, 0, dc->dc_rows);
+       if (0 <= x && 0 <= y)
+               hpcfb_cursor(dc, 1,  y, x); /* enable cursor */
+#endif
+}
+
 static int
 hpcfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
        void *v;



Home | Main Index | Thread Index | Old Index