rework gpu busy timing
[pcsx_rearmed.git] / jni / Android.mk
CommitLineData
b2058a5b
TK
1LOCAL_PATH := $(call my-dir)
2
08700dbe 3$(shell cd "$(LOCAL_PATH)" && ((git describe --always || echo) | sed -e 's/.*/#define REV "\0"/' > ../frontend/revision.h_))
77668f25
AK
4$(shell cd "$(LOCAL_PATH)" && (diff -q ../frontend/revision.h_ ../frontend/revision.h > /dev/null 2>&1 || cp ../frontend/revision.h_ ../frontend/revision.h))
5$(shell cd "$(LOCAL_PATH)" && (rm ../frontend/revision.h_))
b2058a5b 6
cadb8854 7HAVE_CHD ?= 1
226a5691 8USE_LIBRETRO_VFS ?= 0
cadb8854 9
77668f25
AK
10ROOT_DIR := $(LOCAL_PATH)/..
11CORE_DIR := $(ROOT_DIR)/libpcsxcore
12SPU_DIR := $(ROOT_DIR)/plugins/dfsound
13GPU_DIR := $(ROOT_DIR)/plugins/gpulib
14CDR_DIR := $(ROOT_DIR)/plugins/cdrcimg
77668f25
AK
15FRONTEND_DIR := $(ROOT_DIR)/frontend
16NEON_DIR := $(ROOT_DIR)/plugins/gpu_neon
17UNAI_DIR := $(ROOT_DIR)/plugins/gpu_unai
ca177c0f 18PEOPS_DIR := $(ROOT_DIR)/plugins/dfxvideo
77668f25 19DYNAREC_DIR := $(ROOT_DIR)/libpcsxcore/new_dynarec
275ed8df 20DEPS_DIR := $(ROOT_DIR)/deps
397ea1e5 21LIBRETRO_COMMON := $(DEPS_DIR)/libretro-common
87cc59de 22EXTRA_INCLUDES :=
77668f25
AK
23
24# core
25SOURCES_C := $(CORE_DIR)/cdriso.c \
26 $(CORE_DIR)/cdrom.c \
27 $(CORE_DIR)/cheat.c \
630b122b 28 $(CORE_DIR)/database.c \
77668f25 29 $(CORE_DIR)/decode_xa.c \
77668f25
AK
30 $(CORE_DIR)/mdec.c \
31 $(CORE_DIR)/misc.c \
32 $(CORE_DIR)/plugins.c \
33 $(CORE_DIR)/ppf.c \
34 $(CORE_DIR)/psxbios.c \
35 $(CORE_DIR)/psxcommon.c \
36 $(CORE_DIR)/psxcounters.c \
37 $(CORE_DIR)/psxdma.c \
c6a249e3 38 $(CORE_DIR)/psxevents.c \
77668f25
AK
39 $(CORE_DIR)/psxhw.c \
40 $(CORE_DIR)/psxinterpreter.c \
41 $(CORE_DIR)/psxmem.c \
42 $(CORE_DIR)/r3000a.c \
43 $(CORE_DIR)/sio.c \
77668f25 44 $(CORE_DIR)/spu.c \
1328fa32 45 $(CORE_DIR)/gpu.c \
77668f25
AK
46 $(CORE_DIR)/gte.c \
47 $(CORE_DIR)/gte_nf.c \
48 $(CORE_DIR)/gte_divider.c
b2058a5b 49
77668f25
AK
50# spu
51SOURCES_C += $(SPU_DIR)/dma.c \
52 $(SPU_DIR)/freeze.c \
53 $(SPU_DIR)/registers.c \
54 $(SPU_DIR)/spu.c \
55 $(SPU_DIR)/out.c \
56 $(SPU_DIR)/nullsnd.c
b2058a5b 57
77668f25
AK
58# gpu
59SOURCES_C += $(GPU_DIR)/gpu.c \
60 $(GPU_DIR)/vout_pl.c
b2058a5b 61
77668f25
AK
62# cdrcimg
63SOURCES_C += $(CDR_DIR)/cdrcimg.c
b2058a5b 64
77668f25
AK
65# frontend
66SOURCES_C += $(FRONTEND_DIR)/main.c \
67 $(FRONTEND_DIR)/plugin.c \
68 $(FRONTEND_DIR)/cspace.c \
69 $(FRONTEND_DIR)/libretro.c
b2058a5b 70
275ed8df 71# libchdr
72SOURCES_C += \
c9e72d64 73 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Alloc.c \
74 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Bra86.c \
75 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/BraIA64.c \
76 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/CpuArch.c \
77 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Delta.c \
78 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzFind.c \
79 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Lzma86Dec.c \
80 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaDec.c \
81 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaEnc.c \
82 $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Sort.c \
2ff0b512 83 $(DEPS_DIR)/libchdr/src/libchdr_bitstream.c \
84 $(DEPS_DIR)/libchdr/src/libchdr_cdrom.c \
85 $(DEPS_DIR)/libchdr/src/libchdr_chd.c \
86 $(DEPS_DIR)/libchdr/src/libchdr_flac.c \
87 $(DEPS_DIR)/libchdr/src/libchdr_huffman.c
87cc59de 88SOURCES_ASM :=
c82f907a 89
661e95f6 90COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED
94f0c7c5 91COREFLAGS += -DP_HAVE_MMAP=1 -DP_HAVE_PTHREAD=1 -DP_HAVE_POSIX_MEMALIGN=1 -DHAVE_CHD -D_7ZIP_ST
b2058a5b 92
226a5691 93ifeq ($(USE_LIBRETRO_VFS),1)
94SOURCES_C += \
95 $(LIBRETRO_COMMON)/compat/compat_posix_string.c \
96 $(LIBRETRO_COMMON)/compat/fopen_utf8.c \
97 $(LIBRETRO_COMMON)/encodings/compat_strl.c \
98 $(LIBRETRO_COMMON)/encodings/encoding_utf.c \
99 $(LIBRETRO_COMMON)/file/file_path.c \
100 $(LIBRETRO_COMMON)/streams/file_stream.c \
101 $(LIBRETRO_COMMON)/streams/file_stream_transforms.c \
102 $(LIBRETRO_COMMON)/string/stdstring.c \
103 $(LIBRETRO_COMMON)/time/rtime.c \
104 $(LIBRETRO_COMMON)/vfs/vfs_implementation.c
105COREFLAGS += -DUSE_LIBRETRO_VFS
106endif
107
87cc59de 108HAVE_ARI64=0
109HAVE_LIGHTREC=0
21597f53 110LIGHTREC_CUSTOM_MAP=0
06d32fcf 111LIGHTREC_THREADED_COMPILER=0
cef87e92 112HAVE_GPU_NEON=0
87cc59de 113ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
114 HAVE_ARI64=1
cef87e92 115 HAVE_GPU_NEON=1
87cc59de 116else ifeq ($(TARGET_ARCH_ABI),armeabi)
117 HAVE_ARI64=1
118else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
630b122b 119 HAVE_ARI64=1
cef87e92 120 HAVE_GPU_NEON=1
87cc59de 121else ifeq ($(TARGET_ARCH_ABI),x86_64)
122 HAVE_LIGHTREC=1
cef87e92 123 HAVE_GPU_NEON=1
87cc59de 124else ifeq ($(TARGET_ARCH_ABI),x86)
125 HAVE_LIGHTREC=1
cef87e92 126 HAVE_GPU_NEON=1
87cc59de 127else
128 COREFLAGS += -DDRC_DISABLE
129endif
b0ec7ab5 130 COREFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP)
06d32fcf 131 COREFLAGS += -DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER)
87cc59de 132
133ifeq ($(HAVE_ARI64),1)
77668f25 134 SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \
630b122b 135 $(DYNAREC_DIR)/pcsxmem.c
136 ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
137 SOURCES_ASM += $(DYNAREC_DIR)/linkage_arm64.S
138 else
139 SOURCES_ASM += $(CORE_DIR)/gte_arm.S \
140 $(SPU_DIR)/arm_utils.S \
141 $(DYNAREC_DIR)/linkage_arm.S
142 endif
b2058a5b 143endif
630b122b 144 SOURCES_C += $(DYNAREC_DIR)/emu_if.c
b2058a5b 145
87cc59de 146ifeq ($(HAVE_LIGHTREC),1)
b0ec7ab5 147 COREFLAGS += -DLIGHTREC -DLIGHTREC_STATIC
87cc59de 148 EXTRA_INCLUDES += $(DEPS_DIR)/lightning/include \
e168d99d 149 $(DEPS_DIR)/lightrec \
b7de84b4 150 $(DEPS_DIR)/lightrec/tlsf \
e168d99d
PC
151 $(ROOT_DIR)/include/lightning \
152 $(ROOT_DIR)/include/lightrec
87cc59de 153 SOURCES_C += $(DEPS_DIR)/lightrec/blockcache.c \
4373e29d 154 $(DEPS_DIR)/lightrec/constprop.c \
87cc59de 155 $(DEPS_DIR)/lightrec/disassembler.c \
156 $(DEPS_DIR)/lightrec/emitter.c \
157 $(DEPS_DIR)/lightrec/interpreter.c \
158 $(DEPS_DIR)/lightrec/lightrec.c \
159 $(DEPS_DIR)/lightrec/memmanager.c \
160 $(DEPS_DIR)/lightrec/optimizer.c \
161 $(DEPS_DIR)/lightrec/regcache.c \
43d9bcdc 162 $(DEPS_DIR)/lightrec/recompiler.c \
163 $(DEPS_DIR)/lightrec/reaper.c
87cc59de 164 SOURCES_C += $(DEPS_DIR)/lightning/lib/jit_disasm.c \
165 $(DEPS_DIR)/lightning/lib/jit_memory.c \
166 $(DEPS_DIR)/lightning/lib/jit_names.c \
167 $(DEPS_DIR)/lightning/lib/jit_note.c \
168 $(DEPS_DIR)/lightning/lib/jit_print.c \
169 $(DEPS_DIR)/lightning/lib/jit_size.c \
170 $(DEPS_DIR)/lightning/lib/lightning.c
b7de84b4 171 SOURCES_C += $(CORE_DIR)/lightrec/plugin.c $(DEPS_DIR)/lightrec/tlsf/tlsf.c
74c817c6 172ifeq ($(LIGHTREC_CUSTOM_MAP),1)
b0ec7ab5 173 SOURCES_C += $(CORE_DIR)/lightrec/mem.c
87cc59de 174endif
74c817c6 175endif
87cc59de 176
177
cef87e92 178ifeq ($(HAVE_GPU_NEON),1)
74ec4f3a 179 COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON
cef87e92 180 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
181 COREFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x
182 SOURCES_ASM += $(CORE_DIR)/gte_neon.S \
183 $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \
184 $(FRONTEND_DIR)/cspace_neon.S
185 else
186 COREFLAGS += -DSIMD_BUILD
187 SOURCES_C += $(NEON_DIR)/psx_gpu/psx_gpu_simd.c
188 endif
77668f25
AK
189 SOURCES_C += $(NEON_DIR)/psx_gpu_if.c
190else ifeq ($(TARGET_ARCH_ABI),armeabi)
07ade526 191 COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI
192 COREFLAGS += -DHAVE_bgr555_to_rgb565
b26afb99 193 SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \
77668f25
AK
194 $(FRONTEND_DIR)/cspace_arm.S
195 SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
196else
ca177c0f
C
197 COREFLAGS += -fno-strict-aliasing -DGPU_PEOPS
198 SOURCES_C += $(PEOPS_DIR)/gpulib_if.c
b2058a5b
TK
199endif
200
77668f25
AK
201GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
202ifneq ($(GIT_VERSION)," unknown")
203 COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
b2058a5b
TK
204endif
205
77668f25
AK
206include $(CLEAR_VARS)
207LOCAL_MODULE := retro
208LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_ASM)
209LOCAL_CFLAGS := $(COREFLAGS)
210LOCAL_C_INCLUDES := $(ROOT_DIR)/include
c9e72d64 211LOCAL_C_INCLUDES += $(DEPS_DIR)/crypto $(DEPS_DIR)/libchdr/deps/lzma-19.00/include $(DEPS_DIR)/libchdr/include $(DEPS_DIR)/libchdr/include/libchdr
07597ed3 212LOCAL_C_INCLUDES += $(LIBRETRO_COMMON)/include
87cc59de 213LOCAL_C_INCLUDES += $(EXTRA_INCLUDES)
77668f25
AK
214LOCAL_LDFLAGS := -Wl,-version-script=$(FRONTEND_DIR)/link.T
215LOCAL_LDLIBS := -lz -llog
216LOCAL_ARM_MODE := arm
217
218ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
219 LOCAL_ARM_NEON := true
220endif
b2058a5b
TK
221
222include $(BUILD_SHARED_LIBRARY)