diff options
| -rw-r--r-- | include/ui/Rect.h | 2 | ||||
| -rw-r--r-- | include/utils/threads.h | 4 | ||||
| -rw-r--r-- | libs/gui/SurfaceTexture.cpp | 2 | ||||
| -rw-r--r-- | libs/ui/Region.cpp | 5 | ||||
| -rw-r--r-- | libs/utils/Threads.cpp | 8 | ||||
| -rw-r--r-- | opengl/libs/EGL/egl_object.h | 2 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/Android.mk | 3 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/src/dbgcontext.cpp | 24 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/src/egl.cpp | 6 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/src/header.h | 4 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/src/vertex.cpp | 19 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/test/test_main.cpp | 2 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/test/test_server.cpp | 2 | ||||
| -rw-r--r-- | opengl/libs/GLES2_dbg/test/test_socket.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 20 |
15 files changed, 59 insertions, 46 deletions
diff --git a/include/ui/Rect.h b/include/ui/Rect.h index 4e65a2d0b9..9e98bc5620 100644 --- a/include/ui/Rect.h +++ b/include/ui/Rect.h @@ -27,7 +27,7 @@ namespace android { class Rect : public ARect { public: - typedef int32_t value_type; + typedef ARect::value_type value_type; // we don't provide copy-ctor and operator= on purpose // because we want the compiler generated versions diff --git a/include/utils/threads.h b/include/utils/threads.h index c685625055..ab3e8cdb63 100644 --- a/include/utils/threads.h +++ b/include/utils/threads.h @@ -143,6 +143,10 @@ extern int androidSetThreadSchedulingGroup(pid_t tid, int grp); // in either case errno is set. Thread ID zero means current thread. extern int androidSetThreadPriority(pid_t tid, int prio); +// Get the current priority of a particular thread. Returns one of the +// ANDROID_PRIORITY constants or a negative result in case of error. +extern int androidGetThreadPriority(pid_t tid); + // Get the current scheduling group of a particular thread. Normally returns // one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT. // Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 79a01a3512..f2bc81e9a7 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -595,7 +595,7 @@ status_t SurfaceTexture::disconnect(int api) { Mutex::Autolock lock(mMutex); if (mAbandoned) { - LOGE("connect: SurfaceTexture has been abandoned!"); + LOGE("disconnect: SurfaceTexture has been abandoned!"); return NO_INIT; } diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp index a060a5f39d..8dab291b3c 100644 --- a/libs/ui/Region.cpp +++ b/libs/ui/Region.cpp @@ -479,6 +479,11 @@ void Region::boolean_operation(int op, Region& dst, const Region& lhs, const Rect& rhs, int dx, int dy) { + if (!rhs.isValid()) { + LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}", + op, rhs.left, rhs.top, rhs.right, rhs.bottom); + } + #if VALIDATE_WITH_CORECG || VALIDATE_REGIONS boolean_operation(op, dst, lhs, Region(rhs), dx, dy); #else diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index 02c380b0e5..5dbcb75b06 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -368,6 +368,14 @@ int androidSetThreadPriority(pid_t tid, int pri) return rc; } +int androidGetThreadPriority(pid_t tid) { +#if defined(HAVE_PTHREADS) + return getpriority(PRIO_PROCESS, tid); +#else + return ANDROID_PRIORITY_NORMAL; +#endif +} + int androidGetThreadSchedulingGroup(pid_t tid) { int ret = ANDROID_TGROUP_DEFAULT; diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h index d2b737897a..46f7139ad4 100644 --- a/opengl/libs/EGL/egl_object.h +++ b/opengl/libs/EGL/egl_object.h @@ -130,7 +130,7 @@ protected: if (window != NULL) { native_window_set_buffers_format(window, 0); if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) { - LOGE("EGLNativeWindowType %p disconnected failed", window); + LOGW("EGLNativeWindowType %p disconnect failed", window); } } } diff --git a/opengl/libs/GLES2_dbg/Android.mk b/opengl/libs/GLES2_dbg/Android.mk index c2b1142bc3..70853d8cff 100644 --- a/opengl/libs/GLES2_dbg/Android.mk +++ b/opengl/libs/GLES2_dbg/Android.mk @@ -31,6 +31,9 @@ ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER endif +LOCAL_CFLAGS += -DLOG_TAG=\"libGLES2_dbg\" + + # we need to access the private Bionic header <bionic_tls.h> # on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER # behavior from the bionic Android.mk file diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp index 9e77665eba..41061e1bc6 100644 --- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp +++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp @@ -30,13 +30,11 @@ DbgContext * getDbgContextThreadSpecific() { } DbgContext::DbgContext(const unsigned version, const gl_hooks_t * const hooks, - const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat, - const GLenum readType) + const unsigned MAX_VERTEX_ATTRIBS) : lzf_buf(NULL), lzf_readIndex(0), lzf_refSize(0), lzf_refBufSize(0) , version(version), hooks(hooks) , MAX_VERTEX_ATTRIBS(MAX_VERTEX_ATTRIBS) - , readFormat(readFormat), readType(readType) - , readBytesPerPixel(GetBytesPerPixel(readFormat, readType)) + , readBytesPerPixel(4) , captureSwap(0), captureDraw(0) , vertexAttribs(new VertexAttrib[MAX_VERTEX_ATTRIBS]) , hasNonVBOAttribs(false), indexBuffers(NULL), indexBuffer(NULL) @@ -67,11 +65,7 @@ DbgContext* CreateDbgContext(const unsigned version, const gl_hooks_t * const ho assert(GL_NO_ERROR == hooks->gl.glGetError()); GLint MAX_VERTEX_ATTRIBS = 0; hooks->gl.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &MAX_VERTEX_ATTRIBS); - GLint readFormat, readType; - hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat); - hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType); - DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS, readFormat, readType); - + DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS); glesv2debugger::Message msg, cmd; msg.set_context_id(reinterpret_cast<int>(dbg)); msg.set_expect_response(false); @@ -100,33 +94,31 @@ unsigned GetBytesPerPixel(const GLenum format, const GLenum type) { switch (type) { case GL_UNSIGNED_SHORT_5_6_5: - return 2; case GL_UNSIGNED_SHORT_4_4_4_4: - return 2; case GL_UNSIGNED_SHORT_5_5_5_1: return 2; case GL_UNSIGNED_BYTE: break; default: - assert(0); + LOGE("GetBytesPerPixel: unknown type %x", type); } switch (format) { case GL_ALPHA: - return 1; case GL_LUMINANCE: return 1; - break; case GL_LUMINANCE_ALPHA: return 2; case GL_RGB: return 3; case GL_RGBA: + case 0x80E1: // GL_BGRA_EXT return 4; default: - assert(0); - return 0; + LOGE("GetBytesPerPixel: unknown format %x", format); } + + return 1; // in doubt... } void DbgContext::Fetch(const unsigned index, std::string * const data) const diff --git a/opengl/libs/GLES2_dbg/src/egl.cpp b/opengl/libs/GLES2_dbg/src/egl.cpp index eb28d06076..bbea3bd557 100644 --- a/opengl/libs/GLES2_dbg/src/egl.cpp +++ b/opengl/libs/GLES2_dbg/src/egl.cpp @@ -41,11 +41,11 @@ EGLBoolean Debug_eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) void * pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] * dbg->readBytesPerPixel); dbg->hooks->gl.glReadPixels(viewport[0], viewport[1], viewport[2], - viewport[3], dbg->readFormat, dbg->readType, pixels); + viewport[3], GL_RGBA, GL_UNSIGNED_BYTE, pixels); dbg->CompressReadPixelBuffer(msg.mutable_data()); msg.set_data_type(msg.ReferencedImage); - msg.set_pixel_format(dbg->readFormat); - msg.set_pixel_type(dbg->readType); + msg.set_pixel_format(GL_RGBA); + msg.set_pixel_type(GL_UNSIGNED_BYTE); msg.set_image_width(viewport[2]); msg.set_image_height(viewport[3]); } diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h index f2b1fa6635..49f3847f5d 100644 --- a/opengl/libs/GLES2_dbg/src/header.h +++ b/opengl/libs/GLES2_dbg/src/header.h @@ -87,7 +87,6 @@ public: const unsigned int version; // 0 is GLES1, 1 is GLES2 const gl_hooks_t * const hooks; const unsigned int MAX_VERTEX_ATTRIBS; - const GLenum readFormat, readType; // implementation supported glReadPixels const unsigned int readBytesPerPixel; unsigned int captureSwap; // number of eglSwapBuffers to glReadPixels @@ -124,8 +123,7 @@ public: unsigned maxAttrib; // number of slots used by program DbgContext(const unsigned version, const gl_hooks_t * const hooks, - const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat, - const GLenum readType); + const unsigned MAX_VERTEX_ATTRIBS); ~DbgContext(); void Fetch(const unsigned index, std::string * const data) const; diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp index 029ee3bf50..28a24206d6 100644 --- a/opengl/libs/GLES2_dbg/src/vertex.cpp +++ b/opengl/libs/GLES2_dbg/src/vertex.cpp @@ -77,7 +77,7 @@ void Debug_glDrawArrays(GLenum mode, GLint first, GLsizei count) pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] * dbg->readBytesPerPixel); Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3], - dbg->readFormat, dbg->readType, pixels); + GL_RGBA, GL_UNSIGNED_BYTE, pixels); } break; case glesv2debugger::Message_Function_SKIP: @@ -134,19 +134,22 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* msg.set_arg7(dbg->maxAttrib); // indicate capturing vertex data std::string * const data = msg.mutable_data(); if (GL_UNSIGNED_BYTE == type) { - if (dbg->indexBuffer) + if (dbg->indexBuffer) { FetchIndexed(count, (unsigned char *)dbg->indexBuffer->data + (unsigned long)indices, data, dbg); - else + } else { FetchIndexed(count, (unsigned char *)indices, data, dbg); + } } else if (GL_UNSIGNED_SHORT == type) { - if (dbg->indexBuffer) + if (dbg->indexBuffer) { FetchIndexed(count, (unsigned short *)((char *)dbg->indexBuffer->data + (unsigned long)indices), data, dbg); - else + } else { FetchIndexed(count, (unsigned short *)indices, data, dbg); - } else + } + } else { assert(0); + } void * pixels = NULL; int viewport[4] = {}; @@ -174,7 +177,7 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* Send(msg, cmd); expectResponse = cmd.expect_response(); // TODO: pack glReadPixels data with vertex data instead of - // relying on sperate call for transport, this would allow + // relying on separate call for transport, this would allow // auto generated message loop using EXTEND_Debug macro if (dbg->captureDraw > 0) { dbg->captureDraw--; @@ -182,7 +185,7 @@ void Debug_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] * dbg->readBytesPerPixel); Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3], - dbg->readFormat, dbg->readType, pixels); + GL_RGBA, GL_UNSIGNED_BYTE, pixels); } break; case glesv2debugger::Message_Function_SKIP: diff --git a/opengl/libs/GLES2_dbg/test/test_main.cpp b/opengl/libs/GLES2_dbg/test/test_main.cpp index 058bea4d6f..183bf8ecb7 100644 --- a/opengl/libs/GLES2_dbg/test/test_main.cpp +++ b/opengl/libs/GLES2_dbg/test/test_main.cpp @@ -29,7 +29,7 @@ protected: gl_hooks_t hooks; DbgContextTest() - : dbg(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE) { + : dbg(1, &hooks, 32) { // You can do set-up work for each test here. hooks.gl.glGetError = GetError; } diff --git a/opengl/libs/GLES2_dbg/test/test_server.cpp b/opengl/libs/GLES2_dbg/test/test_server.cpp index bbbe913056..0ab87b08ef 100644 --- a/opengl/libs/GLES2_dbg/test/test_server.cpp +++ b/opengl/libs/GLES2_dbg/test/test_server.cpp @@ -151,7 +151,7 @@ protected: virtual void SetUp() { ServerFileTest::SetUp(); - dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE); + dbg = new DbgContext(1, &hooks, 32); ASSERT_NE((void *)NULL, dbg); for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++) ((void **)&hooks)[i] = reinterpret_cast<void *>(glNoop); diff --git a/opengl/libs/GLES2_dbg/test/test_socket.cpp b/opengl/libs/GLES2_dbg/test/test_socket.cpp index b2148acf52..9f815e211b 100644 --- a/opengl/libs/GLES2_dbg/test/test_socket.cpp +++ b/opengl/libs/GLES2_dbg/test/test_socket.cpp @@ -44,7 +44,7 @@ protected: } virtual void SetUp() { - dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE); + dbg = new DbgContext(1, &hooks, 32); ASSERT_TRUE(dbg != NULL); for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++) ((void **)&hooks)[i] = (void *)glNoop; diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index edbc7b0235..f85ce7fd09 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -404,7 +404,9 @@ bool Layer::isCropped() const { void Layer::lockPageFlip(bool& recomputeVisibleRegions) { if (mQueuedFrames > 0) { + // Capture the old state of the layer for comparisons later const bool oldOpacity = isOpaque(); + sp<GraphicBuffer> oldActiveBuffer = mActiveBuffer; // signal another event if we have more frames pending if (android_atomic_dec(&mQueuedFrames) > 1) { @@ -417,7 +419,8 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) return; } - sp<GraphicBuffer> newFrontBuffer(mSurfaceTexture->getCurrentBuffer()); + // update the active buffer + mActiveBuffer = mSurfaceTexture->getCurrentBuffer(); const Rect crop(mSurfaceTexture->getCurrentCrop()); const uint32_t transform(mSurfaceTexture->getCurrentTransform()); @@ -439,16 +442,16 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) mFlinger->invalidateHwcGeometry(); } - uint32_t bufWidth = newFrontBuffer->getWidth(); - uint32_t bufHeight = newFrontBuffer->getHeight(); - if (mActiveBuffer != NULL) { - if (bufWidth != uint32_t(mActiveBuffer->width) || - bufHeight != uint32_t(mActiveBuffer->height)) { + uint32_t bufWidth = mActiveBuffer->getWidth(); + uint32_t bufHeight = mActiveBuffer->getHeight(); + if (oldActiveBuffer != NULL) { + if (bufWidth != uint32_t(oldActiveBuffer->width) || + bufHeight != uint32_t(oldActiveBuffer->height)) { mFlinger->invalidateHwcGeometry(); } } - mCurrentOpacity = getOpacityForFormat(newFrontBuffer->format); + mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format); if (oldOpacity != isOpaque()) { recomputeVisibleRegions = true; } @@ -462,9 +465,6 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) // FIXME: mPostedDirtyRegion = dirty & bounds mPostedDirtyRegion.set(front.w, front.h); - // update active buffer - mActiveBuffer = newFrontBuffer; - if ((front.w != front.requested_w) || (front.h != front.requested_h)) { |