summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-09-20 14:45:05 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-20 14:45:05 -0700
commit21e1b14f2e48e88042654d71fe8fda591c0fe02f (patch)
tree450876b040fcb130824f579783fe649516edd4b7 /Source
parentee02939121e86a57f46474bb213a7909bdcb90ef (diff)
parentb94237ebf14cf9e894b24cfcc613960625b30494 (diff)
downloadexternal_webkit-21e1b14f2e48e88042654d71fe8fda591c0fe02f.zip
external_webkit-21e1b14f2e48e88042654d71fe8fda591c0fe02f.tar.gz
external_webkit-21e1b14f2e48e88042654d71fe8fda591c0fe02f.tar.bz2
Merge "A better CPU upload path"
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/TransferQueue.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
index 02427e4..26b20dc 100644
--- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
@@ -135,9 +135,6 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex,
GLuint srcTexId, GLenum srcTexTarget,
int index)
{
- // guarantee that we have a texture to blit into
- destTex->requireTexture();
-
// Then set up the FBO and copy the SurfTex content in.
glBindFramebuffer(GL_FRAMEBUFFER, fboID);
glFramebufferTexture2D(GL_FRAMEBUFFER,
@@ -260,7 +257,9 @@ void TransferQueue::discardQueue()
// Call on UI thread to copy from the shared Surface Texture to the BaseTile's texture.
void TransferQueue::updateDirtyBaseTiles()
{
+#if !DEBUG_TRANSFER_USING_CPU_UPLOAD
saveGLState();
+#endif
android::Mutex::Autolock lock(m_transferQueueItemLocks);
cleanupTransportQueue();
@@ -279,9 +278,9 @@ void TransferQueue::updateDirtyBaseTiles()
BaseTileTexture* destTexture = 0;
if (!obsoleteBaseTile)
destTexture = m_transferQueue[index].savedBaseTilePtr->backTexture();
-
+#if !DEBUG_TRANSFER_USING_CPU_UPLOAD
m_sharedSurfaceTexture->updateTexImage();
-
+#endif
m_transferQueue[index].savedBaseTilePtr = 0;
m_transferQueue[index].status = emptyItem;
if (obsoleteBaseTile) {
@@ -290,6 +289,9 @@ void TransferQueue::updateDirtyBaseTiles()
continue;
}
+ // guarantee that we have a texture to blit into
+ destTexture->requireTexture();
+
#if DEBUG_TRANSFER_USING_CPU_UPLOAD
// Here we just need to upload the bitmap content to the GL Texture
GLUtils::updateTextureWithBitmap(destTexture->m_ownTextureId, 0, 0,
@@ -317,7 +319,9 @@ void TransferQueue::updateDirtyBaseTiles()
index = (index + 1) % ST_BUFFER_NUMBER;
}
+#if !DEBUG_TRANSFER_USING_CPU_UPLOAD
restoreGLState();
+#endif
m_emptyItemCount = ST_BUFFER_NUMBER;
m_transferQueueItemCond.signal();
@@ -334,7 +338,7 @@ void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo,
renderInfo->x, renderInfo->y);
return;
}
-
+#if !DEBUG_TRANSFER_USING_CPU_UPLOAD
// a) Dequeue the Surface Texture and write into the buffer
if (!m_ANW.get()) {
XLOG("ERROR: ANW is null");
@@ -370,6 +374,7 @@ void TransferQueue::updateQueueWithBitmap(const TileRenderInfo* renderInfo,
}
ANativeWindow_unlockAndPost(m_ANW.get());
+#endif
m_transferQueueItemLocks.lock();
// b) After update the Surface Texture, now udpate the transfer queue info.
addItemInTransferQueue(renderInfo);
@@ -417,8 +422,9 @@ void TransferQueue::cleanupTransportQueue()
for (int i = 0 ; i < ST_BUFFER_NUMBER; i++) {
if (m_transferQueue[index].status == pendingDiscard) {
+#if !DEBUG_TRANSFER_USING_CPU_UPLOAD
m_sharedSurfaceTexture->updateTexImage();
-
+#endif
m_transferQueue[index].savedBaseTilePtr = 0;
m_transferQueue[index].status = emptyItem;
}