Quick fix for slow clearing and context switches of large frame buffers
with old kernels, by breaking the support for large frame buffers in the same way as for current kernels. Large frame buffers may be too large to map into kva, and the kernel (syscons) only uses the first screen page anyway, so r203535, r205557 and 248799 limit the buffer size in VESA modes to the first screen page, apparently without noticing that this breaks applications by using the same limit for user mappings as for kernel mappings. In vgl, this makes the virtual screen the same as the physical screen. However, this is almost a feature since clearing and switching large (usually mostly unused) frame buffers takes too long. E.g., on a 16 year old low-end AGP card it takes about 12 seconds to clear the 128MB frame buffer in old kernels that map it all and also map it with slow attributes (e.g., uncacheable). Older PCI cards are even slower, but usually have less memory. Newer PCIe cards are faster, but may have many GB of memory. Also, vgl malloc()s a shadow buffer with the same size as the frame buffer, so large frame buffers are even more wasteful in applications than in the kernel. Use the same limit in vgl as in newer kernels. Virtual screens and panning still work in non-VESA modes that have more than 1 page. The reduced buffer size in the kernel also breaks mmap() of the last physical page in modes where the reduced size is not a multiple of the physical page size. The same reduction in vgl only reduces the virtual screen size.
This commit is contained in:
parent
0ad6103555
commit
eb6045021e
@ -264,6 +264,19 @@ VGLInit(int mode)
|
||||
else
|
||||
VGLBufSize = max(VGLAdpInfo.va_line_width*VGLModeInfo.vi_height,
|
||||
VGLAdpInfo.va_window_size)*VGLModeInfo.vi_planes;
|
||||
/*
|
||||
* The above is for old -CURRENT. Current -CURRENT since r203535 and/or
|
||||
* r248799 restricts va_buffer_size to the displayed size in VESA modes to
|
||||
* avoid wasting kva for mapping unused parts of the frame buffer. But all
|
||||
* parts were usable here. Applying the same restriction to user mappings
|
||||
* makes our virtualization useless and breaks our panning, but large frame
|
||||
* buffers are also difficult for us to manage (clearing and switching may
|
||||
* be too slow, and malloc() may fail). Restrict ourselves similarly to
|
||||
* get the same efficiency and bugs for all kernels.
|
||||
*/
|
||||
if (0 && VGLModeInfo.vi_mode >= M_VESA_BASE)
|
||||
VGLBufSize = 2*VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*
|
||||
VGLModeInfo.vi_planes;
|
||||
VGLBuf = malloc(VGLBufSize);
|
||||
if (VGLBuf == NULL) {
|
||||
VGLEnd();
|
||||
|
Loading…
Reference in New Issue
Block a user