aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile.android33
-rw-r--r--Makefile.target6
-rwxr-xr-xandroid-configure.sh32
-rw-r--r--android/android.h7
-rw-r--r--android/build/common.sh12
-rw-r--r--android/main-emulator.c2
-rw-r--r--android/multitouch-port.c40
-rw-r--r--android/multitouch-screen.c47
-rw-r--r--android/multitouch-screen.h8
-rw-r--r--android/opengles.c87
-rw-r--r--android/opengles.h24
-rw-r--r--android/qemu-setup.c33
-rw-r--r--distrib/jpeg-6b/jdphuff.c4
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c24
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h6
-rw-r--r--target-arm/exec.h6
-rw-r--r--target-i386/exec.h6
-rw-r--r--vl-android.c77
19 files changed, 392 insertions, 64 deletions
diff --git a/.gitignore b/.gitignore
index db1f286..6937091 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-images/android_icon.o
+images/emulator_icon.o
objs/*
*.*~
diff --git a/Makefile.android b/Makefile.android
index f5c008b..d61264b 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -209,8 +209,8 @@ endif
ifeq ($(HOST_OS),darwin)
QEMU_SYSTEM_LDLIBS += -Wl,-framework,Cocoa,-framework,QTKit,-framework,CoreVideo
- ifneq ($(filter 10.7 10.7.%,$(DARWIN_VERSION)),)
- # Lion/XCode4 needs to be explicitly told the dynamic library
+ ifneq ($(filter 10.7 10.7.% 10.8 10.8.%,$(DARWIN_VERSION)),)
+ # 10.7+ with XCode4 needs to be explicitly told the dynamic library
# lookup symbols in the precompiled libSDL are resolved at
# runtime
QEMU_SYSTEM_LDLIBS += -undefined dynamic_lookup
@@ -219,6 +219,31 @@ endif
include $(LOCAL_PATH)/Makefile.common
+ifeq ($(HOST_OS),windows)
+ # on Windows, link the icon file as well into the executable
+ # unfortunately, our build system doesn't help us much, so we need
+ # to use some weird pathnames to make this work...
+
+ # Locate windres executable
+ WINDRES := windres
+ ifneq ($(USE_MINGW),)
+ # When building the Windows emulator under Linux, use the MinGW one
+ WINDRES := i586-mingw32msvc-windres
+ endif
+
+ # Usage: $(eval $(call insert-windows-icon))
+ define insert-windows-icon
+ LOCAL_PREBUILT_OBJ_FILES += images/emulator_icon.o
+ endef
+
+# This seems to be the only way to add an object file that was not generated from
+# a C/C++/Java source file to our build system. and very unfortunately,
+# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
+# us to put the object file in the source directory.
+$(LOCAL_PATH)/images/emulator_icon.o: $(LOCAL_PATH)/images/android_icon.rc
+ $(WINDRES) $< -I $(LOCAL_PATH)/images -o $@
+endif
+
# We want to build all variants of the emulator binaries. This makes
# it easier to catch target-specific regressions during emulator development.
EMULATOR_TARGET_ARCH := arm
@@ -238,6 +263,10 @@ $(call start-emulator-program, emulator)
LOCAL_SRC_FILES := android/main-emulator.c
LOCAL_STATIC_LIBRARIES := emulator-common
+ifeq ($(HOST_OS),windows)
+$(eval $(call insert-windows-icon))
+endif
+
$(call end-emulator-program)
##############################################################################
diff --git a/Makefile.target b/Makefile.target
index e8a41f4..5b4ec5f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -432,6 +432,11 @@ LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c)
$(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h)
$(call gen-hw-config-defs)
+
+ifeq ($(HOST_OS),windows)
+$(eval $(call insert-windows-icon))
+endif
+
$(call end-emulator-program)
@@ -455,3 +460,4 @@ ifeq ($(HOST_OS),linux)
$(call end-emulator-program)
endif # BUILD_STANDALONE_EMULATOR == nil
endif # HOST_OS == linux
+
diff --git a/android-configure.sh b/android-configure.sh
index beb7427..9510ece 100755
--- a/android-configure.sh
+++ b/android-configure.sh
@@ -196,15 +196,9 @@ if [ "$IN_ANDROID_BUILD" = "yes" ] ; then
# use ccache if USE_CCACHE is defined and the corresponding
# binary is available.
#
- # note: located in PREBUILT/ccache/ccache in the new tree layout
- # located in PREBUILT/ccache in the old one
- #
if [ -n "$USE_CCACHE" ] ; then
CCACHE="$ANDROID_PREBUILT/ccache/ccache$EXE"
if [ ! -f $CCACHE ] ; then
- CCACHE="$ANDROID_PREBUILT/ccache$EXE"
- fi
- if [ ! -f $CCACHE ] ; then
CCACHE="$ANDROID_PREBUILTS/ccache/ccache$EXE"
fi
if [ -f $CCACHE ] ; then
@@ -261,6 +255,32 @@ if [ "$IN_ANDROID_BUILD" = "yes" ] ; then
fi
fi
fi
+else
+ if [ "$GLES_PROBE" = "yes" ]; then
+ GLES_SUPPORT=yes
+ if [ -z "$GLES_INCLUDE" ]; then
+ log "GLES : Probing for headers"
+ GLES_INCLUDE=../../sdk/emulator/opengl/host/include
+ if [ -d "$GLES_INCLUDE" ]; then
+ log "GLES : Headers in $GLES_INCLUDE"
+ else
+ echo "Warning: Could not find OpenGLES emulation include dir: $GLES_INCLUDE"
+ echo "Disabling GLES emulation from this build!"
+ GLES_SUPPORT=no
+ fi
+ fi
+ if [ -z "$GLES_LIBS" ]; then
+ log "GLES : Probing for host libraries"
+ GLES_LIBS=../../out/host/$OS/lib
+ if [ -d "$GLES_LIBS" ]; then
+ echo "GLES : Libs in $GLES_LIBS"
+ else
+ echo "Warning: Could nof find OpenGLES emulation libraries in: $GLES_LIBS"
+ echo "Disabling GLES emulation from this build!"
+ GLES_SUPPORT=no
+ fi
+ fi
+ fi
fi # IN_ANDROID_BUILD = no
if [ "$GLES_SUPPORT" = "yes" ]; then
diff --git a/android/android.h b/android/android.h
index 189b5c2..e32f9f5 100644
--- a/android/android.h
+++ b/android/android.h
@@ -97,6 +97,13 @@ extern int android_parse_network_speed(const char* speed);
* accordingly. returns -1 on error, 0 on success */
extern int android_parse_network_latency(const char* delay);
+/** in qemu_setup.c */
+
+#define ANDROID_GLSTRING_BUF_SIZE 128
+extern char android_gl_vendor[ANDROID_GLSTRING_BUF_SIZE];
+extern char android_gl_renderer[ANDROID_GLSTRING_BUF_SIZE];
+extern char android_gl_version[ANDROID_GLSTRING_BUF_SIZE];
+
extern void android_emulation_setup( void );
extern void android_emulation_teardown( void );
diff --git a/android/build/common.sh b/android/build/common.sh
index c7235ae..e3e190b 100644
--- a/android/build/common.sh
+++ b/android/build/common.sh
@@ -499,10 +499,10 @@ locate_android_prebuilt ()
{
# locate prebuilt directory
ANDROID_PREBUILT_HOST_TAG=$OS
- ANDROID_PREBUILT=$ANDROID_TOP/prebuilt/$ANDROID_PREBUILT_HOST_TAG
- ANDROID_PREBUILTS=$ANDROID_TOP/prebuilts/misc/$ANDROID_PREBUILT_HOST_TAG
+ ANDROID_PREBUILT=$ANDROID_TOP/prebuilt/$ANDROID_PREBUILT_HOST_TAG # AOSP still has it
+ ANDROID_PREBUILTS=$ANDROID_TOP/prebuilts/misc/$ANDROID_PREBUILT_HOST_TAG # AOSP does't have it yet
if [ ! -d $ANDROID_PREBUILT ] ; then
- # this can happen when building on x86_64
+ # this can happen when building on x86_64, or in AOSP
case $OS in
linux-x86_64)
ANDROID_PREBUILT_HOST_TAG=linux-x86
@@ -511,8 +511,7 @@ locate_android_prebuilt ()
*)
esac
if [ ! -d $ANDROID_PREBUILT ] ; then
- echo "Can't find the prebuilt directory $ANDROID_PREBUILT in Android build"
- exit 1
+ ANDROID_PREBUILT=
fi
fi
if [ ! -d $ANDROID_PREBUILTS ] ; then
@@ -525,8 +524,7 @@ locate_android_prebuilt ()
*)
esac
if [ ! -d $ANDROID_PREBUILTS ] ; then
- echo "Can't find the prebuilts directory $ANDROID_PREBUILTS in Android build"
- exit 1
+ ANDROID_PREBUILTS=
fi
fi
log "Prebuilt : ANDROID_PREBUILT=$ANDROID_PREBUILT"
diff --git a/android/main-emulator.c b/android/main-emulator.c
index 0981a71..ac4d2e9 100644
--- a/android/main-emulator.c
+++ b/android/main-emulator.c
@@ -148,6 +148,8 @@ int main(int argc, char** argv)
avdArch = "arm";
D("Can't determine target AVD architecture: defaulting to %s\n", avdArch);
}
+ if (!strcmp(avdArch, "mips"))
+ force_32bit = 1; /* emulator64-mips segfaults currently, 4-19-2012 */
/* Find the architecture-specific program in the same directory */
emulatorPath = getTargetEmulatorPath(argv[0], avdArch, force_32bit);
diff --git a/android/multitouch-port.c b/android/multitouch-port.c
index 7cb9656..88a76fe 100644
--- a/android/multitouch-port.c
+++ b/android/multitouch-port.c
@@ -22,6 +22,7 @@
#include "android/sdk-controller-socket.h"
#include "android/multitouch-port.h"
#include "android/globals.h" /* for android_hw */
+#include "android/opengles.h"
#include "android/utils/misc.h"
#include "android/utils/jpeg-compress.h"
#include "android/utils/debug.h"
@@ -47,17 +48,21 @@
*/
/* Pointer move message. */
-#define SDKCTL_MT_MOVE 1
+#define SDKCTL_MT_MOVE 1
/* First pointer down message. */
-#define SDKCTL_MT_FISRT_DOWN 2
+#define SDKCTL_MT_FISRT_DOWN 2
/* Last pointer up message. */
-#define SDKCTL_MT_LAST_UP 3
+#define SDKCTL_MT_LAST_UP 3
/* Pointer down message. */
-#define SDKCTL_MT_POINTER_DOWN 4
+#define SDKCTL_MT_POINTER_DOWN 4
/* Pointer up message. */
-#define SDKCTL_MT_POINTER_UP 5
+#define SDKCTL_MT_POINTER_UP 5
/* Sends framebuffer update. */
-#define SDKCTL_MT_FB_UPDATE 6
+#define SDKCTL_MT_FB_UPDATE 6
+/* Framebuffer update has been received. */
+#define SDKCTL_MT_FB_UPDATE_RECEIVED 7
+/* Framebuffer update has been handled. */
+#define SDKCTL_MT_FB_UPDATE_HANDLED 8
/* Multi-touch port descriptor. */
struct AndroidMTSPort {
@@ -247,14 +252,28 @@ _on_multitouch_port_connection(void* opaque,
case SDKCTL_PORT_DISCONNECTED:
D("Multi-touch: SDK Controller is disconnected");
+ // Disable OpenGLES framebuffer updates.
+ if (android_hw->hw_gpu_enabled) {
+ android_setPostCallback(NULL, NULL);
+ }
break;
case SDKCTL_PORT_ENABLED:
D("Multi-touch: SDK Controller port is enabled.");
+ // Enable OpenGLES framebuffer updates.
+ if (android_hw->hw_gpu_enabled) {
+ android_setPostCallback(multitouch_opengles_fb_update, NULL);
+ }
+ /* Refresh (possibly stale) device screen. */
+ multitouch_refresh_screen();
break;
case SDKCTL_PORT_DISABLED:
D("Multi-touch: SDK Controller port is disabled.");
+ // Disable OpenGLES framebuffer updates.
+ if (android_hw->hw_gpu_enabled) {
+ android_setPostCallback(NULL, NULL);
+ }
break;
case SDKCTL_HANDSHAKE_CONNECTED:
@@ -317,6 +336,15 @@ _on_multitouch_message(void* client_opaque,
_on_pup((const AndroidMTPtr*)msg_data);
break;
+ case SDKCTL_MT_FB_UPDATE_RECEIVED:
+ D("Framebuffer update ACK.");
+ break;
+
+ case SDKCTL_MT_FB_UPDATE_HANDLED:
+ D("Framebuffer update handled.");
+ multitouch_fb_updated();
+ break;
+
default:
W("Multi-touch: Unknown message %d", msg_type);
break;
diff --git a/android/multitouch-screen.c b/android/multitouch-screen.c
index 59d4d75..36f937d 100644
--- a/android/multitouch-screen.c
+++ b/android/multitouch-screen.c
@@ -87,7 +87,7 @@ typedef struct MTSState {
} MTSState;
/* Default multi-touch screen descriptor */
-static MTSState _MTSState;
+static MTSState _MTSState = { 0 };
/* Pushes event to the event device. */
static void
@@ -252,16 +252,15 @@ _on_fb_sent(void* opaque, SDKCtlDirectPacket* packet, AsyncIOState status)
if (status == ASIO_STATE_SUCCEEDED) {
/* Lets see if we have accumulated more changes while transmission has been
* in progress. */
- if (mts_state->fb_header.w && mts_state->fb_header.h) {
+ if (mts_state->fb_header.w && mts_state->fb_header.h &&
+ !mts_state->fb_transfer_in_progress) {
+ mts_state->fb_transfer_in_progress = 1;
/* Send accumulated updates. */
if (mts_port_send_frame(mts_state->mtsp, &mts_state->fb_header,
mts_state->current_fb, _on_fb_sent, mts_state,
mts_state->ydir)) {
mts_state->fb_transfer_in_progress = 0;
}
- } else {
- /* Framebuffer transfer is completed, and no more updates are pending. */
- mts_state->fb_transfer_in_progress = 0;
}
}
@@ -377,6 +376,44 @@ multitouch_opengles_fb_update(void* context,
}
void
+multitouch_refresh_screen(void)
+{
+ MTSState* const mts_state = &_MTSState;
+
+ /* Make sure MT port is initialized. */
+ if (!_is_mt_initialized) {
+ return;
+ }
+
+ /* Lets see if any updates have been received so far. */
+ if (NULL != mts_state->current_fb) {
+ _mt_fb_common_update(mts_state, 0, 0, mts_state->fb_header.disp_width,
+ mts_state->fb_header.disp_height);
+ }
+}
+
+void
+multitouch_fb_updated(void)
+{
+ MTSState* const mts_state = &_MTSState;
+
+ /* This concludes framebuffer update. */
+ mts_state->fb_transfer_in_progress = 0;
+
+ /* Lets see if we have accumulated more changes while transmission has been
+ * in progress. */
+ if (mts_state->fb_header.w && mts_state->fb_header.h) {
+ mts_state->fb_transfer_in_progress = 1;
+ /* Send accumulated updates. */
+ if (mts_port_send_frame(mts_state->mtsp, &mts_state->fb_header,
+ mts_state->current_fb, _on_fb_sent, mts_state,
+ mts_state->ydir)) {
+ mts_state->fb_transfer_in_progress = 0;
+ }
+ }
+}
+
+void
multitouch_init(AndroidMTSPort* mtsp)
{
if (!_is_mt_initialized) {
diff --git a/android/multitouch-screen.h b/android/multitouch-screen.h
index 95ae86a..baca224 100644
--- a/android/multitouch-screen.h
+++ b/android/multitouch-screen.h
@@ -95,4 +95,12 @@ extern void multitouch_opengles_fb_update(void* context,
int type,
unsigned char* pixels);
+/* Pushes the entire framebuffer to the device. This will force the device to
+ * refresh the entire screen.
+ */
+extern void multitouch_refresh_screen(void);
+
+/* Framebuffer update has been handled by the device. */
+extern void multitouch_fb_updated(void);
+
#endif /* ANDROID_MULTITOUCH_SCREEN_H_ */
diff --git a/android/opengles.c b/android/opengles.c
index d1f4322..f56252c 100644
--- a/android/opengles.c
+++ b/android/opengles.c
@@ -12,6 +12,7 @@
#include "config-host.h"
#include "android/opengles.h"
+#include <assert.h>
/* Declared in "android/globals.h" */
int android_gles_fast_pipes = 1;
@@ -46,6 +47,8 @@ int android_gles_fast_pipes = 1;
DYNLINK_FUNC(initLibrary) \
DYNLINK_FUNC(setStreamMode) \
DYNLINK_FUNC(initOpenGLRenderer) \
+ DYNLINK_FUNC(setPostCallback) \
+ DYNLINK_FUNC(getHardwareStrings) \
DYNLINK_FUNC(createOpenGLSubwindow) \
DYNLINK_FUNC(destroyOpenGLSubwindow) \
DYNLINK_FUNC(repaintOpenGLDisplay) \
@@ -137,14 +140,14 @@ BAD_EXIT:
}
int
-android_startOpenglesRenderer(int width, int height, OnPostFunc onPost, void* onPostContext)
+android_startOpenglesRenderer(int width, int height)
{
if (!rendererLib) {
D("Can't start OpenGLES renderer without support libraries");
return -1;
}
- if (!initOpenGLRenderer(width, height, ANDROID_OPENGLES_BASE_PORT, onPost, onPostContext)) {
+ if (!initOpenGLRenderer(width, height, ANDROID_OPENGLES_BASE_PORT)) {
D("Can't start OpenGLES renderer?");
return -1;
}
@@ -152,6 +155,70 @@ android_startOpenglesRenderer(int width, int height, OnPostFunc onPost, void* on
}
void
+android_setPostCallback(OnPostFunc onPost, void* onPostContext)
+{
+ if (rendererLib) {
+ setPostCallback(onPost, onPostContext);
+ }
+}
+
+static void strncpy_safe(char* dst, const char* src, size_t n)
+{
+ strncpy(dst, src, n);
+ dst[n-1] = '\0';
+}
+
+static void extractBaseString(char* dst, const char* src, size_t dstSize)
+{
+ size_t len = strlen(src);
+ const char* begin = strchr(src, '(');
+ const char* end = strrchr(src, ')');
+
+ if (!begin || !end) {
+ strncpy_safe(dst, src, dstSize);
+ return;
+ }
+ begin += 1;
+
+ // "foo (bar)"
+ // ^ ^
+ // b e
+ // = 5 8
+ // substring with NUL-terminator is end-begin+1 bytes
+ if (end - begin + 1 > dstSize) {
+ end = begin + dstSize - 1;
+ }
+
+ strncpy_safe(dst, begin, end - begin + 1);
+}
+
+void
+android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
+ char* renderer, size_t rendererBufSize,
+ char* version, size_t versionBufSize)
+{
+ const char *vendorSrc, *rendererSrc, *versionSrc;
+
+ getHardwareStrings(&vendorSrc, &rendererSrc, &versionSrc);
+ if (!vendorSrc) vendorSrc = "";
+ if (!rendererSrc) rendererSrc = "";
+ if (!versionSrc) versionSrc = "";
+
+ /* Special case for the default ES to GL translators: extract the strings
+ * of the underlying OpenGL implementation. */
+ if (strncmp(vendorSrc, "Google", 6) == 0 &&
+ strncmp(rendererSrc, "Android Emulator OpenGL ES Translator", 37) == 0) {
+ extractBaseString(vendor, vendorSrc, vendorBufSize);
+ extractBaseString(renderer, rendererSrc, rendererBufSize);
+ extractBaseString(version, versionSrc, versionBufSize);
+ } else {
+ strncpy_safe(vendor, vendorSrc, vendorBufSize);
+ strncpy_safe(renderer, rendererSrc, rendererBufSize);
+ strncpy_safe(version, versionSrc, versionBufSize);
+ }
+}
+
+void
android_stopOpenglesRenderer(void)
{
if (rendererLib) {
@@ -211,11 +278,25 @@ int android_initOpenglesEmulation(void)
return -1;
}
-int android_startOpenglesRenderer(int width, int height, OnPostFunc onPost, void* onPostContext)
+int android_startOpenglesRenderer(int width, int height)
{
return -1;
}
+void
+android_setPostCallback(OnPostFunc onPost, void* onPostContext)
+{
+}
+
+void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
+ char* renderer, size_t rendererBufSize,
+ char* version, size_t versionBufSize)
+{
+ assert(vendorBufSize > 0 && rendererBufSize > 0 && versionBufSize > 0);
+ assert(vendor != NULL && renderer != NULL && version != NULL);
+ vendor[0] = renderer[0] = version[0] = 0;
+}
+
void android_stopOpenglesRenderer(void)
{}
diff --git a/android/opengles.h b/android/opengles.h
index 60e125d..aac6249 100644
--- a/android/opengles.h
+++ b/android/opengles.h
@@ -16,10 +16,6 @@
#define ANDROID_OPENGLES_BASE_PORT 22468
-/* See the description in render_api.h. */
-typedef void (*OnPostFunc)(void* context, int width, int height, int ydir,
- int format, int type, unsigned char* pixels);
-
/* Call this function to initialize the hardware opengles emulation.
* This function will abort if we can't find the corresponding host
* libraries through dlopen() or equivalent.
@@ -30,8 +26,24 @@ int android_initOpenglesEmulation(void);
* At the moment, this must be done before the VM starts. The onPost callback
* may be NULL.
*/
-int android_startOpenglesRenderer(int width, int height,
- OnPostFunc onPost, void* onPostContext);
+int android_startOpenglesRenderer(int width, int height);
+
+/* See the description in render_api.h. */
+typedef void (*OnPostFunc)(void* context, int width, int height, int ydir,
+ int format, int type, unsigned char* pixels);
+void android_setPostCallback(OnPostFunc onPost, void* onPostContext);
+
+/* Retrieve the Vendor/Renderer/Version strings describing the underlying GL
+ * implementation. The call only works while the renderer is started.
+ *
+ * Each string is copied into the corresponding buffer. If the original string
+ * (including NUL terminator) is more than xxBufSize bytes, it will be
+ * truncated. In all cases, including failure, the buffer will be NUL-
+ * terminated when this function returns.
+ */
+void android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
+ char* renderer, size_t rendererBufSize,
+ char* version, size_t versionBufSize);
int android_showOpenglesWindow(void* window, int x, int y, int width, int height, float rotation);
diff --git a/android/qemu-setup.c b/android/qemu-setup.c
index 181c95b..8b8f0b0 100644
--- a/android/qemu-setup.c
+++ b/android/qemu-setup.c
@@ -47,6 +47,11 @@ char* op_http_proxy = NULL;
/* Base port for the emulated system. */
int android_base_port;
+/* Strings describing the host system's OpenGL implementation */
+char android_gl_vendor[ANDROID_GLSTRING_BUF_SIZE];
+char android_gl_renderer[ANDROID_GLSTRING_BUF_SIZE];
+char android_gl_version[ANDROID_GLSTRING_BUF_SIZE];
+
/*** APPLICATION DIRECTORY
*** Where are we ?
***/
@@ -483,6 +488,14 @@ void android_emulation_setup( void )
char tmp[PATH_MAX];
const char* appdir = get_app_dir();
+ const size_t ARGSLEN =
+ PATH_MAX + // max ping program path
+ 10 + // max VERSION_STRING length
+ 3*ANDROID_GLSTRING_BUF_SIZE + // max GL string lengths
+ 29 + // static args characters
+ 1; // NUL terminator
+ char args[ARGSLEN];
+
if (snprintf( tmp, PATH_MAX, "%s%s%s", appdir, PATH_SEP,
_ANDROID_PING_PROGRAM ) >= PATH_MAX) {
dprint( "Application directory too long: %s", appdir);
@@ -507,10 +520,12 @@ void android_emulation_setup( void )
if (!comspec) comspec = "cmd.exe";
// Run
- char args[PATH_MAX + 30];
- if (snprintf( args, PATH_MAX, "/C \"%s\" ping emulator " VERSION_STRING,
- tmp) >= PATH_MAX ) {
- D( "DDMS path too long: %s", tmp);
+ if (snprintf(args, ARGSLEN,
+ "/C \"%s\" ping emulator " VERSION_STRING " \"%s\" \"%s\" \"%s\"",
+ tmp, android_gl_vendor, android_gl_renderer, android_gl_version)
+ >= ARGSLEN)
+ {
+ D( "DDMS command line too long: %s", args);
return;
}
@@ -540,13 +555,17 @@ void android_emulation_setup( void )
int fd = open("/dev/null", O_WRONLY);
dup2(fd, 1);
dup2(fd, 2);
- execl( tmp, _ANDROID_PING_PROGRAM, "ping", "emulator", VERSION_STRING, NULL );
+ execl( tmp, _ANDROID_PING_PROGRAM, "ping", "emulator", VERSION_STRING,
+ android_gl_vendor, android_gl_renderer, android_gl_version,
+ NULL );
}
END_NOSIGALRM
/* don't do anything in the parent or in case of error */
- strncat( tmp, " ping emulator " VERSION_STRING, PATH_MAX - strlen(tmp) );
- D( "ping command: %s", tmp );
+ snprintf(args, ARGSLEN,
+ "%s ping emulator " VERSION_STRING " \"%s\" \"%s\" \"%s\"",
+ tmp, android_gl_vendor, android_gl_renderer, android_gl_version);
+ D( "ping command: %s", args );
#endif
}
}
diff --git a/distrib/jpeg-6b/jdphuff.c b/distrib/jpeg-6b/jdphuff.c
index 922017e..cccfdd9 100644
--- a/distrib/jpeg-6b/jdphuff.c
+++ b/distrib/jpeg-6b/jdphuff.c
@@ -82,6 +82,10 @@ METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data));
METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data));
+GLOBAL(void) jpeg_configure_huffman_decoder_progressive(
+ j_decompress_ptr cinfo, huffman_offset_data offset);
+GLOBAL(void) jpeg_get_huffman_decoder_configuration_progressive(
+ j_decompress_ptr cinfo, huffman_offset_data *offset);
/*
* Initialize for a Huffman-compressed scan.
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c b/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
index 7b99d73..6e97c32 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
+++ b/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
@@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
#undef SDL_X11_SYM
+static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
+{
+ xReq *req;
+ WORD64ALIGN
+ if (dpy->bufptr + len > dpy->bufmax)
+ _XFlush(dpy);
+ dpy->last_req = dpy->bufptr;
+ req = (xReq*)dpy->bufptr;
+ req->reqType = type;
+ req->length = len / 4;
+ dpy->bufptr += len;
+ dpy->request++;
+ return req;
+}
+
static int x11_load_refcount = 0;
void SDL_X11_UnloadSymbols(void)
@@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void)
X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
#endif
+ /*
+ * In case we're built with newer Xlib headers, we need to make sure
+ * that _XGetRequest() is available, even on older systems.
+ * Otherwise, various Xlib macros we use will call a NULL pointer.
+ */
+ if (!SDL_X11_HAVE_XGETREQUEST) {
+ p_XGetRequest = SDL_XGetRequest_workaround;
+ }
+
if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */
SDL_ClearError();
XInitThreads();
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
index b8d90e4..610982c 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
+++ b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
@@ -181,6 +181,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
#endif
/*
+ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
+ */
+SDL_X11_MODULE(XGETREQUEST)
+SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
+
+/*
* These only show up on some variants of Unix.
*/
#if defined(__osf__)
diff --git a/target-arm/exec.h b/target-arm/exec.h
index 07bfd57..83571e6 100644
--- a/target-arm/exec.h
+++ b/target-arm/exec.h
@@ -19,7 +19,11 @@
#include "config.h"
#include "dyngen-exec.h"
-register struct CPUARMState *env asm(AREG0);
+/* Xcode 4.3 doesn't support global register variables */
+#if !defined(__APPLE_CC__) || __APPLE_CC__ < 5621
+ register
+#endif
+struct CPUARMState *env asm(AREG0);
#include "cpu.h"
#include "exec-all.h"
diff --git a/target-i386/exec.h b/target-i386/exec.h
index 42b471a..d194f89 100644
--- a/target-i386/exec.h
+++ b/target-i386/exec.h
@@ -29,7 +29,11 @@
#include "cpu-defs.h"
-register struct CPUX86State *env asm(AREG0);
+/* Xcode 4.3 doesn't support global register variables */
+#if !defined(__APPLE_CC__) || __APPLE_CC__ < 5621
+ register
+#endif
+struct CPUX86State *env asm(AREG0);
#include "qemu-common.h"
#include "qemu-log.h"
diff --git a/vl-android.c b/vl-android.c
index 74a2dc4..c566d92 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -3782,6 +3782,15 @@ int main(int argc, char **argv, char **envp)
}
}
+ /* Set LCD density (if required by -qemu, and AVD is missing it. */
+ if (android_op_lcd_density && !android_hw->hw_lcd_density) {
+ int density;
+ if (parse_int(android_op_lcd_density, &density) || density <= 0) {
+ PANIC("-lcd-density : %d", density);
+ }
+ hwLcd_setBootProperty(density);
+ }
+
/* Initialize camera emulation. */
android_camera_service_init();
@@ -3867,29 +3876,33 @@ int main(int argc, char **argv, char **envp)
nand_add_dev(tmp);
}
- /* qemu.gles will be read by the OpenGLES emulation libraries.
- * If set to 0, the software GLES renderer will be used as a fallback.
- * If the parameter is undefined, this means the system image runs
- * inside an emulator that doesn't support GPU emulation at all.
- */
+ /* qemu.gles will be read by the OpenGL ES emulation libraries.
+ * If set to 0, the software GL ES renderer will be used as a fallback.
+ * If the parameter is undefined, this means the system image runs
+ * inside an emulator that doesn't support GPU emulation at all.
+ *
+ * We always start the GL ES renderer so we can gather stats on the
+ * underlying GL implementation. If GL ES acceleration is disabled,
+ * we just shut it down again once we have the strings. */
{
- int gles_emul = 0;
-
- if (android_hw->hw_gpu_enabled) {
- /* Set framebuffer change notification callback when starting
- * GLES emulation. Currently only multi-touch emulation is
- * interested in FB changes (to transmit them to the device), so
- * the callback is set within MT emulation.*/
- if (android_initOpenglesEmulation() == 0 &&
- android_startOpenglesRenderer(android_hw->hw_lcd_width,
- android_hw->hw_lcd_height,
- multitouch_opengles_fb_update, NULL) == 0) {
- gles_emul = 1;
+ int qemu_gles = 0;
+ if (android_initOpenglesEmulation() == 0 &&
+ android_startOpenglesRenderer(android_hw->hw_lcd_width, android_hw->hw_lcd_height) == 0)
+ {
+ android_getOpenglesHardwareStrings(
+ android_gl_vendor, sizeof(android_gl_vendor),
+ android_gl_renderer, sizeof(android_gl_renderer),
+ android_gl_version, sizeof(android_gl_version));
+ if (android_hw->hw_gpu_enabled) {
+ qemu_gles = 1;
} else {
- dwarning("Could not initialize OpenglES emulation, using software renderer.");
+ android_stopOpenglesRenderer();
+ qemu_gles = 0;
}
+ } else {
+ dwarning("Could not initialize OpenglES emulation, using software renderer.");
}
- if (gles_emul) {
+ if (qemu_gles) {
stralloc_add_str(kernel_params, " qemu.gles=1");
} else {
stralloc_add_str(kernel_params, " qemu.gles=0");
@@ -4042,6 +4055,32 @@ int main(int argc, char **argv, char **envp)
}
}
+ /* Quite often (especially on older XP machines) attempts to allocate large
+ * VM RAM is going to fail, and crash the emulator. Since it's failing deep
+ * inside QEMU, it's not really possible to provide the user with a
+ * meaningful explanation for the crash. So, lets see if QEMU is going to be
+ * able to allocate requested amount of RAM, and if not, lets try to come up
+ * with a recomendation. */
+ {
+ ram_addr_t r_ram = ram_size;
+ void* alloc_check = malloc(r_ram);
+ while (alloc_check == NULL && r_ram > 1024 * 1024) {
+ /* Make it 25% less */
+ r_ram -= r_ram / 4;
+ alloc_check = malloc(r_ram);
+ }
+ if (alloc_check != NULL) {
+ free(alloc_check);
+ }
+ if (r_ram != ram_size) {
+ /* Requested RAM is too large. Report this, as well as calculated
+ * recomendation. */
+ dwarning("Requested RAM size of %dMB is too large for your environment, and is reduced to %dMB.",
+ (int)(ram_size / 1024 / 1024), (int)(r_ram / 1024 / 1024));
+ ram_size = r_ram;
+ }
+ }
+
#ifdef CONFIG_KQEMU
/* FIXME: This is a nasty hack because kqemu can't cope with dynamic
guest ram allocation. It needs to go away. */