From 90ca49139cdc64ab374f2e763cb4c28fffd0a7b8 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 20 Dec 2011 23:56:35 +0200 Subject: gpu_neon: integrate Exophase's rasterizer --- plugins/gpu_neon/Makefile | 4 ++-- plugins/gpu_neon/Makefile.test | 15 ++++++++---- plugins/gpu_neon/psx_gpu_if.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 plugins/gpu_neon/psx_gpu_if.c (limited to 'plugins/gpu_neon') diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile index 66a2bd5..419558f 100644 --- a/plugins/gpu_neon/Makefile +++ b/plugins/gpu_neon/Makefile @@ -37,8 +37,8 @@ ifeq "$(HAVE_NEON)" "1" TARGETS += gpu_neon.$(EXT) endif -gpu_neon.$(EXT): SRC += psx_gpu_if.c -gpu_neon.$(EXT): CFLAGS += -fno-strict-aliasing +gpu_neon.$(EXT): SRC += psx_gpu_if.c psx_gpu/psx_gpu_arm_neon.S +gpu_neon.$(EXT): CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP gpu_peops.$(EXT): SRC += peops_if.c gpu_peops.$(EXT): CFLAGS += -fno-strict-aliasing gpu_unai.$(EXT): SRC += unai_if.cpp ../gpu_unai/gpu_arm.s diff --git a/plugins/gpu_neon/Makefile.test b/plugins/gpu_neon/Makefile.test index 5ca8d18..c2bcee0 100644 --- a/plugins/gpu_neon/Makefile.test +++ b/plugins/gpu_neon/Makefile.test @@ -3,9 +3,12 @@ CXX = $(CROSS_COMPILE)g++ CC_ = $(CROSS_COMPILE)gcc ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') +HAVE_NEON = $(shell $(CC_) -E -dD $(CFLAGS) gpu.h | grep -q '__ARM_NEON__ 1' && echo 1) CFLAGS += -ggdb -Wall -DTEST +ifndef DEBUG CFLAGS += -O2 +endif ifeq "$(ARCH)" "arm" CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp endif @@ -13,17 +16,21 @@ ifeq "$(ARCH)" "x86_64" CFLAGS += -m32 endif -# test_neon TARGETS = test_peops test_unai +ifeq "$(HAVE_NEON)" "1" +TARGETS += test_neon +endif + SRC += test.c all: $(TARGETS) -test_neon: SRC += psx_gpu_if.c -test_neon: CFLAGS += -fno-strict-aliasing +test_neon: SRC += psx_gpu_if.c psx_gpu/psx_gpu_arm_neon.S +test_neon: psx_gpu_if.c psx_gpu/*.c +test_neon: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP test_peops: SRC += peops_if.c test_peops: CFLAGS += -fno-strict-aliasing -test_unai: SRC += unai_if.cpp +test_unai: SRC += unai_if.cpp ../gpu_unai/gpu_arm.s test_unai: CC_ = $(CXX) $(TARGETS): $(SRC) diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c new file mode 100644 index 0000000..8907ac0 --- /dev/null +++ b/plugins/gpu_neon/psx_gpu_if.c @@ -0,0 +1,53 @@ +/* + * (C) GraÅžvydas "notaz" Ignotas, 2011 + * + * This work is licensed under the terms of any of these licenses + * (at your option): + * - GNU GPL, version 2 or later. + * - GNU LGPL, version 2.1 or later. + * See the COPYING file in the top-level directory. + */ + +#include + +#if 1 +#include "psx_gpu/psx_gpu.c" +#else +#define printf xprintf +#define xprintf(...) +#include "psx_gpu/psx_gpu_standard.c" +#endif +#include "psx_gpu/psx_gpu_parse.c" +#include "gpu.h" + +static psx_gpu_struct egpu __attribute__((aligned(256))); + +void do_cmd_list(uint32_t *list, int count) +{ + gpu_parse(&egpu, list, count * 4); +} + +int renderer_init(void) +{ + initialize_psx_gpu(&egpu, gpu.vram); + return 0; +} + +void renderer_sync_ecmds(uint32_t *ecmds) +{ + gpu_parse(&egpu, ecmds + 1, 6 * 4); +} + +void renderer_invalidate_caches(int x, int y, int w, int h) +{ + invalidate_texture_cache_region(&egpu, x, y, x + w - 1, y + h - 1); +} + +void renderer_flush_queues(void) +{ + flush_render_block_buffer(&egpu); +} + +void renderer_set_config(const struct rearmed_cbs *cbs) +{ +} -- cgit v1.2.3