Re: r269471 make unusable VT console

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Tue, 19 Aug 2014 18:28:29 +0200
On 19.08.2014 10:42, Jean-Sébastien Pédron wrote:
> On 16.08.2014 01:51, Nathan Whitehorn wrote:
>> It also has bad effects on boot time. My desktop takes something like 3
>> times as long to boot after r269471. If it can't be fixed quickly, it
>> needs to be reverted.
> 
> Just a quick note: I'm working on an update to vt_vga.

Hello!

Here's a first version of the patch I was talking about:
https://people.freebsd.org/~dumbbell/vt/vt-vga.5.patch

What's new/fixed:

    o  vt_vga introduces a new callback, vd_bitblt_text_t, which takes
       as argument the text buffer, the dirty area, the font and the
       cursor (position, map, colors). With all this information at
       hand, it can redraw the dirty area with almost no read from the
       video memory. This greatly improves the performance. The
       implementation is quite naive and I put a lot of comments. This
       could probably be simplfied/improved.

       The cursor is drawn at the same time than the text: this avoids
       flickering of the mouse pointer.

       The patch reads from the video memory only when the byte to
       write uses more than 2 colors (fg/bg). But this only happens
       with colored text around the cursor or with fonts who's width
       isn't a multiple of 8.

    o  In vt_flush(), handle the cursor position before getting the
       dirty area. This fixes a bug where, if we move the cursor too
       fast, its new location is outside the marked area and it
       disappears from the screen.

       While here, mark the new position of the cursor as dirty, not
       only the old one.

       For the cursor to be drawn, VWF_MOUSE_HIDE must not be set *and*
       VDF_MOUSECURSOR must be set! Before, only the former was checked
       when deciding if the cursor position should be marked as dirty.

       Finally, if the cursor didn't move, don't mark its position as
       dirty.

       Before, these two problems caused major redraw of a large part
       of the screen for nothing, due to a mouse pointer location of
      [0;0] (even if disabled) and its position always marked as dirty.

    o  When the mouse state is changed, mark its position as dirty.

    o  The flush timer is paused during a window switch. In the case of
       vt_vga, vga_initialize() is called and it messes with VGA
       registers and the video memory. If vt_flush() is triggered at
       the same time, unexpected data are displayed. This is fixed,
       though, there's still a annoying flickering, because the sync
       signal is temporarily stopped during vga_initialize().

    o  The patch includes another non-related patch, which tries to
       stabilize the refresh rate. Currently, we schedule the next
       redraw in 40 ms (25 Hz), but that doesn't count for the time
       taken to redraw.

    o  Change how the mouse is enabled/disabled/shown/hidden. Now, the
       GETLEVEL and GETMODE ioctls don't touch this. Everything goes
       through the CONS_MOUSECTL ioctl. This fixes vidcontrol -m on|off.

Known issues:

    o  Instead of having an "if (bitblt_text != NULL)" check in
       vt_flush(), I'll add a generic bitblt_text callback which
       implements the old code, so that other drivers can be changed
       incrementally.

    o  In vt_vga, the screen flickers during a window switch, because
       it stops the sync signal and zeroes the memory. It would be nice
       to avoid that.

    o  Several issues when the font is changed:
         1. The offset to center the text area is global, not per
            window. Therefore other window are not centered anymore.
         2. There's a bug with my patch, where other windows have the
            top-left letter wrongly shifted.
         3. When the text area changes (compared to the whole screen),
            there's garbage in the borders.
         4. The text cursor (the square) may be broken on other windows.

    o  The mouse pointer is somtimes not erased during a move.

    o  The text square cursor handling in vt_vga could be improved:
       colors are just reversed, we shouldn't change the fg/bg colors,
       just write a 0x00 pattern instead.

    o  The vt_flush() timer could maybe be stopped when there's nothing
       to draw. No need to wakeup a core for that.

Any comments?

-- 
Jean-Sébastien Pédron


Received on Tue Aug 19 2014 - 14:28:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:51 UTC