summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/GLUtils.cpp15
-rw-r--r--Source/WebCore/platform/graphics/android/GLUtils.h2
-rw-r--r--Source/WebCore/platform/graphics/android/MediaTexture.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/TexturesGenerator.cpp14
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.h27
-rw-r--r--Source/WebCore/platform/graphics/android/TransferQueue.cpp21
-rw-r--r--Source/WebCore/platform/graphics/android/TransferQueue.h27
-rw-r--r--Source/WebCore/rendering/RenderLayerCompositor.cpp24
8 files changed, 86 insertions, 47 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLUtils.cpp b/Source/WebCore/platform/graphics/android/GLUtils.cpp
index 039896e..d1fe51a 100644
--- a/Source/WebCore/platform/graphics/android/GLUtils.cpp
+++ b/Source/WebCore/platform/graphics/android/GLUtils.cpp
@@ -562,21 +562,6 @@ void GLUtils::createTextureFromEGLImage(GLuint texture, EGLImageKHR image, GLint
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
}
-GLenum GLUtils::getTextureTarget(android::SurfaceTexture* surfaceTexture)
-{
-#if DEPRECATED_SURFACE_TEXTURE_MODE
- if (surfaceTexture) {
- GLenum target = surfaceTexture->getCurrentTextureTarget();
- // TODO: remove this translation when TEXTURE_2D+RGBA surface texture
- // support is deprecated.
- if (target == GL_TEXTURE_2D)
- return 0;
- return target;
- }
-#endif
- return GL_TEXTURE_2D;
-}
-
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/android/GLUtils.h b/Source/WebCore/platform/graphics/android/GLUtils.h
index 67ff77a..b952513 100644
--- a/Source/WebCore/platform/graphics/android/GLUtils.h
+++ b/Source/WebCore/platform/graphics/android/GLUtils.h
@@ -83,8 +83,6 @@ public:
static void updateSurfaceTextureWithBitmap(const TileRenderInfo* , int x, int y, const SkBitmap& bitmap, GLint filter = GL_LINEAR);
#endif
static void updateSharedSurfaceTextureWithBitmap(const TileRenderInfo* , int x, int y, const SkBitmap& bitmap);
-
- static GLenum getTextureTarget(android::SurfaceTexture*);
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
index a653d6e..3fecfb5 100644
--- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
@@ -105,10 +105,9 @@ void MediaTexture::drawContent(const TransformationMatrix& matrix)
m_surfaceTexture->updateTexImage();
bool forceBlending = ANativeWindow_getFormat(m_surfaceTextureClient.get()) == WINDOW_FORMAT_RGB_565;
- GLenum target = GLUtils::getTextureTarget(m_surfaceTexture.get());
TilesManager::instance()->shader()->drawLayerQuad(matrix, m_dimensions,
m_textureId, 1.0f,
- forceBlending, target);
+ forceBlending, GL_TEXTURE_EXTERNAL_OES);
}
void MediaTexture::drawVideo(const TransformationMatrix& matrix, const SkRect& parentBounds)
diff --git a/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp b/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp
index 704b7d0..9780336 100644
--- a/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp
+++ b/Source/WebCore/platform/graphics/android/TexturesGenerator.cpp
@@ -98,8 +98,19 @@ void TexturesGenerator::removeOperationsForFilter(OperationFilter* filter, bool
if (waitForRunning && m_currentOperation) {
QueuedOperation* operation = m_currentOperation;
- if (operation && filter->check(operation))
+
+ if (operation && filter->check(operation)) {
m_waitForCompletion = true;
+ // The reason we are signaling the transferQueue is :
+ // TransferQueue may be waiting a slot to work on, but now UI
+ // thread is waiting for Tex Gen thread to finish first before the
+ // UI thread can free a slot for the transferQueue.
+ // Therefore, it could be a deadlock.
+ // The solution is use this as a flag to tell Tex Gen thread that
+ // UI thread is waiting now, Tex Gen thread should not wait for the
+ // queue any more.
+ TilesManager::instance()->transferQueue()->interruptTransferQueue(true);
+ }
delete filter;
@@ -185,6 +196,7 @@ bool TexturesGenerator::threadLoop()
stop = true;
if (m_waitForCompletion) {
m_waitForCompletion = false;
+ TilesManager::instance()->transferQueue()->interruptTransferQueue(false);
mRequestedOperationsCond.signal();
}
mRequestedOperationsLock.unlock();
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h
index e884fc0..3541422 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/TilesManager.h
@@ -120,39 +120,48 @@ public:
void allocateTiles();
- void setExpandedTileBounds(bool enabled) {
+ void setExpandedTileBounds(bool enabled)
+ {
m_expandedTileBounds = enabled;
}
- bool getShowVisualIndicator() {
+ bool getShowVisualIndicator()
+ {
return m_showVisualIndicator;
}
- void setShowVisualIndicator(bool showVisualIndicator) {
+ void setShowVisualIndicator(bool showVisualIndicator)
+ {
m_showVisualIndicator = showVisualIndicator;
}
- SharedTextureMode getSharedTextureMode() {
+ SharedTextureMode getSharedTextureMode()
+ {
return SurfaceTextureMode;
}
- TilesProfiler* getProfiler() {
+ TilesProfiler* getProfiler()
+ {
return &m_profiler;
}
- TilesTracker* getTilesTracker() {
+ TilesTracker* getTilesTracker()
+ {
return &m_tilesTracker;
}
- bool invertedScreen() {
+ bool invertedScreen()
+ {
return m_invertedScreen;
}
- void setInvertedScreen(bool invert) {
+ void setInvertedScreen(bool invert)
+ {
m_invertedScreen = invert;
}
- void setInvertedScreenContrast(float contrast) {
+ void setInvertedScreenContrast(float contrast)
+ {
m_shader.setContrast(contrast);
}
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
index ae94b2e..a4fd594 100644
--- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
@@ -158,21 +158,38 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, GL
glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO
// Add a sync point here to WAR a driver bug.
- glViewport(0,0,0,0);
+ glViewport(0, 0, 0, 0);
TilesManager::instance()->shader()->drawQuad(rect, destTex->m_ownTextureId,
1.0, GL_TEXTURE_2D);
GLUtils::checkGlError("copy the surface texture into the normal one");
}
+void TransferQueue::interruptTransferQueue(bool interrupt)
+{
+ m_transferQueueItemLocks.lock();
+ m_interruptedByRemovingOp = interrupt;
+ if (m_interruptedByRemovingOp)
+ m_transferQueueItemCond.signal();
+ m_transferQueueItemLocks.unlock();
+}
+
+// This function must be called inside the m_transferQueueItemLocks, for the
+// wait, m_interruptedByRemovingOp and getHasGLContext().
+// Only called by updateQueueWithBitmap() for now.
bool TransferQueue::readyForUpdate()
{
if (!getHasGLContext())
return false;
// Don't use a while loop since when the WebView tear down, the emptyCount
// will still be 0, and we bailed out b/c of GL context lost.
- if (!m_emptyItemCount)
+ if (!m_emptyItemCount) {
+ if (m_interruptedByRemovingOp)
+ return false;
m_transferQueueItemCond.wait(m_transferQueueItemLocks);
+ if (m_interruptedByRemovingOp)
+ return false;
+ }
if (!getHasGLContext())
return false;
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.h b/Source/WebCore/platform/graphics/android/TransferQueue.h
index 8d9df68..550623e 100644
--- a/Source/WebCore/platform/graphics/android/TransferQueue.h
+++ b/Source/WebCore/platform/graphics/android/TransferQueue.h
@@ -62,21 +62,11 @@ public:
// The lock will be done when returning true.
bool readyForUpdate();
+ void interruptTransferQueue(bool);
// This queue can be accessed from UI and TexGen thread, therefore, we need
// a lock to protect its access
TileTransferData* m_transferQueue;
- // We are using wait/signal to handle our own queue sync.
- // First of all, if we don't have our own lock, then while WebView is
- // destroyed, the UI thread will wait for the Tex Gen to get out from
- // dequeue operation, which will not succeed. B/c at this moment, we
- // already lost the GL Context.
- // Now we maintain a counter, which is m_emptyItemCount. When this reach
- // 0, then we need the Tex Gen thread to wait. UI thread can signal this
- // wait after calling updateTexImage at the draw call , or after WebView
- // is destroyed.
- android::Mutex m_transferQueueItemLocks;
-
sp<ANativeWindow> m_ANW;
private:
@@ -114,8 +104,21 @@ private:
GLState m_GLStateBeforeBlit;
sp<android::SurfaceTexture> m_sharedSurfaceTexture;
- android::Condition m_transferQueueItemCond;
int m_emptyItemCount;
+
+ bool m_interruptedByRemovingOp;
+
+ // We are using wait/signal to handle our own queue sync.
+ // First of all, if we don't have our own lock, then while WebView is
+ // destroyed, the UI thread will wait for the Tex Gen to get out from
+ // dequeue operation, which will not succeed. B/c at this moment, we
+ // already lost the GL Context.
+ // Now we maintain a counter, which is m_emptyItemCount. When this reach
+ // 0, then we need the Tex Gen thread to wait. UI thread can signal this
+ // wait after calling updateTexImage at the draw call , or after WebView
+ // is destroyed.
+ android::Mutex m_transferQueueItemLocks;
+ android::Condition m_transferQueueItemCond;
};
} // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp
index 8d066e9..2f344b9 100644
--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp
@@ -79,6 +79,7 @@ struct CompositingState {
, m_subtreeIsCompositing(false)
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
, m_fixedSibling(false)
+ , m_hasFixedElement(false)
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
, m_hasScrollableElement(false)
@@ -93,6 +94,7 @@ struct CompositingState {
bool m_subtreeIsCompositing;
#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
bool m_fixedSibling;
+ bool m_hasFixedElement;
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
bool m_hasScrollableElement;
@@ -625,9 +627,15 @@ bool RenderLayerCompositor::checkForFixedLayers(Vector<RenderLayer*>* list, bool
haveFixedLayer = j;
fixedSibling = true;
}
+ IntRect currentLayerBounds = currentLayer->renderer()->localToAbsoluteQuad(
+ FloatRect(currentLayer->localBoundingBox())).enclosingBoundingBox();
+ if ((currentLayerBounds.width() <= 1
+ || currentLayerBounds.height() <= 1)
+ && haveFixedLayer == j) {
+ haveFixedLayer = -1;
+ fixedSibling = false;
+ }
if (haveFixedLayer != -1 && haveFixedLayer != j) {
- IntRect currentLayerBounds = currentLayer->renderer()->localToAbsoluteQuad(
- FloatRect(currentLayer->localBoundingBox())).enclosingBoundingBox();
bool needComposite = true;
int stop = 0;
if (stopAtFixedLayer)
@@ -709,12 +717,16 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (layer->hasOverflowScroll())
compositingState.m_hasScrollableElement = true;
#endif
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ if (layer->isFixed())
+ compositingState.m_hasFixedElement = true;
+#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
// we don't want to signal that the subtree is compositing if the reason
// is because the layer is an overflow layer -- doing so would trigger
// all the above layers to be composited unnecessarily
- if (willBeComposited && !layer->hasOverflowScroll()) {
+ if (willBeComposited && !layer->hasOverflowScroll() && !layer->isFixed()) {
#else
if (willBeComposited) {
#endif
@@ -816,6 +828,10 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
if (childState.m_subtreeIsCompositing)
compositingState.m_subtreeIsCompositing = true;
+#if ENABLE(COMPOSITED_FIXED_ELEMENTS)
+ if (childState.m_hasFixedElement)
+ compositingState.m_hasFixedElement = true;
+#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
if (childState.m_hasScrollableElement)
compositingState.m_hasScrollableElement = true;
@@ -837,7 +853,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
// We also need to check that we don't have a scrollable layer, as this
// would not have set the m_subtreeIsCompositing flag
- if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !childState.m_hasScrollableElement && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
+ if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !childState.m_hasScrollableElement && !childState.m_hasFixedElement && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
#else
if (layer->isRootLayer() && !childState.m_subtreeIsCompositing && !requiresCompositingLayer(layer) && !m_forceCompositingMode) {
#endif