Ported the latest Voodoo changes from the other emulator.

This commit is contained in:
TC1995
2021-06-15 17:17:56 +02:00
parent 6bd2ba28ce
commit c703fedbe8
6 changed files with 17 additions and 10 deletions

View File

@@ -154,9 +154,6 @@ typedef struct svga_t
/*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/ /*Force CRTC to dword mode, regardless of CR14/CR17. Required for S3 enhanced mode*/
int force_dword_mode; int force_dword_mode;
/*Force CRTC to legacy mode. Required for Voodoo Banshee/3 until there's a proper fix*/
int force_legacy_mode;
int remap_required; int remap_required;
uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr); uint32_t (*remap_func)(struct svga_t *svga, uint32_t in_addr);

View File

@@ -101,7 +101,7 @@ void svga_recalc_remap_func(svga_t *svga)
{ {
int func_nr; int func_nr;
if (svga->fb_only || svga->force_legacy_mode) if (svga->fb_only)
func_nr = 0; func_nr = 0;
else { else {
if (svga->force_dword_mode) if (svga->force_dword_mode)

View File

@@ -469,6 +469,8 @@ typedef struct voodoo_t
uint32_t tile_base, tile_stride; uint32_t tile_base, tile_stride;
int tile_stride_shift, tile_x, tile_x_real; int tile_stride_shift, tile_x, tile_x_real;
int y_origin_swap;
int read_time, write_time, burst_time; int read_time, write_time, burst_time;
pc_timer_t wake_timer; pc_timer_t wake_timer;

View File

@@ -180,6 +180,7 @@ enum
#define VGAINIT0_EXTENDED_SHIFT_OUT (1 << 12) #define VGAINIT0_EXTENDED_SHIFT_OUT (1 << 12)
#define VIDPROCCFG_VIDPROC_ENABLE (1 << 0)
#define VIDPROCCFG_CURSOR_MODE (1 << 1) #define VIDPROCCFG_CURSOR_MODE (1 << 1)
#define VIDPROCCFG_INTERLACE (1 << 3) #define VIDPROCCFG_INTERLACE (1 << 3)
#define VIDPROCCFG_HALF_MODE (1 << 4) #define VIDPROCCFG_HALF_MODE (1 << 4)
@@ -240,6 +241,9 @@ enum
#define VIDSERIAL_I2C_SCK_R (1 << 26) #define VIDSERIAL_I2C_SCK_R (1 << 26)
#define VIDSERIAL_I2C_SDA_R (1 << 27) #define VIDSERIAL_I2C_SDA_R (1 << 27)
#define MISCINIT0_Y_ORIGIN_SWAP_SHIFT (18)
#define MISCINIT0_Y_ORIGIN_SWAP_MASK (0xfff << MISCINIT0_Y_ORIGIN_SWAP_SHIFT)
#ifdef ENABLE_BANSHEE_LOG #ifdef ENABLE_BANSHEE_LOG
int banshee_do_log = ENABLE_BANSHEE_LOG; int banshee_do_log = ENABLE_BANSHEE_LOG;
@@ -485,11 +489,9 @@ static void banshee_recalctimings(svga_t *svga)
// banshee_log("svga->hdisp=%i\n", svga->hdisp); // banshee_log("svga->hdisp=%i\n", svga->hdisp);
svga->interlace = 0; svga->interlace = 0;
svga->force_legacy_mode = 0;
if (banshee->vgaInit0 & VGAINIT0_EXTENDED_SHIFT_OUT) if (banshee->vgaInit0 & VGAINIT0_EXTENDED_SHIFT_OUT)
{ {
svga->force_legacy_mode = 1;
switch (VIDPROCCFG_DESKTOP_PIX_FORMAT) switch (VIDPROCCFG_DESKTOP_PIX_FORMAT)
{ {
case PIX_FORMAT_8: case PIX_FORMAT_8:
@@ -568,6 +570,8 @@ static void banshee_recalctimings(svga_t *svga)
svga->bpp = 8; svga->bpp = 8;
} }
svga->fb_only = (banshee->vidProcCfg & VIDPROCCFG_VIDPROC_ENABLE);
if (((svga->miscout >> 2) & 3) == 3) if (((svga->miscout >> 2) & 3) == 3)
{ {
int k = banshee->pllCtrl0 & 3; int k = banshee->pllCtrl0 & 3;
@@ -639,6 +643,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Init_miscInit0: case Init_miscInit0:
banshee->miscInit0 = val; banshee->miscInit0 = val;
voodoo->y_origin_swap = (val & MISCINIT0_Y_ORIGIN_SWAP_MASK) >> MISCINIT0_Y_ORIGIN_SWAP_SHIFT;
break; break;
case Init_miscInit1: case Init_miscInit1:
banshee->miscInit1 = val; banshee->miscInit1 = val;

View File

@@ -456,8 +456,10 @@ void voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params)
if (params->fbzMode & (1 << 17)) if (params->fbzMode & (1 << 17))
{ {
high_y = voodoo->v_disp - params->clipLowY; int y_origin = (voodoo->type >= VOODOO_BANSHEE) ? (voodoo->y_origin_swap+1) : voodoo->v_disp;
low_y = voodoo->v_disp - params->clipHighY;
high_y = y_origin - params->clipLowY;
low_y = y_origin - params->clipHighY;
} }
else else
{ {

View File

@@ -724,6 +724,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y); uint8_t (*voodoo_draw)(voodoo_state_t *state, voodoo_params_t *params, int x, int real_y);
#endif #endif
int y_diff = SLI_ENABLED ? 2 : 1; int y_diff = SLI_ENABLED ? 2 : 1;
int y_origin = (voodoo->type >= VOODOO_BANSHEE) ? voodoo->y_origin_swap : (voodoo->v_disp-1);
if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH || if ((params->textureMode[0] & TEXTUREMODE_MASK) == TEXTUREMODE_PASSTHROUGH ||
(params->textureMode[0] & TEXTUREMODE_LOCAL_MASK) == TEXTUREMODE_LOCAL) (params->textureMode[0] & TEXTUREMODE_LOCAL_MASK) == TEXTUREMODE_LOCAL)
@@ -788,7 +789,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
int test_y; int test_y;
if (params->fbzMode & (1 << 17)) if (params->fbzMode & (1 << 17))
test_y = (voodoo->v_disp-1) - state->y; test_y = y_origin - state->y;
else else
test_y = state->y; test_y = state->y;
@@ -852,7 +853,7 @@ static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, vood
x2 = (state->vertexBx << 12) + ((state->dxBC * (real_y - state->vertexBy)) >> 4); x2 = (state->vertexBx << 12) + ((state->dxBC * (real_y - state->vertexBy)) >> 4);
if (params->fbzMode & (1 << 17)) if (params->fbzMode & (1 << 17))
real_y = (voodoo->v_disp-1) - (real_y >> 4); real_y = y_origin - (real_y >> 4);
else else
real_y >>= 4; real_y >>= 4;