M pc/devvga.c => pc/devvga.c +14 -0
@@ 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){
M pc/screen.h => pc/screen.h +3 -0
@@ 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*);
M pc/vgat2r4.c => pc/vgat2r4.c +29 -10
@@ 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<<x))
+ pixels |= 0x03<<(x*2);
+ else if(clr & (1<<x))
+ pixels |= 0x02<<(x*2);
+ }
+
+ *data = pixels>>24;
+ *data = pixels>>16;
+ *data = pixels>>8;
+ *data = pixels;
+
*data = 0x00;
*data = 0x00;
*data = 0x00;
M port/devdraw.c => port/devdraw.c +6 -0
@@ 723,6 723,12 @@ drawnewclient(void)
return cl;
}
+int
+drawhasclients(void)
+{
+ return sdraw.nclient != 0;
+}
+
Client*
drawclientofpath(ulong path)
{