changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: igfx: support for X60t with 1400x1050 panel

changeset 4214: d9f445833252
parent 4213: 58775c177bda
child 4215: 4a09496c5f5f
author: cinap_lenrek@felloff.net
date: Fri, 16 Jan 2015 07:55:38 +0100
files: sys/src/cmd/aux/vga/igfx.c
description: igfx: support for X60t with 1400x1050 panel

program secret plane size and position registers described as "reserved"
in g45_vol_3_register_0_0.pdf that was found by inspecting vesa bios
port traces.

also, we have to set 18:19 (Cursor/Dispaly/Overlay Planes Off) in
PIPExCONF while programming the planes on this card. this is what
vesa bios does on modeset.
     1.1--- a/sys/src/cmd/aux/vga/igfx.c
     1.2+++ b/sys/src/cmd/aux/vga/igfx.c
     1.3@@ -24,7 +24,7 @@ enum {
     1.4 
     1.5 enum {
     1.6 	TypeG45,
     1.7-	TypeIVB,		/* Ivy Bdige */
     1.8+	TypeIVB,		/* Ivy Bridge */
     1.9 };
    1.10 
    1.11 struct Reg {
    1.12@@ -94,6 +94,9 @@ struct Plane {
    1.13 	Reg	stride;		/* DSPxSTRIDE */
    1.14 	Reg	surf;		/* DSPxSURF */
    1.15 	Reg	tileoff;	/* DSPxTILEOFF */
    1.16+
    1.17+	Reg	pos;
    1.18+	Reg	size;
    1.19 };
    1.20 
    1.21 struct Curs {
    1.22@@ -289,6 +292,9 @@ snarfpipe(Igfx *igfx, int x)
    1.23 		p->cur->pos	= snarfreg(igfx, 0x70088 | x*0x1000);
    1.24 		break;
    1.25 	case TypeG45:
    1.26+		p->dsp->pos	= snarfreg(igfx, 0x7018C | x*0x1000);
    1.27+		p->dsp->size	= snarfreg(igfx, 0x70190 | x*0x1000);
    1.28+
    1.29 		p->cur->cntr	= snarfreg(igfx, 0x70080 | x*0x40);
    1.30 		p->cur->base	= snarfreg(igfx, 0x70084 | x*0x40);
    1.31 		p->cur->pos	= snarfreg(igfx, 0x7008C | x*0x40);
    1.32@@ -304,7 +310,7 @@ devtype(Igfx *igfx)
    1.33 	switch(igfx->pci->did){
    1.34 	case 0x0166:	/* X230 */
    1.35 		return TypeIVB;
    1.36-	case 0x27a2:	/* T60 (testing) */
    1.37+	case 0x27a2:	/* X60t */
    1.38 	case 0x2a42:	/* X200 */
    1.39 		return TypeG45;
    1.40 	}
    1.41@@ -684,10 +690,10 @@ initpipe(Pipe *p, Mode *m)
    1.42 	p->src.v = (m->x - 1)<<16 | (m->y - 1);
    1.43 
    1.44 	if(p->pfit != nil){
    1.45-		/* panel fitter on, hardcoded coefficients */
    1.46-		p->pfit->ctrl.v = 1<<31 | 1<<23;
    1.47+		/* panel fitter off */
    1.48+		p->pfit->ctrl.v &= ~(1<<31);
    1.49 		p->pfit->winpos.v = 0;
    1.50-		p->pfit->winsize.v = (m->x << 16) | m->y;
    1.51+		p->pfit->winsize.v = 0;
    1.52 	}
    1.53 
    1.54 	/* enable and set monitor timings for cpu pipe */
    1.55@@ -826,6 +832,10 @@ init(Vga* vga, Ctlr* ctlr)
    1.56 	/* virtual width in pixels */
    1.57 	vga->virtx = p->dsp->stride.v / (m->z / 8);
    1.58 
    1.59+	/* plane position and size */
    1.60+	p->dsp->pos.v = 0;
    1.61+	p->dsp->size.v = (m->y - 1)<<16 | (m->x - 1);	/* sic */
    1.62+
    1.63 	p->dsp->surf.v = 0;
    1.64 	p->dsp->linoff.v = 0;
    1.65 	p->dsp->tileoff.v = 0;
    1.66@@ -931,6 +941,10 @@ enablepipe(Igfx *igfx, int x)
    1.67 		loadreg(igfx, p->pfit->winsize);	/* arm */
    1.68 	}
    1.69 
    1.70+	/* keep planes disabled while pipe comes up */
    1.71+	if(igfx->type == TypeG45)
    1.72+		p->conf.v |= 3<<18;
    1.73+
    1.74 	/* enable cpu pipe */
    1.75 	loadtrans(igfx, p);
    1.76 
    1.77@@ -939,6 +953,8 @@ enablepipe(Igfx *igfx, int x)
    1.78 	loadreg(igfx, p->dsp->linoff);
    1.79 	loadreg(igfx, p->dsp->stride);
    1.80 	loadreg(igfx, p->dsp->tileoff);
    1.81+	loadreg(igfx, p->dsp->size);
    1.82+	loadreg(igfx, p->dsp->pos);
    1.83 	loadreg(igfx, p->dsp->surf);	/* arm */
    1.84 
    1.85 	/* program cursor */
    1.86@@ -946,6 +962,12 @@ enablepipe(Igfx *igfx, int x)
    1.87 	loadreg(igfx, p->cur->pos);
    1.88 	loadreg(igfx, p->cur->base);	/* arm */
    1.89 
    1.90+	/* enable planes */
    1.91+	if(igfx->type == TypeG45) {
    1.92+		p->conf.v &= ~(3<<18);
    1.93+		loadreg(igfx, p->conf);
    1.94+	}
    1.95+
    1.96 	if(p->fdi->rxctl.a != 0){
    1.97 		/* enable fdi */
    1.98 		loadreg(igfx, p->fdi->rxtu[1]);
    1.99@@ -1205,6 +1227,8 @@ dumppipe(Igfx *igfx, int x)
   1.100 	dumpreg(name, "stride", p->dsp->stride);
   1.101 	dumpreg(name, "surf", p->dsp->surf);
   1.102 	dumpreg(name, "tileoff", p->dsp->tileoff);
   1.103+	dumpreg(name, "pos", p->dsp->pos);
   1.104+	dumpreg(name, "size", p->dsp->size);
   1.105 
   1.106 	snprint(name, sizeof(name), "%s cur %c", igfx->ctlr->name, 'a'+x);
   1.107 	dumpreg(name, "cntr", p->cur->cntr);