diff options
| -rw-r--r-- | include/ui/EventHub.h | 4 | ||||
| -rw-r--r-- | include/ui/InputDispatcher.h | 12 | ||||
| -rw-r--r-- | libs/gui/SensorEventQueue.cpp | 18 | ||||
| -rw-r--r-- | libs/ui/GraphicLog.cpp | 8 | ||||
| -rw-r--r-- | libs/ui/InputDispatcher.cpp | 202 | ||||
| -rw-r--r-- | libs/ui/InputReader.cpp | 3 | ||||
| -rw-r--r-- | libs/ui/InputTransport.cpp | 11 | ||||
| -rw-r--r-- | libs/utils/Looper.cpp | 14 | ||||
| -rw-r--r-- | opengl/include/GLES/glext.h | 13 | ||||
| -rw-r--r-- | opengl/include/GLES2/gl2ext.h | 13 | ||||
| -rw-r--r-- | services/surfaceflinger/GLExtensions.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/LayerBlur.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/LayerDim.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/TextureManager.cpp | 8 |
15 files changed, 180 insertions, 134 deletions
diff --git a/include/ui/EventHub.h b/include/ui/EventHub.h index 25d5afbf90..d6b09dc01f 100644 --- a/include/ui/EventHub.h +++ b/include/ui/EventHub.h @@ -111,10 +111,10 @@ enum { /* The input device is a multi-touch touchscreen. */ INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010, - /* The input device is a directional pad. */ + /* The input device is a directional pad (implies keyboard, has DPAD keys). */ INPUT_DEVICE_CLASS_DPAD = 0x00000020, - /* The input device is a gamepad (implies keyboard). */ + /* The input device is a gamepad (implies keyboard, has BUTTON keys). */ INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040, /* The input device has switches. */ diff --git a/include/ui/InputDispatcher.h b/include/ui/InputDispatcher.h index e466ddd9ef..96b4faedb0 100644 --- a/include/ui/InputDispatcher.h +++ b/include/ui/InputDispatcher.h @@ -851,8 +851,8 @@ private: // Inbound event processing. void drainInboundQueueLocked(); - void releasePendingEventLocked(bool wasDropped); - void releaseInboundEventLocked(EventEntry* entry, bool wasDropped); + void releasePendingEventLocked(); + void releaseInboundEventLocked(EventEntry* entry); bool isEventFromReliableSourceLocked(EventEntry* entry); // Dispatch state. @@ -886,10 +886,10 @@ private: nsecs_t currentTime, ConfigurationChangedEntry* entry); bool dispatchKeyLocked( nsecs_t currentTime, KeyEntry* entry, nsecs_t keyRepeatTimeout, - nsecs_t* nextWakeupTime); + bool dropEvent, nsecs_t* nextWakeupTime); bool dispatchMotionLocked( nsecs_t currentTime, MotionEntry* entry, - nsecs_t* nextWakeupTime); + bool dropEvent, nsecs_t* nextWakeupTime); void dispatchEventToCurrentInputTargetsLocked( nsecs_t currentTime, EventEntry* entry, bool resumeWithAppendedMotionSample); @@ -914,8 +914,8 @@ private: bool mInputTargetWaitTimeoutExpired; // Finding targets for input events. - void startFindingTargetsLocked(); - void finishFindingTargetsLocked(const InputWindow* window); + void resetTargetsLocked(); + void commitTargetsLocked(const InputWindow* window); int32_t handleTargetsNotReadyLocked(nsecs_t currentTime, const EventEntry* entry, const InputApplication* application, const InputWindow* window, nsecs_t* nextWakeupTime); diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp index c3a9f2246d..f9355249ab 100644 --- a/libs/gui/SensorEventQueue.cpp +++ b/libs/gui/SensorEventQueue.cpp @@ -70,9 +70,13 @@ ssize_t SensorEventQueue::write(ASensorEvent const* events, size_t numEvents) ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents) { ssize_t size = mSensorChannel->read(events, numEvents*sizeof(events[0])); + LOGE_IF(size<0 && size!=-EAGAIN, + "SensorChannel::read error (%s)", strerror(-size)); if (size >= 0) { if (size % sizeof(events[0])) { // partial read!!! should never happen. + LOGE("SensorEventQueue partial read (event-size=%u, read=%d)", + sizeof(events[0]), int(size)); return -EINVAL; } // returns number of events read @@ -95,8 +99,18 @@ status_t SensorEventQueue::waitForEvent() const { const int fd = getFd(); sp<Looper> looper(getLooper()); - int32_t result = looper->pollOnce(-1); - return (result == fd) ? status_t(NO_ERROR) : status_t(-1); + + int32_t result; + do { + result = looper->pollOnce(-1); + if (result == ALOOPER_EVENT_ERROR) { + LOGE("SensorChannel::waitForEvent error (errno=%d)", errno); + result = -EPIPE; // unknown error, so we make up one + break; + } + } while (result != fd); + + return (result == fd) ? status_t(NO_ERROR) : result; } status_t SensorEventQueue::wake() const diff --git a/libs/ui/GraphicLog.cpp b/libs/ui/GraphicLog.cpp index b55ce2342b..7ba2779d1c 100644 --- a/libs/ui/GraphicLog.cpp +++ b/libs/ui/GraphicLog.cpp @@ -30,7 +30,11 @@ ANDROID_SINGLETON_STATIC_INSTANCE(GraphicLog) static inline void writeInt32(uint8_t* base, size_t& pos, int32_t value) { +#ifdef HAVE_LITTLE_ENDIAN + int32_t v = value; +#else int32_t v = htole32(value); +#endif base[pos] = EVENT_TYPE_INT; memcpy(&base[pos+1], &v, sizeof(int32_t)); pos += 1+sizeof(int32_t); @@ -38,7 +42,11 @@ void writeInt32(uint8_t* base, size_t& pos, int32_t value) { static inline void writeInt64(uint8_t* base, size_t& pos, int64_t value) { +#ifdef HAVE_LITTLE_ENDIAN + int64_t v = value; +#else int64_t v = htole64(value); +#endif base[pos] = EVENT_TYPE_LONG; memcpy(&base[pos+1], &v, sizeof(int64_t)); pos += 1+sizeof(int64_t); diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index dea7936f19..1cf7592ff5 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -122,7 +122,7 @@ InputDispatcher::~InputDispatcher() { AutoMutex _l(mLock); resetKeyRepeatLocked(); - releasePendingEventLocked(true); + releasePendingEventLocked(); drainInboundQueueLocked(); } @@ -174,7 +174,7 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t keyRepeatTimeout, if (! mDispatchEnabled) { if (mPendingEvent || ! mInboundQueue.isEmpty()) { LOGI("Dropping pending events because input dispatch is disabled."); - releasePendingEventLocked(true); + releasePendingEventLocked(); drainInboundQueueLocked(); } return; @@ -281,51 +281,50 @@ void InputDispatcher::dispatchOnceInnerLocked(nsecs_t keyRepeatTimeout, // Now we have an event to dispatch. assert(mPendingEvent != NULL); - bool wasDispatched = false; - bool wasDropped = false; + bool done = false; switch (mPendingEvent->type) { case EventEntry::TYPE_CONFIGURATION_CHANGED: { ConfigurationChangedEntry* typedEntry = static_cast<ConfigurationChangedEntry*>(mPendingEvent); - wasDispatched = dispatchConfigurationChangedLocked(currentTime, typedEntry); + done = dispatchConfigurationChangedLocked(currentTime, typedEntry); break; } case EventEntry::TYPE_KEY: { KeyEntry* typedEntry = static_cast<KeyEntry*>(mPendingEvent); - if (isAppSwitchPendingLocked()) { - if (isAppSwitchKey(typedEntry->keyCode)) { + bool appSwitchKey = isAppSwitchKey(typedEntry->keyCode); + bool dropEvent = isAppSwitchDue && ! appSwitchKey; + done = dispatchKeyLocked(currentTime, typedEntry, keyRepeatTimeout, dropEvent, + nextWakeupTime); + if (done) { + if (dropEvent) { + LOGI("Dropped key because of pending overdue app switch."); + } else if (appSwitchKey) { resetPendingAppSwitchLocked(true); - } else if (isAppSwitchDue) { - LOGI("Dropping key because of pending overdue app switch."); - wasDropped = true; - break; } } - wasDispatched = dispatchKeyLocked(currentTime, typedEntry, keyRepeatTimeout, - nextWakeupTime); break; } case EventEntry::TYPE_MOTION: { MotionEntry* typedEntry = static_cast<MotionEntry*>(mPendingEvent); - if (isAppSwitchDue) { - LOGI("Dropping motion because of pending overdue app switch."); - wasDropped = true; - break; + bool dropEvent = isAppSwitchDue; + done = dispatchMotionLocked(currentTime, typedEntry, dropEvent, nextWakeupTime); + if (done) { + if (dropEvent) { + LOGI("Dropped motion because of pending overdue app switch."); + } } - wasDispatched = dispatchMotionLocked(currentTime, typedEntry, nextWakeupTime); break; } default: assert(false); - wasDropped = true; break; } - if (wasDispatched || wasDropped) { - releasePendingEventLocked(wasDropped); + if (done) { + releasePendingEventLocked(); *nextWakeupTime = LONG_LONG_MIN; // force next poll to wake up immediately } } @@ -403,21 +402,21 @@ InputDispatcher::CommandEntry* InputDispatcher::postCommandLocked(Command comman void InputDispatcher::drainInboundQueueLocked() { while (! mInboundQueue.isEmpty()) { EventEntry* entry = mInboundQueue.dequeueAtHead(); - releaseInboundEventLocked(entry, true /*wasDropped*/); + releaseInboundEventLocked(entry); } } -void InputDispatcher::releasePendingEventLocked(bool wasDropped) { +void InputDispatcher::releasePendingEventLocked() { if (mPendingEvent) { - releaseInboundEventLocked(mPendingEvent, wasDropped); + releaseInboundEventLocked(mPendingEvent); mPendingEvent = NULL; } } -void InputDispatcher::releaseInboundEventLocked(EventEntry* entry, bool wasDropped) { - if (wasDropped) { +void InputDispatcher::releaseInboundEventLocked(EventEntry* entry) { + if (entry->injectionResult == INPUT_EVENT_INJECTION_PENDING) { #if DEBUG_DISPATCH_CYCLE - LOGD("Pending event was dropped."); + LOGD("Inbound event was dropped. Setting injection result to failed."); #endif setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED); } @@ -492,7 +491,41 @@ bool InputDispatcher::dispatchConfigurationChangedLocked( bool InputDispatcher::dispatchKeyLocked( nsecs_t currentTime, KeyEntry* entry, nsecs_t keyRepeatTimeout, - nsecs_t* nextWakeupTime) { + bool dropEvent, nsecs_t* nextWakeupTime) { + // Give the policy a chance to intercept the key. + if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN) { + bool trusted; + if (! dropEvent && mFocusedWindow) { + trusted = checkInjectionPermission(mFocusedWindow, + entry->injectorPid, entry->injectorUid); + } else { + trusted = isEventFromReliableSourceLocked(entry); + } + if (trusted) { + CommandEntry* commandEntry = postCommandLocked( + & InputDispatcher::doInterceptKeyBeforeDispatchingLockedInterruptible); + if (! dropEvent && mFocusedWindow) { + commandEntry->inputChannel = mFocusedWindow->inputChannel; + } + commandEntry->keyEntry = entry; + entry->refCount += 1; + return false; // wait for the command to run + } else { + entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_CONTINUE; + } + } else if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_SKIP) { + resetTargetsLocked(); + setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_SUCCEEDED); + return true; + } + + // Clean up if dropping the event. + if (dropEvent) { + resetTargetsLocked(); + setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED); + return true; + } + // Preprocessing. if (! entry->dispatchInProgress) { logOutboundKeyDetailsLocked("dispatchKey - ", entry); @@ -521,7 +554,7 @@ bool InputDispatcher::dispatchKeyLocked( } entry->dispatchInProgress = true; - startFindingTargetsLocked(); // resets mCurrentInputTargetsValid + resetTargetsLocked(); } // Identify targets. @@ -539,20 +572,7 @@ bool InputDispatcher::dispatchKeyLocked( } addMonitoringTargetsLocked(); - finishFindingTargetsLocked(window); - } - - // Give the policy a chance to intercept the key. - if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN) { - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doInterceptKeyBeforeDispatchingLockedInterruptible); - commandEntry->inputChannel = mCurrentInputChannel; - commandEntry->keyEntry = entry; - entry->refCount += 1; - return false; // wait for the command to run - } - if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_SKIP) { - return true; + commitTargetsLocked(window); } // Dispatch the key. @@ -576,13 +596,20 @@ void InputDispatcher::logOutboundKeyDetailsLocked(const char* prefix, const KeyE } bool InputDispatcher::dispatchMotionLocked( - nsecs_t currentTime, MotionEntry* entry, nsecs_t* nextWakeupTime) { + nsecs_t currentTime, MotionEntry* entry, bool dropEvent, nsecs_t* nextWakeupTime) { + // Clean up if dropping the event. + if (dropEvent) { + resetTargetsLocked(); + setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED); + return true; + } + // Preprocessing. if (! entry->dispatchInProgress) { logOutboundMotionDetailsLocked("dispatchMotion - ", entry); entry->dispatchInProgress = true; - startFindingTargetsLocked(); // resets mCurrentInputTargetsValid + resetTargetsLocked(); } bool isPointerEvent = entry->source & AINPUT_SOURCE_CLASS_POINTER; @@ -610,7 +637,7 @@ bool InputDispatcher::dispatchMotionLocked( } addMonitoringTargetsLocked(); - finishFindingTargetsLocked(window); + commitTargetsLocked(window); } // Dispatch the motion. @@ -705,14 +732,14 @@ void InputDispatcher::dispatchEventToCurrentInputTargetsLocked(nsecs_t currentTi } } -void InputDispatcher::startFindingTargetsLocked() { +void InputDispatcher::resetTargetsLocked() { mCurrentInputTargetsValid = false; mCurrentInputTargets.clear(); mCurrentInputChannel.clear(); mInputTargetWaitCause = INPUT_TARGET_WAIT_CAUSE_NONE; } -void InputDispatcher::finishFindingTargetsLocked(const InputWindow* window) { +void InputDispatcher::commitTargetsLocked(const InputWindow* window) { mCurrentInputWindowType = window->layoutParamsType; mCurrentInputChannel = window->inputChannel; mCurrentInputTargetsValid = true; @@ -776,6 +803,9 @@ void InputDispatcher::resumeAfterTargetsNotReadyTimeoutLocked(nsecs_t newTimeout // Give up. mInputTargetWaitTimeoutExpired = true; + // Release the touch target. + releaseTouchedWindowLocked(); + // Input state will not be realistic. Mark it out of sync. if (inputChannel.get()) { ssize_t connectionIndex = getConnectionIndexLocked(inputChannel); @@ -2159,9 +2189,8 @@ void InputDispatcher::setInputWindows(const Vector<InputWindow>& inputWindows) { { // acquire lock AutoMutex _l(mLock); - sp<InputChannel> oldFocusedWindowChannel = mFocusedWindow - ? mFocusedWindow->inputChannel : NULL; - int32_t oldFocusedWindowLayer = mFocusedWindow ? mFocusedWindow->layer : -1; + // Clear old window pointers but remember their associated channels. + mFocusedWindow = NULL; sp<InputChannel> touchedWindowChannel; if (mTouchedWindow) { @@ -2175,11 +2204,11 @@ void InputDispatcher::setInputWindows(const Vector<InputWindow>& inputWindows) { } mTouchedWallpaperWindows.clear(); } - - mFocusedWindow = NULL; mWallpaperWindows.clear(); - mWindows.clear(); + + // Loop over new windows and rebuild the necessary window pointers for + // tracking focus and touch. mWindows.appendVector(inputWindows); size_t numWindows = mWindows.size(); @@ -2203,41 +2232,8 @@ void InputDispatcher::setInputWindows(const Vector<InputWindow>& inputWindows) { mTouchedWindow = window; } } - mTempTouchedWallpaperChannels.clear(); - bool preempt = false; - if (mFocusedWindow - && mFocusedWindow->inputChannel != oldFocusedWindowChannel - && mFocusedWindow->canReceiveKeys) { - // If the new input focus is an error window or appears above the current - // input focus, drop the current touched window so that we can start - // delivering events to the new input focus as soon as possible. - if (mFocusedWindow->layoutParamsFlags & InputWindow::FLAG_SYSTEM_ERROR) { -#if DEBUG_FOCUS - LOGD("Preempting: New SYSTEM_ERROR window; resetting state"); -#endif - preempt = true; - } else if (oldFocusedWindowChannel.get() != NULL - && mFocusedWindow->layer > oldFocusedWindowLayer) { -#if DEBUG_FOCUS - LOGD("Preempting: Transferring focus to new window at higher layer: " - "old win layer=%d, new win layer=%d", - oldFocusedWindowLayer, mFocusedWindow->layer); -#endif - preempt = true; - } - } - if (mTouchedWindow && ! mTouchedWindow->visible) { -#if DEBUG_FOCUS - LOGD("Preempting: Touched window became invisible."); -#endif - preempt = true; - } - if (preempt) { - releaseTouchedWindowLocked(); - } - #if DEBUG_FOCUS logDispatchStateLocked(); #endif @@ -2312,7 +2308,17 @@ void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) { void InputDispatcher::logDispatchStateLocked() { String8 dump; dumpDispatchStateLocked(dump); - LOGD("%s", dump.string()); + + char* text = dump.lockBuffer(dump.size()); + char* start = text; + while (*start != '\0') { + char* end = strchr(start, '\n'); + if (*end == '\n') { + *(end++) = '\0'; + } + LOGD("%s", start); + start = end; + } } void InputDispatcher::dumpDispatchStateLocked(String8& dump) { @@ -2326,28 +2332,30 @@ void InputDispatcher::dumpDispatchStateLocked(String8& dump) { } else { dump.append(" focusedApplication: <null>\n"); } - dump.appendFormat(" focusedWindow: '%s'\n", - mFocusedWindow != NULL ? mFocusedWindow->inputChannel->getName().string() : "<null>"); - dump.appendFormat(" touchedWindow: '%s', touchDown=%d\n", - mTouchedWindow != NULL ? mTouchedWindow->inputChannel->getName().string() : "<null>", + dump.appendFormat(" focusedWindow: name='%s'\n", + mFocusedWindow != NULL ? mFocusedWindow->name.string() : "<null>"); + dump.appendFormat(" touchedWindow: name='%s', touchDown=%d\n", + mTouchedWindow != NULL ? mTouchedWindow->name.string() : "<null>", mTouchDown); for (size_t i = 0; i < mTouchedWallpaperWindows.size(); i++) { - dump.appendFormat(" touchedWallpaperWindows[%d]: '%s'\n", - i, mTouchedWallpaperWindows[i]->inputChannel->getName().string()); + dump.appendFormat(" touchedWallpaperWindows[%d]: name='%s'\n", + i, mTouchedWallpaperWindows[i]->name.string()); } for (size_t i = 0; i < mWindows.size(); i++) { - dump.appendFormat(" windows[%d]: '%s', paused=%s, hasFocus=%s, hasWallpaper=%s, " - "visible=%s, flags=0x%08x, type=0x%08x, " + dump.appendFormat(" windows[%d]: name='%s', paused=%s, hasFocus=%s, hasWallpaper=%s, " + "visible=%s, canReceiveKeys=%s, flags=0x%08x, type=0x%08x, layer=%d, " "frame=[%d,%d][%d,%d], " "visibleFrame=[%d,%d][%d,%d], " "touchableArea=[%d,%d][%d,%d], " "ownerPid=%d, ownerUid=%d, dispatchingTimeout=%0.3fms\n", - i, mWindows[i].inputChannel->getName().string(), + i, mWindows[i].name.string(), toString(mWindows[i].paused), toString(mWindows[i].hasFocus), toString(mWindows[i].hasWallpaper), toString(mWindows[i].visible), + toString(mWindows[i].canReceiveKeys), mWindows[i].layoutParamsFlags, mWindows[i].layoutParamsType, + mWindows[i].layer, mWindows[i].frameLeft, mWindows[i].frameTop, mWindows[i].frameRight, mWindows[i].frameBottom, mWindows[i].visibleFrameLeft, mWindows[i].visibleFrameTop, diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp index 88084c019c..783cbc4275 100644 --- a/libs/ui/InputReader.cpp +++ b/libs/ui/InputReader.cpp @@ -325,9 +325,6 @@ InputDevice* InputReader::createDevice(int32_t deviceId, const String8& name, ui if (classes & INPUT_DEVICE_CLASS_DPAD) { keyboardSources |= AINPUT_SOURCE_DPAD; } - if (classes & INPUT_DEVICE_CLASS_GAMEPAD) { - keyboardSources |= AINPUT_SOURCE_GAMEPAD; - } if (keyboardSources != 0) { device->addMapper(new KeyboardInputMapper(device, diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp index 4c402dc020..2c6346ebee 100644 --- a/libs/ui/InputTransport.cpp +++ b/libs/ui/InputTransport.cpp @@ -131,7 +131,10 @@ status_t InputChannel::openInputChannelPair(const String8& name, } status_t InputChannel::sendSignal(char signal) { - ssize_t nWrite = ::write(mSendPipeFd, & signal, 1); + ssize_t nWrite; + do { + nWrite = ::write(mSendPipeFd, & signal, 1); + } while (nWrite == -1 && errno == EINTR); if (nWrite == 1) { #if DEBUG_CHANNEL_SIGNALS @@ -147,7 +150,11 @@ status_t InputChannel::sendSignal(char signal) { } status_t InputChannel::receiveSignal(char* outSignal) { - ssize_t nRead = ::read(mReceivePipeFd, outSignal, 1); + ssize_t nRead; + do { + nRead = ::read(mReceivePipeFd, outSignal, 1); + } while (nRead == -1 && errno == EINTR); + if (nRead == 1) { #if DEBUG_CHANNEL_SIGNALS LOGD("channel '%s' ~ received signal '%c'", mName.string(), *outSignal); diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp index fd287da51f..4aa50d675f 100644 --- a/libs/utils/Looper.cpp +++ b/libs/utils/Looper.cpp @@ -162,9 +162,11 @@ int Looper::pollInner(int timeoutMillis) { struct epoll_event eventItems[EPOLL_MAX_EVENTS]; int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis); if (eventCount < 0) { - if (errno != EINTR) { - LOGW("Poll failed with an unexpected error, errno=%d", errno); + if (errno == EINTR) { + return ALOOPER_POLL_WAKE; } + + LOGW("Poll failed with an unexpected error, errno=%d", errno); return ALOOPER_POLL_ERROR; } @@ -196,7 +198,7 @@ int Looper::pollInner(int timeoutMillis) { ssize_t nRead; do { nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer)); - } while (nRead == sizeof(buffer)); + } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer)); } else { LOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); } @@ -272,7 +274,11 @@ void Looper::wake() { LOGD("%p ~ wake", this); #endif - ssize_t nWrite = write(mWakeWritePipeFd, "W", 1); + ssize_t nWrite; + do { + nWrite = write(mWakeWritePipeFd, "W", 1); + } while (nWrite == -1 && errno == EINTR); + if (nWrite != 1) { if (errno != EAGAIN) { LOGW("Could not write wake signal, errno=%d", errno); diff --git a/opengl/include/GLES/glext.h b/opengl/include/GLES/glext.h index a5b3eada3f..65ab5e40bf 100644 --- a/opengl/include/GLES/glext.h +++ b/opengl/include/GLES/glext.h @@ -211,9 +211,12 @@ typedef void* GLeglImageOES; #define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 #endif -/* GL_OES_texture_external */ -#ifndef GL_TEXTURE_EXTERNAL_OES +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external #define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 #endif /*------------------------------------------------------------------------* @@ -782,9 +785,9 @@ typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arra typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); #endif -/* GL_OES_texture_external */ -#ifndef GL_OES_texture_external -#define GL_OES_texture_external 1 +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 #endif /*------------------------------------------------------------------------* diff --git a/opengl/include/GLES2/gl2ext.h b/opengl/include/GLES2/gl2ext.h index de5d65a231..9db4e252c5 100644 --- a/opengl/include/GLES2/gl2ext.h +++ b/opengl/include/GLES2/gl2ext.h @@ -146,9 +146,12 @@ typedef void* GLeglImageOES; #define GL_INT_10_10_10_2_OES 0x8DF7 #endif -/* GL_OES_texture_external */ -#ifndef GL_TEXTURE_EXTERNAL_OES +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external #define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 #endif /*------------------------------------------------------------------------* @@ -546,9 +549,9 @@ typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); #define GL_OES_vertex_type_10_10_10_2 1 #endif -/* GL_OES_texture_external */ -#ifndef GL_OES_texture_external -#define GL_OES_texture_external 1 +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 #endif /*------------------------------------------------------------------------* diff --git a/services/surfaceflinger/GLExtensions.cpp b/services/surfaceflinger/GLExtensions.cpp index 7f4f9fc074..850866aa68 100644 --- a/services/surfaceflinger/GLExtensions.cpp +++ b/services/surfaceflinger/GLExtensions.cpp @@ -86,7 +86,7 @@ void GLExtensions::initWithGLStrings( mHaveNpot = true; } - if (hasExtension("GL_OES_texture_external")) { + if (hasExtension("GL_OES_EGL_image_external")) { mHaveTextureExternal = true; } else if (strstr(mRenderer.string(), "Adreno")) { // hack for Adreno 200 diff --git a/services/surfaceflinger/LayerBlur.cpp b/services/surfaceflinger/LayerBlur.cpp index 2ee21b92b5..4cfcfe3b43 100644 --- a/services/surfaceflinger/LayerBlur.cpp +++ b/services/surfaceflinger/LayerBlur.cpp @@ -146,7 +146,7 @@ void LayerBlur::onDraw(const Region& clip) const Region::const_iterator it = clip.begin(); Region::const_iterator const end = clip.end(); if (it != end) { -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp index a1f339e488..80cc52c42d 100644 --- a/services/surfaceflinger/LayerDim.cpp +++ b/services/surfaceflinger/LayerDim.cpp @@ -71,7 +71,7 @@ void LayerDim::onDraw(const Region& clip) const glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0, 0, 0, alpha); -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 5a27fc509b..b45f6fed16 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1003,7 +1003,7 @@ void SurfaceFlinger::drawWormhole() const glVertexPointer(2, GL_SHORT, 0, vertices); glTexCoordPointer(2, GL_SHORT, 0, tcoords); glEnableClientState(GL_TEXTURE_COORD_ARRAY); -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } diff --git a/services/surfaceflinger/TextureManager.cpp b/services/surfaceflinger/TextureManager.cpp index 76f61598b1..c9a15f56ab 100644 --- a/services/surfaceflinger/TextureManager.cpp +++ b/services/surfaceflinger/TextureManager.cpp @@ -43,7 +43,7 @@ TextureManager::TextureManager() } GLenum TextureManager::getTextureTarget(const Image* image) { -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) switch (image->target) { case Texture::TEXTURE_EXTERNAL: return GL_TEXTURE_EXTERNAL_OES; @@ -85,7 +85,7 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format) pImage->height = 0; GLenum target = GL_TEXTURE_2D; -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { if (format && isYuvFormat(format)) { target = GL_TEXTURE_EXTERNAL_OES; @@ -306,7 +306,7 @@ void TextureManager::activateTexture(const Texture& texture, bool filter) if (target == GL_TEXTURE_2D) { glBindTexture(GL_TEXTURE_2D, texture.name); glEnable(GL_TEXTURE_2D); -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } @@ -329,7 +329,7 @@ void TextureManager::activateTexture(const Texture& texture, bool filter) void TextureManager::deactivateTextures() { glDisable(GL_TEXTURE_2D); -#if defined(GL_OES_texture_external) +#if defined(GL_OES_EGL_image_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } |