svn commit: r346488 - head/lib/libvgl

Bruce Evans bde at FreeBSD.org
Tue Sep 3 14:08:09 UTC 2019


Author: bde
Date: Sun Apr 21 16:17:35 2019
New Revision: 346488
URL: https://svnweb.freebsd.org/changeset/base/346488

Log:
  Use a shadow buffer and never read from the frame buffer.  Remove large slow
  code for reading from the frame buffer.
  
  Reading from the frame buffer is usually much slower than writing to
  the frame buffer.  Typically 10 to 100 times slower.  It old modes,
  it takes many more PIOs, and in newer modes with no PIOs writes are
  often write-combined while reads remain uncached.
  
  Reading from the frame buffer is not very common, so this change doesn't
  give speedups of 10 to 100 times.  My main test case is a floodfill()
  function that reads about as many pixels as it writes.  The speedups
  are typically a factor of 2 to 4.
  
  Duplicating writes to the shadow buffer is slower when no reads from the
  frame buffer are done, but reads are often done for the pixels under the
  mouse cursor, and doing these reads from the shadow buffer more than
  compensates for the overhead of writing the shadow buffer in at least the
  slower modes.  Management of the mouse cursor also becomes simpler.
  
  The shadow buffer doesn't take any extra memory, except twice as much
  in old 4-plane modes.  A buffer for holding a copy of the frame buffer
  was allocated up front for use in the screen switching signal handler.
  This wasn't changed when the handler was made async-signal safe.  Use
  the same buffer the shadow (but make it twice as large in the 4-plane
  modes), and remove large special code for writing it as well as large
  special code for reading ut.  It used to have a rawer format in the
  4-plane modes.  Now it has a bitmap format which takes twice as much
  memory but can be written almost as fast without special code.
  
  VIDBUFs that are not the whole frame buffer were never supported, and the
  change depends on this.  Check for invalid VIDBUFs in some places and do
  nothing.  The removed code did something not so good.

Modified:
  head/lib/libvgl/bitmap.c
  head/lib/libvgl/main.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/simple.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/bitmap.c
==============================================================================
--- head/lib/libvgl/bitmap.c	Sun Apr 21 14:45:18 2019	(r346487)
+++ head/lib/libvgl/bitmap.c	Sun Apr 21 16:17:35 2019	(r346488)
@@ -163,108 +163,6 @@ WriteVerticalLine(VGLBitmap *dst, int x, int y, int wi
   }
 }
 
-static void
-ReadVerticalLine(VGLBitmap *src, int x, int y, int width, byte *line)
-{
-  int i, bit, pos, count, planepos, start_offset, end_offset, offset;
-  int width2, len;
-  byte *address;
-  byte *VGLPlane[4];
-
-  switch (src->Type) {
-  case VIDBUF4S:
-    start_offset = (x & 0x07);
-    end_offset = (x + width) & 0x07;
-    count = (width + start_offset) / 8;
-    if (end_offset)
-      count++;
-    VGLPlane[0] = VGLBuf;
-    VGLPlane[1] = VGLPlane[0] + count;
-    VGLPlane[2] = VGLPlane[1] + count;
-    VGLPlane[3] = VGLPlane[2] + count;
-    for (i=0; i<4; i++) {
-      outb(0x3ce, 0x04);
-      outb(0x3cf, i);
-      pos = VGLAdpInfo.va_line_width*y + x/8;
-      for (width2 = count; width2 > 0; ) {
-	offset = VGLSetSegment(pos);
-	len = min(VGLAdpInfo.va_window_size - offset, width2);
-	bcopy(src->Bitmap + offset, &VGLPlane[i][count - width2], len);
-	pos += len;
-	width2 -= len;
-      }
-    }
-    goto read_planar;
-  case VIDBUF4:
-    address = src->Bitmap + VGLAdpInfo.va_line_width * y + x/8;
-    start_offset = (x & 0x07);
-    end_offset = (x + width) & 0x07;
-    count = (width + start_offset) / 8;
-    if (end_offset)
-      count++;
-    VGLPlane[0] = VGLBuf;
-    VGLPlane[1] = VGLPlane[0] + count;
-    VGLPlane[2] = VGLPlane[1] + count;
-    VGLPlane[3] = VGLPlane[2] + count;
-    for (i=0; i<4; i++) {
-      outb(0x3ce, 0x04);
-      outb(0x3cf, i);
-      bcopy(address, &VGLPlane[i][0], count);
-    }
-read_planar:
-    pos = 0;
-    planepos = 0;
-    bit = 7 - start_offset;
-    while (pos < width) {
-      for (; bit >= 0 && pos < width; bit--, pos++) {
-        line[pos] = (VGLPlane[0][planepos] & (1<<bit) ? 1 : 0) |
-                    ((VGLPlane[1][planepos] & (1<<bit) ? 1 : 0) << 1) |
-                    ((VGLPlane[2][planepos] & (1<<bit) ? 1 : 0) << 2) |
-                    ((VGLPlane[3][planepos] & (1<<bit) ? 1 : 0) << 3);
-      }
-      planepos++;
-      bit = 7;
-    }
-    break;
-  case VIDBUF8X:
-    address = src->Bitmap + VGLAdpInfo.va_line_width * y + x/4;
-    for (i=0; i<4; i++) {
-      outb(0x3ce, 0x04);
-      outb(0x3cf, (x + i)%4);
-      for (planepos=0, pos=i; pos<width; planepos++, pos+=4)
-        line[pos] = address[planepos];
-      if ((x + i)%4 == 3)
-	++address;
-    }
-    break;
-  case VIDBUF8S:
-  case VIDBUF16S:
-  case VIDBUF24S:
-  case VIDBUF32S:
-    width = width * src->PixelBytes;
-    pos = (src->VXsize * y + x) * src->PixelBytes;
-    while (width > 0) {
-      offset = VGLSetSegment(pos);
-      i = min(VGLAdpInfo.va_window_size - offset, width);
-      bcopy(src->Bitmap + offset, line, i);
-      line += i;
-      pos += i;
-      width -= i;
-    }
-    break;
-  case MEMBUF:
-  case VIDBUF8:
-  case VIDBUF16:
-  case VIDBUF24:
-  case VIDBUF32:
-    address = src->Bitmap + (src->VXsize * y + x) * src->PixelBytes;
-    bcopy(address, line, width * src->PixelBytes);
-    break;
-  default:
-    ;
-  }
-}
-
 int
 __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
 	      VGLBitmap *dst, int dstx, int dsty, int width, int hight)
@@ -304,38 +202,11 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
     yextra = hight - 1;
     ystep = -1;
   }
-  if (src->Type == MEMBUF) {
-    for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend;
-         srcline += ystep, dstline += ystep) {
-      WriteVerticalLine(dst, dstx, dstline, width, 
-        src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes);
-    }
+  for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend;
+       srcline += ystep, dstline += ystep) {
+    WriteVerticalLine(dst, dstx, dstline, width, 
+      src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes);
   }
-  else if (dst->Type == MEMBUF) {
-    for (srcline=srcy, dstline=dsty; srcline<srcy+hight; srcline++, dstline++) {
-      ReadVerticalLine(src, srcx, srcline, width,
-        dst->Bitmap+(dstline*dst->VXsize+dstx)*src->PixelBytes);
-    }
-  }
-  else {
-    byte buffer[2048];	/* XXX */
-    byte *p;
-
-    if (width * src->PixelBytes > sizeof(buffer)) {
-      p = malloc(width * src->PixelBytes);
-      if (p == NULL)
-	return 1;
-    } else {
-      p = buffer;
-    }
-    for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend;
-         srcline += ystep, dstline += ystep) {
-      ReadVerticalLine(src, srcx, srcline, width, p);
-      WriteVerticalLine(dst, dstx, dstline, width, p);
-    }
-    if (width * src->PixelBytes > sizeof(buffer))
-      free(p);
-  }
   return 0;
 }
 
@@ -345,12 +216,20 @@ VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
 {
   int error;
 
+  if (src == VGLDisplay)
+    src = &VGLVDisplay;
   if (src->Type != MEMBUF)
-    VGLMouseFreeze(srcx, srcy, width, hight, 0);
-  if (dst->Type != MEMBUF)
+    return -1;		/* invalid */
+  if (dst == VGLDisplay) {
     VGLMouseFreeze(dstx, dsty, width, hight, 0);
+    __VGLBitmapCopy(src, srcx, srcy, &VGLVDisplay, dstx, dsty, width, hight);
+    src = &VGLVDisplay;
+    srcx = dstx;
+    srcy = dsty;
+  } else if (dst->Type != MEMBUF)
+    return -1;		/* invalid */
   error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight);
-  if (src->Type != MEMBUF || dst->Type != MEMBUF)
+  if (dst == VGLDisplay)
     VGLMouseUnFreeze();
   return error;
 }

Modified: head/lib/libvgl/main.c
==============================================================================
--- head/lib/libvgl/main.c	Sun Apr 21 14:45:18 2019	(r346487)
+++ head/lib/libvgl/main.c	Sun Apr 21 16:17:35 2019	(r346488)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #define max(x, y)	(((x) > (y)) ? (x) : (y))
 
 VGLBitmap *VGLDisplay;
+VGLBitmap VGLVDisplay;
 video_info_t VGLModeInfo;
 video_adapter_info_t VGLAdpInfo;
 byte *VGLBuf;
@@ -334,6 +335,13 @@ VGLInit(int mode)
   }
   VGLDisplay->Bitmap = VGLMem;
 
+  VGLVDisplay = *VGLDisplay;
+  VGLVDisplay.Type = MEMBUF;
+  if (VGLModeInfo.vi_depth < 8)
+    VGLVDisplay.Bitmap = malloc(2 * VGLBufSize);
+  else
+    VGLVDisplay.Bitmap = VGLBuf;
+
   VGLSavePalette();
 
 #ifdef LIBVGL_DEBUG
@@ -365,10 +373,6 @@ VGLCheckSwitch()
     exit(0);
   }
   while (VGLSwitchPending) {
-    unsigned int offset;
-    unsigned int len;
-    int i;
-
     VGLSwitchPending = 0;
     if (VGLOnDisplay) {
       if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT)
@@ -440,98 +444,12 @@ VGLCheckSwitch()
       VGLRestoreBorder();
       VGLMouseRestore();
       VGLPanScreen(VGLDisplay, VGLDisplay->Xorigin, VGLDisplay->Yorigin);
-      switch (VGLDisplay->Type) {
-      case VIDBUF4S:
-	outb(0x3c6, 0xff);
-	outb(0x3ce, 0x01); outb(0x3cf, 0x00);		/* set/reset enable */
-	outb(0x3ce, 0x08); outb(0x3cf, 0xff);		/* bit mask */
-	for (offset = 0; offset < VGLBufSize/VGLModeInfo.vi_planes;
-	     offset += len) {
-	  VGLSetSegment(offset);
-	  len = min(VGLBufSize/VGLModeInfo.vi_planes - offset,
-		    VGLAdpInfo.va_window_size);
-	  for (i = 0; i < VGLModeInfo.vi_planes; i++) {
-	    outb(0x3c4, 0x02);
-	    outb(0x3c5, 0x01<<i);
-	    bcopy(&VGLBuf[i*VGLBufSize/VGLModeInfo.vi_planes + offset],
-		  VGLMem, len);
-	  }
-	}
-	break;
-      case VIDBUF4:
-      case VIDBUF8X:
-	outb(0x3c6, 0xff);
-	outb(0x3ce, 0x01); outb(0x3cf, 0x00);		/* set/reset enable */
-	outb(0x3ce, 0x08); outb(0x3cf, 0xff);		/* bit mask */
-	for (i = 0; i < VGLModeInfo.vi_planes; i++) {
-	  outb(0x3c4, 0x02);
-	  outb(0x3c5, 0x01<<i);
-	  bcopy(&VGLBuf[i*VGLAdpInfo.va_window_size], VGLMem,
-		VGLAdpInfo.va_window_size);
-	}
-	break;
-      case VIDBUF8:
-      case VIDBUF8S:
-      case VIDBUF16:
-      case VIDBUF16S:
-      case VIDBUF24:
-      case VIDBUF24S:
-      case VIDBUF32:
-      case VIDBUF32S:
-	for (offset = 0; offset < VGLBufSize; offset += len) {
-	  VGLSetSegment(offset);
-	  len = min(VGLBufSize - offset, VGLAdpInfo.va_window_size);
-          bcopy(&VGLBuf[offset], VGLMem, len);
-	}
-	break;
-      }
+      VGLBitmapCopy(&VGLVDisplay, 0, 0, VGLDisplay, 0, 0, 
+                    VGLDisplay->VXsize, VGLDisplay->VYsize);
       VGLRestorePalette();
       ioctl(0, VT_RELDISP, VT_ACKACQ);
     }
     else {
-      switch (VGLDisplay->Type) {
-      case VIDBUF4S:
-	for (offset = 0; offset < VGLBufSize/VGLModeInfo.vi_planes;
-	     offset += len) {
-	  VGLSetSegment(offset);
-	  len = min(VGLBufSize/VGLModeInfo.vi_planes - offset,
-		    VGLAdpInfo.va_window_size);
-	  for (i = 0; i < VGLModeInfo.vi_planes; i++) {
-	    outb(0x3ce, 0x04);
-	    outb(0x3cf, i);
-	    bcopy(VGLMem, &VGLBuf[i*VGLBufSize/VGLModeInfo.vi_planes + offset],
-		  len);
-	  }
-	}
-	break;
-      case VIDBUF4:
-      case VIDBUF8X:
-	/*
-	 * NOTE: the saved buffer is NOT in the MEMBUF format which 
-	 * the ordinary memory bitmap object is stored in. XXX
-	 */
-	for (i = 0; i < VGLModeInfo.vi_planes; i++) {
-	  outb(0x3ce, 0x04);
-	  outb(0x3cf, i);
-	  bcopy(VGLMem, &VGLBuf[i*VGLAdpInfo.va_window_size],
-		VGLAdpInfo.va_window_size);
-	}
-	break;
-      case VIDBUF8:
-      case VIDBUF8S:
-      case VIDBUF16:
-      case VIDBUF16S:
-      case VIDBUF24:
-      case VIDBUF24S:
-      case VIDBUF32:
-      case VIDBUF32S:
-	for (offset = 0; offset < VGLBufSize; offset += len) {
-	  VGLSetSegment(offset);
-	  len = min(VGLBufSize - offset, VGLAdpInfo.va_window_size);
-          bcopy(VGLMem, &VGLBuf[offset], len);
-	}
-	break;
-      }
       VGLMem = MAP_FAILED;
       munmap(VGLDisplay->Bitmap, VGLAdpInfo.va_window_size);
       ioctl(0, VGLOldMode, 0);

Modified: head/lib/libvgl/mouse.c
==============================================================================
--- head/lib/libvgl/mouse.c	Sun Apr 21 14:45:18 2019	(r346487)
+++ head/lib/libvgl/mouse.c	Sun Apr 21 16:17:35 2019	(r346488)
@@ -82,9 +82,6 @@ static VGLBitmap VGLMouseStdAndMask = 
 static VGLBitmap VGLMouseStdOrMask = 
     VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, StdOrMask);
 static VGLBitmap *VGLMouseAndMask, *VGLMouseOrMask;
-static byte map[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*4];
-static VGLBitmap VGLMouseSave = 
-    VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, map);
 static int VGLMouseVisible = 0;
 static int VGLMouseShown = 0;
 static int VGLMouseXpos = 0;
@@ -117,10 +114,9 @@ VGLMousePointerShow()
       gdcidx = inb(0x3ce);
       gdcval = inb(0x3cf);
     }
-    __VGLBitmapCopy(VGLDisplay, VGLMouseXpos, VGLMouseYpos, 
-		  &VGLMouseSave, 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
-    bcopy(VGLMouseSave.Bitmap, buffer.Bitmap,
-          MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*VGLDisplay->PixelBytes);
+    buffer.PixelBytes = VGLDisplay->PixelBytes;
+    __VGLBitmapCopy(&VGLVDisplay, VGLMouseXpos, VGLMouseYpos, 
+                    &buffer, 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
     for (pos = 0; pos <  MOUSE_IMG_SIZE*MOUSE_IMG_SIZE; pos++)
       for (i = 0; i < VGLDisplay->PixelBytes; i++) {
         pos1 = pos * VGLDisplay->PixelBytes + i;
@@ -154,8 +150,8 @@ VGLMousePointerHide()
       gdcidx = inb(0x3ce);
       gdcval = inb(0x3cf);
     }
-    __VGLBitmapCopy(&VGLMouseSave, 0, 0, VGLDisplay, 
-		  VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
+    __VGLBitmapCopy(&VGLVDisplay, VGLMouseXpos, VGLMouseYpos, VGLDisplay, 
+                    VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
     if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
       outb(0x3c4, crtcidx);
       outb(0x3c5, crtcval);
@@ -302,8 +298,6 @@ VGLMouseStatus(int *x, int *y, char *buttons)
 int
 VGLMouseFreeze(int x, int y, int width, int hight, u_long color)
 {
-  int i, xstride, ystride;
-
     INTOFF();
     if (width > 1 || hight > 1 || (color & 0xc0000000) == 0) { /* bitmap */
       if (VGLMouseShown == 1) {
@@ -327,20 +321,7 @@ VGLMouseFreeze(int x, int y, int width, int hight, u_l
       if (VGLMouseShown &&
           x >= VGLMouseXpos && x < VGLMouseXpos + MOUSE_IMG_SIZE &&
           y >= VGLMouseYpos && y < VGLMouseYpos + MOUSE_IMG_SIZE) {
-        xstride = VGLDisplay->PixelBytes;
-        ystride = MOUSE_IMG_SIZE * xstride;
-        if (color & 0x40000000) {	/* Get */
-          color = 0;
-          for (i = xstride - 1; i >= 0; i--)
-            color = (color << 8) |
-                    VGLMouseSave.Bitmap[(y-VGLMouseYpos)*ystride+
-                                        (x-VGLMouseXpos)*xstride+i];
-          return 0x40000000 | (color & 0xffffff);
-        } else {			/* Set */
-          color &= 0xffffff;		/* discard flag and other garbage */
-          for (i = 0; i < xstride; i++, color >>= 8)
-            VGLMouseSave.Bitmap[(y-VGLMouseYpos)*ystride+
-                                (x-VGLMouseXpos)*xstride+i] = color;
+        if (color & 0x80000000) {	/* Set */
           if (VGLMouseAndMask->Bitmap 
             [(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)]) {
             return 1;

Modified: head/lib/libvgl/simple.c
==============================================================================
--- head/lib/libvgl/simple.c	Sun Apr 21 14:45:18 2019	(r346487)
+++ head/lib/libvgl/simple.c	Sun Apr 21 16:17:35 2019	(r346488)
@@ -55,6 +55,8 @@ VGLSetXY(VGLBitmap *object, int x, int y, u_long color
 
   VGLCheckSwitch();
   if (x>=0 && x<object->VXsize && y>=0 && y<object->VYsize) {
+    if (object == VGLDisplay)
+      VGLSetXY(&VGLVDisplay, x, y, color);
     if (object->Type == MEMBUF ||
         !VGLMouseFreeze(x, y, 1, 1, 0x80000000 | color)) {
       offset = (y * object->VXsize + x) * object->PixelBytes;
@@ -113,78 +115,37 @@ static u_long
 __VGLGetXY(VGLBitmap *object, int x, int y)
 {
   int offset;
-  int i;
   u_long color;
-  byte mask;
 
   offset = (y * object->VXsize + x) * object->PixelBytes;
-  switch (object->Type) {
-    case VIDBUF8S:
-    case VIDBUF16S:
-    case VIDBUF24S:
-    case VIDBUF32S:
-      offset = VGLSetSegment(offset);
-      /* FALLTHROUGH */
-    case MEMBUF:
-    case VIDBUF8:
-    case VIDBUF16:
-    case VIDBUF24:
-    case VIDBUF32:
-      switch (object->PixelBytes) {
-      case 1:
-        memcpy(&color, &object->Bitmap[offset], 1);
-        return le32toh(color) & 0xff;
-      case 2:
-        memcpy(&color, &object->Bitmap[offset], 2);
-        return le32toh(color) & 0xffff;
-      case 3:
-        memcpy(&color, &object->Bitmap[offset], 3);
-        return le32toh(color) & 0xffffff;
-      case 4:
-        memcpy(&color, &object->Bitmap[offset], 4);
-        return le32toh(color);
-      }
-      break;
-    case VIDBUF8X:
-      outb(0x3ce, 0x04); outb(0x3cf, x & 0x3);
-      return object->Bitmap[(unsigned)(VGLAdpInfo.va_line_width*y)+(x/4)];
-    case VIDBUF4S:
-      offset = VGLSetSegment(y*VGLAdpInfo.va_line_width + x/8);
-      goto get_planar;
-    case VIDBUF4:
-      offset = y*VGLAdpInfo.va_line_width + x/8;
-get_planar:
-      color = 0;
-      mask = 0x80 >> (x%8);
-      for (i = 0; i < VGLModeInfo.vi_planes; i++) {
-	outb(0x3ce, 0x04); outb(0x3cf, i);
-	color |= (((volatile VGLBitmap *)object)->Bitmap[offset] & mask) ?
-		 (1 << i) : 0;
-      }
-      return color;
+  switch (object->PixelBytes) {
+  case 1:
+    memcpy(&color, &object->Bitmap[offset], 1);
+    return le32toh(color) & 0xff;
+  case 2:
+    memcpy(&color, &object->Bitmap[offset], 2);
+    return le32toh(color) & 0xffff;
+  case 3:
+    memcpy(&color, &object->Bitmap[offset], 3);
+    return le32toh(color) & 0xffffff;
+  case 4:
+    memcpy(&color, &object->Bitmap[offset], 4);
+    return le32toh(color);
   }
-  return 0;		/* XXX black? */
+  return 0;		/* invalid */
 }
 
 u_long
 VGLGetXY(VGLBitmap *object, int x, int y)
 {
-  u_long color;
-
   VGLCheckSwitch();
   if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
     return 0;
-  if (object->Type != MEMBUF) {
-    color = VGLMouseFreeze(x, y, 1, 1, 0x40000000);
-    if (color & 0x40000000) {
-      VGLMouseUnFreeze();
-      return color & 0xffffff;
-    }
-  }
-  color = __VGLGetXY(object, x, y);
+  if (object == VGLDisplay)
+    object = &VGLVDisplay;
   if (object->Type != MEMBUF)
-    VGLMouseUnFreeze();
-  return color;
+    return 0;		/* invalid */
+  return __VGLGetXY(object, x, y);
 }
 
  /*
@@ -493,8 +454,11 @@ VGLClear(VGLBitmap *object, u_long color)
   int i;
 
   VGLCheckSwitch();
-  if (object->Type != MEMBUF)
+  if (object == VGLDisplay) {
     VGLMouseFreeze(0, 0, object->Xsize, object->Ysize, color);
+    VGLClear(&VGLVDisplay, color);
+  } else if (object->Type != MEMBUF)
+    return;		/* invalid */
   switch (object->Type) {
   case MEMBUF:
   case VIDBUF8:
@@ -545,7 +509,7 @@ VGLClear(VGLBitmap *object, u_long color)
     outb(0x3ce, 0x05); outb(0x3cf, 0x00);
     break;
   }
-  if (object->Type != MEMBUF)
+  if (object == VGLDisplay)
     VGLMouseUnFreeze();
 }
 

Modified: head/lib/libvgl/vgl.h
==============================================================================
--- head/lib/libvgl/vgl.h	Sun Apr 21 14:45:18 2019	(r346487)
+++ head/lib/libvgl/vgl.h	Sun Apr 21 16:17:35 2019	(r346488)
@@ -100,6 +100,7 @@ typedef struct VGLObject {
 extern video_adapter_info_t	VGLAdpInfo;
 extern video_info_t		VGLModeInfo;
 extern VGLBitmap 		*VGLDisplay;
+extern VGLBitmap 		VGLVDisplay;
 extern byte 			*VGLBuf;
 
 /*




More information about the svn-src-all mailing list