render-cg: expose vram buffers with dgetvram() and dsetvram()

This commit is contained in:
Lephe 2020-05-10 23:03:02 +02:00
parent d3c43c3ecd
commit e217309adf
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
3 changed files with 18 additions and 6 deletions

1
TODO
View file

@ -2,6 +2,7 @@ For the 2.0.0 release:
* bopti: remove image_t, leaving only bopti_image_t
* project: remove the compat branch
* gray: remove g*() functions
* core: remove the boot log
Crucial, missing things.
! core: the four basic memory functions (with automated tests)

View file

@ -19,7 +19,7 @@
#define DWIDTH 396
#define DHEIGHT 224
/* gint VRAM address. This value must always point to a 32-aligned bufer of
/* gint VRAM address. This value must always point to a 32-aligned buffer of
size 177408. Any function can use it freely to perform rendering or store
data when not drawing. Triple buffering is already implemented in gint, see
the dvram() function below.
@ -84,7 +84,7 @@ typedef struct
// Video RAM management
//---
/* dvram() - Control video RAM address and triple buffering
/* dsetvram() - Control video RAM address and triple buffering
Normal rendering under gint uses double-buffering: there is one image
displayed on the screen and one in memory, in a region called the video RAM
@ -112,7 +112,11 @@ typedef struct
@main Main VRAM area, used alone if [secondary] is NULL
@secondary Additional VRAM area, enables triple buffering if non-NULL */
void dvram(uint16_t *main, uint16_t *secondary);
void dsetvram(uint16_t *main, uint16_t *secondary);
/* dgetvram() - Get VRAM addresses
Returns the VRAM buffer addresses used to render on fx-CG 50. */
void dgetvram(uint16_t **main, uint16_t **secondary);
#endif /* FXCG50 */

View file

@ -7,8 +7,8 @@ static uint16_t *scnd = (void *)0xac11b500;
/* Shared VRAM pointer, the one exposed by <gint/display.h> */
uint16_t *gint_vram = (void *)0xac0f0000;
/* dvram() - control video RAM address and triple buffering */
void dvram(uint16_t *new_main, uint16_t *new_secondary)
/* dsetvram() - Control video RAM address and triple buffering */
void dsetvram(uint16_t *new_main, uint16_t *new_secondary)
{
if(gint_vram == main) gint_vram = new_main;
else if(gint_vram == scnd) gint_vram = new_secondary;
@ -17,7 +17,14 @@ void dvram(uint16_t *new_main, uint16_t *new_secondary)
scnd = new_secondary;
}
/* dvram_switch() - triple buffering switch
/* dgetvram() - Get VRAM addresses */
void dgetvram(uint16_t **ptr_main, uint16_t **ptr_scnd)
{
if(ptr_main) *ptr_main = main;
if(ptr_scnd) *ptr_scnd = scnd;
}
/* dvram_switch() - Triple buffering switch
This function is not public, it is used only by dupdate(). */
void dvram_switch(void)
{