Skip to content

Commit 708a700

Browse files
committed
Mystique: Made the changes apply only to the Millennium.
1 parent 0f8fde0 commit 708a700

File tree

1 file changed

+48
-19
lines changed

1 file changed

+48
-19
lines changed

src/video/vid_mga.c

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,31 @@ mystique_out(uint16_t addr, uint8_t val, void *priv)
722722
if (mystique->crtcext_idx < 6)
723723
mystique->crtcext_regs[mystique->crtcext_idx] = val;
724724

725-
if (mystique->crtcext_idx == 4) {
725+
if ((mystique->type >= MGA_1064SG) && (mystique->crtcext_idx == 0) &&
726+
(mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE)) {
727+
svga->rowoffset = svga->crtc[0x13] |
728+
((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4);
729+
svga->rowoffset <<= 1;
730+
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) |
731+
(svga->crtc[0xc] << 8) | svga->crtc[0xd];
732+
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8)) {
733+
svga->rowoffset <<= 1;
734+
svga->ma_latch <<= 1;
735+
}
736+
737+
svga->ma_latch <<= 1;
738+
if (svga->ma_latch != mystique->ma_latch_old) {
739+
if (svga->interlace && svga->oddeven)
740+
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
741+
(svga->ma_latch << 2) + (svga->rowoffset << 1);
742+
else
743+
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
744+
(svga->ma_latch << 2);
745+
mystique->ma_latch_old = svga->ma_latch;
746+
}
747+
}
748+
749+
if (mystique->crtcext_idx == 4) {
726750
if (svga->gdcreg[6] & 0xc) {
727751
/*64k banks*/
728752
svga->read_bank = (val & 0x7f) << 16;
@@ -817,21 +841,6 @@ mystique_vblank_start(svga_t *svga)
817841
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];
818842
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8))
819843
svga->ma_latch <<= 1;
820-
821-
if (mystique->type >= MGA_1064SG) {
822-
/*Mystique, unlike most SVGA cards, allows display start to take
823-
effect mid-screen*/
824-
svga->ma_latch <<= 1;
825-
/* Only change maback so the new display start will take effect on the next
826-
horizontal retrace. */
827-
if (svga->ma_latch != mystique->ma_latch_old) {
828-
if (svga->interlace && svga->oddeven)
829-
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) + (svga->ma_latch << 2) + (svga->rowoffset << 1);
830-
else
831-
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) + (svga->ma_latch << 2);
832-
mystique->ma_latch_old = svga->ma_latch;
833-
}
834-
}
835844
}
836845
}
837846

@@ -906,10 +915,28 @@ mystique_recalctimings(svga_t *svga)
906915
svga->hdisp_time = svga->hdisp;
907916
svga->rowoffset = svga->crtc[0x13] | ((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4);
908917

909-
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8))
918+
if (mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8)) {
910919
svga->rowoffset <<= 1;
920+
if (mystique->type >= MGA_1064SG)
921+
svga->ma_latch <<= 1;
922+
}
911923

912924
if (mystique->type >= MGA_1064SG) {
925+
/*Mystique, unlike most SVGA cards, allows display start to take
926+
effect mid-screen*/
927+
svga->ma_latch <<= 1;
928+
/* Only change maback so the new display start will take effect on the next
929+
horizontal retrace. */
930+
if (svga->ma_latch != mystique->ma_latch_old) {
931+
if (svga->interlace && svga->oddeven)
932+
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
933+
(svga->ma_latch << 2) + (svga->rowoffset << 1);
934+
else
935+
svga->maback = (svga->maback - (mystique->ma_latch_old << 2)) +
936+
(svga->ma_latch << 2);
937+
mystique->ma_latch_old = svga->ma_latch;
938+
}
939+
913940
svga->rowoffset <<= 1;
914941
switch (mystique->xmulctrl & XMULCTRL_DEPTH_MASK) {
915942
case XMULCTRL_DEPTH_8:
@@ -960,13 +987,15 @@ mystique_recalctimings(svga_t *svga)
960987
}
961988
svga->packed_chain4 = 1;
962989
svga->line_compare = mystique_line_compare;
963-
svga->vblank_start = mystique_vblank_start;
990+
if (mystique->type < MGA_1064SG)
991+
svga->vblank_start = mystique_vblank_start;
964992
} else {
965993
svga->packed_chain4 = 0;
966994
svga->line_compare = NULL;
967-
svga->vblank_start = NULL;
968995
if (mystique->type >= MGA_1064SG)
969996
svga->bpp = 8;
997+
else
998+
svga->vblank_start = NULL;
970999
}
9711000

9721001
svga->fb_only = svga->packed_chain4;

0 commit comments

Comments
 (0)