render-cg: allow VRAM in user stack

This is currently unused and has some artifacts in gintctl for reasons I
haven't understood yet. Will have to investigate later.
This commit is contained in:
Lephe 2020-07-02 15:47:11 +02:00
parent f8ee9b7414
commit ed30b2cb21
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
3 changed files with 31 additions and 16 deletions

8
configure vendored
View File

@ -13,9 +13,9 @@ prefix=
cflags=
# Behavior
boot_log=
no_syscalls=
static_gray=
user_vram=
# Size limits
atexit_max=
@ -57,6 +57,7 @@ Library options (disabled by default):
Only use this option if you have a good idea of which.
--static-gray Allocate gray VRAMs in static RAM instead of the heap
May help when --no-syscalls is on.
--user-vram Allocate VRAM in user stack; takes 350k/512k [fxcg50]
Size limits:
--atexit-max=NUM Number of exit handlers in atexit()'s array [16]
@ -109,12 +110,12 @@ for arg; do case "$arg" in
--cflags=*)
cflags=${arg#*=};;
--boot-log)
boot_log=true;;
--no-syscalls)
no_syscalls=true;;
--static-gray)
static_gray=true;;
--user-vram)
user_vram=true;;
--atexit-max=*)
n=${arg#*=}
@ -190,6 +191,7 @@ output_config()
echo -n " -D$(echo $target | tr 'a-z' 'A-Z')"
[[ "$no_syscalls" ]] && echo -n " -DGINT_NO_SYSCALLS"
[[ "$static_gray" ]] && echo -n " -DGINT_STATIC_GRAY"
[[ "$user_vram" ]] && echo -n " -DGINT_USER_VRAM"
[[ "$atexit_max" ]] && echo -n " -DATEXIT_MAX=$atexit_max"
echo ""
}

View File

@ -68,18 +68,14 @@ SECTIONS
*(.text .text.*)
} > rom
/* Interrupt handlers going to ROM:
- gint's interrupt handler blocks (.gint.blocks)
Although gint's blocks end up in VBR space, they are installed at
/* gint's interrupt handler blocks (.gint.blocks)
Although gint's blocks end up in VBR space, they are relocated at
startup by the library/drivers, so we store them here for now */
.gint.blocks : {
KEEP(*(.gint.blocks));
} > rom
/* Driver data going to ROM:
- Exposed driver interfaces (.gint.drivers)
/* Exposed driver interfaces (.gint.drivers)
The driver information is required to start and configure the
driver, even if the symbols are not referenced */
.gint.drivers : {
@ -117,6 +113,7 @@ SECTIONS
.bss (NOLOAD) : {
_rbss = . ;
*(.bss.vram)
*(.bss COMMON)
. = ALIGN(16);
@ -183,9 +180,7 @@ SECTIONS
/*
** gint-related sections
** 8c160000:5k VBR space
** 8c161400:3k .gint.data and .gint.bss
** gint-related sections (VBR space, .gint.data and .gint.bss)
*/
/* VBR address: let's just start at the beginning of the RAM area.

View File

@ -1,13 +1,31 @@
#include <gint/display.h>
/* Put both VRAMs in the system stack! */
#ifdef GINT_USER_VRAM
/* We want to put the VRAM in the user section, however we can't use the
virtualized P0 address as this will mess up the DMA. As the static RAM is
always fully mapped at a fixed place, we can use the target P1 address. We
just need to allocate the space for the linker. This special section ensures
that the first address of the user stack will be used */
GALIGNED(4) GSECTION(".bss.vram") int8_t _gint_vram_buffers[396*224*2];
/* In this case, we can define pointers to our user stack directly, these will
be the physical address associated with _vram_buffers */
static uint16_t *main = (void *)0xac161400;
static uint16_t *scnd = (void *)0xac18c900;
/* Shared VRAM pointer, the one exposed by <gint/display.h> */
uint16_t *gint_vram = (void *)0xac161400;
#else
/* Otherwise, just put both VRAMs in the system stack! */
static uint16_t *main = (void *)0xac0f0000;
static uint16_t *scnd = (void *)0xac11b500;
uint16_t *gint_vram = (void *)0xac0f0000;
#endif
/* On Prizm: should be: 0xa80f0000 and 0xa811b500 */
/* Shared VRAM pointer, the one exposed by <gint/display.h> */
uint16_t *gint_vram = (void *)0xac0f0000;
/* dsetvram() - Control video RAM address and triple buffering */
void dsetvram(uint16_t *new_main, uint16_t *new_secondary)