FreeBSD Bugzilla – Attachment 5931 Details for
Bug 13764
[PATCH] Stop syscons from flushing history buffer when changing video mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.53 KB, created by
mark
on 1999-09-15 19:00:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mark
Created:
1999-09-15 19:00:01 UTC
Size:
4.53 KB
patch
obsolete
>*** /usr/src/sys/dev/syscons/syscons.c.orig Wed Sep 8 18:42:25 1999 >--- /usr/src/sys/dev/syscons/syscons.c Wed Sep 15 18:13:19 1999 >*************** >*** 3320,3347 **** > void > sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait) > { >! u_short *usp; > >! if (lines < scp->ysize) >! lines = scp->ysize; > >! usp = scp->history; >! scp->history = NULL; >! if (usp != NULL) { >! free(usp, M_DEVBUF); >! if (extra > 0) > extra_history_size += extra; > } > > scp->history_size = lines * scp->xsize; > if (lines > imax(sc_history_size, scp->ysize)) > extra_history_size -= lines - imax(sc_history_size, scp->ysize); >! usp = (u_short *)malloc(scp->history_size * sizeof(u_short), > M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); >! if (usp != NULL) >! bzero(usp, scp->history_size * sizeof(u_short)); >! scp->history_head = scp->history_pos = usp; >! scp->history = usp; > } > > static scr_stat >--- 3320,3380 ---- > void > sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait) > { >! u_short *new, *old; >! u_short head_offset = 0, pos_offset = 0; >! int i, j; >! int old_size = 0; > >! old = NULL; >! >! if (scp->history != NULL) { >! >! /* Save pointer offsets and size of the old buffer */ > >! head_offset = scp->history_head - scp->history; >! pos_offset = scp->history_pos - scp->history; >! old_size = scp->history_size; >! if (extra > 0) > extra_history_size += extra; > } > >+ if (lines < scp->ysize) >+ lines = scp->ysize; >+ > scp->history_size = lines * scp->xsize; > if (lines > imax(sc_history_size, scp->ysize)) > extra_history_size -= lines - imax(sc_history_size, scp->ysize); >! new = (u_short *)malloc(scp->history_size * sizeof(u_short), > M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); >! if (new != NULL) >! bzero(new, scp->history_size * sizeof(u_short)); >! >! /* Copy contents of old buffer to the new one, but start at >! * the end and work back. This ensures that if the new buffer >! * is smaller than the old one then the oldest data is >! * truncated rather than the latest. >! */ >! >! if (scp->history != NULL) { >! i = scp->history_size - 1; >! j = old_size - 1; >! >! while (i >= 0 && j >= 0) >! *(new + i--) = *(scp->history + j--); >! >! old = scp->history; >! scp->history = new; >! >! scp->history_head = scp->history_pos = scp->history + head_offset; >! scp->history_pos = scp->history_pos = scp->history + pos_offset; >! >! } else >! scp->history = scp->history_head = scp->history_pos = new; >! >! if (old != NULL) { >! free(old, M_DEVBUF); >! >! } > } > > static scr_stat >*** /usr/src/sys/dev/syscons/scvidctl.c.orig Tue Sep 7 20:53:19 1999 >--- /usr/src/sys/dev/syscons/scvidctl.c Wed Sep 15 00:44:55 1999 >*************** >*** 86,91 **** >--- 86,107 ---- > int s; > int i; > >+ /* Copy screen into the top of the history buffer. This must >+ * be done here so that scp->{x,y}size are still set to the >+ * old mode values. Any later and we will copy too few or too >+ * many (the extra will be garbage) lines. >+ */ >+ >+ for (i = 0; i < scp->ysize; i++) { >+ bcopy(scp->scr_buf + (scp->xsize * i), scp->history_head, >+ scp->xsize * sizeof(u_short)); >+ >+ scp->history_head += scp->xsize; >+ >+ if (scp->history_head + scp->xsize > scp->history + scp->history_size) >+ scp->history_head=scp->history; >+ } >+ > if ((*vidsw[scp->ad]->get_info)(scp->adp, mode, &info)) > return ENODEV; > >*************** >*** 138,153 **** > scp->xpixel = scp->xsize*8; > scp->ypixel = scp->ysize*fontsize; > > /* allocate buffers */ > sc_alloc_scr_buffer(scp, TRUE, TRUE); > if (ISMOUSEAVAIL(scp->adp->va_flags)) > sc_alloc_cut_buffer(scp, FALSE); > sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); > splx(s); >- >- if (scp == cur_console) >- set_mode(scp); >- scp->status &= ~UNKNOWN_MODE; > > if (tp == NULL) > return 0; >--- 154,173 ---- > scp->xpixel = scp->xsize*8; > scp->ypixel = scp->ysize*fontsize; > >+ /* We need to call set_mode() before sc_alloc_history_buffer() >+ * or the history buffer will get screwed up. >+ */ >+ >+ if (scp == cur_console) >+ set_mode(scp); >+ scp->status &= ~UNKNOWN_MODE; >+ > /* allocate buffers */ > sc_alloc_scr_buffer(scp, TRUE, TRUE); > if (ISMOUSEAVAIL(scp->adp->va_flags)) > sc_alloc_cut_buffer(scp, FALSE); > sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); > splx(s); > > if (tp == NULL) > return 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13764
: 5931