Skip to content

Commit

Permalink
Implement screen blank-on-reset behaviour for rest of the cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed Feb 22, 2024
1 parent 7e43522 commit 196f444
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 50 deletions.
23 changes: 20 additions & 3 deletions src/video/vid_ati18800.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,23 @@ ati18800_recalctimings(svga_t *svga)
}
}

static void
ati18800_reset(void *priv)
{
ati18800_t *ati18800 = (ati18800_t *) priv;
svga_t *svga = (svga_t*) &ati18800->svga;

memset(svga->crtc, 0x00, sizeof(svga->crtc));
memset(svga->attrregs, 0x00, sizeof(svga->attrregs));
memset(svga->gdcreg, 0x00, sizeof(svga->gdcreg));
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
svga_recalctimings(svga);
}

static void *
ati18800_init(const device_t *info)
{
Expand Down Expand Up @@ -345,7 +362,7 @@ const device_t ati18800_wonder_device = {
.local = ATI18800_WONDER,
.init = ati18800_init,
.close = ati18800_close,
.reset = NULL,
.reset = ati18800_reset,
{ .available = ati18800_wonder_available },
.speed_changed = ati18800_speed_changed,
.force_redraw = ati18800_force_redraw,
Expand All @@ -360,7 +377,7 @@ const device_t ati18800_vga88_device = {
.local = ATI18800_VGA88,
.init = ati18800_init,
.close = ati18800_close,
.reset = NULL,
.reset = ati18800_reset,
{ .available = ati18800_vga88_available },
.speed_changed = ati18800_speed_changed,
.force_redraw = ati18800_force_redraw,
Expand All @@ -374,7 +391,7 @@ const device_t ati18800_device = {
.local = ATI18800_EDGE16,
.init = ati18800_init,
.close = ati18800_close,
.reset = NULL,
.reset = ati18800_reset,
{ .available = ati18800_available },
.speed_changed = ati18800_speed_changed,
.force_redraw = ati18800_force_redraw,
Expand Down
29 changes: 23 additions & 6 deletions src/video/vid_ati28800.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,23 @@ ati28800_recalctimings(svga_t *svga)
}
}

static void
ati28800_reset(void *priv)
{
ati28800_t *ati28800 = (ati28800_t *) priv;
svga_t *svga = (svga_t*) &ati28800->svga;

memset(svga->crtc, 0x00, sizeof(svga->crtc));
memset(svga->attrregs, 0x00, sizeof(svga->attrregs));
memset(svga->gdcreg, 0x00, sizeof(svga->gdcreg));
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
svga_recalctimings(svga);
}

static void
ati28800k_recalctimings(svga_t *svga)
{
Expand Down Expand Up @@ -788,7 +805,7 @@ const device_t ati28800_device = {
.local = 0,
.init = ati28800_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = ati28800_available },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand All @@ -802,7 +819,7 @@ const device_t ati28800k_device = {
.local = 0,
.init = ati28800k_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = ati28800k_available },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand All @@ -816,7 +833,7 @@ const device_t ati28800k_spc4620p_device = {
.local = 1,
.init = ati28800k_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = NULL },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand All @@ -830,7 +847,7 @@ const device_t ati28800k_spc6033p_device = {
.local = 2,
.init = ati28800k_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = NULL },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand All @@ -844,7 +861,7 @@ const device_t compaq_ati28800_device = {
.local = VGAWONDERXL,
.init = ati28800_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = compaq_ati28800_available },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand All @@ -859,7 +876,7 @@ const device_t ati28800_wonderxl24_device = {
.local = VGAWONDERXL24,
.init = ati28800_init,
.close = ati28800_close,
.reset = NULL,
.reset = ati28800_reset,
{ .available = ati28800_wonderxl24_available },
.speed_changed = ati28800_speed_changed,
.force_redraw = ati28800_force_redraw,
Expand Down
22 changes: 21 additions & 1 deletion src/video/vid_et3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ et3000_recalctimings(svga_t *svga)
default:
break;
}

svga->dpms = !(svga->crtc[0x17] & 0x80);
}

et3000_log("HDISP = %i, HTOTAL = %i, ROWOFFSET = %i, INTERLACE = %i\n",
Expand All @@ -478,6 +480,24 @@ et3000_recalctimings(svga_t *svga)
}
}

static void
et3000_reset(void *priv)
{
et3000_t *dev = (et3000_t *) priv;
svga_t *svga = (svga_t*) &dev->svga;

memset(svga->crtc, 0x00, sizeof(svga->crtc));
memset(svga->attrregs, 0x00, sizeof(svga->attrregs));
memset(svga->gdcreg, 0x00, sizeof(svga->gdcreg));
svga->crtc[0x17] = 0x0;
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
svga_recalctimings(svga);
}

static void *
et3000_init(const device_t *info)
{
Expand Down Expand Up @@ -570,7 +590,7 @@ const device_t et3000_isa_device = {
.local = 0,
.init = et3000_init,
.close = et3000_close,
.reset = NULL,
.reset = et3000_reset,
{ .available = et3000_available },
.speed_changed = et3000_speed_changed,
.force_redraw = et3000_force_redraw,
Expand Down
35 changes: 29 additions & 6 deletions src/video/vid_et4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,11 @@ et4000_recalctimings(svga_t *svga)
else if (svga->render == svga_render_8bpp_highres)
svga->render = svga_render_8bpp_tseng_highres;
}

/* From ET4000 docs:
Bit 7 of the CRTC Mode register is set to 0 to place all horizontal and vertical timing control circuitry into a hold state.
*/
svga->dpms = !(svga->crtc[0x17] & 0x80);
}

static void
Expand Down Expand Up @@ -780,6 +785,24 @@ et4000_mca_feedb(UNUSED(void *priv))
return 1;
}

static void
et4000_reset(void *priv)
{
et4000_t *dev = (et4000_t *) priv;
svga_t *svga = (svga_t*) &dev->svga;

memset(svga->crtc, 0x00, sizeof(svga->crtc));
memset(svga->attrregs, 0x00, sizeof(svga->attrregs));
memset(svga->gdcreg, 0x00, sizeof(svga->gdcreg));
svga->crtc[0x17] = 0x0;
svga->crtc[0] = 63;
svga->crtc[6] = 255;
svga->dispontime = 1000ULL << 32;
svga->dispofftime = 1000ULL << 32;
svga->bpp = 8;
svga_recalctimings(svga);
}

static void *
et4000_init(const device_t *info)
{
Expand Down Expand Up @@ -1014,7 +1037,7 @@ const device_t et4000_tc6058af_isa_device = {
.local = 0,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000_tc6058af_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand All @@ -1028,7 +1051,7 @@ const device_t et4000_isa_device = {
.local = ET4000_TYPE_ISA,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand All @@ -1042,7 +1065,7 @@ const device_t et4000_mca_device = {
.local = ET4000_TYPE_MCA,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand All @@ -1056,7 +1079,7 @@ const device_t et4000k_isa_device = {
.local = ET4000_TYPE_KOREAN,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000k_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand All @@ -1070,7 +1093,7 @@ const device_t et4000k_tg286_isa_device = {
.local = ET4000_TYPE_TRIGEM,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000k_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand All @@ -1084,7 +1107,7 @@ const device_t et4000_kasan_isa_device = {
.local = ET4000_TYPE_KASAN,
.init = et4000_init,
.close = et4000_close,
.reset = NULL,
.reset = et4000_reset,
{ .available = et4000_kasan_available },
.speed_changed = et4000_speed_changed,
.force_redraw = et4000_force_redraw,
Expand Down
Loading

0 comments on commit 196f444

Please sign in to comment.