r61524: fix a tight freeze window due to a CPU/DMA race

This commit is contained in:
Lephe 2021-11-20 16:39:46 +01:00
parent caf585b0a1
commit 055c8f405b
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 4 additions and 3 deletions

View File

@ -149,6 +149,10 @@ void r61524_start_frame(int start, int height)
void r61524_display(uint16_t *vram, int start, int height, int method)
{
/* Wait for any transfer to finish before using the screen, otherwise
the DMA might write data *while* we're sending commands! */
dma_transfer_wait(0);
r61524_start_frame(start, height);
if(method == R61524_CPU)
@ -167,9 +171,6 @@ void r61524_display(uint16_t *vram, int start, int height, int method)
int blocks = 99 * (height >> 2);
if(method == R61524_DMA) {
/* If the previous transfer is still running, wait for it; then
start sending asynchronously and return. */
dma_transfer_wait(0);
dma_transfer_async(0, DMA_32B, blocks, src, DMA_INC, dst,
DMA_FIXED, GINT_CALL_NULL);
}