]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/vgas3.c
[9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
[plan9front.git] / sys / src / 9 / pc / vgas3.c
index a948b315449031339b23b7e5b472f73055a609c9..e6e400fda69fc14b6122ecd59163f371d2b44483 100644 (file)
@@ -4,6 +4,7 @@
 #include "dat.h"
 #include "fns.h"
 #include "io.h"
+#include "../port/pci.h"
 #include "../port/error.h"
 
 #define        Image   IMAGE
@@ -91,8 +92,9 @@ s3page(VGAscr* scr, int page)
 static void
 s3linear(VGAscr* scr, int, int)
 {
+       uvlong mmiobase;
+       ulong mmiosize;
        int id, j;
-       ulong mmiobase, mmiosize;
        Pcidev *p;
        
        p = scr->pci;
@@ -307,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;
@@ -317,7 +319,7 @@ s3enable(VGAscr* scr)
         * Load, locate and enable the cursor
         * in Microsoft Windows format.
         */
-       s3load(scr, &arrow);
+       s3load(scr, &cursor);
        s3move(scr, ZP);
        vgaxo(Crtx, 0x55, vgaxi(Crtx, 0x55) & ~0x10);
        s3vsyncactive();
@@ -418,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;
@@ -450,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;
@@ -464,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;