From: John Hodge Date: Sun, 8 Jun 2014 09:56:45 +0000 (+0800) Subject: Kernel/VTerm - Fix doing full redraw on every string X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=c4c3f325ee7a3a869b0df5414fde7c3a85410777;p=tpg%2Facess2.git Kernel/VTerm - Fix doing full redraw on every string --- diff --git a/KernelLand/Kernel/drv/vterm_output.c b/KernelLand/Kernel/drv/vterm_output.c index 532d2686..79afaa74 100644 --- a/KernelLand/Kernel/drv/vterm_output.c +++ b/KernelLand/Kernel/drv/vterm_output.c @@ -52,8 +52,12 @@ void VT_int_ScrollFramebuffer( tVTerm *Term, int Count ) // Only update if this is the current terminal if( Term != gpVT_CurTerm ) return; + ENTER("pTerm iCount", + Term, Count); + if( Count > Term->ScrollHeight ) Count = Term->ScrollHeight; if( Count < -Term->ScrollHeight ) Count = -Term->ScrollHeight; + LOG("Count = %i", Count); // Switch to 2D Command Stream tmp = VIDEO_BUFFMT_2DSTREAM; @@ -81,6 +85,7 @@ void VT_int_ScrollFramebuffer( tVTerm *Term, int Count ) // Restore old mode (this function is only called during text mode) tmp = VIDEO_BUFFMT_TEXT; VFS_IOCtl(giVT_OutputDevHandle, VIDEO_IOCTL_SETBUFFORMAT, &tmp); + LEAVE('-'); } void VT_int_UpdateCursor( tVTerm *Term, int bShow ) @@ -88,6 +93,8 @@ void VT_int_UpdateCursor( tVTerm *Term, int bShow ) tVideo_IOCtl_Pos csr_pos; if( Term != gpVT_CurTerm ) return ; + + ENTER("pTerm bShow", Term, Show); if( !bShow ) { @@ -119,6 +126,7 @@ void VT_int_UpdateCursor( tVTerm *Term, int bShow ) csr_pos.y = Term->VideoCursorY; } VFS_IOCtl(giVT_OutputDevHandle, VIDEO_IOCTL_SETCURSOR, &csr_pos); + LEAVE('-'); } /** @@ -129,13 +137,16 @@ void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll ) { // Only update if this is the current terminal if( Term != gpVT_CurTerm ) return; - + + ENTER("pTerm iUpdateAll", Term, UpdateAll); + switch( Term->Mode ) { case TERM_MODE_TEXT: { size_t view_pos = (Term->Flags & VT_FLAG_ALTBUF) ? 0 : Term->ViewTopRow*Term->TextWidth; const tVT_Pos *wrpos = VT_int_GetWritePosPtr(Term); const tVT_Char *buffer = (Term->Flags & VT_FLAG_ALTBUF) ? Term->AltBuf : Term->Text; + LOG("view_pos = %i, wrpos = %p, buffer=%p", view_pos, wrpos, buffer); // Re copy the entire screen? if(UpdateAll) { VFS_WriteAt( @@ -161,5 +172,6 @@ void VT_int_UpdateScreen( tVTerm *Term, int UpdateAll ) } VT_int_UpdateCursor(Term, 1); + LEAVE('-'); } diff --git a/KernelLand/Kernel/drv/vterm_termbuf.c b/KernelLand/Kernel/drv/vterm_termbuf.c index fed577a9..ed954809 100644 --- a/KernelLand/Kernel/drv/vterm_termbuf.c +++ b/KernelLand/Kernel/drv/vterm_termbuf.c @@ -25,6 +25,7 @@ extern int Term_HandleVT100(tVTerm *Term, int Len, const char *Buf); */ void VT_int_PutString(tVTerm *Term, const Uint8 *Buffer, Uint Count) { + ENTER("pTerm pBuffer iCount", Term, Buffer, Count); // Iterate for( int ofs = 0; ofs < Count; ) { @@ -43,7 +44,9 @@ void VT_int_PutString(tVTerm *Term, const Uint8 *Buffer, Uint Count) ofs += esc_len; } // Update Screen - VT_int_UpdateScreen( Term, 1 ); + LOG("Update"); + VT_int_UpdateScreen( Term, 0 ); + LEAVE('-'); } void VT_int_PutRawString(tVTerm *Term, const Uint8 *String, size_t Bytes) @@ -121,6 +124,7 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch) case '\0': // Ignore NULL byte return; case '\n': + LOG("Newline, update"); VT_int_UpdateScreen( Term, 0 ); // Update the line before newlining wrpos->Row ++; // TODO: Force scroll? @@ -165,8 +169,10 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch) buffer[ write_pos ].Ch = Ch; buffer[ write_pos ].Colour = Term->CurColour; // Update the line before wrapping - if( (write_pos + 1) % Term->TextWidth == 0 ) + if( (write_pos + 1) % Term->TextWidth == 0 ) { + LOG("Line wrap, update"); VT_int_UpdateScreen( Term, 0 ); + } write_pos ++; wrpos->Col ++; break; @@ -177,12 +183,11 @@ void VT_int_PutChar(tVTerm *Term, Uint32 Ch) HEAP_VALIDATE(); // TODO: Schedule a delayed screen update - - //LEAVE('-'); } void VT_int_ScrollText(tVTerm *Term, int Count) { + ENTER("pTerm iCount", Term, Count); tVT_Char *buf; int scroll_top, scroll_height; @@ -276,6 +281,7 @@ void VT_int_ScrollText(tVTerm *Term, int Count) *wrpos = init_wrpos; HEAP_VALIDATE(); + LEAVE('-'); } /** diff --git a/KernelLand/Kernel/drv/vterm_vt100.c b/KernelLand/Kernel/drv/vterm_vt100.c index 1399d7ba..0d59a666 100644 --- a/KernelLand/Kernel/drv/vterm_vt100.c +++ b/KernelLand/Kernel/drv/vterm_vt100.c @@ -5,7 +5,7 @@ * drv/vterm_vt100.c * - Virtual Terminal - VT100 (Kinda) Emulation */ -#define DEBUG 1 +#define DEBUG 0 #include "vterm.h" #define sTerminal sVTerm