diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index c505b5cc2..7b1db7cc8 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -634,14 +634,12 @@ static void wake_fifo_thread(mystique_t *mystique); static void wait_fifo_idle(mystique_t *mystique); static void mystique_queue(mystique_t *mystique, uint32_t addr, uint32_t val, uint32_t type); -#if 0 static uint8_t mystique_readb_linear(uint32_t addr, void *priv); static uint16_t mystique_readw_linear(uint32_t addr, void *priv); static uint32_t mystique_readl_linear(uint32_t addr, void *priv); static void mystique_writeb_linear(uint32_t addr, uint8_t val, void *priv); static void mystique_writew_linear(uint32_t addr, uint16_t val, void *priv); static void mystique_writel_linear(uint32_t addr, uint32_t val, void *priv); -#endif static void mystique_recalc_mapping(mystique_t *mystique); static int mystique_line_compare(svga_t *svga); @@ -722,10 +720,15 @@ mystique_out(uint16_t addr, uint8_t val, void *priv) if (mystique->crtcext_idx == 1) svga->dpms = !!(val & 0x30); if (mystique->crtcext_idx < 4) { - if (mystique->crtcext_idx != 3) { - svga->fullchange = changeframecount; - svga_recalctimings(svga); - } + svga->fullchange = changeframecount; + svga_recalctimings(svga); + } + if (mystique->crtcext_idx == 3) { + if (val & CRTCX_R3_MGAMODE) + svga->fb_only = 1; + else + svga->fb_only = 0; + svga_recalctimings(svga); } if (mystique->crtcext_idx == 4) { if (svga->gdcreg[6] & 0xc) { @@ -877,6 +880,7 @@ mystique_recalctimings(svga_t *svga) svga->interlace = !!(mystique->crtcext_regs[0] & 0x80); if (mystique->crtcext_regs[3] & CRTCX_R3_MGAMODE) { + svga->packed_chain4 = 1; svga->lowres = 0; svga->char_width = 8; svga->hdisp = (svga->crtc[1] + 1) * 8; @@ -887,7 +891,6 @@ mystique_recalctimings(svga_t *svga) svga->rowoffset <<= 1; svga->ma_latch <<= 1; } - if (mystique->type >= MGA_1064SG) { /*Mystique, unlike most SVGA cards, allows display start to take effect mid-screen*/ @@ -900,6 +903,7 @@ mystique_recalctimings(svga_t *svga) } svga->rowoffset <<= 1; + switch (mystique->xmulctrl & XMULCTRL_DEPTH_MASK) { case XMULCTRL_DEPTH_8: case XMULCTRL_DEPTH_2G8V16: @@ -948,7 +952,6 @@ mystique_recalctimings(svga_t *svga) } } svga->line_compare = mystique_line_compare; - svga->packed_chain4 = !svga->chain4; } else { svga->packed_chain4 = 0; svga->line_compare = NULL; @@ -956,11 +959,7 @@ mystique_recalctimings(svga_t *svga) svga->bpp = 8; } - svga->fb_only = svga->packed_chain4; svga->disable_blink = (svga->bpp > 4); -#if 0 - pclog("PackedChain4=%d, chain4=%x, fast=%x, bit6 attrreg10=%02x, bits 5-6 gdcreg5=%02x.\n", svga->packed_chain4, svga->chain4, svga->fast, svga->attrregs[0x10] & 0x40, svga->gdcreg[5] & 0x60); -#endif } static void @@ -2564,7 +2563,6 @@ mystique_accel_iload_write_l(UNUSED(uint32_t addr), uint32_t val, void *priv) } } -#if 0 static uint8_t mystique_readb_linear(uint32_t addr, void *priv) { @@ -2618,7 +2616,7 @@ mystique_writeb_linear(uint32_t addr, uint8_t val, void *priv) if (addr >= svga->vram_max) return; addr &= svga->vram_mask; - svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount; + svga->changedvram[addr >> 12] = changeframecount; svga->vram[addr] = val; } @@ -2633,7 +2631,7 @@ mystique_writew_linear(uint32_t addr, uint16_t val, void *priv) if (addr >= svga->vram_max) return; addr &= svga->vram_mask; - svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount; + svga->changedvram[addr >> 12] = changeframecount; *(uint16_t *) &svga->vram[addr] = val; } @@ -2648,10 +2646,9 @@ mystique_writel_linear(uint32_t addr, uint32_t val, void *priv) if (addr >= svga->vram_max) return; addr &= svga->vram_mask; - svga->changedvram[addr >> 12] = svga->monitor->mon_changeframecount; + svga->changedvram[addr >> 12] = changeframecount; *(uint32_t *) &svga->vram[addr] = val; } -#endif static void run_dma(mystique_t *mystique) @@ -5631,9 +5628,9 @@ mystique_init(const device_t *info) mem_mapping_disable(&mystique->ctrl_mapping); mem_mapping_add(&mystique->lfb_mapping, 0, 0, - svga_read_linear, svga_readw_linear, svga_readl_linear, - svga_write_linear, svga_writew_linear, svga_writel_linear, - NULL, 0, &mystique->svga); + mystique_readb_linear, mystique_readw_linear, mystique_readl_linear, + mystique_writeb_linear, mystique_writew_linear, mystique_writel_linear, + NULL, 0, mystique); mem_mapping_disable(&mystique->lfb_mapping); mem_mapping_add(&mystique->iload_mapping, 0, 0, @@ -5804,6 +5801,7 @@ const device_t millennium_device = { .config = mystique_config }; +#if defined(DEV_BRANCH) && defined(USE_MGA) const device_t mystique_device = { .name = "Matrox Mystique", .internal_name = "mystique", @@ -5831,3 +5829,4 @@ const device_t mystique_220_device = { .force_redraw = mystique_force_redraw, .config = mystique_config }; +#endif