GIF: Improve FIFO check

fingers crossed that it fixes #1 again
This commit is contained in:
hch12907 2018-11-07 15:55:35 +08:00
parent 620110cfa6
commit 8089b206dd

View file

@ -89,8 +89,8 @@ int CGif::time_step(const int ticks_available)
if (!fifo->has_read_available(NUMBER_BYTES_IN_QWORD)) if (!fifo->has_read_available(NUMBER_BYTES_IN_QWORD))
continue; continue;
// P3TAG holding something means that PATH3 was previously interrupted, and needs to recontinue // IP3 set to 1 indicates that PATH3 was previously interrupted, and needs to recontinue
if (r.ee.gif.p3tag.read_uword()) if (r.ee.gif.stat.extract_field(GifRegister_Stat::IP3))
{ {
// Note: check endianness? // Note: check endianness?
uqword p3data; uqword p3data;
@ -157,6 +157,8 @@ int CGif::time_step(const int ticks_available)
uqword data; uqword data;
fifo->read(reinterpret_cast<ubyte*>(&data), NUMBER_BYTES_IN_QWORD); fifo->read(reinterpret_cast<ubyte*>(&data), NUMBER_BYTES_IN_QWORD);
cycles_consumed = handle_data_image(data);
// In intermittent mode, the GIF checks for other requests from PATH1 & PATH2, // In intermittent mode, the GIF checks for other requests from PATH1 & PATH2,
// and priotises them over PATH3 if there are. // and priotises them over PATH3 if there are.
// The check is done every 8 qwords (or 1 slice). // The check is done every 8 qwords (or 1 slice).
@ -185,8 +187,6 @@ int CGif::time_step(const int ticks_available)
} }
} }
cycles_consumed = handle_data_image(data);
break; break;
} }
default: default:
@ -194,6 +194,20 @@ int CGif::time_step(const int ticks_available)
throw std::runtime_error("Unknown GIF data processing method"); throw std::runtime_error("Unknown GIF data processing method");
} }
} }
// TODO: remove this hack.
// Hack: if there are active transfers, force FQC to 16, otherwise 0.
// This is because we do not have a reliable way of tracking the FIFO usage
if (fifo->has_read_available(NUMBER_BYTES_IN_QWORD))
{
BOOST_LOG(Core::get_logger()) << "GIF: FQC set to 16";
stat.insert_field(GifRegister_Stat::FQC, 16);
}
else
{
BOOST_LOG(Core::get_logger()) << "GIF: FQC set to 0";
stat.insert_field(GifRegister_Stat::FQC, 0);
}
} }
// TODO: Confirm behaviour. // TODO: Confirm behaviour.
@ -211,19 +225,6 @@ int CGif::time_step(const int ticks_available)
} }
} }
// TODO: remove this hack.
// Hack: if there are active transfers, force FQC to 16, otherwise 0.
// This is because we do not have a reliable way of tracking the FIFO usage
if (fifo->has_read_available(NUMBER_BYTES_IN_QWORD))
{
BOOST_LOG(Core::get_logger()) << "GIF: FQC set to 16";
stat.insert_field(GifRegister_Stat::FQC, 16);
}
else
{
stat.insert_field(GifRegister_Stat::FQC, 0);
}
// Do not process other paths if at least one path was successfully processed. // Do not process other paths if at least one path was successfully processed.
if (cycles_consumed) if (cycles_consumed)
break; break;