From d4e99b8dbde227f8ee141e961e69d761e573efaf Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 9 Oct 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-10-09 --- pc/devvga.c | 14 ++++++++++++++ pc/screen.h | 3 +++ pc/vgat2r4.c | 39 +++++++++++++++++++++++++++++---------- port/devdraw.c | 6 ++++++ 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/pc/devvga.c b/pc/devvga.c index 814445d971fcd292dfa7b4588d0caf90a503ad54..195f7e820795220171e7c9cef3d409d29d8fadf8 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -129,6 +129,8 @@ vgaread(Chan* c, void* a, long n, vlong off) return 0; } +static char Ebusy[] = "vga already configured"; + static void vgactl(char* a) { @@ -195,6 +197,9 @@ vgactl(char* a) else if(strcmp(field[0], "size") == 0){ if(n < 3) error(Ebadarg); + if(drawhasclients()) + error(Ebusy); + x = strtoul(field[1], &p, 0); if(x == 0 || x > 2048) error(Ebadarg); @@ -264,8 +269,17 @@ vgactl(char* a) return; } else if(strcmp(field[0], "drawinit") == 0){ + /* + * This is a separate message, but first we need to make + * aux/vga send it; once everyone has the new vga, we + * can take the drawinit stuff out of hwgc. + */ + + /* if(scr && scr->dev && scr->dev->drawinit) scr->dev->drawinit(scr); + */ + return; } else if(strcmp(field[0], "linear") == 0){ diff --git a/pc/screen.h b/pc/screen.h index 68b7ad566b5c202dda6c3e9cb2fc13eea40ccca0..863c4543be10135514798d73c525d9552ba2dec6 100644 --- a/pc/screen.h +++ b/pc/screen.h @@ -131,7 +131,10 @@ extern void setcursor(Cursor*); extern int screensize(int, int, int, ulong); extern int screenaperture(int, int); extern Rectangle physgscreenr; /* actual monitor size */ + +/* devdraw.c */ extern void deletescreenimage(void); +extern int drawhasclients(void); /* vga.c */ extern void vgascreenwin(VGAscr*); diff --git a/pc/vgat2r4.c b/pc/vgat2r4.c index 5db33da178ca1fbc20d1a7148605447b846c41bc..21ba69226c6d9f61f664f831aaa1d4aacea471fb 100644 --- a/pc/vgat2r4.c +++ b/pc/vgat2r4.c @@ -45,8 +45,8 @@ enum { /* index registers */ CursorArray = 0x100, - CursorMode32x32 = 0x03, - CursorMode64x64 = 0x07, + CursorMode32x32 = 0x23, + CursorMode64x64 = 0x27, CursorMode = CursorMode64x64, }; @@ -185,9 +185,9 @@ t2r4curdisable(VGAscr* scr) static void t2r4curload(VGAscr* scr, Cursor* curs) { - int x, y; - ulong *mmio; - uchar *data, p, p0, p1; + uchar *data; + int x, y, zoom; + ulong clr, *mmio, pixels, set; mmio = scr->mmio; if(mmio == 0) @@ -219,13 +219,32 @@ t2r4curload(VGAscr* scr, Cursor* curs) * 1 0 cursor colour 1 * 1 1 cursor colour 2 * Put the cursor into the top-left of the array. + * + * Although this looks a lot like the IBM RGB524 cursor, the + * scanlines appear to be twice as long as they should be and + * some of the other features are missing. */ + if(mmio[Zoom] & 0x0F) + zoom = 32; + else + zoom = 16; data = (uchar*)&mmio[Data]; - for(y = 0; y < 32; y++){ - *data = 0xFF; - *data = 0xAA; - *data = 0xFF; - *data = 0xAA; + for(y = 0; y < zoom; y++){ + clr = (curs->clr[2*y]<<8)|curs->clr[y*2 + 1]; + set = (curs->set[2*y]<<8)|curs->set[y*2 + 1]; + pixels = 0; + for(x = 0; x < 16; x++){ + if(set & (1<>24; + *data = pixels>>16; + *data = pixels>>8; + *data = pixels; + *data = 0x00; *data = 0x00; *data = 0x00; diff --git a/port/devdraw.c b/port/devdraw.c index 5da8145ddc745297ee1f1d27abc9854bad838fb5..cf20cd806a215a49ba2efde3e364a61f6cc3ebbb 100644 --- a/port/devdraw.c +++ b/port/devdraw.c @@ -723,6 +723,12 @@ drawnewclient(void) return cl; } +int +drawhasclients(void) +{ + return sdraw.nclient != 0; +} + Client* drawclientofpath(ulong path) {