vxKernel/src/display/dclear.c

57 lines
1012 B
C
Raw Normal View History

#include <vhex/defs/types.h>
#include <vhex/display.h>
#include <vhex/display/stack.h>
//---
// kernel-level API
//---
/* dclear_draw() : real drawing algorithm */
void dclear_render(dsurface_t *surface, uint32_t color)
{
VxKernel 0.6.0-17 : Add RTC driver + prepare FS support @add <> include/vhex/display/draw/rect | add filled rectangle API <> src/display/draw/drect | add filled rectangle drawing API <> board/fxcg50/ | add devices special section (WIP) <> include/vhex/device | add device structure (WIP) <> include/vhex/driver/mpu/sh/sh7305/ | [intc] add primitive which allow dummy default interrupt handler | [rtc] add complete RTC hardware structure | [rtc] add hardware-level kernel API <> include/vhex/fs | add file system abstraction API (WIP) | add Fugue FAT file system abstraction API (WIP) <> include/vhex/rtc | add RTC user-level API | add driver-level interface | add kernel-level types <> src/fs | add base Fugue abstraction (WIP) | add libc functions (WIP) @update <> include/vhex/display/draw/text | merge halign and valign argument | add special alignment flags <> include/vhex/driver | add RTC driver flags <> include/vhex/driver/mpu/sh/sh7305/cpg | rename weird field | add Spread Spectrum emulator field | properly expand LSTATS register <> src/driver/mpu/sh/sh7305 | [intc] allow user-level interrupt handler installation | [intc] expose common interrupt handler | [rtc] add RTC entire driver <> src/driver/scree/r61524 | use complete VRAM instead of fragmented render @fix <> src/display | [text] fix height for text display geometry | [text] fix alignment calculation | [dclear] fix geometry support <> src/driver/mpu/sh/sh7305 | [cpg] fix driver installation | [cpg] fix driver spread spectrum | [cpg] fix driver declaration | [tmu] fix exception with the profiling primitives
2022-08-08 20:19:00 +02:00
uint32_t *vram = surface->vram;
for (size_t i = 0; i < surface->width * (surface->height/2); ++i)
vram[i] = color;
#if 0
uint32_t *vram;
int size = (surface->y1 == 220) ? 792 : 1980;
vram = surface->vram;
for (int i = 0; i < size; ++i)
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
vram[i] = color;
VxKernel 0.6.0-17 : Add RTC driver + prepare FS support @add <> include/vhex/display/draw/rect | add filled rectangle API <> src/display/draw/drect | add filled rectangle drawing API <> board/fxcg50/ | add devices special section (WIP) <> include/vhex/device | add device structure (WIP) <> include/vhex/driver/mpu/sh/sh7305/ | [intc] add primitive which allow dummy default interrupt handler | [rtc] add complete RTC hardware structure | [rtc] add hardware-level kernel API <> include/vhex/fs | add file system abstraction API (WIP) | add Fugue FAT file system abstraction API (WIP) <> include/vhex/rtc | add RTC user-level API | add driver-level interface | add kernel-level types <> src/fs | add base Fugue abstraction (WIP) | add libc functions (WIP) @update <> include/vhex/display/draw/text | merge halign and valign argument | add special alignment flags <> include/vhex/driver | add RTC driver flags <> include/vhex/driver/mpu/sh/sh7305/cpg | rename weird field | add Spread Spectrum emulator field | properly expand LSTATS register <> src/driver/mpu/sh/sh7305 | [intc] allow user-level interrupt handler installation | [intc] expose common interrupt handler | [rtc] add RTC entire driver <> src/driver/scree/r61524 | use complete VRAM instead of fragmented render @fix <> src/display | [text] fix height for text display geometry | [text] fix alignment calculation | [dclear] fix geometry support <> src/driver/mpu/sh/sh7305 | [cpg] fix driver installation | [cpg] fix driver spread spectrum | [cpg] fix driver declaration | [tmu] fix exception with the profiling primitives
2022-08-08 20:19:00 +02:00
#endif
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
}
//---
// Dstack-level API
//---
/* dclear_dstack() : dstack rwrapper primitive */
void dclear_dstack(dsurface_t *surface, uint32_t *arg)
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
{
dclear_render(surface, arg[0]);
}
//---
// User-level API
//---
/* dclear(): Fill the screen with a single color */
did_t dclear(int color)
{
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
uint32_t copti;
dstack_invalidate();
if (color == C_NONE)
return (-1);
color = color & 0xffff;
copti = (color << 16) | (color << 0);
return dstack_add_action(
VxKernel 0.6.0-13 : Add keyboard API + update timer API @add <> include/vhex/driver/mpu/sh/sh7305/keysc | add internal driver primitives <> include/vhex/driver/mpu/sh/sh7305/tmu | add internal driver primitives <> include/vhex/keyboard | add getkey* (high-level) API | add key event API | add key status API | add keycode information | add keyboard driver interface @update <> include/vhex/driver | add KEYBOARD driver flags <> include/vhex/keyboard | isolate each part of the keyboard module | link the keycache part with the driver-provided keycache information <> src/drivers/mpu/sh/sh7305/keysc | use the new keycache API (high-level interrupt handler) | update keycache API | link the new API in the driver device <> src/drivers/mpu/sh/sh7305/tmu | add timer reservation (WIP) | use a "reservation" cache to known which timer is free instead of hardware | rename internal functions <> src/module/display | Now, by default, DSTACK_CALL() create a pointer on a dstack_call_t | use dsubimage dstack primitive in dimage() @fix <> board/fxcg50/fxcg50.ld | remove the IL-memory and allow only the X-memory area. This because the bootloader uses the IL-memory for DMA transfer and other "low-level" routine used by Gint. Moreover, I originally try to move each "display-driver" in this place, but after some profiling and tests, the dclear()/dupdate() combo went from 9155us up to 33250us (for many reason). So, I keep this area free, but I moved-back from RAM display routines. <> board/fxcg50/initialize | remove "section" copy. This role has been delegated to the bootload (vxBoot) because, in the final ELF file generated by GCC, many relocalization information for the IL/X memory has been set and the bootloader cannot performs general relocalization. So, all "special section/memory" displacement has been moved in the bootloader and we don't have to worrying about the section copy. <> src/drivers/mpu/sh/sh7305/tmu | fix delay calculation in timer reload primitive | disable interruption for profiling timer <> src/module/dislay/ | fix shader index used during the dstack_render() | fix many errors in dimage() shadow render (WIP)
2022-06-24 15:33:36 +02:00
DSTACK_CALL(&dclear_dstack, copti),
VxKernel 0.6.0-4 : Support the text API @add <> src/modules/display/text/dascii | proof-of-concept of "one-char" drawing API (used for kernel debug) <> src/modules/fs | empty File System module used to expose some primitives used by the libc: | write(), read(), lseek() and close() which there have been removed from the | `fxlibc` project which used an old / deprecated ABI/sycall interface that | doesn't exist in this version of Vhex @update <> include/display/draw/pixel | remove the display ID returned by dpixel(). All primitives that support | shaders must provide explicit API. This to allow fast-optimized API and | polyvalence API for shadering which impact the performance <> src/modules/display/dclear | isolate tree level for this primitive: | - kernel : direct fragment drawing primitive (by-pass dstack) | - dstack : dstack drawing primitive | - user : user drawing primitive (dstack-API) | invalidate automatically the dstack each time the primitive (user-level) is | involved <> src/modules/display/dstack | isolate the dstack invalidate part in a specific primitive @fix <> make/Makefile | proper support of the OpenLibm header path <> src/drivers/screen/r61524 | proper support of the last data fragment size. This caused an override on | the first X line of the screen <> src/modules/display/dstack | fix a crash when the number of action is full | fix a crash with the default index used for action cache | fix a crash with the default index used for shader cache | fix action initialization | fix action quit primitive <> src/modules/display/text/dfont | fix the character drawing algorithm | proper support of the character drawing color (foreground/background) | fix the kernel-level primitive used to display a Unicode string <> src/modules/display/text/dtext | fix a crash with the internal index counter | fix a crash in the internal cache | fix the quit function
2022-06-10 21:28:51 +02:00
NULL,
NULL
);
}