From caa4f675c969f77c2d5bd08ec959b46cdc8055b9 Mon Sep 17 00:00:00 2001 From: Lephe Date: Mon, 1 Jun 2020 12:11:59 +0200 Subject: [PATCH] bopti: deprecate image_t, renamed to bopti_image_t --- TODO | 33 +++++++++++---------------------- include/display/fx.h | 8 ++++---- include/gint/display-cg.h | 8 ++++++-- include/gint/display-fx.h | 8 ++++++-- include/gint/display.h | 6 +++--- include/gint/gray.h | 4 ++-- src/gray/gimage.c | 4 ++-- src/render-cg/bopti-asm.h | 8 ++++---- src/render-cg/bopti.c | 10 +++++----- src/render-cg/dimage.c | 4 ++-- src/render-fx/bopti.c | 8 ++++---- src/render-fx/dimage.c | 4 ++-- 12 files changed, 51 insertions(+), 54 deletions(-) diff --git a/TODO b/TODO index ac8b04e..f48dbae 100644 --- a/TODO +++ b/TODO @@ -1,27 +1,21 @@ -For the 2.0.0 release: -* bopti: remove image_t, leaving only bopti_image_t +For the 2.1.0 release: +* core: use gint_switch() to handle TLB misses +* core: the four basic memory functions (with automated tests) +* bopti: remove the deprecated image_t definition * 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) -! core: use gint_switch() to handle TLB misses -! core: recheck SH3 compatibility - -Issues. +Issues: * #3 make drawing functions parameterized -* #5 add decent random number generation (TinyMT) * #8 support fx-CG Manager * #10 support fx-CG 20 -Complementary elements on existing code. +Extensions on existing code: * gray: add gprint() * gray: double-buffer gray settings and unify d* with g* -* display: deprecate image_t and rename it bopti_image_t * topti: support unicode fonts * gray: find good values for more models than the Graph 35+E II -* dma: maybe relax the 4-byte size constraint for dma_memset() * dma: fx9860g support (need to switch it on and update the Makefile) * core: try to leave add-in without reset in case of panic * hardware: fill in the HWMEM_FITTLB flag @@ -31,24 +25,19 @@ Complementary elements on existing code. * core: use cmp/str for memchr() * r61524: brightness control and clean the file * t6k11: check if dupdate() can be done by the DMA - -Keep in mind. +* core: review forgotten globals and MPU addresses not in * build: make the build system simpler (two targets are enough by default) * core: run destructors when a task-switch results in leaving the app * core: invoke main menu instead of returning after main() ends -* prizm: don't hardcode stack address in fxcg50.ld +* prizm: don't hardcode stack address in fxcg50.ld (if possible) * prizm: detect P1 static RAM (stack) in TLB * core rtc: use qdiv10 to massively improve division performance -* setjmp: more registers may need to be saved -* core: free heap when a task-switch results in leaving the app -* core: save and restore interrupt masks -* timer: make sure ETMU interrupts are disabled in ctx_restore() * core: document the SH7305 PFC in Future directions. * A complete file system abstraction * Integrate overclock management -* Audio playback using Martin Poupe's method -* Serial communication [SCIF] [SCIFA] -* USB communication [USB] +* Audio playback using TSWilliamson's libsnd method +* Serial communication +* USB communication, using Yatis' reverse-engineering of the module * Make fx9860g projects work out of the box on fxcg50 diff --git a/include/display/fx.h b/include/display/fx.h index a65e4f0..349e98e 100644 --- a/include/display/fx.h +++ b/include/display/fx.h @@ -30,8 +30,8 @@ void masks(int x1, int x2, uint32_t *masks); @left @top @w @h Bounding box to render @v1 @v2 VRAMs @bopti_asm Rendering function */ -void bopti_render_clip(int x, int y, image_t const *img, int left, int top, - int w, int h, uint32_t *v1, uint32_t *v2, void *bopti_asm); +void bopti_render_clip(int x, int y, bopti_image_t const *img, int left, + int top, int w, int h, uint32_t *v1, uint32_t *v2, void *bopti_asm); /* bopti_render_noclip() - render a bopti image without clipping This function is only ever slightly faster than bopti_render_clip(), @@ -44,7 +44,7 @@ void bopti_render_clip(int x, int y, image_t const *img, int left, int top, @left @top @w @h Bounding box to render @v1 @v2 VRAMs @bopti_asm Rendering function */ -void bopti_render_noclip(int x, int y, image_t const *img, int left, int top, - int w, int h, uint32_t *v1, uint32_t *v2, void *bopti_asm); +void bopti_render_noclip(int x, int y, bopti_image_t const *img, int left, + int top, int w, int h, uint32_t *v1, uint32_t *v2, void *bopti_asm); #endif /* DISPLAY_FX */ diff --git a/include/gint/display-cg.h b/include/gint/display-cg.h index 6d47ef4..6b5fbf2 100644 --- a/include/gint/display-cg.h +++ b/include/gint/display-cg.h @@ -56,7 +56,7 @@ enum { // Image rendering (bopti) //--- -/* image_t: Image files encoded for bopti +/* bopti_image_t: Image files encoded for bopti This format is created by the fxSDK's [fxconv] tool from standard images. */ typedef struct { @@ -78,7 +78,11 @@ typedef struct Then raw pixel data in row-major order. */ uint16_t data[]; -} GPACKED(4) image_t; +} GPACKED(4) bopti_image_t; + +/* Old alias to image_t, now deprecated because of libimg */ +typedef bopti_image_t image_t __attribute__((deprecated( + "image_t has been renamed to bopti_image_t"))); //--- // Video RAM management diff --git a/include/gint/display-fx.h b/include/gint/display-fx.h index 679c5d5..f9dfcf2 100644 --- a/include/gint/display-fx.h +++ b/include/gint/display-fx.h @@ -61,7 +61,7 @@ typedef enum // Image rendering (bopti) //--- -/* image_t - image files encoded for bopti +/* bopti_image_t - image files encoded for bopti This format is the result of encoding images for bopti with the fxSDK's [fxconv] tool. The bopti routines can render it extremely fast, which makes it preferable over plain bitmaps if the images are never edited. */ @@ -81,7 +81,11 @@ typedef struct /* Raw layer data */ uint8_t data[]; -} GPACKED(4) image_t; +} GPACKED(4) bopti_image_t; + +/* Old alias to image_t, now deprecated because of libimg */ +typedef bopti_image_t image_t __attribute__((deprecated( + "image_t has been renamed to bopti_image_t"))); #endif /* FX9860G */ diff --git a/include/gint/display.h b/include/gint/display.h index 92dae6e..553e3b5 100644 --- a/include/gint/display.h +++ b/include/gint/display.h @@ -226,7 +226,7 @@ void dprint(int x, int y, int fg, int bg, char const *format, ...); // Image rendering (bopti) //--- -/* The image_t structure is platform-dependent. */ +/* The bopti_image_t structure is platform-dependent. */ /* dimage(): Render a full image This function blits an image on the VRAM using gint's special format. It is @@ -234,7 +234,7 @@ void dprint(int x, int y, int fg, int bg, char const *format, ...); @x @y Coordinates of the top-left corner of the image @image Pointer to image encoded with [fxconv] */ -void dimage(int x, int y, image_t const *image); +void dimage(int x, int y, bopti_image_t const *image); /* Option values for dsubimage() */ enum { @@ -256,7 +256,7 @@ enum { @left @top Top-left coordinates of the subrectangle within [image] @width @height Subrectangle dimensions @flags OR-combination of DIMAGE_* flags */ -void dsubimage(int x, int y, image_t const *image, int left, int top, +void dsubimage(int x, int y, bopti_image_t const *image, int left, int top, int width, int height, int flags); //--- diff --git a/include/gint/gray.h b/include/gint/gray.h index 2df8a14..6eff524 100644 --- a/include/gint/gray.h +++ b/include/gint/gray.h @@ -171,7 +171,7 @@ void gtext(int x, int y, const char *str, int fg, int bg); @x @y Coordinates of the top-left corner of the image @image Pointer to gray image encoded with [fxconv] */ -void gimage(int x, int y, image_t const *image); +void gimage(int x, int y, bopti_image_t const *image); /* gsubimage(): Render a section of an image Like dsubimage() for gray images. Same options apply. @@ -181,7 +181,7 @@ void gimage(int x, int y, image_t const *image); @left @top Top-left coordinates of the subrectangle within [image] @width @height Subrectangle dimensions @flags OR-combination of DIMAGE_* flags */ -void gsubimage(int x, int y, image_t const *image, int left, int top, +void gsubimage(int x, int y, bopti_image_t const *image, int left, int top, int width, int height, int flags); //--- diff --git a/src/gray/gimage.c b/src/gray/gimage.c index c56d936..82e567d 100644 --- a/src/gray/gimage.c +++ b/src/gray/gimage.c @@ -11,7 +11,7 @@ static void *bopti_asm[] = { }; /* gimage(): Render a full image */ -void gimage(int x, int y, image_t const *img) +void gimage(int x, int y, bopti_image_t const *img) { uint32_t *light, *dark; gvram(&light, &dark); @@ -21,7 +21,7 @@ void gimage(int x, int y, image_t const *img) } /* gsubimage(): Render a section of an image */ -void gsubimage(int x, int y, image_t const *img, int left, int top, +void gsubimage(int x, int y, bopti_image_t const *img, int left, int top, int width, int height, int flags) { uint32_t *light, *dark; diff --git a/src/render-cg/bopti-asm.h b/src/render-cg/bopti-asm.h index 159856b..57afb27 100644 --- a/src/render-cg/bopti-asm.h +++ b/src/render-cg/bopti-asm.h @@ -42,14 +42,14 @@ void bopti_p4(uint8_t const *data, uint16_t *target, int width, int height, /* bopti_render_clip(): Render with clipping Same parameters as dsubimage(), except for flags. */ -void bopti_render_clip(int x, int y, image_t const *img, int left, int top, - int width, int height); +void bopti_render_clip(int x, int y, bopti_image_t const *img, int left, + int top, int width, int height); /* bopti_render_clip(): Render without clipping Behaviour is not defined if (left,top)+(width,height) is not included in the source image or (x,y)+(width,height) is not included in the VRAM area. Same parameters as dsubimage(), except for flags. */ -void bopti_render_noclip(int x, int y, image_t const *img, int left, int top, - int width, int height); +void bopti_render_noclip(int x, int y, bopti_image_t const *img, int left, + int top, int width, int height); #endif /* GINT_RENDERCG_BOPTIASM */ diff --git a/src/render-cg/bopti.c b/src/render-cg/bopti.c index cfde180..4645a57 100644 --- a/src/render-cg/bopti.c +++ b/src/render-cg/bopti.c @@ -18,7 +18,7 @@ enum { PX_P4 = 3, }; -void bopti_render(image_t const *img, struct box *box) +void bopti_render(bopti_image_t const *img, struct box *box) { /* Offset in video RAM and output stride */ uint16_t *target = gint_vram + (396 * box->y + box->x); @@ -70,8 +70,8 @@ void bopti_render(image_t const *img, struct box *box) } } -void bopti_render_clip(int x, int y, image_t const *img, int left, int top, - int width, int height) +void bopti_render_clip(int x, int y, bopti_image_t const *img, int left, + int top, int width, int height) { /* Adjust the bounding box of the input image */ if(left < 0) width += left, x -= left, left = 0; @@ -94,8 +94,8 @@ void bopti_render_clip(int x, int y, image_t const *img, int left, int top, bopti_render(img, &box); } -void bopti_render_noclip(int x, int y, image_t const *img, int left, int top, - int width, int height) +void bopti_render_noclip(int x, int y, bopti_image_t const *img, int left, + int top, int width, int height) { struct box box = { x, y, width, height, left, top }; bopti_render(img, &box); diff --git a/src/render-cg/dimage.c b/src/render-cg/dimage.c index 0315ba1..2883153 100644 --- a/src/render-cg/dimage.c +++ b/src/render-cg/dimage.c @@ -2,13 +2,13 @@ #include "bopti-asm.h" /* dimage() - render a full image */ -void dimage(int x, int y, image_t const *img) +void dimage(int x, int y, bopti_image_t const *img) { bopti_render_clip(x, y, img, 0, 0, img->width, img->height); } /* dsubimage() - render a section of an image */ -void dsubimage(int x, int y, image_t const *img, int left, int top, +void dsubimage(int x, int y, bopti_image_t const *img, int left, int top, int width, int height, int flags) { if(flags & DIMAGE_NOCLIP) diff --git a/src/render-fx/bopti.c b/src/render-fx/bopti.c index fffc264..026af9d 100644 --- a/src/render-fx/bopti.c +++ b/src/render-fx/bopti.c @@ -144,7 +144,7 @@ void bopti_grid(void **layer, int rows, struct command *c) } } -void bopti_render(image_t const *img, struct rbox *rbox, uint32_t *v1, +void bopti_render(bopti_image_t const *img, struct rbox *rbox, uint32_t *v1, uint32_t *v2, void *bopti_asm) { /* Compute rendering masks */ @@ -204,7 +204,7 @@ void bopti_render(image_t const *img, struct rbox *rbox, uint32_t *v1, bopti_grid((void **)&layer, rbox->bottom - rbox->top, &c); } -void bopti_render_clip(int visual_x, int y, image_t const *img, int left, +void bopti_render_clip(int visual_x, int y, bopti_image_t const *img, int left, int top, int width, int height, uint32_t *v1, uint32_t *v2, void *bopti_asm) { @@ -249,8 +249,8 @@ void bopti_render_clip(int visual_x, int y, image_t const *img, int left, bopti_render(img, &rbox, v1, v2, bopti_asm); } -void bopti_render_noclip(int visual_x, int y, image_t const *img, int left, - int top, int width, int height, uint32_t *v1, uint32_t *v2, +void bopti_render_noclip(int visual_x, int y, bopti_image_t const *img, + int left, int top, int width, int height, uint32_t *v1, uint32_t *v2, void *bopti_asm) { /* End row (excluded) */ diff --git a/src/render-fx/dimage.c b/src/render-fx/dimage.c index de390d7..afacca9 100644 --- a/src/render-fx/dimage.c +++ b/src/render-fx/dimage.c @@ -9,7 +9,7 @@ static void *bopti_asm[] = { }; /* dimage() - render a full image */ -void dimage(int x, int y, image_t const *img) +void dimage(int x, int y, bopti_image_t const *img) { if(img->gray) return; bopti_render_clip(x, y, img, 0, 0, img->width, img->height, gint_vram, @@ -17,7 +17,7 @@ void dimage(int x, int y, image_t const *img) } /* dsubimage() - render a section of an image */ -void dsubimage(int x, int y, image_t const *img, int left, int top, +void dsubimage(int x, int y, bopti_image_t const *img, int left, int top, int width, int height, int flags) { if(img->gray) return;