Merge "DO NOT MERGE: Remove Device Bluez-Dbus interface watch." into gingerbread
diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h
index 711a658..f00f2db 100644
--- a/include/ui/InputDispatcher.h
+++ b/include/ui/InputDispatcher.h
@@ -147,9 +147,12 @@
/* Notifies the system that an input channel recovered from ANR. */
virtual void notifyInputChannelRecoveredFromANR(const sp<InputChannel>& inputChannel) = 0;
- /* Gets the key repeat timeout or -1 if automatic key repeating is disabled. */
+ /* Gets the key repeat initial timeout or -1 if automatic key repeating is disabled. */
virtual nsecs_t getKeyRepeatTimeout() = 0;
+ /* Gets the key repeat inter-key delay. */
+ virtual nsecs_t getKeyRepeatDelay() = 0;
+
/* Waits for key event input targets to become available.
* If the event is being injected, injectorPid and injectorUid should specify the
* process id and used id of the injecting application, otherwise they should both
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp
index e5b7f28..df232d4 100644
--- a/libs/ui/InputDispatcher.cpp
+++ b/libs/ui/InputDispatcher.cpp
@@ -97,6 +97,7 @@
void InputDispatcher::dispatchOnce() {
nsecs_t keyRepeatTimeout = mPolicy->getKeyRepeatTimeout();
+ nsecs_t keyRepeatDelay = mPolicy->getKeyRepeatDelay();
bool skipPoll = false;
nsecs_t currentTime;
@@ -146,7 +147,7 @@
if (mInboundQueue.isEmpty()) {
if (mKeyRepeatState.lastKeyEntry) {
if (currentTime >= mKeyRepeatState.nextRepeatTime) {
- processKeyRepeatLockedInterruptible(currentTime, keyRepeatTimeout);
+ processKeyRepeatLockedInterruptible(currentTime, keyRepeatDelay);
skipPoll = true;
} else {
if (mKeyRepeatState.nextRepeatTime < nextWakeupTime) {
@@ -335,7 +336,7 @@
}
void InputDispatcher::processKeyRepeatLockedInterruptible(
- nsecs_t currentTime, nsecs_t keyRepeatTimeout) {
+ nsecs_t currentTime, nsecs_t keyRepeatDelay) {
KeyEntry* entry = mKeyRepeatState.lastKeyEntry;
// Search the inbound queue for a key up corresponding to this device.
@@ -352,7 +353,7 @@
}
}
- // Synthesize a key repeat after the repeat timeout expired.
+ // Synthesize a key repeat.
// Reuse the repeated key entry if it is otherwise unreferenced.
uint32_t policyFlags = entry->policyFlags & POLICY_FLAG_RAW_MASK;
if (entry->refCount == 1) {
@@ -375,7 +376,7 @@
entry->flags |= AKEY_EVENT_FLAG_LONG_PRESS;
}
- mKeyRepeatState.nextRepeatTime = currentTime + keyRepeatTimeout;
+ mKeyRepeatState.nextRepeatTime = currentTime + keyRepeatDelay;
#if DEBUG_OUTBOUND_EVENT_DETAILS
LOGD("processKeyRepeat - eventTime=%lld, deviceId=0x%x, source=0x%x, policyFlags=0x%x, "
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 5e61607..df21358 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -239,7 +239,7 @@
memset(images, 0, sizeof(images));
}
EGLDisplay dpy;
- EGLConfig context;
+ EGLContext context;
EGLImageKHR images[IMPL_NUM_IMPLEMENTATIONS];
};
@@ -1769,7 +1769,7 @@
egl_connection_t* const cnx = &gEGLImpl[i];
if (image->images[i] != EGL_NO_IMAGE_KHR) {
if (cnx->dso) {
- if (cnx->egl.eglCreateImageKHR) {
+ if (cnx->egl.eglDestroyImageKHR) {
if (cnx->egl.eglDestroyImageKHR(
dp->disp[i].dpy, image->images[i])) {
success = true;
diff --git a/opengl/tests/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
index 06fa0c2..4d10ee5 100644
--- a/opengl/tests/angeles/app-linux.cpp
+++ b/opengl/tests/angeles/app-linux.cpp
@@ -63,7 +63,7 @@
int gAppAlive = 1;
static const char sAppName[] =
- "San Angeles Observation OpenGL ES version example (Linux)";
+ "San Angeles Observation OpenGL ES version example (Linux)";
static int sWindowWidth = WINDOW_DEFAULT_WIDTH;
static int sWindowHeight = WINDOW_DEFAULT_HEIGHT;
@@ -74,22 +74,22 @@
const char *egl_strerror(unsigned err)
{
switch(err){
- case EGL_SUCCESS: return "SUCCESS";
- case EGL_NOT_INITIALIZED: return "NOT INITIALIZED";
- case EGL_BAD_ACCESS: return "BAD ACCESS";
- case EGL_BAD_ALLOC: return "BAD ALLOC";
- case EGL_BAD_ATTRIBUTE: return "BAD_ATTRIBUTE";
- case EGL_BAD_CONFIG: return "BAD CONFIG";
- case EGL_BAD_CONTEXT: return "BAD CONTEXT";
- case EGL_BAD_CURRENT_SURFACE: return "BAD CURRENT SURFACE";
- case EGL_BAD_DISPLAY: return "BAD DISPLAY";
- case EGL_BAD_MATCH: return "BAD MATCH";
- case EGL_BAD_NATIVE_PIXMAP: return "BAD NATIVE PIXMAP";
- case EGL_BAD_NATIVE_WINDOW: return "BAD NATIVE WINDOW";
- case EGL_BAD_PARAMETER: return "BAD PARAMETER";
- case EGL_BAD_SURFACE: return "BAD_SURFACE";
-// case EGL_CONTEXT_LOST: return "CONTEXT LOST";
- default: return "UNKNOWN";
+ case EGL_SUCCESS: return "SUCCESS";
+ case EGL_NOT_INITIALIZED: return "NOT INITIALIZED";
+ case EGL_BAD_ACCESS: return "BAD ACCESS";
+ case EGL_BAD_ALLOC: return "BAD ALLOC";
+ case EGL_BAD_ATTRIBUTE: return "BAD_ATTRIBUTE";
+ case EGL_BAD_CONFIG: return "BAD CONFIG";
+ case EGL_BAD_CONTEXT: return "BAD CONTEXT";
+ case EGL_BAD_CURRENT_SURFACE: return "BAD CURRENT SURFACE";
+ case EGL_BAD_DISPLAY: return "BAD DISPLAY";
+ case EGL_BAD_MATCH: return "BAD MATCH";
+ case EGL_BAD_NATIVE_PIXMAP: return "BAD NATIVE PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW: return "BAD NATIVE WINDOW";
+ case EGL_BAD_PARAMETER: return "BAD PARAMETER";
+ case EGL_BAD_SURFACE: return "BAD_SURFACE";
+ // case EGL_CONTEXT_LOST: return "CONTEXT LOST";
+ default: return "UNKNOWN";
}
}
@@ -118,52 +118,59 @@
fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
}
-static int initGraphics()
+static int initGraphics(unsigned samples)
{
EGLint configAttribs[] = {
- EGL_DEPTH_SIZE, 16,
- EGL_NONE
- };
-
- EGLint majorVersion;
- EGLint minorVersion;
- EGLContext context;
- EGLConfig config;
- EGLSurface surface;
- EGLint w, h;
- EGLDisplay dpy;
+ EGL_DEPTH_SIZE, 16,
+ EGL_SAMPLE_BUFFERS, samples ? 1 : 0,
+ EGL_SAMPLES, samples,
+ EGL_NONE
+ };
- EGLNativeWindowType window = android_createDisplaySurface();
-
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(dpy, &majorVersion, &minorVersion);
-
- status_t err = EGLUtils::selectConfigForNativeWindow(
- dpy, configAttribs, window, &config);
- if (err) {
- fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
- return 0;
- }
+ EGLint majorVersion;
+ EGLint minorVersion;
+ EGLContext context;
+ EGLConfig config;
+ EGLSurface surface;
+ EGLint w, h;
+ EGLDisplay dpy;
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
- egl_error("eglCreateWindowSurface");
+ EGLNativeWindowType window = android_createDisplaySurface();
- fprintf(stderr,"surface = %p\n", surface);
+ dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ eglInitialize(dpy, &majorVersion, &minorVersion);
- context = eglCreateContext(dpy, config, NULL, NULL);
- egl_error("eglCreateContext");
- fprintf(stderr,"context = %p\n", context);
-
- eglMakeCurrent(dpy, surface, surface, context);
- egl_error("eglMakeCurrent");
+ status_t err = EGLUtils::selectConfigForNativeWindow(
+ dpy, configAttribs, window, &config);
+ if (err) {
+ fprintf(stderr, "couldn't find an EGLConfig matching the screen format\n");
+ return 0;
+ }
- eglQuerySurface(dpy, surface, EGL_WIDTH, &sWindowWidth);
- eglQuerySurface(dpy, surface, EGL_HEIGHT, &sWindowHeight);
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
+ egl_error("eglCreateWindowSurface");
+
+ fprintf(stderr,"surface = %p\n", surface);
+
+ context = eglCreateContext(dpy, config, NULL, NULL);
+ egl_error("eglCreateContext");
+ fprintf(stderr,"context = %p\n", context);
+
+ eglMakeCurrent(dpy, surface, surface, context);
+ egl_error("eglMakeCurrent");
+
+ eglQuerySurface(dpy, surface, EGL_WIDTH, &sWindowWidth);
+ eglQuerySurface(dpy, surface, EGL_HEIGHT, &sWindowHeight);
sEglDisplay = dpy;
sEglSurface = surface;
sEglContext = context;
+ if (samples == 0) {
+ // GL_MULTISAMPLE is enabled by default
+ glDisable(GL_MULTISAMPLE);
+ }
+
return EGL_TRUE;
}
@@ -179,35 +186,47 @@
int main(int argc, char *argv[])
{
- // not referenced:
- argc = argc;
- argv = argv;
+ unsigned samples = 0;
+ printf("usage: %s [samples]\n", argv[0]);
+ if (argc == 2) {
+ samples = atoi( argv[1] );
+ printf("Multisample enabled: GL_SAMPLES = %u\n", samples);
+ }
- if (!initGraphics())
+ if (!initGraphics(samples))
{
fprintf(stderr, "Graphics initialization failed.\n");
return EXIT_FAILURE;
}
appInit();
-
+
+ struct timeval timeTemp;
+ int frameCount = 0;
+ gettimeofday(&timeTemp, NULL);
+ double totalTime = timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec;
+
while (gAppAlive)
{
struct timeval timeNow;
- if (gAppAlive)
- {
- gettimeofday(&timeNow, NULL);
- appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
- sWindowWidth, sWindowHeight);
- checkGLErrors();
- eglSwapBuffers(sEglDisplay, sEglSurface);
- checkEGLErrors();
- }
+ gettimeofday(&timeNow, NULL);
+ appRender(timeNow.tv_sec * 1000 + timeNow.tv_usec / 1000,
+ sWindowWidth, sWindowHeight);
+ checkGLErrors();
+ eglSwapBuffers(sEglDisplay, sEglSurface);
+ checkEGLErrors();
+ frameCount++;
}
+ gettimeofday(&timeTemp, NULL);
+
appDeinit();
deinitGraphics();
+ totalTime = (timeTemp.tv_usec/1000000.0 + timeTemp.tv_sec) - totalTime;
+ printf("totalTime=%f s, frameCount=%d, %.2f fps\n",
+ totalTime, frameCount, frameCount/totalTime);
+
return EXIT_SUCCESS;
}