Merge git://github.com/notaz/pcsx_rearmed
authortwinaphex <autechre1024@hotmail.com>
Sat, 9 Feb 2013 09:05:21 +0000 (10:05 +0100)
committertwinaphex <autechre1024@hotmail.com>
Sat, 9 Feb 2013 09:05:21 +0000 (10:05 +0100)
31 files changed:
Makefile
configure
frontend/cspace.c [moved from plugins/gpulib/cspace.c with 99% similarity]
frontend/cspace.h [moved from plugins/gpulib/cspace.h with 100% similarity]
frontend/cspace_arm.S [new file with mode: 0644]
frontend/cspace_neon.s [moved from plugins/gpulib/cspace_neon.s with 100% similarity]
frontend/libpicofe
frontend/libretro.c
frontend/main.c
frontend/main.h
frontend/menu.c
frontend/plat_pollux.c
frontend/plat_sdl.c
frontend/plugin_lib.c
frontend/plugin_lib.h
jni/Android.mk
plugins/dfxvideo/Makefile
plugins/dfxvideo/draw_pl.c
plugins/gpu-gles/Makefile
plugins/gpu-gles/gpuDraw.c
plugins/gpu-gles/gpuDraw.h
plugins/gpu-gles/gpuExternals.h
plugins/gpu-gles/gpuPlugin.c
plugins/gpu-gles/gpuPrim.c
plugins/gpu-gles/gpuStdafx.h
plugins/gpu-gles/gpulib_if.c
plugins/gpu_unai/Makefile
plugins/gpu_unai/gpu.cpp
plugins/gpulib/Makefile
plugins/gpulib/gpulib.mak
plugins/gpulib/vout_pl.c

index 0d72dea..9f8b777 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
index 4d3bb5f..8b5cbda 100755 (executable)
--- a/configure
+++ b/configure
@@ -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
similarity index 99%
rename from plugins/gpulib/cspace.c
rename to frontend/cspace.c
index f0c4912..33a981d 100644 (file)
@@ -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_;
similarity index 100%
rename from plugins/gpulib/cspace.h
rename to frontend/cspace.h
diff --git a/frontend/cspace_arm.S b/frontend/cspace_arm.S
new file mode 100644 (file)
index 0000000..e9d15a5
--- /dev/null
@@ -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}
index 215e7ed..cceadf4 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 215e7ed2510e191664b611a578ffb987cf4fdab3
+Subproject commit cceadf4cd4f1fa7e7f12b3765bba31bfcef6b1e0
index 4f6879e..c6d113f 100644 (file)
@@ -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"
index 0f0e641..df2af8f 100644 (file)
@@ -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) \
index d971890..7ce9e5d 100644 (file)
@@ -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__ */
index 8119505..46e4298 100644 (file)
@@ -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))
index c932261..252feba 100644 (file)
@@ -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;
index 5b85375..dacf584 100644 (file)
@@ -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)
index dfff868..a3dcbab 100644 (file)
 #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++;
index a83d954..4a11002 100644 (file)
@@ -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
index 06b4379..81962e0 100644 (file)
@@ -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
index ee7c4dc..fb879f4 100644 (file)
@@ -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
index 61fb94c..37dbfff 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "gpu.h"
 
-#include "../gpulib/cspace.h"
 #include "../../frontend/plugin_lib.h"
 #include "pcnt.h"
 
index 769a68b..e914764 100644 (file)
@@ -16,6 +16,6 @@ CFLAGS += $(CFLAGS_GLES)
 LDLIBS += $(LDLIBS_GLES)\r
 endif\r
 \r
-BIN_STANDLALONE = gpuGLES.so\r
+#BIN_STANDALONE = gpuGLES.so\r
 BIN_GPULIB = gpu_gles.so\r
 include ../gpulib/gpulib.mak\r
index b619104..34d1c3b 100644 (file)
@@ -248,9 +248,9 @@ void CreateScanLines(void)
 int use_fsaa = 0;\r
 \r
 EGLDisplay display;\r
-EGLConfig  config;\r
-EGLContext context;\r
 EGLSurface surface;\r
+static EGLConfig  config;\r
+static EGLContext context;\r
 \r
 #if defined(USE_X11)\r
 #include "X11/Xlib.h"\r
@@ -435,10 +435,19 @@ static int initEGL(void)
        return 0;\r
 }\r
 \r
-int GLinitialize() \r
+static int created_gles_context;\r
+\r
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface)\r
 {\r
- if(initEGL()!=0)\r
-  return -1;\r
+ if(ext_gles_display != NULL && ext_gles_surface != NULL) { \r
+  display = (EGLDisplay)ext_gles_display;\r
+  surface = (EGLSurface)ext_gles_surface;\r
+ }\r
+ else {\r
+  if(initEGL()!=0)\r
+   return -1;\r
+  created_gles_context=1;\r
+ }\r
 \r
  //----------------------------------------------------// \r
 \r
@@ -448,7 +457,7 @@ int GLinitialize()
             iResY-(rRatioRect.top+rRatioRect.bottom),\r
             rRatioRect.right, \r
             rRatioRect.bottom); glError();\r
-                                                      \r
+\r
  glScissor(0, 0, iResX, iResY); glError();             // init clipping (fullscreen)\r
  glEnable(GL_SCISSOR_TEST); glError();\r
 \r
@@ -532,16 +541,19 @@ void GLcleanup()
 {                                                     \r
  CleanupTextureStore();                                // bye textures\r
 \r
-       eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );\r
-       eglDestroySurface( display, surface );\r
-       eglDestroyContext( display, context );\r
-       eglTerminate( display );\r
+ if(created_gles_context) {\r
+  eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );\r
+  eglDestroySurface( display, surface );\r
+  eglDestroyContext( display, context );\r
+  eglTerminate( display );\r
 \r
 #if defined(USE_X11)\r
                if (x11Window) XDestroyWindow(x11Display, x11Window);\r
                if (x11Colormap) XFreeColormap( x11Display, x11Colormap );\r
                if (x11Display) XCloseDisplay(x11Display);\r
 #endif\r
+  created_gles_context=0;\r
+ }\r
 }\r
 \r
 ////////////////////////////////////////////////////////////////////////\r
index c59927d..a45bf46 100644 (file)
@@ -49,7 +49,7 @@ extern "C" {
 BOOL bSetupPixelFormat(HDC hDC);\r
 #endif\r
 \r
-int  GLinitialize();\r
+int  GLinitialize(void *ext_gles_display, void *ext_gles_surface);\r
 void GLcleanup();\r
 #ifdef _WINDOWS\r
 BOOL offset2(void);\r
index 897b446..1260167 100644 (file)
@@ -41,6 +41,10 @@ extern "C" {
 #include <GLES/glext.h>\r
 #endif\r
 \r
+#ifndef GL_BGRA_EXT\r
+#define GL_BGRA_EXT GL_RGBA // ??\r
+#endif\r
+\r
 #ifdef __NANOGL__\r
 #define glTexParameteri(x,y,z) glTexParameterf(x,y,z) \r
 #define glAlphaFuncx(x,y) glAlphaFunc(x,y) \r
index 9d749a5..60570ac 100644 (file)
@@ -511,7 +511,7 @@ long CALLBACK GPUopen(int hwndGPU)
 // lGPUstatusRet = 0x74000000;\r
 \r
 // with some emus, we could do the OGL init right here... oh my\r
- if(bIsFirstFrame) GLinitialize();\r
+ if(bIsFirstFrame) GLinitialize(NULL, NULL);\r
 \r
  return 0;\r
 }\r
@@ -1170,7 +1170,7 @@ void CALLBACK GPUwriteStatus(unsigned long gdata)
 {\r
 unsigned long lCommand=(gdata>>24)&0xff;\r
 \r
-if(bIsFirstFrame) GLinitialize();                     // real ogl startup (needed by some emus)\r
+if(bIsFirstFrame) GLinitialize(NULL, NULL);           // real ogl startup (needed by some emus)\r
 \r
 ulStatusControl[lCommand]=gdata;\r
 \r
@@ -2183,7 +2183,7 @@ unsigned long dmaMem;
 unsigned char * baseAddrB;\r
 short count;unsigned int DMACommandCounter = 0;\r
 \r
-if(bIsFirstFrame) GLinitialize();\r
+if(bIsFirstFrame) GLinitialize(NULL, NULL);\r
 \r
 GPUIsBusy;\r
 \r
index 2f200eb..218ff66 100644 (file)
@@ -44,9 +44,6 @@
 // globals\r
 ////////////////////////////////////////////////////////////////////////\r
 \r
-EGLSurface surface;\r
-EGLDisplay display;\r
-\r
 \r
 BOOL           bDrawTextured;                          // current active drawing states\r
 BOOL           bDrawSmoothShaded;\r
index 69050b3..41051dc 100644 (file)
@@ -82,12 +82,6 @@ extern "C" {
 #define SHADETEXBIT(x) ((x>>24) & 0x1)\r
 #define SEMITRANSBIT(x) ((x>>25) & 0x1)\r
 \r
-#ifndef _WINDOWS\r
-#ifndef GL_BGRA_EXT\r
-#define GL_BGRA_EXT GL_RGBA\r
-#endif\r
-#endif\r
-\r
 #if 0\r
 #define glError() { \\r
        GLenum err = glGetError(); \\r
index 2090553..1f4a23d 100644 (file)
@@ -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);
 }
 
index 994997f..1075ee5 100644 (file)
@@ -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
index df5e0cf..d509617 100644 (file)
@@ -819,7 +819,6 @@ void  GPU_updateLace(void)
 #else
 
 #include "../../frontend/plugin_lib.h"
-#include "../gpulib/cspace.h"
 
 extern "C" {
 
index 4a45aa2..cff6141 100644 (file)
@@ -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
index ad6a8ad..6377274 100644 (file)
@@ -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
index 5af0762..541b5e0 100644 (file)
@@ -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);
   }
 }