From 729bf464c538c1ae7413e922c759c41a5271f9a9 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 26 Dec 2012 01:40:09 +0200 Subject: [PATCH 1/5] (Android) Enable logger and overlay for phoenix. Doesn't build otherwise for me. --- android/phoenix/jni/Android.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/phoenix/jni/Android.mk b/android/phoenix/jni/Android.mk index d09d7dadca..3eabbc2505 100644 --- a/android/phoenix/jni/Android.mk +++ b/android/phoenix/jni/Android.mk @@ -4,6 +4,7 @@ PERF_TEST := 1 HAVE_OPENSL := 1 HAVE_NEON := 1 HAVE_SINC := 1 +HAVE_LOGGER := 1 include $(CLEAR_VARS) @@ -44,12 +45,16 @@ RARCH_PATH := ../../.. LIBXML_PATH := ../../../deps/libxml2 LOCAL_SRC_FILES += $(RARCH_PATH)/console/griffin/griffin.c +ifeq ($(HAVE_LOGGER), 1) +LOCAL_CFLAGS += -DHAVE_LOGGER +LOGGER_LDLIBS := -llog +endif ifeq ($(PERF_TEST), 1) LOCAL_CFLAGS += -DPERF_TEST endif -LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 +LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DHAVE_OVERLAY -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 -llog -ldl LOCAL_C_INCLUDES += $(LIBXML_PATH) From bbc898400d59aa455d035cf150e7c123d60bb8c3 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 26 Dec 2012 01:48:28 +0200 Subject: [PATCH 2/5] (Android) Remove unneeded include. Also fixes build on older NDK (r6b). --- gfx/context/androidegl_ctx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 04baa40cac..fcbdb2929f 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -19,7 +19,6 @@ #include "../gl_common.h" #include /* Requires NDK r5 or newer */ -#include #include "../../android/native/jni/android_general.h" #include "../image.h" From df2466c5ed70010cfd4e17026da7b26e82d275f6 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 26 Dec 2012 01:57:06 +0200 Subject: [PATCH 3/5] (Android) Fix crash on orientation update. --- gfx/context/androidegl_ctx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index fcbdb2929f..1c5d27808e 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -84,9 +84,11 @@ static void gfx_ctx_get_video_size(unsigned *width, unsigned *height) } } -static bool gfx_ctx_orientation_update(void) +static void gfx_ctx_orientation_update(void) { gl_t *gl = (gl_t*)driver.video_data; + if (!gl) + return; // Get real known video size, which might have been altered by context. gfx_ctx_get_video_size(&gl->win_width, &gl->win_height); From fff846d57988b296bbc931701561f3dea9fed50b Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 26 Dec 2012 02:29:38 +0200 Subject: [PATCH 4/5] (Android) Remove unused variables. width/height is read by gfx_ctx_get_video_size() later. --- gfx/context/androidegl_ctx.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 1c5d27808e..4759de4396 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -124,8 +124,6 @@ static bool gfx_ctx_init(void) EGLint num_config; EGLint egl_version_major, egl_version_minor; EGLint format; - EGLint width; - EGLint height; GLfloat ratio; EGLint context_attributes[] = { @@ -183,13 +181,6 @@ static bool gfx_ctx_init(void) goto error; } - if (!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &width) || - !eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height)) - { - RARCH_ERR("eglQuerySurface failed.\n"); - goto error; - } - if (g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT)) { RARCH_LOG("[ANDROID/EGL]: Setting up reentrant state.\n"); From b1e8c84f554b983ee54c5c9e66c606c31841acce Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 26 Dec 2012 03:01:02 +0200 Subject: [PATCH 5/5] (Android) Enable and fix warnings. --- android/native/jni/Android.mk | 2 +- android/native/jni/cpufeatures.c | 5 +---- android/native/jni/input_android.c | 1 - android/phoenix/jni/Android.mk | 2 +- gfx/context/androidegl_ctx.c | 3 +-- gfx/gl.c | 3 --- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/android/native/jni/Android.mk b/android/native/jni/Android.mk index 03c119c1aa..75e419d21d 100644 --- a/android/native/jni/Android.mk +++ b/android/native/jni/Android.mk @@ -58,7 +58,7 @@ ifeq ($(DEBUG_INPUT), 1) LOCAL_CFLAGS += -DRARCH_INPUT_DEBUG endif -LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 +LOCAL_CFLAGS += -Wall -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 $(LOGGER_LDLIBS) -ldl #LOCAL_C_INCLUDES += $(LIBXML_PATH) diff --git a/android/native/jni/cpufeatures.c b/android/native/jni/cpufeatures.c index b8fccdc6b6..7af2dc6410 100644 --- a/android/native/jni/cpufeatures.c +++ b/android/native/jni/cpufeatures.c @@ -129,7 +129,7 @@ extract_cpuinfo_field(char* buffer, int buflen, const char* field) int fieldlen = strlen(field); char* bufend = buffer + buflen; char* result = NULL; - int len, ignore; + int len; const char *p, *q; /* Look for first field occurence, and ensures it starts the line. @@ -400,9 +400,6 @@ android_cpuInit(void) #ifdef __ARM_ARCH__ { - char* features = NULL; - char* architecture = NULL; - /* Extract architecture from the "CPU Architecture" field. * The list is well-known, unlike the the output of * the 'Processor' field which can vary greatly. diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index c142009dcc..3cba28b656 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -338,7 +338,6 @@ static void android_input_poll(void *data) if(type_event == AINPUT_EVENT_TYPE_MOTION) { action = AMotionEvent_getAction(event); - int8_t motion_action = action & AMOTION_EVENT_ACTION_MASK; size_t motion_pointer = action >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; float x = AMotionEvent_getX(event, motion_pointer); diff --git a/android/phoenix/jni/Android.mk b/android/phoenix/jni/Android.mk index 3eabbc2505..405753bef9 100644 --- a/android/phoenix/jni/Android.mk +++ b/android/phoenix/jni/Android.mk @@ -54,7 +54,7 @@ ifeq ($(PERF_TEST), 1) LOCAL_CFLAGS += -DPERF_TEST endif -LOCAL_CFLAGS += -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DHAVE_OVERLAY -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 +LOCAL_CFLAGS += -Wall -Wno-unused-function -O3 -fno-stack-protector -funroll-loops -DNDEBUG -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_VID_CONTEXT -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_GLSL -DHAVE_ZLIB -DWANT_RZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREAD -D__LIBRETRO__ -DRARCH_PERFORMANCE_MODE -DRARCH_GPU_PERFORMANCE_MODE -DHAVE_OVERLAY -DPACKAGE_VERSION=\"$(RARCH_VERSION)\" -std=gnu99 LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -landroid -lEGL -lGLESv2 -llog -ldl LOCAL_C_INCLUDES += $(LIBXML_PATH) diff --git a/gfx/context/androidegl_ctx.c b/gfx/context/androidegl_ctx.c index 4759de4396..d860110f06 100644 --- a/gfx/context/androidegl_ctx.c +++ b/gfx/context/androidegl_ctx.c @@ -124,7 +124,6 @@ static bool gfx_ctx_init(void) EGLint num_config; EGLint egl_version_major, egl_version_minor; EGLint format; - GLfloat ratio; EGLint context_attributes[] = { EGL_CONTEXT_CLIENT_VERSION, 2, @@ -321,9 +320,9 @@ static void gfx_ctx_set_filtering(unsigned index, bool set_smooth) static void gfx_ctx_set_fbo(unsigned mode) { +#ifdef HAVE_FBO gl_t *gl = driver.video_data; -#ifdef HAVE_FBO switch(mode) { case FBO_DEINIT: diff --git a/gfx/gl.c b/gfx/gl.c index 49b05d5d6c..c78d6280a7 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1279,8 +1279,6 @@ static void gl_free(void *data) static void gl_set_nonblock_state(void *data, bool state) { - gl_t *gl = (gl_t*)data; - RARCH_LOG("GL VSync => %s\n", state ? "off" : "on"); context_swap_interval_func(state ? 0 : 1); } @@ -1598,7 +1596,6 @@ static bool gl_alive(void *data) static bool gl_focus(void *data) { - gl_t *gl = (gl_t*)data; return context_has_focus_func(); }