aux/vga: remove panning, add screen tilting support

This commit is contained in:
cinap_lenrek 2020-12-27 23:10:39 +01:00
parent 806353ec9e
commit 0e632454e2
5 changed files with 25 additions and 15 deletions

View file

@ -15,6 +15,10 @@ vga \- configure a VGA card
.I monitor
]
[
.B -t
.I tilt
]
[
.B -x
.I file
]
@ -91,6 +95,17 @@ print a trace of the functions called.
.B -V
print a verbose trace of the functions called.
.TP
.B -t
can be used to change the tilt of the screen.
The value is one of
.BR none ,
.BR left ,
.B inverted
and
.BR right .
See
.IR vga (3).
.TP
.BI -x " file"
use
.I file
@ -137,9 +152,6 @@ is of the form
.I X x Y
and configures the display to have a virtual
screen of the given size.
The physical screen will pan to follow the mouse.
This is useful on displays with small screens,
such as laptops, but can be confusing.
.PP
Using the monitor name
.B vesa

View file

@ -204,14 +204,14 @@ chanstr[32+1] = {
static void
usage(void)
{
fprint(2, "usage: aux/vga [ -BcdilpvV ] [ -b bios-id ] [ -m monitor ] [ -x db ] [ mode [ virtualsize ] ]\n");
fprint(2, "usage: aux/vga [ -BcdilpvV ] [ -b bios-id ] [ -m monitor ] [ -x db ] [ -t tilt ] [ mode [ virtualsize ] ]\n");
exits("usage");
}
void
main(int argc, char** argv)
{
char *bios, buf[256], sizeb[256], *p, *vsize, *psize;
char *bios, buf[256], sizeb[256], *p, *vsize, *psize, *tilt;
char *type, *vtype;
int virtual, len;
Ctlr *ctlr;
@ -220,8 +220,9 @@ main(int argc, char** argv)
fmtinstall('H', encodefmt);
Binit(&stdout, 1, OWRITE);
tilt = getenv("tiltscreen");
bios = getenv("vgactlr");
if((type = getenv("monitor")) == 0)
if((type = getenv("monitor")) == nil)
type = "vga";
psize = vsize = "640x480x8";
@ -259,6 +260,9 @@ main(int argc, char** argv)
*/
rflag++;
break;
case 't':
tilt = EARGF(usage());
break;
case 'v':
vflag = 1;
break;
@ -372,12 +376,10 @@ main(int argc, char** argv)
vga->virty = atoi(p+1);
if(vga->virtx < vga->mode->x || vga->virty < vga->mode->y)
error("virtual size smaller than physical size\n");
vga->panning = 1;
}
else{
vga->virtx = vga->mode->x;
vga->virty = vga->mode->y;
vga->panning = 0;
}
trace("vmf %d vmdf %d vf1 %lud vbw %lud\n",
@ -526,10 +528,11 @@ main(int argc, char** argv)
if(vga->virtx != vga->mode->x || vga->virty != vga->mode->y){
sprint(buf, "%dx%d", vga->mode->x, vga->mode->y);
vgactlw("actualsize", buf);
if(vga->panning)
vgactlw("panning", "on");
}
if(tilt != nil && *tilt != '\0')
vgactlw("tilt", tilt);
if(pflag)
dump(vga);
}

View file

@ -275,7 +275,6 @@ options(Vga *vga, Ctlr *ctlr)
if(v = dbattr(vga->mode->attr, "virtx")){
vga->virtx = atoi(v);
vga->virty = vga->mode->y;
vga->panning = 0;
}
ctlr->flag |= Foptions;
}

View file

@ -434,8 +434,6 @@ dump(Vga* vga, Ctlr* ctlr)
printitem(ctlr->name, "virtual");
Bprint(&stdout, "%ld %ld\n", vga->virtx, vga->virty);
printitem(ctlr->name, "panning");
Bprint(&stdout, "%s\n", vga->panning ? "on" : "off");
if(vga->f[0]){
printitem(ctlr->name, "clock[0] f");
Bprint(&stdout, "%9ld\n", vga->f[0]);

View file

@ -212,8 +212,6 @@ typedef struct Vga {
ulong virtx; /* resolution of virtual screen */
ulong virty;
int panning; /* pan the virtual screen */
Ctlr* ctlr;
Ctlr* ramdac;
Ctlr* clock;