diff options
author | Chris Craik <ccraik@google.com> | 2012-03-07 17:06:45 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2012-03-08 17:23:21 -0800 |
commit | f8f42bbda64a56cfd5ab48a274020d4efc9a5594 (patch) | |
tree | da8491da5d178ea70d78f5ba27c56e9bdf786a39 /Source | |
parent | ddacf299acbe17093f175cec8d86088ea3472793 (diff) | |
download | external_webkit-f8f42bbda64a56cfd5ab48a274020d4efc9a5594.zip external_webkit-f8f42bbda64a56cfd5ab48a274020d4efc9a5594.tar.gz external_webkit-f8f42bbda64a56cfd5ab48a274020d4efc9a5594.tar.bz2 |
remove TextureTileInfo and readyfor check
These checks are obsolete, as texture/tile stealing both occur on the UI thread,
and detach textures from tiles.
Change-Id: I6d906217ee8954ac04b95f94a4516fd4dfbbb3b0
Diffstat (limited to 'Source')
5 files changed, 12 insertions, 114 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp index 7466d64..ae4fb9d 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp @@ -255,11 +255,7 @@ void BaseTile::drawGL(float opacity, const SkRect& rect, float scale, if (!isTexturePainted) return; - if (m_frontTexture->readyFor(this)) - m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform); - else { - XLOG("tile %p at %d, %d not readyfor (at draw),", this, m_x, m_y); - } + m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform); } bool BaseTile::isTileReady() @@ -280,14 +276,7 @@ bool BaseTile::isTileReady() if (m_state != ReadyToSwap && m_state != UpToDate) return false; - bool ready = texture->readyFor(this); - - if (ready) - return true; - - XLOG("tile %p at %d, %d not readyfor (at isTileReady)", this, m_x, m_y); - - return false; + return true; } bool BaseTile::intersectWithRect(int x, int y, int tileWidth, int tileHeight, diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp index 955d6dd..9403584 100644 --- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp @@ -120,54 +120,13 @@ bool BaseTileTexture::release(TextureOwner* owner) return true; } -float BaseTileTexture::scale() +void BaseTileTexture::transferComplete() { - TextureTileInfo* textureInfo = &m_ownTextureTileInfo; - return textureInfo->m_scale; -} - -// This function + TilesManager::addItemInTransferQueue() is replacing the -// setTile(). -void BaseTileTexture::setOwnTextureTileInfoFromQueue(const TextureTileInfo* info) -{ - m_ownTextureTileInfo.m_x = info->m_x; - m_ownTextureTileInfo.m_y = info->m_y; - m_ownTextureTileInfo.m_scale = info->m_scale; - m_ownTextureTileInfo.m_painter = info->m_painter; - m_ownTextureTileInfo.m_picture = info->m_picture; - m_ownTextureTileInfo.m_inverted = TilesManager::instance()->invertedScreen(); if (m_owner) { BaseTile* owner = static_cast<BaseTile*>(m_owner); owner->backTextureTransfer(); - } - -} - -bool BaseTileTexture::readyFor(BaseTile* baseTile) -{ - const TextureTileInfo* info = &m_ownTextureTileInfo; - - if (isPureColor() && info->m_painter == baseTile->painter()) { - XLOG("ReadyFor saw a pureColor tile (%p) at (%d, %d), rgb %x", - this, baseTile->x(), baseTile->y(), pureColor().rgb()); - return true; - } - - if (!info->m_painter || !baseTile->painter()) - return false; - - if (info && - (info->m_x == baseTile->x()) && - (info->m_y == baseTile->y()) && - (info->m_scale == baseTile->scale()) && - (info->m_inverted == TilesManager::instance()->invertedScreen())) - return true; - - XLOG("texture %p readyFor return false for tile x, y (%d %d) texId %d ," - " BaseTileTexture %p, BaseTile is %p, SCALE %f, painter %p, inv %d", - this, baseTile->x(), baseTile->y(), m_ownTextureId, this, baseTile, - baseTile->scale(), baseTile->painter(), TilesManager::instance()->invertedScreen()); - return false; + } else + XLOGC("ERROR: owner missing after transfer of texture %p", this); } void BaseTileTexture::drawGL(bool isLayer, const SkRect& rect, float opacity, diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.h b/Source/WebCore/platform/graphics/android/BaseTileTexture.h index 3e4f872..321ca31 100644 --- a/Source/WebCore/platform/graphics/android/BaseTileTexture.h +++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.h @@ -39,30 +39,6 @@ namespace WebCore { class BaseTile; -class TextureTileInfo { -public: - TextureTileInfo() - : m_x(-1) - , m_y(-1) - , m_layerId(-1) - , m_scale(0) - , m_texture(0) - , m_painter(0) - , m_picture(0) - , m_inverted(false) - { - } - int m_x; - int m_y; - int m_layerId; - float m_scale; - TextureInfo* m_texture; - TilePainter* m_painter; - unsigned int m_picture; - bool m_inverted; - IntRect m_inval; -}; - class BaseTileTexture { public: // This object is to be constructed on the consumer's thread and must have @@ -92,7 +68,7 @@ public: void requireGLTexture(); void discardGLTexture(); - void setOwnTextureTileInfoFromQueue(const TextureTileInfo* info); + void transferComplete(); TextureInfo* getTextureInfo() { return &m_ownTextureInfo; } @@ -106,8 +82,6 @@ public: void drawGL(bool isLayer, const SkRect& rect, float opacity, const TransformationMatrix* transform); private: - TextureTileInfo m_ownTextureTileInfo; - // TODO: Merge this info into the TextureTileInfo. TextureInfo m_ownTextureInfo; SkSize m_size; SkBitmap::Config m_config; diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index 8ad9119..0002c2c 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -152,15 +152,6 @@ bool TransferQueue::checkObsolete(const TileTransferData* data) return true; } - const TextureTileInfo* tileInfo = &(data->tileInfo); - - if (tileInfo->m_x != baseTilePtr->x() - || tileInfo->m_y != baseTilePtr->y() - || tileInfo->m_scale != baseTilePtr->scale()) { - XLOG("Mismatching x, y, scale or painter , such that the tile is obsolete"); - return true; - } - return false; } @@ -176,7 +167,7 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, int textureWidth = destTex->getSize().width(); int textureHeight = destTex->getSize().height(); - IntRect inval = m_transferQueue[index].tileInfo.m_inval; + IntRect inval = m_transferQueue[index].invalRect; bool partialInval = !inval.isEmpty(); if (partialInval && frontTex) { @@ -352,7 +343,7 @@ void TransferQueue::updatePureColorTiles() if (!obsoleteBaseTile) { destTexture = data->savedBaseTilePtr->backTexture(); destTexture->setPureColor(data->pureColor); - destTexture->setOwnTextureTileInfoFromQueue(&data->tileInfo); + destTexture->transferComplete(); } } else if (data->status == emptyItem || data->status == pendingDiscard) { // The queue should be clear instead of setting to different status. @@ -413,7 +404,7 @@ void TransferQueue::updateDirtyBaseTiles() // Here we just need to upload the bitmap content to the GL Texture GLUtils::updateTextureWithBitmap(destTexture->m_ownTextureId, *m_transferQueue[index].bitmap, - m_transferQueue[index].tileInfo.m_inval); + m_transferQueue[index].invalRect); } else { if (!usedFboForUpload) { saveGLState(); @@ -425,13 +416,8 @@ void TransferQueue::updateDirtyBaseTiles() index); } - // After the base tile copied into the GL texture, we need to - // update the texture's info such that at draw time, readyFor - // will find the latest texture's info - // We don't need a map any more, each texture contains its own - // texturesTileInfo. destTexture->setPure(false); - destTexture->setOwnTextureTileInfoFromQueue(&m_transferQueue[index].tileInfo); + destTexture->transferComplete(); XLOG("Blit tile x, y %d %d with dest texture %p to destTexture->m_ownTextureId %d", m_transferQueue[index].tileInfo.m_x, @@ -548,9 +534,6 @@ void TransferQueue::addItemCommon(const TileRenderInfo* renderInfo, data->status = pendingBlit; data->uploadType = type; - // Now fill the tileInfo. - TextureTileInfo* textureInfo = &(data->tileInfo); - IntRect inval(0, 0, 0, 0); if (renderInfo->invalRect) { inval.setX(renderInfo->invalRect->fLeft); @@ -558,14 +541,7 @@ void TransferQueue::addItemCommon(const TileRenderInfo* renderInfo, inval.setWidth(renderInfo->invalRect->width()); inval.setHeight(renderInfo->invalRect->height()); } - textureInfo->m_inval = inval; - - textureInfo->m_x = renderInfo->x; - textureInfo->m_y = renderInfo->y; - textureInfo->m_scale = renderInfo->scale; - textureInfo->m_painter = renderInfo->tilePainter; - - textureInfo->m_picture = renderInfo->textureInfo->m_pictureCount; + data->invalRect = inval; } // Note that there should be lock/unlock around this function call. diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.h b/Source/WebCore/platform/graphics/android/TransferQueue.h index 5dd2e0a..b864085 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.h +++ b/Source/WebCore/platform/graphics/android/TransferQueue.h @@ -87,7 +87,7 @@ public: TransferItemStatus status; BaseTile* savedBaseTilePtr; BaseTileTexture* savedBaseTileTexturePtr; - TextureTileInfo tileInfo; + IntRect invalRect; TextureUploadType uploadType; // This is only useful in Cpu upload code path, so it will be dynamically // lazily allocated. |