On Mon, Apr 30, 2018 at 06:13:00PM +0000, Miod Vallat wrote:
> > On Sun, Apr 29, 2018 at 09:42:00AM +0000, Miod Vallat wrote:
> > > 
> > > > Don't use attr uninitialised.  Avoids glitches seen when using
> > > > scrollback with radeondrm.
> > > 
> > > That's horrible. The bg attribute should be passed to the function,
> > > rather than computed here with possibly wrong values.
> > > 
> > 
> > You didn't include a diff so I guess you propose something like this?
> 
> I'm not sure this is correct, but that's probably better.
> 
> My point is that, if you need to erase a few rows, you need to use the
> default (non kernel) background attribute. This attribute depends from
> the wsdisplay emulation in use (it's edp->defattr). But since the
> emulation is the one asking for scrollback, it should be easy to plumb
> it down the way - adding an extra argument to the .scrollback
> wsdisplay_accessops and then to rasops_scrollback().

scrollback isn't part of wsdisplay_emulops but rather wsdisplay_accessops.
It isn't clear how to properly get an attr in wsscrollback()
GETCHAR/getchar is part of wsmoused and sc->sc_accessops->getchar
may be NULL.

Index: dev/ic/vga.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.69
diff -u -p -r1.69 vga.c
--- dev/ic/vga.c        17 Jun 2017 19:20:30 -0000      1.69
+++ dev/ic/vga.c        1 May 2018 03:09:58 -0000
@@ -250,7 +250,7 @@ int vga_show_screen(void *, void *, int,
                        void (*) (void *, int, int), void *);
 int    vga_load_font(void *, void *, struct wsdisplay_font *);
 int    vga_list_font(void *, struct wsdisplay_font *);
-void   vga_scrollback(void *, void *, int);
+void   vga_scrollback(void *, void *, int, long);
 void   vga_burner(void *v, u_int on, u_int flags);
 int    vga_getchar(void *, int, int, struct wsdisplay_charcell *);
 
@@ -942,7 +942,7 @@ vga_list_font(void *v, struct wsdisplay_
 }
 
 void
-vga_scrollback(void *v, void *cookie, int lines)
+vga_scrollback(void *v, void *cookie, int lines, long attr)
 {
        struct vga_config *vc = v;
        struct vgascreen *scr = cookie;
@@ -1157,7 +1157,7 @@ vga_putchar(void *c, int row, int col, u
        
        s = spltty();
        if (scr->pcs.active && scr->pcs.visibleoffset != scr->pcs.dispoffset)
-               vga_scrollback(scr->cfg, scr, 0);
+               vga_scrollback(scr->cfg, scr, 0, attr);
        rc = pcdisplay_putchar(c, row, col, uc, attr);
        splx(s);
 
Index: dev/pci/drm/i915/i915_drv.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/i915/i915_drv.c,v
retrieving revision 1.112
diff -u -p -r1.112 i915_drv.c
--- dev/pci/drm/i915/i915_drv.c 27 Apr 2018 21:36:12 -0000      1.112
+++ dev/pci/drm/i915/i915_drv.c 1 May 2018 03:06:37 -0000
@@ -1925,7 +1925,7 @@ int       inteldrm_list_font(void *, struct ws
 int    inteldrm_getchar(void *, int, int, struct wsdisplay_charcell *);
 void   inteldrm_burner(void *, u_int, u_int);
 void   inteldrm_burner_cb(void *);
-void   inteldrm_scrollback(void *, void *, int lines);
+void   inteldrm_scrollback(void *, void *, int, long);
 
 struct wsscreen_descr inteldrm_stdscreen = {
        "std",
@@ -2177,12 +2177,12 @@ const struct backlight_ops inteldrm_back
 };
 
 void
-inteldrm_scrollback(void *v, void *cookie, int lines)
+inteldrm_scrollback(void *v, void *cookie, int lines, long attr)
 {
        struct inteldrm_softc *dev_priv = v;
        struct rasops_info *ri = &dev_priv->ro;
 
-       rasops_scrollback(ri, cookie, lines);
+       rasops_scrollback(ri, cookie, lines, attr);
 }
 
 int    inteldrm_match(struct device *, void *, void *);
Index: dev/pci/drm/radeon/radeon_kms.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_kms.c,v
retrieving revision 1.55
diff -u -p -r1.55 radeon_kms.c
--- dev/pci/drm/radeon/radeon_kms.c     25 Apr 2018 01:27:46 -0000      1.55
+++ dev/pci/drm/radeon/radeon_kms.c     28 Apr 2018 01:39:19 -0000
@@ -202,6 +202,7 @@ struct wsdisplay_accessops radeondrm_acc
        .getchar = rasops_getchar,
        .load_font = rasops_load_font,
        .list_font = rasops_list_font,
+       .scrollback = rasops_scrollback,
        .burn_screen = radeondrm_burner
 };
 
Index: dev/rasops/rasops.c
===================================================================
RCS file: /cvs/src/sys/dev/rasops/rasops.c,v
retrieving revision 1.53
diff -u -p -r1.53 rasops.c
--- dev/rasops/rasops.c 27 Apr 2018 21:36:12 -0000      1.53
+++ dev/rasops/rasops.c 1 May 2018 03:04:54 -0000
@@ -1541,7 +1541,7 @@ rasops_vcons_putchar(void *cookie, int r
        int off = row * scr->rs_ri->ri_cols + col + scr->rs_dispoffset;
 
        if (scr->rs_visible && scr->rs_visibleoffset != scr->rs_dispoffset)
-               rasops_scrollback(scr->rs_ri, scr, 0);
+               rasops_scrollback(scr->rs_ri, scr, 0, attr);
 
        scr->rs_bs[off].uc = uc;
        scr->rs_bs[off].attr = attr;
@@ -1901,12 +1901,11 @@ rasops_list_font(void *v, struct wsdispl
 }
 
 void
-rasops_scrollback(void *v, void *cookie, int lines)
+rasops_scrollback(void *v, void *cookie, int lines, long attr)
 {
        struct rasops_info *ri = v;
        struct rasops_screen *scr = cookie;
        int row, col, oldvoff;
-       long attr;
 
        oldvoff = scr->rs_visibleoffset;
 
Index: dev/rasops/rasops.h
===================================================================
RCS file: /cvs/src/sys/dev/rasops/rasops.h,v
retrieving revision 1.22
diff -u -p -r1.22 rasops.h
--- dev/rasops/rasops.h 27 Apr 2018 21:36:12 -0000      1.22
+++ dev/rasops/rasops.h 1 May 2018 03:05:01 -0000
@@ -178,7 +178,7 @@ int rasops_show_screen(void *, void *, i
 int    rasops_load_font(void *, void *, struct wsdisplay_font *);
 int    rasops_list_font(void *, struct wsdisplay_font *);
 int    rasops_getchar(void *, int, int, struct wsdisplay_charcell *);
-void   rasops_scrollback(void *, void *, int);
+void   rasops_scrollback(void *, void *, int, long);
 
 extern const u_char    rasops_isgray[16];
 extern const u_char    rasops_cmap[256*3];
Index: dev/wscons/wsdisplay.c
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.131
diff -u -p -r1.131 wsdisplay.c
--- dev/wscons/wsdisplay.c      19 Feb 2018 08:59:52 -0000      1.131
+++ dev/wscons/wsdisplay.c      1 May 2018 03:03:29 -0000
@@ -2264,6 +2264,7 @@ void
 wsscrollback(void *arg, int op)
 {
        struct wsdisplay_softc *sc = arg;
+       struct wsdisplay_charcell cell;
        int lines;
 
        if (sc->sc_focus == NULL)
@@ -2278,8 +2279,9 @@ wsscrollback(void *arg, int op)
        }
 
        if (sc->sc_accessops->scrollback) {
+               GETCHAR(sc->sc_focus, 0, &cell);
                (*sc->sc_accessops->scrollback)(sc->sc_accesscookie,
-                   sc->sc_focus->scr_dconf->emulcookie, lines);
+                   sc->sc_focus->scr_dconf->emulcookie, lines, cell.attr);
        }
 }
 #endif
Index: dev/wscons/wsdisplayvar.h
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsdisplayvar.h,v
retrieving revision 1.31
diff -u -p -r1.31 wsdisplayvar.h
--- dev/wscons/wsdisplayvar.h   19 Jul 2017 14:34:10 -0000      1.31
+++ dev/wscons/wsdisplayvar.h   1 May 2018 01:17:43 -0000
@@ -141,7 +141,7 @@ struct wsdisplay_accessops {
                               void (*) (void *, int, int), void *);
        int     (*load_font)(void *, void *, struct wsdisplay_font *);
        int     (*list_font)(void *, struct wsdisplay_font *);
-       void    (*scrollback)(void *, void *, int);
+       void    (*scrollback)(void *, void *, int, long);
        int     (*getchar)(void *, int, int, struct wsdisplay_charcell *);
        void    (*burn_screen)(void *, u_int, u_int);
        void    (*pollc)(void *, int);
Index: arch/amd64/amd64/efifb.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/efifb.c,v
retrieving revision 1.16
diff -u -p -r1.16 efifb.c
--- arch/amd64/amd64/efifb.c    27 Apr 2018 21:36:12 -0000      1.16
+++ arch/amd64/amd64/efifb.c    1 May 2018 03:07:40 -0000
@@ -101,7 +101,7 @@ int  efifb_show_screen(void *, void *, i
            void *);
 int     efifb_list_font(void *, struct wsdisplay_font *);
 int     efifb_load_font(void *, void *, struct wsdisplay_font *);
-void    efifb_scrollback(void *, void *, int lines);
+void    efifb_scrollback(void *, void *, int, long);
 void    efifb_efiinfo_init(struct efifb *);
 void    efifb_cnattach_common(void);
 
@@ -402,12 +402,12 @@ efifb_list_font(void *v, struct wsdispla
 }
 
 void
-efifb_scrollback(void *v, void *cookie, int lines)
+efifb_scrollback(void *v, void *cookie, int lines, long attr)
 {
        struct efifb_softc      *sc = v;
        struct rasops_info      *ri = &sc->sc_fb->rinfo;
 
-       rasops_scrollback(ri, cookie, lines);
+       rasops_scrollback(ri, cookie, lines, attr);
 }
 
 int

Reply via email to