Merge "Fix potential issue with the TextLayoutCache with glyphs"
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 926eb9a..e2d6179 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -20,6 +20,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
#include <gui/ISurfaceTexture.h>
@@ -61,7 +62,8 @@
// tex indicates the name OpenGL texture to which images are to be streamed.
// This texture name cannot be changed once the SurfaceTexture is created.
- SurfaceTexture(GLuint tex, bool allowSynchronousMode = true);
+ SurfaceTexture(GLuint tex, bool allowSynchronousMode = true,
+ GLenum texTarget = GL_TEXTURE_EXTERNAL_OES);
virtual ~SurfaceTexture();
@@ -458,6 +460,14 @@
// member variables are accessed.
mutable Mutex mMutex;
+ // mTexTarget is the GL texture target with which the GL texture object is
+ // associated. It is set in the constructor and never changed. It is
+ // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android
+ // Browser. In that case it is set to GL_TEXTURE_2D to allow
+ // glCopyTexSubImage to read from the texture. This is a hack to work
+ // around a GL driver limitation on the number of FBO attachments, which the
+ // browser's tile cache exceeds.
+ const GLenum mTexTarget;
};
// ----------------------------------------------------------------------------
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index dac9418..c72a45b 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -94,7 +94,8 @@
return android_atomic_inc(&globalCounter);
}
-SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) :
+SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
+ GLenum texTarget) :
mDefaultWidth(1),
mDefaultHeight(1),
mPixelFormat(PIXEL_FORMAT_RGBA_8888),
@@ -110,7 +111,8 @@
mSynchronousMode(false),
mAllowSynchronousMode(allowSynchronousMode),
mConnectedApi(NO_CONNECTED_API),
- mAbandoned(false) {
+ mAbandoned(false),
+ mTexTarget(texTarget) {
// Choose a name using the PID and a process-unique ID.
mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId());
@@ -698,9 +700,8 @@
ST_LOGW("updateTexImage: clearing GL error: %#04x", error);
}
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName);
- glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,
- (GLeglImageOES)image);
+ glBindTexture(mTexTarget, mTexName);
+ glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image);
bool failed = false;
while ((error = glGetError()) != GL_NO_ERROR) {
@@ -735,7 +736,7 @@
mDequeueCondition.signal();
} else {
// We always bind the texture even if we don't update its contents.
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName);
+ glBindTexture(mTexTarget, mTexName);
}
return OK;
@@ -761,7 +762,7 @@
}
GLenum SurfaceTexture::getCurrentTextureTarget() const {
- return GL_TEXTURE_EXTERNAL_OES;
+ return mTexTarget;
}
void SurfaceTexture::getTransformMatrix(float mtx[16]) {
diff --git a/libs/utils/Android.mk b/libs/utils/Android.mk
index e4eadbd..638f72f 100644
--- a/libs/utils/Android.mk
+++ b/libs/utils/Android.mk
@@ -100,12 +100,8 @@
LOCAL_SHARED_LIBRARIES := \
libz \
liblog \
- libcutils
-
-ifeq ($(TARGET_OS)-$(TARGET_ARCH),linux-x86)
-# This is needed on x86 to bring in dl_iterate_phdr for CallStack.cpp
-LOCAL_SHARED_LIBRARIES += libdl
-endif # linux-x86
+ libcutils \
+ libdl
LOCAL_MODULE:= libutils
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index d2bba0b..879e858 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -176,9 +176,9 @@
mList->numHwLayers, mList->flags);
result.append(buffer);
result.append(
- " type | hints | flags | tr | blend | format | source crop | frame name \n"
- "-----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n");
- // " ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____]
+ " type | handle | hints | flags | tr | blend | format | source crop | frame name \n"
+ "----------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n");
+ // " ________ | ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____]
for (size_t i=0 ; i<mList->numHwLayers ; i++) {
const hwc_layer_t& l(mList->hwLayers[i]);
const sp<LayerBase> layer(visibleLayersSortedByZ[i]);
@@ -190,9 +190,9 @@
}
}
snprintf(buffer, SIZE,
- " %8s | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n",
+ " %8s | %08x | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n",
l.compositionType ? "OVERLAY" : "FB",
- l.hints, l.flags, l.transform, l.blending, format,
+ intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, format,
l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom,
l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom,
layer->getName().string());