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 .I monitor
] ]
[ [
.B -t
.I tilt
]
[
.B -x .B -x
.I file .I file
] ]
@ -91,6 +95,17 @@ print a trace of the functions called.
.B -V .B -V
print a verbose trace of the functions called. print a verbose trace of the functions called.
.TP .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" .BI -x " file"
use use
.I file .I file
@ -137,9 +152,6 @@ is of the form
.I X x Y .I X x Y
and configures the display to have a virtual and configures the display to have a virtual
screen of the given size. 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 .PP
Using the monitor name Using the monitor name
.B vesa .B vesa

View file

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

View file

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

View file

@ -434,8 +434,6 @@ dump(Vga* vga, Ctlr* ctlr)
printitem(ctlr->name, "virtual"); printitem(ctlr->name, "virtual");
Bprint(&stdout, "%ld %ld\n", vga->virtx, vga->virty); 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]){ if(vga->f[0]){
printitem(ctlr->name, "clock[0] f"); printitem(ctlr->name, "clock[0] f");
Bprint(&stdout, "%9ld\n", vga->f[0]); Bprint(&stdout, "%9ld\n", vga->f[0]);

View file

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