- increase the number of possible grfmodes from 8 to 24
- changes for the grfconfig interface: - Remove gv->{hblank_stop,vblank_stop} and calculate HBE and VBE from gv->{htotal,vtotal}. - Add support for gv->disp_flags to select interlace, doublescan and horizontal/vertical sync polarity. - Return EINVAL for gv->disp_flags and sync-on-green. This makes it possible to use xfree values for grfconfig.
This commit is contained in:
parent
ce2e3d407b
commit
f46269ea78
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_cl.c,v 1.19 1997/03/05 22:46:32 veego Exp $ */
|
||||
/* $NetBSD: grf_cl.c,v 1.20 1997/07/29 17:46:24 veego Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Klaus Burkert
|
||||
@ -117,8 +117,10 @@ void cl_memset __P((unsigned char *, unsigned char, int));
|
||||
/* Graphics display definitions.
|
||||
* These are filled by 'grfconfig' using GRFIOCSETMON.
|
||||
*/
|
||||
#define monitor_def_max 8
|
||||
static struct grfvideo_mode monitor_def[8] = {
|
||||
#define monitor_def_max 24
|
||||
static struct grfvideo_mode monitor_def[24] = {
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}
|
||||
};
|
||||
static struct grfvideo_mode *monitor_current = &monitor_def[0];
|
||||
@ -142,8 +144,8 @@ unsigned long cl_maxpixelclock = 86000000;
|
||||
extern unsigned char CIRRUSFONT[];
|
||||
|
||||
struct grfcltext_mode clconsole_mode = {
|
||||
{255, "", 25200000, 640, 480, 4, 80, 100, 94, 99, 100, 481, 522, 490,
|
||||
498, 522},
|
||||
{255, "", 25200000, 640, 480, 4, 640/8, 752/8, 792/8, 800/8,
|
||||
481, 490, 498, 522, 0},
|
||||
8, CIRRUSFONTY, 80, 480 / CIRRUSFONTY, CIRRUSFONT, 32, 255
|
||||
};
|
||||
/* Console colors */
|
||||
@ -620,7 +622,6 @@ cl_getvmode(gp, vm)
|
||||
/* adjust internal values to pixel values */
|
||||
|
||||
vm->hblank_start *= 8;
|
||||
vm->hblank_stop *= 8;
|
||||
vm->hsync_start *= 8;
|
||||
vm->hsync_stop *= 8;
|
||||
vm->htotal *= 8;
|
||||
@ -1053,11 +1054,10 @@ cl_setmonitor(gp, gv)
|
||||
/* handle interactive setting of console mode */
|
||||
if (gv->mode_num == 255) {
|
||||
bcopy(gv, &clconsole_mode.gv, sizeof(struct grfvideo_mode));
|
||||
clconsole_mode.gv.hblank_start /= 8;
|
||||
clconsole_mode.gv.hblank_stop /= 8;
|
||||
clconsole_mode.gv.hsync_start /= 8;
|
||||
clconsole_mode.gv.hsync_stop /= 8;
|
||||
clconsole_mode.gv.htotal /= 8;
|
||||
clconsole_mode.gv.hblank_start /= 8;
|
||||
clconsole_mode.gv.hsync_start /= 8;
|
||||
clconsole_mode.gv.hsync_stop /= 8;
|
||||
clconsole_mode.gv.htotal /= 8;
|
||||
clconsole_mode.rows = gv->disp_height / clconsole_mode.fy;
|
||||
clconsole_mode.cols = gv->disp_width / clconsole_mode.fx;
|
||||
if (!(gp->g_flags & GF_GRFON))
|
||||
@ -1070,13 +1070,12 @@ cl_setmonitor(gp, gv)
|
||||
md = monitor_def + (gv->mode_num - 1);
|
||||
bcopy(gv, md, sizeof(struct grfvideo_mode));
|
||||
|
||||
/* adjust pixel oriented values to internal rep. */
|
||||
/* adjust pixel oriented values to internal rep. */
|
||||
|
||||
md->hblank_start /= 8;
|
||||
md->hblank_stop /= 8;
|
||||
md->hsync_start /= 8;
|
||||
md->hsync_stop /= 8;
|
||||
md->htotal /= 8;
|
||||
md->hblank_start /= 8;
|
||||
md->hsync_start /= 8;
|
||||
md->hsync_stop /= 8;
|
||||
md->htotal /= 8;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1345,10 +1344,22 @@ cl_mondefok(gv)
|
||||
maxpix = 0;
|
||||
break;
|
||||
default:
|
||||
printf("grfcl: Illegal depth in mode %d\n",
|
||||
(int) gv->mode_num);
|
||||
return (0);
|
||||
}
|
||||
if (gv->pixel_clock > maxpix)
|
||||
|
||||
if (gv->pixel_clock > maxpix) {
|
||||
printf("grfcl: Pixelclock too high in mode %d\n",
|
||||
(int) gv->mode_num);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (gv->disp_flags & GRF_FLAGS_SYNC_ON_GREEN) {
|
||||
printf("grfcl: sync-on-green is not supported\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -1363,19 +1374,21 @@ cl_load_mon(gp, md)
|
||||
unsigned char num0, denom0, clkdoub;
|
||||
unsigned short HT, HDE, HBS, HBE, HSS, HSE, VDE, VBS, VBE, VSS,
|
||||
VSE, VT;
|
||||
char LACE, DBLSCAN, TEXT;
|
||||
int uplim, lowlim;
|
||||
int sr15;
|
||||
int clkmul, offsmul, clkmode;
|
||||
int vmul;
|
||||
int sr15;
|
||||
unsigned char hvsync_pulse;
|
||||
char TEXT;
|
||||
|
||||
/* identity */
|
||||
gv = &md->gv;
|
||||
TEXT = (gv->depth == 4);
|
||||
|
||||
if (!cl_mondefok(gv)) {
|
||||
printf("mondef not ok\n");
|
||||
printf("grfcl: Monitor definition not ok\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
ba = gp->g_regkva;
|
||||
fb = gp->g_fbkva;
|
||||
|
||||
@ -1405,14 +1418,14 @@ cl_load_mon(gp, md)
|
||||
/* get display mode parameters */
|
||||
|
||||
HBS = gv->hblank_start;
|
||||
HBE = gv->hblank_stop;
|
||||
HSS = gv->hsync_start;
|
||||
HSE = gv->hsync_stop;
|
||||
HBE = gv->htotal - 1;
|
||||
HT = gv->htotal;
|
||||
VBS = gv->vblank_start;
|
||||
VSS = gv->vsync_start;
|
||||
VSE = gv->vsync_stop;
|
||||
VBE = gv->vblank_stop;
|
||||
VBE = gv->vtotal - 1;
|
||||
VT = gv->vtotal;
|
||||
|
||||
if (TEXT)
|
||||
@ -1421,13 +1434,6 @@ cl_load_mon(gp, md)
|
||||
HDE = (gv->disp_width + 3) / 8 - 1; /* HBS; */
|
||||
VDE = gv->disp_height - 1;
|
||||
|
||||
/* figure out whether lace or dblscan is needed */
|
||||
|
||||
uplim = gv->disp_height + (gv->disp_height / 4);
|
||||
lowlim = gv->disp_height - (gv->disp_height / 4);
|
||||
LACE = (((VT * 2) > lowlim) && ((VT * 2) < uplim)) ? 1 : 0;
|
||||
DBLSCAN = (((VT / 2) > lowlim) && ((VT / 2) < uplim)) ? 1 : 0;
|
||||
|
||||
/* adjustments */
|
||||
switch (gv->depth) {
|
||||
case 8:
|
||||
@ -1461,24 +1467,24 @@ cl_load_mon(gp, md)
|
||||
break;
|
||||
}
|
||||
|
||||
if (LACE)
|
||||
VDE /= 2;
|
||||
|
||||
if (DBLSCAN)
|
||||
VDE *= 2;
|
||||
|
||||
if ((VT > 1023) && (!LACE)) {
|
||||
VDE /= 2;
|
||||
VBS /= 2;
|
||||
VSS /= 2;
|
||||
VSE /= 2;
|
||||
VBE /= 2;
|
||||
VT /= 2;
|
||||
if ((VT > 1023) && (!(gv->disp_flags & GRF_FLAGS_LACE))) {
|
||||
WCrt(ba, CRT_ID_MODE_CONTROL, 0xe7);
|
||||
}
|
||||
else
|
||||
} else
|
||||
WCrt(ba, CRT_ID_MODE_CONTROL, 0xe3);
|
||||
|
||||
vmul = 2;
|
||||
if ((VT > 1023) || (gv->disp_flags & GRF_FLAGS_LACE))
|
||||
vmul = 1;
|
||||
if (gv->disp_flags & GRF_FLAGS_DBLSCAN)
|
||||
vmul = 4;
|
||||
|
||||
VDE = VDE * vmul / 2;
|
||||
VBS = VBS * vmul / 2;
|
||||
VSS = VSS * vmul / 2;
|
||||
VSE = VSE * vmul / 2;
|
||||
VBE = VBE * vmul / 2;
|
||||
VT = VT * vmul / 2;
|
||||
|
||||
WSeq(ba, SEQ_ID_MEMORY_MODE, (TEXT || (gv->depth == 1)) ? 0x06 : 0x0e);
|
||||
if (cl_64bit == 1) {
|
||||
if (TEXT || (gv->depth == 1))
|
||||
@ -1499,6 +1505,18 @@ cl_load_mon(gp, md)
|
||||
|
||||
cl_CompFQ(gv->pixel_clock * clkmul, &num0, &denom0, &clkdoub);
|
||||
|
||||
/* Horizontal/Vertical Sync Pulse */
|
||||
hvsync_pulse = vgar(ba, GREG_MISC_OUTPUT_R);
|
||||
if (gv->disp_flags & GRF_FLAGS_PHSYNC)
|
||||
hvsync_pulse &= ~0x40;
|
||||
else
|
||||
hvsync_pulse |= 0x40;
|
||||
if (gv->disp_flags & GRF_FLAGS_PVSYNC)
|
||||
hvsync_pulse &= ~0x80;
|
||||
else
|
||||
hvsync_pulse |= 0x80;
|
||||
vgaw(ba, GREG_MISC_OUTPUT_W, hvsync_pulse);
|
||||
|
||||
if (clkdoub) {
|
||||
HDE /= 2;
|
||||
HBS /= 2;
|
||||
@ -1535,7 +1553,7 @@ cl_load_mon(gp, md)
|
||||
|
||||
WCrt(ba, CRT_ID_CHAR_HEIGHT,
|
||||
0x40 | /* TEXT ? 0x00 ??? */
|
||||
(DBLSCAN ? 0x80 : 0x00) |
|
||||
((gv->disp_flags & GRF_FLAGS_DBLSCAN) ? 0x80 : 0x00) |
|
||||
((VBS & 0x200) ? 0x20 : 0x00) |
|
||||
(TEXT ? ((md->fy - 1) & 0x1f) : 0x00));
|
||||
|
||||
@ -1566,7 +1584,7 @@ cl_load_mon(gp, md)
|
||||
WCrt(ba, CRT_ID_LINE_COMPARE, 0xff);
|
||||
WCrt(ba, CRT_ID_LACE_END, HT / 2); /* MW/16 */
|
||||
WCrt(ba, CRT_ID_LACE_CNTL,
|
||||
(LACE ? 0x01 : 0x00) |
|
||||
((gv->disp_flags & GRF_FLAGS_LACE) ? 0x01 : 0x00) |
|
||||
((HBE & 0x40) ? 0x10 : 0x00) |
|
||||
((HBE & 0x80) ? 0x20 : 0x00) |
|
||||
((VBE & 0x100) ? 0x40 : 0x00) |
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: grf_et.c,v 1.9 1997/03/05 22:50:38 veego Exp $ */
|
||||
/* $NetBSD: grf_et.c,v 1.10 1997/07/29 17:46:31 veego Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Klaus Burkert
|
||||
@ -111,8 +111,10 @@ void et_memset __P((unsigned char *d, unsigned char c, int l));
|
||||
* Graphics display definitions.
|
||||
* These are filled by 'grfconfig' using GRFIOCSETMON.
|
||||
*/
|
||||
#define monitor_def_max 8
|
||||
static struct grfvideo_mode monitor_def[8] = {
|
||||
#define monitor_def_max 24
|
||||
static struct grfvideo_mode monitor_def[24] = {
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0},
|
||||
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}
|
||||
};
|
||||
static struct grfvideo_mode *monitor_current = &monitor_def[0];
|
||||
@ -133,8 +135,8 @@ static struct grfvideo_mode *monitor_current = &monitor_def[0];
|
||||
extern unsigned char TSENGFONT[];
|
||||
|
||||
struct grfettext_mode etconsole_mode = {
|
||||
{255, "", 25000000, 640, 480, 4, 640/8, 784/8, 680/8, 768/8, 800/8,
|
||||
481, 521, 491, 493, 525},
|
||||
{255, "", 25000000, 640, 480, 4, 640/8, 680/8, 768/8, 800/8,
|
||||
481, 491, 493, 525, 0},
|
||||
8, TSENGFONTY, 640 / 8, 480 / TSENGFONTY, TSENGFONT, 32, 255
|
||||
};
|
||||
|
||||
@ -590,7 +592,6 @@ et_getvmode(gp, vm)
|
||||
/* adjust internal values to pixel values */
|
||||
|
||||
vm->hblank_start *= 8;
|
||||
vm->hblank_stop *= 8;
|
||||
vm->hsync_start *= 8;
|
||||
vm->hsync_stop *= 8;
|
||||
vm->htotal *= 8;
|
||||
@ -835,7 +836,6 @@ et_setmonitor(gp, gv)
|
||||
if (gv->mode_num == 255) {
|
||||
bcopy(gv, &etconsole_mode.gv, sizeof(struct grfvideo_mode));
|
||||
etconsole_mode.gv.hblank_start /= 8;
|
||||
etconsole_mode.gv.hblank_stop /= 8;
|
||||
etconsole_mode.gv.hsync_start /= 8;
|
||||
etconsole_mode.gv.hsync_stop /= 8;
|
||||
etconsole_mode.gv.htotal /= 8;
|
||||
@ -854,7 +854,6 @@ et_setmonitor(gp, gv)
|
||||
/* adjust pixel oriented values to internal rep. */
|
||||
|
||||
md->hblank_start /= 8;
|
||||
md->hblank_stop /= 8;
|
||||
md->hsync_start /= 8;
|
||||
md->hsync_stop /= 8;
|
||||
md->htotal /= 8;
|
||||
@ -1071,10 +1070,22 @@ et_mondefok(gv)
|
||||
maxpix = 21000000;
|
||||
break;
|
||||
default:
|
||||
printf("grfet: Illegal depth in mode %d\n",
|
||||
(int) gv->mode_num);
|
||||
return (0);
|
||||
}
|
||||
if (gv->pixel_clock > maxpix)
|
||||
|
||||
if (gv->pixel_clock > maxpix) {
|
||||
printf("grfet: Pixelclock too high in mode %d\n",
|
||||
(int) gv->mode_num);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (gv->disp_flags & GRF_FLAGS_SYNC_ON_GREEN) {
|
||||
printf("grfet: sync-on-green is not supported\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -1090,9 +1101,8 @@ et_load_mon(gp, md)
|
||||
unsigned char num0, denom0;
|
||||
unsigned short HT, HDE, HBS, HBE, HSS, HSE, VDE, VBS, VBE, VSS,
|
||||
VSE, VT;
|
||||
char LACE, DBLSCAN, TEXT;
|
||||
unsigned char seq;
|
||||
int uplim, lowlim;
|
||||
unsigned char hvsync_pulse, seq;
|
||||
char TEXT;
|
||||
int hmul;
|
||||
|
||||
/* identity */
|
||||
@ -1100,9 +1110,10 @@ et_load_mon(gp, md)
|
||||
TEXT = (gv->depth == 4);
|
||||
|
||||
if (!et_mondefok(gv)) {
|
||||
printf("mondef not ok\n");
|
||||
printf("grfet: Monitor definition not ok\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
ba = gp->g_regkva;
|
||||
|
||||
/* provide all needed information in grf device-independant locations */
|
||||
@ -1131,14 +1142,14 @@ et_load_mon(gp, md)
|
||||
/* get display mode parameters */
|
||||
|
||||
HBS = gv->hblank_start;
|
||||
HBE = gv->hblank_stop;
|
||||
HSS = gv->hsync_start;
|
||||
HSE = gv->hsync_stop;
|
||||
HBE = gv->htotal - 1;
|
||||
HT = gv->htotal;
|
||||
VBS = gv->vblank_start;
|
||||
VSS = gv->vsync_start;
|
||||
VSE = gv->vsync_stop;
|
||||
VBE = gv->vblank_stop;
|
||||
VBE = gv->vtotal - 1;
|
||||
VT = gv->vtotal;
|
||||
|
||||
if (TEXT)
|
||||
@ -1147,24 +1158,21 @@ et_load_mon(gp, md)
|
||||
HDE = (gv->disp_width + 3) / 8 - 1; /* HBS; */
|
||||
VDE = gv->disp_height - 1;
|
||||
|
||||
/* figure out whether lace or dblscan is needed */
|
||||
|
||||
uplim = gv->disp_height + (gv->disp_height / 4);
|
||||
lowlim = gv->disp_height - (gv->disp_height / 4);
|
||||
LACE = (((VT * 2) > lowlim) && ((VT * 2) < uplim)) ? 1 : 0;
|
||||
DBLSCAN = (((VT / 2) > lowlim) && ((VT / 2) < uplim)) ? 1 : 0;
|
||||
|
||||
/* adjustments (crest) */
|
||||
switch (gv->depth) {
|
||||
case 15:
|
||||
case 16: hmul = 2;
|
||||
break;
|
||||
case 24: hmul = 3;
|
||||
break;
|
||||
break;
|
||||
case 32: hmul = 4;
|
||||
break;
|
||||
default: hmul = 1;
|
||||
case 16:
|
||||
hmul = 2;
|
||||
break;
|
||||
case 24:
|
||||
hmul = 3;
|
||||
break;
|
||||
case 32:
|
||||
hmul = 4;
|
||||
break;
|
||||
default:
|
||||
hmul = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
HDE *= hmul;
|
||||
@ -1174,17 +1182,20 @@ et_load_mon(gp, md)
|
||||
HBE *= hmul;
|
||||
HT *= hmul;
|
||||
|
||||
if (LACE) {
|
||||
VBS *= 2,
|
||||
if (gv->disp_flags & GRF_FLAGS_LACE) {
|
||||
VDE /= 2;
|
||||
VT = VT + 1;
|
||||
}
|
||||
|
||||
if (gv->disp_flags & GRF_FLAGS_DBLSCAN) {
|
||||
VDE *= 2;
|
||||
VBS *= 2;
|
||||
VSS *= 2;
|
||||
VSE *= 2;
|
||||
VBE *= 2;
|
||||
VT = VT * 2 + 1;
|
||||
VT *= 2;
|
||||
}
|
||||
|
||||
if (DBLSCAN)
|
||||
VDE *= 2;
|
||||
|
||||
WSeq(ba, SEQ_ID_MEMORY_MODE, (TEXT || (gv->depth == 1)) ? 0x06 : 0x0e);
|
||||
|
||||
WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
|
||||
@ -1194,9 +1205,20 @@ et_load_mon(gp, md)
|
||||
/* Set clock */
|
||||
et_CompFQ( gv->pixel_clock * hmul, &num0, &denom0);
|
||||
|
||||
vgaw(ba, GREG_MISC_OUTPUT_W, 0xe3 | ((num0 & 3) << 2));
|
||||
/* Horizontal/Vertical Sync Pulse */
|
||||
hvsync_pulse = 0xe3;
|
||||
if (gv->disp_flags & GRF_FLAGS_PHSYNC)
|
||||
hvsync_pulse &= ~0x40;
|
||||
else
|
||||
hvsync_pulse |= 0x40;
|
||||
if (gv->disp_flags & GRF_FLAGS_PVSYNC)
|
||||
hvsync_pulse &= ~0x80;
|
||||
else
|
||||
hvsync_pulse |= 0x80;
|
||||
|
||||
vgaw(ba, GREG_MISC_OUTPUT_W, hvsync_pulse | ((num0 & 3) << 2));
|
||||
WCrt(ba, CRT_ID_6845_COMPAT, (num0 & 4) ? 0x0a : 0x08);
|
||||
seq=RSeq(ba, SEQ_ID_CLOCKING_MODE);
|
||||
seq = RSeq(ba, SEQ_ID_CLOCKING_MODE);
|
||||
switch(denom0) {
|
||||
case 0:
|
||||
WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xb4);
|
||||
@ -1238,7 +1260,7 @@ et_load_mon(gp, md)
|
||||
|
||||
WCrt(ba, CRT_ID_MAX_ROW_ADDRESS,
|
||||
0x40 | /* splitscreen not visible */
|
||||
(DBLSCAN ? 0x80 : 0x00) |
|
||||
((gv->disp_flags & GRF_FLAGS_DBLSCAN) ? 0x80 : 0x00) |
|
||||
((VBS & 0x200) ? 0x20 : 0x00) |
|
||||
(TEXT ? ((md->fy - 1) & 0x1f) : 0x00));
|
||||
|
||||
@ -1278,7 +1300,7 @@ et_load_mon(gp, md)
|
||||
((VDE & 0x400) ? 0x04 : 0x00) |
|
||||
((VSS & 0x400) ? 0x08 : 0x00) |
|
||||
0x10 |
|
||||
(LACE ? 0x80 : 0x00));
|
||||
((gv->disp_flags & GRF_FLAGS_LACE) ? 0x80 : 0x00));
|
||||
|
||||
WCrt(ba, CRT_ID_HOR_OVERFLOW,
|
||||
((HT & 0x100) ? 0x01 : 0x00) |
|
||||
@ -1511,10 +1533,9 @@ et_getControllerType(gp)
|
||||
*mem = 0;
|
||||
|
||||
/* make ACL visible */
|
||||
if(ettype == MERLIN) {
|
||||
if (ettype == MERLIN) {
|
||||
WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xbb);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xfb);
|
||||
}
|
||||
|
||||
@ -1528,13 +1549,12 @@ et_getControllerType(gp)
|
||||
/* hide ACL */
|
||||
WIma(ba, IMA_PORTCONTROL, 0x00);
|
||||
|
||||
if(ettype == MERLIN) {
|
||||
if (ettype == MERLIN) {
|
||||
WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0x93);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xd3);
|
||||
}
|
||||
return((*mem == 0xff) ? ETW32 : ET4000);
|
||||
return ((*mem == 0xff) ? ETW32 : ET4000);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user