diff options
31 files changed, 234 insertions, 92 deletions
@@ -99,10 +99,6 @@ endif # builtin gpu OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o -OBJS += plugins/gpulib/cspace.o -ifeq "$(HAVE_NEON)" "1" -OBJS += plugins/gpulib/cspace_neon.o -endif ifeq "$(BUILTIN_GPU)" "neon" 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 @@ -115,7 +111,6 @@ plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c OBJS += plugins/dfxvideo/gpulib_if.o endif ifeq "$(BUILTIN_GPU)" "unai" -OBJS += plugins/gpulib/cspace.o OBJS += plugins/gpu_unai/gpulib_if.o ifeq "$(ARCH)" "arm" OBJS += plugins/gpu_unai/gpu_arm.o @@ -131,6 +126,15 @@ OBJS += plugins/cdrcimg/cdrcimg.o OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o # frontend/gui +OBJS += frontend/cspace.o +ifeq "$(HAVE_NEON)" "1" +OBJS += frontend/cspace_neon.o +else +ifeq "$(ARCH)" "arm" +OBJS += frontend/cspace_arm.o +endif +endif + ifeq "$(PLATFORM)" "generic" OBJS += frontend/libpicofe/in_sdl.o OBJS += frontend/libpicofe/plat_sdl.o @@ -49,6 +49,7 @@ have_tslib="" have_gles="" enable_dynarec="yes" need_sdl="no" +need_xlib="no" need_libpicofe="yes" need_warm="no" CFLAGS_GLES="" @@ -84,6 +85,7 @@ set_platform() drc_cache_base="yes" optimize_cortexa8="yes" have_arm_neon="yes" + need_xlib="yes" ;; maemo) ram_fixed="yes" @@ -360,6 +362,15 @@ EOF compile_binary "$@" } +check_xlib_headers() +{ + cat > $TMPC <<EOF + #include <X11/Xlib.h> + void *f() { return XOpenDisplay(0); } +EOF + compile_object "$@" +} + MAIN_LDLIBS="$MAIN_LDLIBS -lz" check_zlib || fail "please install zlib (libz-dev)" @@ -420,6 +431,7 @@ fi if [ -d /opt/vc/include -a -d /opt/vc/lib ]; then CFLAGS_GLES="$CFLAGS_GLES -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads" LDLIBS_GLES="$LDLIBS_GLES -L/opt/vc/lib" + need_xlib="yes" fi # check for GLES headers @@ -445,6 +457,11 @@ if [ "$have_arm_neon" = "yes" -a "$builtin_gpu" != "neon" ]; then plugins="$plugins plugins/gpu_neon/gpu_neon.so" fi +# check for xlib (only headers needed) +if [ "x$need_xlib" = "xyes" ]; then + check_xlib_headers || fail "please install libx11-dev" +fi + cat > $TMPC <<EOF void test(void *f, void *d) { fread(d, 1, 1, f); } EOF diff --git a/plugins/gpulib/cspace.c b/frontend/cspace.c index f0c4912..33a981d 100644 --- a/plugins/gpulib/cspace.c +++ b/frontend/cspace.c @@ -15,7 +15,7 @@ * in favor of NEON version or platform-specific conversion */ -#ifndef __ARM_NEON__ +#ifndef __arm__ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes) { @@ -32,6 +32,10 @@ void bgr555_to_rgb565(void *dst_, const void *src_, int bytes) } } +#endif + +#ifndef __ARM_NEON__ + void bgr888_to_rgb565(void *dst_, const void *src_, int bytes) { const unsigned char *src = src_; diff --git a/plugins/gpulib/cspace.h b/frontend/cspace.h index 1a9e339..1a9e339 100644 --- a/plugins/gpulib/cspace.h +++ b/frontend/cspace.h diff --git a/frontend/cspace_arm.S b/frontend/cspace_arm.S new file mode 100644 index 0000000..e9d15a5 --- /dev/null +++ b/frontend/cspace_arm.S @@ -0,0 +1,65 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2013 + * + * This work is licensed under the terms of GNU GPL version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "arm_features.h" + +.text +.align 2 + +@ lr=0x001f001f +@ trashes r11, r12 +.macro bgr555_to_rgb565_one rn + and r11, lr, \rn + and r12, lr, \rn, lsr #5 + and \rn, lr, \rn, lsr #10 + orr r12, r11, lsl #5 + orr \rn, r12, lsl #6 +.endm + +.macro pld_ reg offs=#0 +#ifdef HAVE_ARMV6 + pld [\reg, \offs] +#endif +.endm + +.global bgr555_to_rgb565 @ void *dst, const void *src, int bytes +bgr555_to_rgb565: + pld_ r1 + push {r4-r11,lr} + mov lr, #0x001f + subs r2, #4*8 + orr lr, lr, lsl #16 + blt 1f + +0: + ldmia r1!, {r3-r10} + subs r2, #4*8 + bgr555_to_rgb565_one r3 + + pld_ r1, #32*2 + bgr555_to_rgb565_one r4 + bgr555_to_rgb565_one r5 + bgr555_to_rgb565_one r6 + bgr555_to_rgb565_one r7 + bgr555_to_rgb565_one r8 + bgr555_to_rgb565_one r9 + bgr555_to_rgb565_one r10 + stmia r0!, {r3-r10} + bge 0b + +1: + adds r2, #4*8 + popeq {r4-r11,pc} + +2: + ldr r3, [r1], #4 + subs r2, #4 + bgr555_to_rgb565_one r3 + str r3, [r0], #4 + bgt 2b + + pop {r4-r11,pc} diff --git a/plugins/gpulib/cspace_neon.s b/frontend/cspace_neon.s index b458f06..b458f06 100644 --- a/plugins/gpulib/cspace_neon.s +++ b/frontend/cspace_neon.s diff --git a/frontend/libpicofe b/frontend/libpicofe -Subproject 215e7ed2510e191664b611a578ffb987cf4fdab +Subproject cceadf4cd4f1fa7e7f12b3765bba31bfcef6b1e diff --git a/frontend/libretro.c b/frontend/libretro.c index 4f6879e..c6d113f 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -15,7 +15,7 @@ #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../libpcsxcore/cheat.h" #include "../plugins/dfsound/out.h" -#include "../plugins/gpulib/cspace.h" +#include "cspace.h" #include "main.h" #include "plugin.h" #include "plugin_lib.h" diff --git a/frontend/main.c b/frontend/main.c index 0f0e641..df2af8f 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -50,7 +50,7 @@ extern int iUseInterpolation; extern int iXAPitch; extern int iVolume; -int ready_to_go, g_resetting; +int ready_to_go, g_emu_want_quit, g_emu_resetting; unsigned long gpuDisp; char cfgfile_basename[MAXPATHLEN]; int state_slot; @@ -437,6 +437,12 @@ int emu_core_init(void) return 0; } +void emu_core_ask_exit(void) +{ + stop = 1; + g_emu_want_quit = 1; +} + #ifndef NO_FRONTEND static void create_profile_dir(const char *directory) { char path[MAXPATHLEN]; @@ -622,7 +628,7 @@ int main(int argc, char *argv[]) pl_start_watchdog(); - while (1) + while (!g_emu_want_quit) { stop = 0; emu_action = SACTION_NONE; @@ -632,6 +638,12 @@ int main(int argc, char *argv[]) do_emu_action(); } + printf("Exit..\n"); + ClosePlugins(); + SysClose(); + menu_finish(); + plat_finish(); + return 0; } @@ -684,7 +696,7 @@ void SysReset() { // so we need to prevent updateLace() call.. void *real_lace = GPU_updateLace; GPU_updateLace = dummy_lace; - g_resetting = 1; + g_emu_resetting = 1; // reset can run code, timing must be set pl_timing_prepare(Config.PsxType); @@ -695,7 +707,7 @@ void SysReset() { CDR_stop(); GPU_updateLace = real_lace; - g_resetting = 0; + g_emu_resetting = 0; } void SysClose() { @@ -704,22 +716,15 @@ void SysClose() { StopDebugger(); - if (emuLog != NULL) fclose(emuLog); + if (emuLog != NULL && emuLog != stdout && emuLog != stderr) { + fclose(emuLog); + emuLog = NULL; + } } void SysUpdate() { } -void OnFile_Exit() { - printf("OnFile_Exit\n"); - SysClose(); -#ifndef NO_FRONTEND - menu_finish(); - plat_finish(); - exit(0); -#endif -} - int get_state_filename(char *buf, int size, int i) { return get_gameid_filename(buf, size, "." STATES_DIR "%.32s-%.9s.%3.3d", i); @@ -809,8 +814,7 @@ void SysMessage(const char *fmt, ...) { } static void SignalExit(int sig) { - ClosePlugins(); - OnFile_Exit(); + emu_core_ask_exit(); } #define PARSEPATH(dst, src) \ diff --git a/frontend/main.h b/frontend/main.h index d971890..7ce9e5d 100644 --- a/frontend/main.h +++ b/frontend/main.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA */ -#ifndef __LINUX_H__ -#define __LINUX_H__ +#ifndef __FRONTEND_MAIN_H__ +#define __FRONTEND_MAIN_H__ #include "config.h" @@ -41,6 +41,8 @@ extern int state_slot; int emu_core_preinit(void); int emu_core_init(void); +void emu_core_ask_exit(void); + void emu_set_default_config(void); void emu_on_new_cd(int show_hud_msg); @@ -52,7 +54,7 @@ int emu_load_state(int slot); void set_cd_image(const char *fname); extern unsigned long gpuDisp; -extern int ready_to_go, g_resetting; +extern int ready_to_go, g_emu_want_quit, g_emu_resetting; extern char hud_msg[64]; extern int hud_new_msg; @@ -68,7 +70,7 @@ enum sched_action { SACTION_SWITCH_DISPMODE, SACTION_FAST_FORWARD, SACTION_SCREENSHOT, - SACTION_VOLUME_UP, + SACTION_VOLUME_UP, // 10 SACTION_VOLUME_DOWN, SACTION_MINIMIZE, SACTION_TOGGLE_FPS, @@ -93,4 +95,4 @@ static inline void emu_set_action(enum sched_action action_) emu_action = action_; } -#endif /* __LINUX_H__ */ +#endif /* __FRONTEND_MAIN_H__ */ diff --git a/frontend/menu.c b/frontend/menu.c index 8119505..46e4298 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -26,6 +26,7 @@ #include "plugin_lib.h" #include "plat.h" #include "pcnt.h" +#include "cspace.h" #include "libpicofe/plat.h" #include "libpicofe/input.h" #include "libpicofe/linux/in_evdev.h" @@ -36,7 +37,6 @@ #include "../libpcsxcore/cheat.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../plugins/dfinput/externals.h" -#include "../plugins/gpulib/cspace.h" #include "psemu_plugin_defs.h" #include "revision.h" @@ -1832,7 +1832,6 @@ static void menu_bios_warn(void) // ------------ main menu ------------ static menu_entry e_menu_main[]; -void OnFile_Exit(); static void draw_frame_main(void) { @@ -2153,8 +2152,8 @@ static int main_menu_handler(int id, int keys) in_menu_wait(PBTN_MOK|PBTN_MBACK, NULL, 70); break; case MA_MAIN_EXIT: - OnFile_Exit(); - break; + emu_core_ask_exit(); + return 1; default: lprintf("%s: something unknown selected\n", __FUNCTION__); break; @@ -2240,7 +2239,7 @@ void menu_loop(void) do { me_loop_d(e_menu_main, &sel, NULL, draw_frame_main); - } while (!ready_to_go); + } while (!ready_to_go && !g_emu_want_quit); /* wait until menu, ok, back is released */ while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK)) diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index c932261..252feba 100644 --- a/frontend/plat_pollux.c +++ b/frontend/plat_pollux.c @@ -46,8 +46,8 @@ #include "main.h" #include "menu.h" #include "plat.h" +#include "cspace.h" #include "../libpcsxcore/psxmem_map.h" -#include "../plugins/gpulib/cspace.h" static int fbdev = -1; diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c index 5b85375..dacf584 100644 --- a/frontend/plat_sdl.c +++ b/frontend/plat_sdl.c @@ -1,5 +1,5 @@ /* - * (C) Gražvydas "notaz" Ignotas, 2011,2012 + * (C) Gražvydas "notaz" Ignotas, 2011-2013 * * This work is licensed under the terms of any of these licenses * (at your option): @@ -17,8 +17,9 @@ #include "libpicofe/fonts.h" #include "libpicofe/plat_sdl.h" #include "libpicofe/gl.h" -#include "../plugins/gpulib/cspace.h" +#include "cspace.h" #include "plugin_lib.h" +#include "plugin.h" #include "main.h" #include "plat.h" #include "revision.h" @@ -56,7 +57,7 @@ static int psx_w, psx_h; static void *shadow_fb, *menubg_img; static int in_menu; -static int change_video_mode(void) +static int change_video_mode(int force) { int w, h; @@ -69,13 +70,39 @@ static int change_video_mode(void) h = psx_h; } - return plat_sdl_change_video_mode(w, h, 0); + return plat_sdl_change_video_mode(w, h, force); +} + +static void resize_cb(int w, int h) +{ + // used by some plugins.. + pl_rearmed_cbs.screen_w = w; + pl_rearmed_cbs.screen_h = h; + pl_rearmed_cbs.gles_display = gl_es_display; + pl_rearmed_cbs.gles_surface = gl_es_surface; + plugin_call_rearmed_cbs(); +} + +static void quit_cb(void) +{ + emu_core_ask_exit(); +} + +static void get_layer_pos(int *x, int *y, int *w, int *h) +{ + // always fill entire SDL window + *x = *y = 0; + *w = pl_rearmed_cbs.screen_w; + *h = pl_rearmed_cbs.screen_h; } void plat_init(void) { int ret; + plat_sdl_quit_cb = quit_cb; + plat_sdl_resize_cb = resize_cb; + ret = plat_sdl_init(); if (ret != 0) exit(1); @@ -93,6 +120,7 @@ void plat_init(void) in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler); in_probe(); pl_rearmed_cbs.only_16bpp = 1; + pl_rearmed_cbs.pl_get_layer_pos = get_layer_pos; bgr_to_uyvy_init(); } @@ -162,7 +190,7 @@ void *plat_gvideo_set_mode(int *w, int *h, int *bpp) { psx_w = *w; psx_h = *h; - change_video_mode(); + change_video_mode(0); if (plat_sdl_overlay != NULL) { pl_plat_clear = plat_sdl_overlay_clear; pl_plat_blit = overlay_blit; @@ -204,6 +232,8 @@ void plat_gvideo_close(void) void plat_video_menu_enter(int is_rom_loaded) { + int force_mode_change = 0; + in_menu = 1; /* surface will be lost, must adjust pl_vout_buf for menu bg */ @@ -215,7 +245,11 @@ void plat_video_menu_enter(int is_rom_loaded) memcpy(menubg_img, plat_sdl_screen->pixels, psx_w * psx_h * 2); pl_vout_buf = menubg_img; - change_video_mode(); + /* gles plugin messes stuff up.. */ + if (pl_rearmed_cbs.gpu_caps & GPU_CAP_OWNS_DISPLAY) + force_mode_change = 1; + + change_video_mode(force_mode_change); } void plat_video_menu_begin(void) diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index dfff868..a3dcbab 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -28,10 +28,10 @@ #include "plat.h" #include "pcnt.h" #include "pl_gun_ts.h" +#include "cspace.h" #include "psemu_plugin_defs.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../libpcsxcore/psxmem_map.h" -#include "../plugins/gpulib/cspace.h" #include "../plugins/dfinput/externals.h" int in_type1, in_type2; @@ -240,9 +240,12 @@ static void pl_vout_set_mode(int w, int h, int raw_w, int raw_h, int bpp) psx_w = raw_w; psx_h = raw_h; + psx_bpp = bpp; vout_w = w; vout_h = h; - vout_bpp = psx_bpp = bpp; + vout_bpp = bpp; + if (pl_rearmed_cbs.only_16bpp) + vout_bpp = 16; // don't use very low heights if (vout_h < 192) { @@ -270,7 +273,7 @@ static void pl_vout_set_mode(int w, int h, int raw_w, int raw_h, int bpp) pl_vout_buf = plat_gvideo_set_mode(&vout_w, &vout_h, &vout_bpp); if (pl_vout_buf == NULL && pl_plat_blit == NULL) fprintf(stderr, "failed to set mode %dx%d@%d\n", - vout_w, vout_h, psx_bpp); + vout_w, vout_h, vout_bpp); else { pl_vout_w = vout_w; pl_vout_h = vout_h; @@ -606,7 +609,7 @@ void pl_frame_limit(void) struct timeval now; int diff, usadj; - if (g_resetting) + if (g_emu_resetting) return; vsync_cnt++; diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index a83d954..4a11002 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -51,13 +51,15 @@ struct rearmed_cbs { // some stats, for display by some plugins int flips_per_sec, cpu_usage; float vsps_cur; // currect vsync/s + // these are for gles plugin + unsigned int screen_w, screen_h; + void *gles_display, *gles_surface; // gpu options int frameskip; int fskip_advice; unsigned int *gpu_frame_count; unsigned int *gpu_hcnt; unsigned int flip_cnt; // increment manually if not using pl_vout_flip - unsigned int screen_w, screen_h; // gles plugin wants this unsigned int only_16bpp; // platform is 16bpp-only struct { int allow_interlace; // 0 off, 1 on, 2 guess diff --git a/jni/Android.mk b/jni/Android.mk index 06b4379..81962e0 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -29,14 +29,17 @@ ifeq ($(TARGET_ARCH),arm) # spu LOCAL_SRC_FILES += ../plugins/dfsound/arm_utils.S + # misc + ifeq ($(NO_NEON_BUILD),1) # gpu LOCAL_CFLAGS += -DREARMED - LOCAL_SRC_FILES += ../plugins/gpulib/cspace.c ../plugins/gpu_unai/gpulib_if.cpp ../plugins/gpu_unai/gpu_arm.s + LOCAL_SRC_FILES += ../plugins/gpu_unai/gpulib_if.cpp ../plugins/gpu_unai/gpu_arm.s + LOCAL_SRC_FILES += ../frontend/cspace_arm.S else LOCAL_ARM_NEON := true LOCAL_CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP - LOCAL_SRC_FILES += ../libpcsxcore/gte_neon.S ../plugins/gpulib/cspace_neon.s + LOCAL_SRC_FILES += ../libpcsxcore/gte_neon.S ../frontend/cspace_neon.s # gpu LOCAL_SRC_FILES += ../plugins/gpu_neon/psx_gpu_if.c ../plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S @@ -54,7 +57,7 @@ endif ifneq ($(TARGET_ARCH),arm) # gpu LOCAL_CFLAGS += -DREARMED - LOCAL_SRC_FILES += ../plugins/gpulib/cspace.c ../plugins/gpu_unai/gpulib_if.cpp + LOCAL_SRC_FILES += ../plugins/gpu_unai/gpulib_if.cpp endif $(shell cd "$(LOCAL_PATH)" && ((git describe || echo) | sed -e 's/.*/#define REV "\0"/' > ../frontend/revision.h_)) @@ -84,7 +87,7 @@ LOCAL_SRC_FILES += ../plugins/cdrcimg/cdrcimg.c LOCAL_SRC_FILES += ../plugins/dfinput/main.c ../plugins/dfinput/pad.c ../plugins/dfinput/guncon.c # misc -LOCAL_SRC_FILES += ../frontend/main.c ../frontend/plugin.c +LOCAL_SRC_FILES += ../frontend/main.c ../frontend/plugin.c ../frontend/cspace.c # libretro LOCAL_SRC_FILES += ../frontend/libretro.c diff --git a/plugins/dfxvideo/Makefile b/plugins/dfxvideo/Makefile index ee7c4dc..fb879f4 100644 --- a/plugins/dfxvideo/Makefile +++ b/plugins/dfxvideo/Makefile @@ -14,6 +14,6 @@ SRC_STANDALONE += draw_pl.c #LDLIBS_STANDALONE += -lX11 -lXv -lXext #endif -BIN_STANDLALONE = gpuPEOPS.so +#BIN_STANDALONE = gpuPEOPS.so BIN_GPULIB = gpu_peops.so include ../gpulib/gpulib.mak diff --git a/plugins/dfxvideo/draw_pl.c b/plugins/dfxvideo/draw_pl.c index 61fb94c..37dbfff 100644 --- a/plugins/dfxvideo/draw_pl.c +++ b/plugins/dfxvideo/draw_pl.c @@ -9,7 +9,6 @@ #include "gpu.h" -#include "../gpulib/cspace.h" #include "../../frontend/plugin_lib.h" #include "pcnt.h" diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile index 769a68b..e914764 100644 --- a/plugins/gpu-gles/Makefile +++ b/plugins/gpu-gles/Makefile @@ -16,6 +16,6 @@ CFLAGS += $(CFLAGS_GLES) LDLIBS += $(LDLIBS_GLES)
endif
-BIN_STANDLALONE = gpuGLES.so
+#BIN_STANDALONE = gpuGLES.so
BIN_GPULIB = gpu_gles.so
include ../gpulib/gpulib.mak
diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c index b619104..34d1c3b 100644 --- a/plugins/gpu-gles/gpuDraw.c +++ b/plugins/gpu-gles/gpuDraw.c @@ -248,9 +248,9 @@ void CreateScanLines(void) int use_fsaa = 0;
EGLDisplay display;
-EGLConfig config;
-EGLContext context;
EGLSurface surface;
+static EGLConfig config;
+static EGLContext context;
#if defined(USE_X11)
#include "X11/Xlib.h"
@@ -435,10 +435,19 @@ static int initEGL(void) return 0;
}
-int GLinitialize()
+static int created_gles_context;
+
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface)
{
- if(initEGL()!=0)
- return -1;
+ if(ext_gles_display != NULL && ext_gles_surface != NULL) {
+ display = (EGLDisplay)ext_gles_display;
+ surface = (EGLSurface)ext_gles_surface;
+ }
+ else {
+ if(initEGL()!=0)
+ return -1;
+ created_gles_context=1;
+ }
//----------------------------------------------------//
@@ -448,7 +457,7 @@ int GLinitialize() iResY-(rRatioRect.top+rRatioRect.bottom),
rRatioRect.right,
rRatioRect.bottom); glError();
-
+
glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)
glEnable(GL_SCISSOR_TEST); glError();
@@ -532,16 +541,19 @@ void GLcleanup() {
CleanupTextureStore(); // bye textures
- eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
- eglDestroySurface( display, surface );
- eglDestroyContext( display, context );
- eglTerminate( display );
+ if(created_gles_context) {
+ eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ eglDestroySurface( display, surface );
+ eglDestroyContext( display, context );
+ eglTerminate( display );
#if defined(USE_X11)
if (x11Window) XDestroyWindow(x11Display, x11Window);
if (x11Colormap) XFreeColormap( x11Display, x11Colormap );
if (x11Display) XCloseDisplay(x11Display);
#endif
+ created_gles_context=0;
+ }
}
////////////////////////////////////////////////////////////////////////
diff --git a/plugins/gpu-gles/gpuDraw.h b/plugins/gpu-gles/gpuDraw.h index c59927d..a45bf46 100644 --- a/plugins/gpu-gles/gpuDraw.h +++ b/plugins/gpu-gles/gpuDraw.h @@ -49,7 +49,7 @@ extern "C" { BOOL bSetupPixelFormat(HDC hDC);
#endif
-int GLinitialize();
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface);
void GLcleanup();
#ifdef _WINDOWS
BOOL offset2(void);
diff --git a/plugins/gpu-gles/gpuExternals.h b/plugins/gpu-gles/gpuExternals.h index 897b446..1260167 100644 --- a/plugins/gpu-gles/gpuExternals.h +++ b/plugins/gpu-gles/gpuExternals.h @@ -41,6 +41,10 @@ extern "C" { #include <GLES/glext.h>
#endif
+#ifndef GL_BGRA_EXT
+#define GL_BGRA_EXT GL_RGBA // ??
+#endif
+
#ifdef __NANOGL__
#define glTexParameteri(x,y,z) glTexParameterf(x,y,z)
#define glAlphaFuncx(x,y) glAlphaFunc(x,y)
diff --git a/plugins/gpu-gles/gpuPlugin.c b/plugins/gpu-gles/gpuPlugin.c index 9d749a5..60570ac 100644 --- a/plugins/gpu-gles/gpuPlugin.c +++ b/plugins/gpu-gles/gpuPlugin.c @@ -511,7 +511,7 @@ long CALLBACK GPUopen(int hwndGPU) // lGPUstatusRet = 0x74000000;
// with some emus, we could do the OGL init right here... oh my
- if(bIsFirstFrame) GLinitialize();
+ if(bIsFirstFrame) GLinitialize(NULL, NULL);
return 0;
}
@@ -1170,7 +1170,7 @@ void CALLBACK GPUwriteStatus(unsigned long gdata) {
unsigned long lCommand=(gdata>>24)&0xff;
-if(bIsFirstFrame) GLinitialize(); // real ogl startup (needed by some emus)
+if(bIsFirstFrame) GLinitialize(NULL, NULL); // real ogl startup (needed by some emus)
ulStatusControl[lCommand]=gdata;
@@ -2183,7 +2183,7 @@ unsigned long dmaMem; unsigned char * baseAddrB;
short count;unsigned int DMACommandCounter = 0;
-if(bIsFirstFrame) GLinitialize();
+if(bIsFirstFrame) GLinitialize(NULL, NULL);
GPUIsBusy;
diff --git a/plugins/gpu-gles/gpuPrim.c b/plugins/gpu-gles/gpuPrim.c index 2f200eb..218ff66 100644 --- a/plugins/gpu-gles/gpuPrim.c +++ b/plugins/gpu-gles/gpuPrim.c @@ -44,9 +44,6 @@ // globals
////////////////////////////////////////////////////////////////////////
-EGLSurface surface;
-EGLDisplay display;
-
BOOL bDrawTextured; // current active drawing states
BOOL bDrawSmoothShaded;
diff --git a/plugins/gpu-gles/gpuStdafx.h b/plugins/gpu-gles/gpuStdafx.h index 69050b3..41051dc 100644 --- a/plugins/gpu-gles/gpuStdafx.h +++ b/plugins/gpu-gles/gpuStdafx.h @@ -82,12 +82,6 @@ extern "C" { #define SHADETEXBIT(x) ((x>>24) & 0x1)
#define SEMITRANSBIT(x) ((x>>25) & 0x1)
-#ifndef _WINDOWS
-#ifndef GL_BGRA_EXT
-#define GL_BGRA_EXT GL_RGBA
-#endif
-#endif
-
#if 0
#define glError() { \
GLenum err = glGetError(); \
diff --git a/plugins/gpu-gles/gpulib_if.c b/plugins/gpu-gles/gpulib_if.c index 2090553..1f4a23d 100644 --- a/plugins/gpu-gles/gpulib_if.c +++ b/plugins/gpu-gles/gpulib_if.c @@ -690,7 +690,7 @@ long GPUopen(void **dpy) InitializeTextureStore(); // init texture mem - ret = GLinitialize(); + ret = GLinitialize(cbs->gles_display, cbs->gles_surface); MakeDisplayLists(); is_opened = 1; @@ -726,9 +726,16 @@ void renderer_set_config(const struct rearmed_cbs *cbs_) bUseFastMdec = cbs->gpu_peopsgl.bUseFastMdec; iTexGarbageCollection = cbs->gpu_peopsgl.iTexGarbageCollection; iVRamSize = cbs->gpu_peopsgl.iVRamSize; + if (cbs->pl_set_gpu_caps) cbs->pl_set_gpu_caps(GPU_CAP_OWNS_DISPLAY); + if (is_opened && cbs->gles_display != NULL && cbs->gles_surface != NULL) { + // HACK.. + GPUclose(); + GPUopen(NULL); + } + set_vram(gpu.vram); } diff --git a/plugins/gpu_unai/Makefile b/plugins/gpu_unai/Makefile index 994997f..1075ee5 100644 --- a/plugins/gpu_unai/Makefile +++ b/plugins/gpu_unai/Makefile @@ -11,6 +11,6 @@ ifeq "$(ARCH)" "arm" SRC += gpu_arm.s endif -BIN_STANDLALONE = gpuPCSX4ALL.so +#BIN_STANDALONE = 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 df5e0cf..d509617 100644 --- a/plugins/gpu_unai/gpu.cpp +++ b/plugins/gpu_unai/gpu.cpp @@ -819,7 +819,6 @@ void GPU_updateLace(void) #else #include "../../frontend/plugin_lib.h" -#include "../gpulib/cspace.h" extern "C" { diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile index 4a45aa2..cff6141 100644 --- a/plugins/gpulib/Makefile +++ b/plugins/gpulib/Makefile @@ -16,11 +16,6 @@ else OBJS += vout_pl.o EXT = $(ARCH).a endif -ifeq "$(HAVE_NEON)" "1" -OBJS += cspace_neon.o -else -OBJS += cspace.o -endif CFLAGS += $(PLUGIN_CFLAGS) # need to compile to another dir, same files are compiled diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak index ad6a8ad..6377274 100644 --- a/plugins/gpulib/gpulib.mak +++ b/plugins/gpulib/gpulib.mak @@ -1,5 +1,5 @@ # depends on ARCH definition -# always adding gpulib to deps in case cspace is needed +# always adding gpulib to deps (XXX might be no longer needed) # users must include ../../config.mak LDFLAGS += -shared -Wl,--no-undefined @@ -16,8 +16,8 @@ endif GPULIB_A = ../gpulib/gpulib$(EXT).a -ifdef BIN_STANDLALONE -TARGETS += $(BIN_STANDLALONE) +ifdef BIN_STANDALONE +TARGETS += $(BIN_STANDALONE) endif ifdef BIN_GPULIB TARGETS += $(BIN_GPULIB) @@ -30,11 +30,11 @@ PLUGINDIR = $(shell basename $(WD)) all: ../../config.mak $(TARGETS) -ifdef BIN_STANDLALONE +ifdef BIN_STANDALONE ifneq ($(findstring .cpp,$(SRC_STANDALONE)),) CC_STANDLALONE = $(CXX) endif -$(BIN_STANDLALONE): $(SRC) $(SRC_STANDALONE) $(GPULIB_A) +$(BIN_STANDALONE): $(SRC) $(SRC_STANDALONE) $(GPULIB_A) $(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE) ln -fs $(PLUGINDIR)/$@ ../ endif diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c index 5af0762..541b5e0 100644 --- a/plugins/gpulib/vout_pl.c +++ b/plugins/gpulib/vout_pl.c @@ -11,7 +11,6 @@ #include <string.h> #include "gpu.h" -#include "cspace.h" #include "../../frontend/plugin_lib.h" static const struct rearmed_cbs *cbs; @@ -50,8 +49,7 @@ static void check_mode_change(int force) old_status = gpu.status.reg; old_h = h; - cbs->pl_vout_set_mode(w_out, h_out, w, h, - (gpu.status.rgb24 && !cbs->only_16bpp) ? 24 : 16); + cbs->pl_vout_set_mode(w_out, h_out, w, h, gpu.status.rgb24 ? 24 : 16); } } |