gint/src/render-cg/dupdate.c
Lephe 7a3604ccbb
render-cg: allocate VRAM in the heap; default to double buffering
* Create a heap arena over the OS stack, large enough to hold two VRAMs
  as was previously done, unless GINT_NO_OS_STACK is set at compile
  time. (This replaces GINT_USER_VRAM.)

* Allocate a single VRAM in the heap at startup.

* Use double buffering by default as triple buffering is almost entirely
  useless. dudpate() waits if both VRAMs are identical to prevent
  corruption, but this can be bypassed with R61524 functions as usual.
  This adds about 180 kB of heap data to any add-in using default
  settings.
2022-05-04 20:08:52 +01:00

21 lines
551 B
C

#include <gint/display.h>
#include <gint/drivers/r61524.h>
#include "render-cg.h"
/* dupdate(): Push the video RAM to the display driver */
void dupdate(void)
{
/* If triple buffering is enabled, don't wait for the DMA to finish */
uint16_t *vram_1, *vram_2;
dgetvram(&vram_1, &vram_2);
int method = (vram_1 == vram_2) ? R61524_DMA_WAIT : R61524_DMA;
r61524_display(gint_vram, 0, 224, method);
gint_call_t hook = dupdate_get_hook();
if(hook.function) gint_call(hook);
/* Switch buffers if triple buffering is enabled */
dvram_switch();
}