Continued preparing Voodoo2 CMDFIFO support.

- Zero out voodoo device state in init().
- Added the CMDFIFO state to save/restore list.
- Added CMDFIFO register handling in read/write functions.
- Added new function cmdfifo_put().
- TODO: CMDFIFO thread.
This commit is contained in:
Volker Ruppert 2017-05-13 11:52:49 +00:00
parent af76e0c412
commit 19f6cbc519
3 changed files with 60 additions and 4 deletions

View File

@ -207,6 +207,7 @@ void bx_voodoo_c::init(void)
BX_VOODOO_THIS s.vdraw.gui_update_pending = 0;
v = new voodoo_state;
memset(v, 0, sizeof(voodoo_state));
BX_VOODOO_THIS s.model = (Bit8u)SIM->get_param_enum("model", base)->get();
if (BX_VOODOO_THIS s.model == VOODOO_2) {
init_pci_conf(0x121a, 0x0002, 0x02, 0x038000, 0x00);
@ -326,6 +327,18 @@ void bx_voodoo_c::register_state(void)
new bx_shadow_num_c(fbi, "dady", &v->fbi.dady);
new bx_shadow_num_c(fbi, "dzdy", &v->fbi.dzdy);
new bx_shadow_num_c(fbi, "dwdy", &v->fbi.dwdy);
bx_list_c *cmdfifo = new bx_list_c(fbi, "cmdfifo", "");
for (i = 0; i < 2; i++) {
sprintf(name, "%d", i);
bx_list_c *num = new bx_list_c(cmdfifo, name, "");
new bx_shadow_bool_c(num, "enable", &v->fbi.cmdfifo[i].enable, BASE_HEX);
new bx_shadow_num_c(num, "base", &v->fbi.cmdfifo[i].base, BASE_HEX);
new bx_shadow_num_c(num, "end", &v->fbi.cmdfifo[i].end, BASE_HEX);
new bx_shadow_num_c(num, "rdptr", &v->fbi.cmdfifo[i].rdptr, BASE_HEX);
new bx_shadow_num_c(num, "depth", &v->fbi.cmdfifo[i].depth);
new bx_shadow_num_c(num, "amin", &v->fbi.cmdfifo[i].amin, BASE_HEX);
new bx_shadow_num_c(num, "amax", &v->fbi.cmdfifo[i].amax, BASE_HEX);
}
bx_list_c *fogblend = new bx_list_c(fbi, "fogblend", "");
for (i = 0; i < 64; i++) {
sprintf(name, "%d", i);

View File

@ -1455,7 +1455,7 @@ struct _fifo_state
typedef struct _cmdfifo_info cmdfifo_info;
struct _cmdfifo_info
{
Bit8u enable; /* enabled? */
bx_bool enable; /* enabled? */
Bit8u count_holes; /* count holes? */
Bit32u base; /* base address in framebuffer RAM */
Bit32u end; /* end address in framebuffer RAM */

View File

@ -1303,6 +1303,14 @@ void dacdata_r(dac_state *d, Bit8u regnum)
d->read_result = result;
}
void cmdfifo_put(Bit32u fbi_offset, Bit32u data)
{
BX_ERROR(("Writing to CMDFIFO has no effect yet: FBI offset=0x%08x, data=0x%08x",
fbi_offset, data));
*(Bit32u*)&v->fbi.ram[fbi_offset] = data;
v->fbi.cmdfifo[0].depth++;
}
voodoo_reg reg;
void register_w(Bit32u offset, Bit32u data)
@ -1335,9 +1343,7 @@ void register_w(Bit32u offset, Bit32u data)
BX_ERROR(("CMDFIFO-to-FIFO mode not supported yet"));
} else if ((offset & 0x80000) > 0) {
Bit32u fbi_offset = (v->fbi.cmdfifo[0].base + ((offset & 0xffff) << 2)) & v->fbi.mask;
BX_ERROR(("Writing to CMDFIFO has no effect yet: FBI offset=0x%08x, data=0x%08x",
fbi_offset, data));
*(Bit32u*)&v->fbi.ram[fbi_offset] = data;
cmdfifo_put(fbi_offset, data);
return;
} else {
if (v->regaccess[regnum] & REGISTER_WRITETHRU) {
@ -1744,6 +1750,9 @@ void register_w(Bit32u offset, Bit32u data)
if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
{
if ((v->type == VOODOO_2) && (regnum == fbiInit7)) {
v->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data);
}
v->reg[regnum].u = data;
recompute_video_memory(v);
v->fbi.video_changed = 1;
@ -1872,8 +1881,26 @@ void register_w(Bit32u offset, Bit32u data)
v->fbi.cmdfifo[0].end = ((data >> 16) & 0x3ff) << 12;
break;
case cmdFifoRdPtr:
v->fbi.cmdfifo[0].rdptr = data;
break;
case cmdFifoDepth:
v->fbi.cmdfifo[0].depth = data & 0xffff;
break;
case cmdFifoAMin:
v->fbi.cmdfifo[0].amin = data;
break;
case cmdFifoAMax:
v->fbi.cmdfifo[0].amax = data;
break;
case intrCtrl:
case userIntrCMD:
case bltSize:
case bltCommand:
BX_ERROR(("Writing to register %s not supported yet", v->regnames[regnum]));
break;
@ -2504,6 +2531,22 @@ Bit32u register_r(Bit32u offset)
case cmdFifoBaseAddr:
result = (v->fbi.cmdfifo[0].base >> 12) | ((v->fbi.cmdfifo[0].end >> 12) << 16);
break;
case cmdFifoRdPtr:
result = v->fbi.cmdfifo[0].rdptr;
break;
case cmdFifoDepth:
result = v->fbi.cmdfifo[0].depth;
break;
case cmdFifoAMin:
result = v->fbi.cmdfifo[0].amin;
break;
case cmdFifoAMax:
result = v->fbi.cmdfifo[0].amax;
break;
}
return result;