NetBSD-Bugs archive

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

Re: kern/61047: lack of support of console cursor on/off on genfb/rasops display (patch included)



The following reply was made to PR kern/61047; it has been noted by GNATS.

From: Piotr Meyer <aniou+gnats%smutek.pl@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/61047: lack of support of console cursor on/off on
 genfb/rasops display (patch included)
Date: Mon, 23 Nov 2026 01:24:04 +0100

 Poor me, I messed-up files order in diff. There is an valid patch, 
 sorry.
 
 Best regards,
 Piotr Meyer
 
 
 --- wsdisplay_vconsvar.h.orig   2026-11-23 00:49:18.255745466 +0100
 +++ wsdisplay_vconsvar.h        2026-11-23 00:48:38.900408023 +0100
 @@ -81,6 +81,7 @@
         /* status flags used by vcons */
         uint32_t scr_status;
  #define VCONS_IS_VISIBLE       1       /* this screen is currently visible */
 +#define VCONS_CURSOR_ON     2   /* this screen has cursor enabled   */
         /* non zero when some rasops operation is in progress */
         int scr_busy;
  #ifdef WSDISPLAY_SCROLLSUPPORT
 @@ -104,6 +105,7 @@
  #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE)
  #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)
  #define SCREEN_ENABLE_DRAWING(scr) ((scr)->scr_flags &= ~VCONS_DONT_DRAW)
 +#define SCREEN_CURSOR_IS_ON(scr) (((scr)->scr_status & VCONS_CURSOR_ON) != 0)
  
  #define DEFATTR ((WS_DEFAULT_FG << 24) || (WS_DEFAULT_BG << 16))
 
 
 --- wsdisplay_vcons.c.orig      2026-11-23 00:49:18.648046369 +0100
 +++ wsdisplay_vcons.c   2026-11-23 00:48:44.134032357 +0100
 @@ -753,8 +753,15 @@
                                 vdp->erasecols(ri, i, start, j - start, last_a);
                         }
                 }
 -               ri->ri_flg &= ~RI_CURSOR;
 -               scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
 +#ifdef WSDISPLAY_SCROLLSUPPORT
 +        if ((scr->scr_line_wanted == 0) && (SCREEN_CURSOR_IS_ON(scr))) {
 +#else
 +        if SCREEN_CURSOR_IS_ON(scr) {
 +#endif
 +                   ri->ri_flg &= ~RI_CURSOR;
 +                   scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
 +        }
 +
  #ifdef VCONS_DRAW_INTR
                 vdp->cursor_offset = ri->ri_crow * ri->ri_cols + ri->ri_ccol;
  #endif
 
 @@ -810,8 +817,10 @@
                                 boffset++;
                         }
                 }
 -               ri->ri_flg &= ~RI_CURSOR;
 -               scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
 +               if SCREEN_CURSOR_IS_ON(scr) {
 +                       ri->ri_flg &= ~RI_CURSOR;
 +                       scr->scr_vd->private->cursor(ri, 1, ri->ri_crow, ri->ri_ccol);
 +               }
                 vdp->cursor_offset = ri->ri_crow * ri->ri_cols + ri->ri_ccol;
         }
         vcons_unlock(scr);
 @@ -893,7 +902,7 @@
                 return ENOMEM;
  
         scr->scr_flags = 0;
 -       scr->scr_status = 0;
 +       scr->scr_status = VCONS_CURSOR_ON;
         scr->scr_busy = 0;
         scr->scr_type = __UNCONST(type);
  
 @@ -1350,10 +1359,20 @@
  {
         struct rasops_info *ri = cookie;
         struct vcons_screen *scr = ri->ri_hw;
 +       bool cursor_state_flip;
 +
 +    vcons_lock(scr);
 +       cursor_state_flip = (on != 0) != SCREEN_CURSOR_IS_ON(scr);
 +       if (cursor_state_flip) {
 +               scr->scr_status &= ~VCONS_CURSOR_ON;
 +               scr->scr_status |= (on != 0) ? VCONS_CURSOR_ON : 0;
 +       }
 +    vcons_unlock(scr);
  
         if (vcons_use_intr(scr)) {
                 vcons_lock(scr);
 -               if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
 +
 +               if ((scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) || cursor_state_flip) {
                         scr->scr_ri.ri_crow = row;
                         scr->scr_ri.ri_ccol = col;
                         vcons_dirty(scr);
 @ -1599,7 +1618,7 @@
                 }
         }
  
 -       if (scr->scr_line_wanted == 0) {
 +       if ((scr->scr_line_wanted == 0) && (SCREEN_CURSOR_IS_ON(scr))) {
                 /* this was a reset - need to draw the cursor */
                 scr->scr_ri.ri_flg &= ~RI_CURSOR;
                 scr->scr_vd->private->cursor(scr, 1, scr->scr_ri.ri_crow,
 
 
 -- 
 Piotr 'aniou' Meyer
 



Home | Main Index | Thread Index | Old Index