Merge pull request #1487 from 86Box/tc1995

Ported the latest Voodoo changes from the other emulator.
This commit is contained in:
Miran Grča
2021-06-15 17:21:25 +02:00
committed by GitHub
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*/
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;
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;
if (svga->fb_only || svga->force_legacy_mode)
if (svga->fb_only)
func_nr = 0;
else {
if (svga->force_dword_mode)

View File

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

View File

@@ -180,6 +180,7 @@ enum
#define VGAINIT0_EXTENDED_SHIFT_OUT (1 << 12)
#define VIDPROCCFG_VIDPROC_ENABLE (1 << 0)
#define VIDPROCCFG_CURSOR_MODE (1 << 1)
#define VIDPROCCFG_INTERLACE (1 << 3)
#define VIDPROCCFG_HALF_MODE (1 << 4)
@@ -240,6 +241,9 @@ enum
#define VIDSERIAL_I2C_SCK_R (1 << 26)
#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
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);
svga->interlace = 0;
svga->force_legacy_mode = 0;
if (banshee->vgaInit0 & VGAINIT0_EXTENDED_SHIFT_OUT)
{
svga->force_legacy_mode = 1;
switch (VIDPROCCFG_DESKTOP_PIX_FORMAT)
{
case PIX_FORMAT_8:
@@ -568,6 +570,8 @@ static void banshee_recalctimings(svga_t *svga)
svga->bpp = 8;
}
svga->fb_only = (banshee->vidProcCfg & VIDPROCCFG_VIDPROC_ENABLE);
if (((svga->miscout >> 2) & 3) == 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:
banshee->miscInit0 = val;
voodoo->y_origin_swap = (val & MISCINIT0_Y_ORIGIN_SWAP_MASK) >> MISCINIT0_Y_ORIGIN_SWAP_SHIFT;
break;
case Init_miscInit1:
banshee->miscInit1 = val;

View File

@@ -456,8 +456,10 @@ void voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params)
if (params->fbzMode & (1 << 17))
{
high_y = voodoo->v_disp - params->clipLowY;
low_y = voodoo->v_disp - params->clipHighY;
int y_origin = (voodoo->type >= VOODOO_BANSHEE) ? (voodoo->y_origin_swap+1) : voodoo->v_disp;
high_y = y_origin - params->clipLowY;
low_y = y_origin - params->clipHighY;
}
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);
#endif
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 ||
(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;
if (params->fbzMode & (1 << 17))
test_y = (voodoo->v_disp-1) - state->y;
test_y = y_origin - state->y;
else
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);
if (params->fbzMode & (1 << 17))
real_y = (voodoo->v_disp-1) - (real_y >> 4);
real_y = y_origin - (real_y >> 4);
else
real_y >>= 4;