aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2012-01-19 01:33:12 +0200
committernotaz2012-01-19 01:38:45 +0200
commit62d7fa9555924ab8e152b546711d27add640b102 (patch)
tree28c231a8f642d28d357bbdce9edb2b79e199764e
parent5d834c089ea695dba7643cba8686ce2ac06d8db4 (diff)
downloadpcsx_rearmed-62d7fa9555924ab8e152b546711d27add640b102.tar.gz
pcsx_rearmed-62d7fa9555924ab8e152b546711d27add640b102.tar.bz2
pcsx_rearmed-62d7fa9555924ab8e152b546711d27add640b102.zip
refactor gpu plugins and Makefiles
name common gpu code gpulib, reduce amount of copy-paste in plugin Makefiles
-rw-r--r--Makefile23
-rw-r--r--frontend/menu.c2
-rw-r--r--frontend/plat_pollux.c2
-rw-r--r--plugins/dfxvideo/draw_fb.c2
-rw-r--r--plugins/dfxvideo/gpulib_if.c (renamed from plugins/gpu_neon/peops_if.c)6
-rw-r--r--plugins/gpu_neon/Makefile59
-rw-r--r--plugins/gpu_neon/psx_gpu_if.c2
-rw-r--r--plugins/gpu_unai/Makefile41
-rw-r--r--plugins/gpu_unai/gpu.cpp2
-rw-r--r--plugins/gpu_unai/gpulib_if.cpp (renamed from plugins/gpu_neon/unai_if.cpp)2
-rw-r--r--plugins/gpulib/Makefile38
-rw-r--r--plugins/gpulib/Makefile.test (renamed from plugins/gpu_neon/Makefile.test)9
-rw-r--r--plugins/gpulib/cspace.c (renamed from frontend/cspace.c)0
-rw-r--r--plugins/gpulib/cspace.h (renamed from frontend/cspace.h)0
-rw-r--r--plugins/gpulib/cspace_neon.s (renamed from frontend/cspace_neon.s)0
-rw-r--r--plugins/gpulib/gpu.c (renamed from plugins/gpu_neon/gpu.c)0
-rw-r--r--plugins/gpulib/gpu.h (renamed from plugins/gpu_neon/gpu.h)0
-rw-r--r--plugins/gpulib/gpulib.mak54
-rw-r--r--plugins/gpulib/test.c (renamed from plugins/gpu_neon/test.c)0
-rw-r--r--plugins/gpulib/vout_fb.c (renamed from plugins/gpu_neon/vout_fb.c)2
-rw-r--r--plugins/gpulib/vout_sdl.c (renamed from plugins/gpu_neon/vout_sdl.c)0
21 files changed, 142 insertions, 102 deletions
diff --git a/Makefile b/Makefile
index 21f3ef6..d40985b 100644
--- a/Makefile
+++ b/Makefile
@@ -95,23 +95,25 @@ LDFLAGS += -lasound
endif
# gpu
-OBJS += plugins/gpu_neon/gpu.o
+OBJS += plugins/gpulib/gpu.o
ifeq "$(HAVE_NEON)" "1"
+OBJS += plugins/gpulib/cspace_neon.o
OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
else
+OBJS += plugins/gpulib/cspace.o
# note: code is not safe for strict-aliasing? (Castlevania problems)
-plugins/gpu_neon/peops_if.o: CFLAGS += -fno-strict-aliasing
-plugins/gpu_neon/peops_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
-OBJS += plugins/gpu_neon/peops_if.o
+plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
+plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
+OBJS += plugins/dfxvideo/gpulib_if.o
endif
ifdef X11
LDFLAGS += -lX11 `sdl-config --libs`
-OBJS += plugins/gpu_neon/vout_sdl.o
-plugins/gpu_neon/vout_sdl.o: CFLAGS += `sdl-config --cflags`
+OBJS += plugins/gpulib/vout_sdl.o
+plugins/gpulib/vout_sdl.o: CFLAGS += `sdl-config --cflags`
else
-OBJS += plugins/gpu_neon/vout_fb.o
+OBJS += plugins/gpulib/vout_fb.o
endif
# cdrcimg
@@ -147,11 +149,6 @@ endif
endif # !USE_GTK
-ifeq "$(HAVE_NEON)" "1"
-OBJS += frontend/cspace_neon.o
-else
-OBJS += frontend/cspace.o
-endif
ifdef X11
frontend/%.o: CFLAGS += -DX11
OBJS += frontend/xkb.o
@@ -183,7 +180,7 @@ $(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
PLUGINS ?= plugins/spunull/spunull.so plugins/gpu-gles/gpuGLES.so \
- plugins/gpu_neon/gpu_unai.so plugins/gpu_neon/gpu_peops.so
+ plugins/gpu_unai/gpu_unai.so plugins/dfxvideo/gpu_peops.so
$(PLUGINS):
make -C $(dir $@)
diff --git a/frontend/menu.c b/frontend/menu.c
index a8d2e48..c05d910 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -25,7 +25,6 @@
#include "omap.h"
#include "plat.h"
#include "pcnt.h"
-#include "cspace.h"
#include "common/plat.h"
#include "common/input.h"
#include "linux/in_evdev.h"
@@ -35,6 +34,7 @@
#include "../libpcsxcore/psemu_plugin_defs.h"
#include "../libpcsxcore/new_dynarec/new_dynarec.h"
#include "../plugins/dfinput/main.h"
+#include "../plugins/gpulib/cspace.h"
#include "revision.h"
#define REARMED_BIRTHDAY_TIME 1293306830 /* 25 Dec 2010 */
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index af5b81a..daf2f84 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -23,13 +23,13 @@
#include "warm/warm.h"
#include "plugin_lib.h"
#include "pl_gun_ts.h"
-#include "cspace.h"
#include "blit320.h"
#include "in_tsbutton.h"
#include "main.h"
#include "menu.h"
#include "plat.h"
#include "pcnt.h"
+#include "../plugins/gpulib/cspace.h"
int gp2x_dev_id;
diff --git a/plugins/dfxvideo/draw_fb.c b/plugins/dfxvideo/draw_fb.c
index 8814da8..22351a4 100644
--- a/plugins/dfxvideo/draw_fb.c
+++ b/plugins/dfxvideo/draw_fb.c
@@ -9,8 +9,8 @@
#include "gpu.h"
+#include "../gpulib/cspace.h"
#include "../../frontend/plugin_lib.h"
-#include "../../frontend/cspace.h"
#include "../../frontend/pcnt.h"
// misc globals
diff --git a/plugins/gpu_neon/peops_if.c b/plugins/dfxvideo/gpulib_if.c
index 191fce1..82bc38d 100644
--- a/plugins/gpu_neon/peops_if.c
+++ b/plugins/dfxvideo/gpulib_if.c
@@ -15,7 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "gpu.h"
+#include "../gpulib/gpu.h"
#define u32 uint32_t
@@ -260,8 +260,8 @@ unsigned short sSetMask = 0;
unsigned long lSetMask = 0;
long lLowerpart;
-#include "../dfxvideo/soft.c"
-#include "../dfxvideo/prim.c"
+#include "soft.c"
+#include "prim.c"
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile
index 2d942f8..93839d2 100644
--- a/plugins/gpu_neon/Makefile
+++ b/plugins/gpu_neon/Makefile
@@ -1,59 +1,28 @@
CC = $(CROSS_COMPILE)gcc
-CXX = $(CROSS_COMPILE)g++
-CC_ = $(CC)
ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
-CFLAGS += -ggdb -Wall -fPIC -O2
-CFLAGS += -fno-strict-aliasing
-ifdef MAEMO
-CFLAGS += -DMAEMO
-endif
+HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS_) ../gpulib/gpu.h | grep -q '__ARM_NEON__ 1' && echo 1)
-SRC += gpu.c
+# FIXME: rework NEON detection to get rid of this
ifeq "$(ARCH)" "arm"
-ARM_CORTEXA8 ?= 1
-ifeq "$(ARM_CORTEXA8)" "1"
-CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
-SRC += ../../frontend/cspace_neon.s
-else
-CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
-SRC += ../../frontend/cspace.c
-endif
-SRC += vout_fb.c
-EXT = so
-endif
-ifeq "$(ARCH)" "x86_64"
-CFLAGS += `sdl-config --cflags` -m32
-LDFLAGS += `sdl-config --libs`
-SRC += vout_sdl.c
-EXT = so.x86
+ ARM_CORTEXA8 ?= 1
+ ifeq "$(ARM_CORTEXA8)" "1"
+ CFLAGS_ += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
+ endif
endif
-HAVE_NEON = $(shell $(CC_) -E -dD $(CFLAGS) gpu.h | grep -q '__ARM_NEON__ 1' && echo 1)
+CFLAGS += -ggdb -Wall -fPIC -O2
-TARGETS = gpu_neon.$(EXT) gpu_peops.$(EXT) gpu_unai.$(EXT)
+SRC += psx_gpu_if.c
-gpu_neon.$(EXT): SRC += psx_gpu_if.c
-gpu_neon.$(EXT): CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
+CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
ifeq "$(HAVE_NEON)" "1"
-gpu_neon.$(EXT): SRC += psx_gpu/psx_gpu_arm_neon.S
-gpu_neon.$(EXT): CFLAGS += -DNEON_BUILD
+SRC += psx_gpu/psx_gpu_arm_neon.S
+CFLAGS += -DNEON_BUILD
else
-gpu_neon.$(EXT): CFLAGS += -fno-strict-aliasing
-endif
-gpu_peops.$(EXT): SRC += peops_if.c
-gpu_peops.$(EXT): CFLAGS += -fno-strict-aliasing
-gpu_unai.$(EXT): SRC += unai_if.cpp
-gpu_unai.$(EXT): CC_ = $(CXX)
-ifeq "$(ARCH)" "arm"
-gpu_unai.$(EXT): SRC += ../gpu_unai/gpu_arm.s
+CFLAGS += -fno-strict-aliasing
endif
-all: $(TARGETS)
-
-$(TARGETS): $(SRC)
- $(CC_) -o $@ $(SRC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@
-
-clean:
- $(RM) $(TARGETS)
+BIN_GPULIB = gpu_neon.so
+include ../gpulib/gpulib.mak
diff --git a/plugins/gpu_neon/psx_gpu_if.c b/plugins/gpu_neon/psx_gpu_if.c
index 1c462e1..3ff6e48 100644
--- a/plugins/gpu_neon/psx_gpu_if.c
+++ b/plugins/gpu_neon/psx_gpu_if.c
@@ -15,7 +15,7 @@ extern const unsigned char cmd_lengths[256];
#include "psx_gpu/psx_gpu.c"
#include "psx_gpu/psx_gpu_parse.c"
-#include "gpu.h"
+#include "../gpulib/gpu.h"
static psx_gpu_struct egpu __attribute__((aligned(256)));
diff --git a/plugins/gpu_unai/Makefile b/plugins/gpu_unai/Makefile
index e4b6e6b..dd9e4ca 100644
--- a/plugins/gpu_unai/Makefile
+++ b/plugins/gpu_unai/Makefile
@@ -1,34 +1,17 @@
-CC = $(CROSS_COMPILE)gcc
+CC = $(CROSS_COMPILE)g++
-CFLAGS += -ggdb -fPIC -Wall -DREARMED
-ifndef DEBUG
-CFLAGS += -O2 -ffast-math -fomit-frame-pointer
-endif
-ifdef MAEMO
-CFLAGS += -DMAEMO
-endif
-ARM_CORTEXA8 ?= 1
-ifeq "$(ARM_CORTEXA8)" "1"
-CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
-SRC += ../../frontend/cspace_neon.s
-else
-CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
-SRC += ../../frontend/cspace.c
-endif
-
-SRC += gpu.cpp gpu_arm.s
+ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
-TARGET = gpuPCSX4ALL.so
-LDFLAGS += -shared -Wl,-soname,$(TARGET)
+CFLAGS += -DREARMED
+CFLAGS += -ggdb -Wall -fPIC -O2 -ffast-math
--include Makefile.local
+SRC_STANDALONE += gpu.cpp
+SRC_GPULIB += gpulib_if.cpp
-all: $(TARGET)
-
-$(TARGET): $(SRC)
- $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
-
-# $(TARGET): *.h
+ifeq "$(ARCH)" "arm"
+SRC += gpu_arm.s
+endif
-clean:
- $(RM) $(TARGET) $(OBJ)
+BIN_STANDLALONE = gpuPCSX4ALL.so
+BIN_GPULIB = gpu_unai.so
+include ../gpulib/gpulib.mak
diff --git a/plugins/gpu_unai/gpu.cpp b/plugins/gpu_unai/gpu.cpp
index f0539c0..5a0ad2c 100644
--- a/plugins/gpu_unai/gpu.cpp
+++ b/plugins/gpu_unai/gpu.cpp
@@ -821,7 +821,7 @@ void GPU_updateLace(void)
#else
#include "../../frontend/plugin_lib.h"
-#include "../../frontend/cspace.h"
+#include "../gpulib/cspace.h"
extern "C" {
diff --git a/plugins/gpu_neon/unai_if.cpp b/plugins/gpu_unai/gpulib_if.cpp
index 8917f2a..22fe31e 100644
--- a/plugins/gpu_neon/unai_if.cpp
+++ b/plugins/gpu_unai/gpulib_if.cpp
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "gpu.h"
+#include "../gpulib/gpu.h"
#define u8 uint8_t
#define s8 int8_t
diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile
new file mode 100644
index 0000000..a244524
--- /dev/null
+++ b/plugins/gpulib/Makefile
@@ -0,0 +1,38 @@
+CC = $(CROSS_COMPILE)gcc
+AS = $(CROSS_COMPILE)as
+AR = $(CROSS_COMPILE)ar
+
+ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
+
+CFLAGS += -ggdb -Wall -fPIC -O2
+
+OBJS += gpu.o
+
+ifeq "$(ARCH)" "arm"
+ARM_CORTEXA8 ?= 1
+ifeq "$(ARM_CORTEXA8)" "1"
+CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
+ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
+OBJS += cspace_neon.o
+else
+CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
+ASFLAGS += -mcpu=arm926ej-s -mfloat-abi=softfp
+OBJS += cspace.o
+endif
+OBJS += vout_fb.o
+EXT = a
+else
+CFLAGS += `sdl-config --cflags` -m32
+OBJS += vout_sdl.o
+EXT = x86.a
+endif
+
+TARGET = gpulib.$(EXT)
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(AR) crs $@ $^
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
diff --git a/plugins/gpu_neon/Makefile.test b/plugins/gpulib/Makefile.test
index 114f86e..196b1f9 100644
--- a/plugins/gpu_neon/Makefile.test
+++ b/plugins/gpulib/Makefile.test
@@ -22,18 +22,17 @@ SRC += test.c
all: $(TARGETS)
-test_neon: SRC += psx_gpu_if.c
-test_neon: psx_gpu_if.c psx_gpu/*.c
+test_neon: SRC += ../gpu_neon/psx_gpu_if.c
test_neon: CFLAGS += -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
ifeq "$(HAVE_NEON)" "1"
-test_neon: SRC += psx_gpu/psx_gpu_arm_neon.S
+test_neon: SRC += ../gpu_neon/psx_gpu/psx_gpu_arm_neon.S
test_neon: CFLAGS += -DNEON_BUILD
else
test_neon: CFLAGS += -fno-strict-aliasing
endif
-test_peops: SRC += peops_if.c
+test_peops: SRC += ../dfxvideo/gpulib_if.c
test_peops: CFLAGS += -fno-strict-aliasing
-test_unai: SRC += unai_if.cpp
+test_unai: SRC += ../gpu_unai/gpulib_if.cpp
test_unai: CC_ = $(CXX)
ifeq "$(ARCH)" "arm"
test_unai: SRC += ../gpu_unai/gpu_arm.s
diff --git a/frontend/cspace.c b/plugins/gpulib/cspace.c
index eee56ce..eee56ce 100644
--- a/frontend/cspace.c
+++ b/plugins/gpulib/cspace.c
diff --git a/frontend/cspace.h b/plugins/gpulib/cspace.h
index 644143b..644143b 100644
--- a/frontend/cspace.h
+++ b/plugins/gpulib/cspace.h
diff --git a/frontend/cspace_neon.s b/plugins/gpulib/cspace_neon.s
index abc0381..abc0381 100644
--- a/frontend/cspace_neon.s
+++ b/plugins/gpulib/cspace_neon.s
diff --git a/plugins/gpu_neon/gpu.c b/plugins/gpulib/gpu.c
index 5b16cd4..5b16cd4 100644
--- a/plugins/gpu_neon/gpu.c
+++ b/plugins/gpulib/gpu.c
diff --git a/plugins/gpu_neon/gpu.h b/plugins/gpulib/gpu.h
index d9ad416..d9ad416 100644
--- a/plugins/gpu_neon/gpu.h
+++ b/plugins/gpulib/gpu.h
diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak
new file mode 100644
index 0000000..cec6f5a
--- /dev/null
+++ b/plugins/gpulib/gpulib.mak
@@ -0,0 +1,54 @@
+# depends on ARCH definition
+# always adding gpulib to LDLIBS in case cspace is needed
+
+LDFLAGS += -shared
+ifeq "$(ARCH)" "arm"
+ ARM_CORTEXA8 ?= 1
+ ifeq "$(ARM_CORTEXA8)" "1"
+ CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
+ ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
+ else
+ CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
+ ASFLAGS += -mcpu=arm926ej-s -mfloat-abi=softfp
+ endif
+ EXT =
+else
+ CFLAGS += -m32
+ LDFLAGS += -m32
+ LDLIBS_GPULIB += `sdl-config --libs`
+ EXT = .x86
+endif
+ifdef MAEMO
+ CFLAGS += -DMAEMO
+endif
+ifdef DEBUG
+ CFLAGS += -O0
+endif
+
+GPULIB_A = ../gpulib/gpulib$(EXT).a
+LDLIBS += $(GPULIB_A)
+
+ifdef BIN_STANDLALONE
+TARGETS += $(BIN_STANDLALONE)$(EXT)
+endif
+ifdef BIN_GPULIB
+TARGETS += $(BIN_GPULIB)$(EXT)
+endif
+
+all: $(GPULIB_A) $(TARGETS)
+
+ifdef BIN_STANDLALONE
+$(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE)
+ $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(LDLIBS_STANDALONE)
+endif
+
+ifdef BIN_GPULIB
+$(BIN_GPULIB)$(EXT): $(SRC) $(SRC_GPULIB)
+ $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(LDLIBS_GPULIB)
+endif
+
+$(GPULIB_A):
+ make -C ../gpulib/ all
+
+clean:
+ $(RM) $(TARGETS)
diff --git a/plugins/gpu_neon/test.c b/plugins/gpulib/test.c
index e523e20..e523e20 100644
--- a/plugins/gpu_neon/test.c
+++ b/plugins/gpulib/test.c
diff --git a/plugins/gpu_neon/vout_fb.c b/plugins/gpulib/vout_fb.c
index 20c8ff3..021efa7 100644
--- a/plugins/gpu_neon/vout_fb.c
+++ b/plugins/gpulib/vout_fb.c
@@ -9,8 +9,8 @@
*/
#include "gpu.h"
+#include "cspace.h"
#include "../../frontend/plugin_lib.h"
-#include "../../frontend/cspace.h"
static const struct rearmed_cbs *cbs;
static void *screen_buf;
diff --git a/plugins/gpu_neon/vout_sdl.c b/plugins/gpulib/vout_sdl.c
index db1ae96..db1ae96 100644
--- a/plugins/gpu_neon/vout_sdl.c
+++ b/plugins/gpulib/vout_sdl.c