summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/vgas3.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-12-27 23:08:59 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-12-27 23:08:59 +0100
commit806353ec9eda162a3ff13cad1e5228c58cd67566 (patch)
tree442d3fcd52e36862de12d047cf6e3a5eca2672d0 /sys/src/9/pc/vgas3.c
parent874e71c8dc489b820c9a6066d13c470a34d7f83f (diff)
devvga: implement screen tilting, remove panning and overlays
Tilting allows using left/right rotated or invetrted display orientation. This can be changed at runtime such as: echo tilt right > /dev/vgactl This removes the old panning and vga overlays as they are only implemented with some ancient vga controllers.
Diffstat (limited to 'sys/src/9/pc/vgas3.c')
-rw-r--r--sys/src/9/pc/vgas3.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sys/src/9/pc/vgas3.c b/sys/src/9/pc/vgas3.c
index 710756d7c..e6e400fda 100644
--- a/sys/src/9/pc/vgas3.c
+++ b/sys/src/9/pc/vgas3.c
@@ -309,7 +309,7 @@ s3enable(VGAscr* scr)
* Find a place for the cursor data in display memory.
* Must be on a 1024-byte boundary.
*/
- storage = (scr->gscreen->width*sizeof(ulong)*scr->gscreen->r.max.y+1023)/1024;
+ storage = (scr->pitch*scr->height+1023)/1024;
vgaxo(Crtx, 0x4C, storage>>8);
vgaxo(Crtx, 0x4D, storage & 0xFF);
storage *= 1024;
@@ -420,14 +420,12 @@ hwscroll(VGAscr *scr, Rectangle r, Rectangle sr)
{
enum { Bitbltop = 0xCC }; /* copy source */
ulong *mmio;
- ulong cmd, stride;
+ ulong cmd;
Point dp, sp;
- int did, d;
+ int did;
- d = scr->gscreen->depth;
- did = (d-8)/8;
+ did = (scr->gscreen->depth-8)/8;
cmd = 0x00000020|(Bitbltop<<17)|(did<<2);
- stride = Dx(scr->gscreen->r)*d/8;
if(r.min.x <= sr.min.x){
cmd |= 1<<25;
@@ -452,7 +450,7 @@ hwscroll(VGAscr *scr, Rectangle r, Rectangle sr)
waitforfifo(scr, 7);
mmio[SrcBase] = scr->paddr;
mmio[DstBase] = scr->paddr;
- mmio[Stride] = (stride<<16)|stride;
+ mmio[Stride] = (scr->pitch<<16)|scr->pitch;
mmio[WidthHeight] = ((Dx(r)-1)<<16)|Dy(r);
mmio[SrcXY] = (sp.x<<16)|sp.y;
mmio[DestXY] = (dp.x<<16)|dp.y;
@@ -466,20 +464,18 @@ hwfill(VGAscr *scr, Rectangle r, ulong sval)
{
enum { Bitbltop = 0xCC }; /* copy source */
ulong *mmio;
- ulong cmd, stride;
- int did, d;
+ ulong cmd;
+ int did;
- d = scr->gscreen->depth;
- did = (d-8)/8;
+ did = (scr->gscreen->depth-8)/8;
cmd = 0x16000120|(Bitbltop<<17)|(did<<2);
- stride = Dx(scr->gscreen->r)*d/8;
mmio = scr->mmio;
waitforlinearfifo(scr);
waitforfifo(scr, 8);
mmio[SrcBase] = scr->paddr;
mmio[DstBase] = scr->paddr;
mmio[DstBase] = scr->paddr;
- mmio[Stride] = (stride<<16)|stride;
+ mmio[Stride] = (scr->pitch<<16)|scr->pitch;
mmio[FgrdData] = sval;
mmio[WidthHeight] = ((Dx(r)-1)<<16)|Dy(r);
mmio[DestXY] = (r.min.x<<16)|r.min.y;