vmx(1): round up frame buffer size to whole pages, ignore vga access in linear framebuffer, tell openbsd about framebuffer
This commit is contained in:
parent
164588e3e2
commit
da6e5efe39
2 changed files with 34 additions and 0 deletions
|
@ -554,6 +554,34 @@ obsdend(void)
|
||||||
obsdarg0 = nil;
|
obsdarg0 = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
obsdfb(void)
|
||||||
|
{
|
||||||
|
int i, s, p;
|
||||||
|
u32int r, g, b, a, m;
|
||||||
|
extern VgaMode *curmode, textmode;
|
||||||
|
extern uintptr fbaddr, fbsz;
|
||||||
|
|
||||||
|
if(curmode == &textmode) return;
|
||||||
|
p = r = g = b = a = 0;
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
s = curmode->chan >> 8 * i & 0xf;
|
||||||
|
if(s == 0) continue;
|
||||||
|
m = (1<<s)-1 << p;
|
||||||
|
p += s;
|
||||||
|
switch(curmode->chan >> 4 + 8 * i & 0xf){
|
||||||
|
case CRed: r |= m; break;
|
||||||
|
case CGreen: g |= m; break;
|
||||||
|
case CBlue: b |= m; break;
|
||||||
|
case CAlpha: case CIgnore: a |= m; break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obsdstart(BOOTARG_EFIINFO);
|
||||||
|
obsdpack("vvvviiiiiii", 0ULL, 0ULL, (uvlong)fbaddr, (uvlong)fbsz, curmode->h, curmode->w, curmode->w, r, g, b, a);
|
||||||
|
obsdend();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
obsdargs(void)
|
obsdargs(void)
|
||||||
{
|
{
|
||||||
|
@ -572,6 +600,7 @@ obsdargs(void)
|
||||||
if(obsddbcons != -1){
|
if(obsddbcons != -1){
|
||||||
obsdstart(BOOTARG_DDB); obsdpack("i", obsddbcons); obsdend();
|
obsdstart(BOOTARG_DDB); obsdpack("i", obsddbcons); obsdend();
|
||||||
}
|
}
|
||||||
|
obsdfb();
|
||||||
obsdstart(BOOTARG_END); obsdend();
|
obsdstart(BOOTARG_END); obsdend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ uintptr fbaddr;
|
||||||
VgaMode *curmode, *nextmode, *modes, **modeslast = &modes;
|
VgaMode *curmode, *nextmode, *modes, **modeslast = &modes;
|
||||||
int curhbytes, nexthbytes;
|
int curhbytes, nexthbytes;
|
||||||
int vesamode, maxw, maxh;
|
int vesamode, maxw, maxh;
|
||||||
|
int novga;
|
||||||
|
|
||||||
VgaMode textmode = {
|
VgaMode textmode = {
|
||||||
.w 640, .h 400, .no 3
|
.w 640, .h 400, .no 3
|
||||||
|
@ -152,6 +153,8 @@ vgaio(int isin, u16int port, u32int val, int sz, void *)
|
||||||
{
|
{
|
||||||
u32int m;
|
u32int m;
|
||||||
|
|
||||||
|
if(novga)
|
||||||
|
return 0;
|
||||||
if(port == 0x3d4 && sz == 2 && !isin){
|
if(port == 0x3d4 && sz == 2 && !isin){
|
||||||
vgaio(0, 0x3d4, (u8int)val, 1, nil);
|
vgaio(0, 0x3d4, (u8int)val, 1, nil);
|
||||||
return vgaio(0, 0x3d5, (u8int)(val >> 8), 1, nil);
|
return vgaio(0, 0x3d5, (u8int)(val >> 8), 1, nil);
|
||||||
|
@ -691,6 +694,8 @@ vgafbparse(char *fbstring)
|
||||||
if(vesamode == 0){
|
if(vesamode == 0){
|
||||||
curmode = modes;
|
curmode = modes;
|
||||||
curhbytes = curmode->hbytes;
|
curhbytes = curmode->hbytes;
|
||||||
|
fbsz = -(-fbsz & -4096);
|
||||||
|
novga = 1;
|
||||||
}else{
|
}else{
|
||||||
curmode = &textmode;
|
curmode = &textmode;
|
||||||
if(fbsz < (1<<22))
|
if(fbsz < (1<<22))
|
||||||
|
|
Loading…
Reference in a new issue