From 0e632454e2d6cba7acb7e05771e027244e02416d Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 27 Dec 2020 23:10:39 +0100 Subject: [PATCH] aux/vga: remove panning, add screen tilting support --- sys/man/8/vga | 18 +++++++++++++++--- sys/src/cmd/aux/vga/main.c | 17 ++++++++++------- sys/src/cmd/aux/vga/vesa.c | 1 - sys/src/cmd/aux/vga/vga.c | 2 -- sys/src/cmd/aux/vga/vga.h | 2 -- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/sys/man/8/vga b/sys/man/8/vga index ff62768bd..f274267ad 100644 --- a/sys/man/8/vga +++ b/sys/man/8/vga @@ -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 diff --git a/sys/src/cmd/aux/vga/main.c b/sys/src/cmd/aux/vga/main.c index 8d044c906..deeed1784 100644 --- a/sys/src/cmd/aux/vga/main.c +++ b/sys/src/cmd/aux/vga/main.c @@ -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); } diff --git a/sys/src/cmd/aux/vga/vesa.c b/sys/src/cmd/aux/vga/vesa.c index 1f353e73b..9b7165e31 100644 --- a/sys/src/cmd/aux/vga/vesa.c +++ b/sys/src/cmd/aux/vga/vesa.c @@ -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; } diff --git a/sys/src/cmd/aux/vga/vga.c b/sys/src/cmd/aux/vga/vga.c index c208b81a4..ac2420a2b 100644 --- a/sys/src/cmd/aux/vga/vga.c +++ b/sys/src/cmd/aux/vga/vga.c @@ -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]); diff --git a/sys/src/cmd/aux/vga/vga.h b/sys/src/cmd/aux/vga/vga.h index daea27467..cea109fc4 100644 --- a/sys/src/cmd/aux/vga/vga.h +++ b/sys/src/cmd/aux/vga/vga.h @@ -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;