diff --git a/lib/libvgl/main.c b/lib/libvgl/main.c index df52de6c10fd..3b5ac8e955df 100644 --- a/lib/libvgl/main.c +++ b/lib/libvgl/main.c @@ -93,7 +93,8 @@ struct vt_mode smode; size[2] = VGLOldVInfo.font_size;; ioctl(0, KDRASTER, size); } - ioctl(0, KDDISABIO, 0); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) + ioctl(0, KDDISABIO, 0); ioctl(0, KDSETMODE, KD_TEXT); smode.mode = VT_AUTO; ioctl(0, VT_SETMODE, &smode); @@ -176,7 +177,7 @@ VGLInit(int mode) if (VGLDisplay == NULL) return -2; - if (ioctl(0, KDENABIO, 0)) { + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0)) { free(VGLDisplay); return -3; } @@ -370,7 +371,8 @@ VGLCheckSwitch() VGLSwitchPending = 0; if (VGLOnDisplay) { - ioctl(0, KDENABIO, 0); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) + ioctl(0, KDENABIO, 0); ioctl(0, KDSETMODE, KD_GRAPHICS); ioctl(0, VGLMode, 0); VGLCurWindow = 0; @@ -531,7 +533,8 @@ VGLCheckSwitch() munmap(VGLDisplay->Bitmap, VGLAdpInfo.va_window_size); ioctl(0, VGLOldMode, 0); ioctl(0, KDSETMODE, KD_TEXT); - ioctl(0, KDDISABIO, 0); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) + ioctl(0, KDDISABIO, 0); ioctl(0, VT_RELDISP, VT_TRUE); VGLDisplay->Bitmap = VGLBuf; VGLDisplay->Type = MEMBUF; diff --git a/lib/libvgl/mouse.c b/lib/libvgl/mouse.c index 0a2ebe5dadb6..8dc429a932c3 100644 --- a/lib/libvgl/mouse.c +++ b/lib/libvgl/mouse.c @@ -111,10 +111,12 @@ VGLMousePointerShow() if (!VGLMouseVisible) { INTOFF(); VGLMouseVisible = 1; - crtcidx = inb(0x3c4); - crtcval = inb(0x3c5); - gdcidx = inb(0x3ce); - gdcval = inb(0x3cf); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) { + crtcidx = inb(0x3c4); + crtcval = inb(0x3c5); + gdcidx = inb(0x3ce); + gdcval = inb(0x3cf); + } __VGLBitmapCopy(VGLDisplay, VGLMouseXpos, VGLMouseYpos, &VGLMouseSave, 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); bcopy(VGLMouseSave.Bitmap, buffer.Bitmap, @@ -128,10 +130,12 @@ VGLMousePointerShow() } __VGLBitmapCopy(&buffer, 0, 0, VGLDisplay, VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); - outb(0x3c4, crtcidx); - outb(0x3c5, crtcval); - outb(0x3ce, gdcidx); - outb(0x3cf, gdcval); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) { + outb(0x3c4, crtcidx); + outb(0x3c5, crtcval); + outb(0x3ce, gdcidx); + outb(0x3cf, gdcval); + } INTON(); } } @@ -144,16 +148,20 @@ VGLMousePointerHide() if (VGLMouseVisible) { INTOFF(); VGLMouseVisible = 0; - crtcidx = inb(0x3c4); - crtcval = inb(0x3c5); - gdcidx = inb(0x3ce); - gdcval = inb(0x3cf); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) { + crtcidx = inb(0x3c4); + crtcval = inb(0x3c5); + gdcidx = inb(0x3ce); + gdcval = inb(0x3cf); + } __VGLBitmapCopy(&VGLMouseSave, 0, 0, VGLDisplay, VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); - outb(0x3c4, crtcidx); - outb(0x3c5, crtcval); - outb(0x3ce, gdcidx); - outb(0x3cf, gdcval); + if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) { + outb(0x3c4, crtcidx); + outb(0x3c5, crtcval); + outb(0x3ce, gdcidx); + outb(0x3cf, gdcval); + } INTON(); } } diff --git a/lib/libvgl/simple.c b/lib/libvgl/simple.c index 3879ace8576d..1da02746c529 100644 --- a/lib/libvgl/simple.c +++ b/lib/libvgl/simple.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "vgl.h" @@ -551,6 +552,8 @@ VGLRestorePalette() { int i; + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + return; outb(0x3C6, 0xFF); inb(0x3DA); outb(0x3C8, 0x00); @@ -571,6 +574,8 @@ VGLSavePalette() { int i; + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + return; outb(0x3C6, 0xFF); inb(0x3DA); outb(0x3C7, 0x00); @@ -591,6 +596,8 @@ VGLSetPalette(byte *red, byte *green, byte *blue) { int i; + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + return; for (i=0; i<256; i++) { VGLSavePaletteRed[i] = red[i]; VGLSavePaletteGreen[i] = green[i]; @@ -615,6 +622,8 @@ VGLSetPalette(byte *red, byte *green, byte *blue) void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue) { + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + return; VGLSavePaletteRed[color] = red; VGLSavePaletteGreen[color] = green; VGLSavePaletteBlue[color] = blue; @@ -630,11 +639,15 @@ VGLSetPaletteIndex(byte color, byte red, byte green, byte blue) void VGLSetBorder(byte color) { + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0)) + return; VGLCheckSwitch(); inb(0x3DA); outb(0x3C0,0x11); outb(0x3C0, color); inb(0x3DA); outb(0x3C0, 0x20); + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + ioctl(0, KDDISABIO, 0); } void @@ -642,7 +655,11 @@ VGLBlankDisplay(int blank) { byte val; + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0)) + return; VGLCheckSwitch(); outb(0x3C4, 0x01); val = inb(0x3C5); outb(0x3C4, 0x01); outb(0x3C5, ((blank) ? (val |= 0x20) : (val &= 0xDF))); + if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT) + ioctl(0, KDDISABIO, 0); }