зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1145764 - Add logging for tile retention inside a TiledLayerBuffer. r=nical
This commit is contained in:
Родитель
80dc89efcd
Коммит
0e43c5e14d
|
@ -8,10 +8,12 @@
|
|||
// Debug defines
|
||||
//#define GFX_TILEDLAYER_DEBUG_OVERLAY
|
||||
//#define GFX_TILEDLAYER_PREF_WARNINGS
|
||||
//#define GFX_TILEDLAYER_RETAINING_LOG
|
||||
|
||||
#include <stdint.h> // for uint16_t, uint32_t
|
||||
#include <sys/types.h> // for int32_t
|
||||
#include "gfxPlatform.h" // for GetTileWidth/GetTileHeight
|
||||
#include "LayersLogging.h" // for print_stderr
|
||||
#include "mozilla/gfx/Logging.h" // for gfxCriticalError
|
||||
#include "nsDebug.h" // for NS_ASSERTION
|
||||
#include "nsPoint.h" // for nsIntPoint
|
||||
|
@ -327,6 +329,22 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
const nsIntRegion& oldValidRegion = mValidRegion;
|
||||
const int oldRetainedHeight = mRetainedHeight;
|
||||
|
||||
#ifdef GFX_TILEDLAYER_RETAINING_LOG
|
||||
{ // scope ss
|
||||
std::stringstream ss;
|
||||
ss << "TiledLayerBuffer " << this << " starting update"
|
||||
<< " on bounds ";
|
||||
AppendToString(ss, newBound);
|
||||
ss << " with mResolution=" << mResolution << "\n";
|
||||
for (size_t i = 0; i < mRetainedTiles.Length(); i++) {
|
||||
ss << "mRetainedTiles[" << i << "] = ";
|
||||
mRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
print_stderr(ss);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Pass 1: Recycle valid content from the old buffer
|
||||
// Recycle tiles from the old buffer that contain valid regions.
|
||||
// Insert placeholders tiles if we have no valid area for that tile
|
||||
|
@ -396,6 +414,21 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
mRetainedWidth = tileX;
|
||||
mRetainedHeight = tileY;
|
||||
|
||||
#ifdef GFX_TILEDLAYER_RETAINING_LOG
|
||||
{ // scope ss
|
||||
std::stringstream ss;
|
||||
ss << "TiledLayerBuffer " << this << " finished pass 1 of update;"
|
||||
<< " tilesMissing=" << tilesMissing << "\n";
|
||||
for (size_t i = 0; i < oldRetainedTiles.Length(); i++) {
|
||||
ss << "oldRetainedTiles[" << i << "] = ";
|
||||
oldRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
print_stderr(ss);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Pass 1.5: Release excess tiles in oldRetainedTiles
|
||||
// Tiles in oldRetainedTiles that aren't in newRetainedTiles will be recycled
|
||||
// before creating new ones, but there could still be excess unnecessary
|
||||
|
@ -436,6 +469,24 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
|
||||
nsIntRegion regionToPaint(aPaintRegion);
|
||||
|
||||
#ifdef GFX_TILEDLAYER_RETAINING_LOG
|
||||
{ // scope ss
|
||||
std::stringstream ss;
|
||||
ss << "TiledLayerBuffer " << this << " finished pass 1.5 of update\n";
|
||||
for (size_t i = 0; i < oldRetainedTiles.Length(); i++) {
|
||||
ss << "oldRetainedTiles[" << i << "] = ";
|
||||
oldRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
for (size_t i = 0; i < newRetainedTiles.Length(); i++) {
|
||||
ss << "newRetainedTiles[" << i << "] = ";
|
||||
newRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
print_stderr(ss);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Pass 2: Validate
|
||||
// We know at this point that any tile in the new buffer that had valid content
|
||||
// from the previous buffer is placed correctly in the new buffer.
|
||||
|
@ -530,6 +581,25 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
AsDerived().UnlockTile(newRetainedTiles[i]);
|
||||
}
|
||||
|
||||
#ifdef GFX_TILEDLAYER_RETAINING_LOG
|
||||
{ // scope ss
|
||||
std::stringstream ss;
|
||||
ss << "TiledLayerBuffer " << this << " finished pass 2 of update;"
|
||||
<< " oldTileCount=" << oldTileCount << "\n";
|
||||
for (size_t i = 0; i < oldRetainedTiles.Length(); i++) {
|
||||
ss << "oldRetainedTiles[" << i << "] = ";
|
||||
oldRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
for (size_t i = 0; i < newRetainedTiles.Length(); i++) {
|
||||
ss << "newRetainedTiles[" << i << "] = ";
|
||||
newRetainedTiles[i].Dump(ss);
|
||||
ss << "\n";
|
||||
}
|
||||
print_stderr(ss);
|
||||
}
|
||||
#endif
|
||||
|
||||
// At this point, oldTileCount should be zero
|
||||
MOZ_ASSERT(oldTileCount == 0, "Failed to release old tiles");
|
||||
|
||||
|
|
|
@ -540,6 +540,18 @@ TileClient::operator=(const TileClient& o)
|
|||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
TileClient::Dump(std::stringstream& aStream)
|
||||
{
|
||||
aStream << "TileClient(bb=" << (TextureClient*)mBackBuffer << " fb=" << mFrontBuffer.get();
|
||||
if (mBackBufferOnWhite) {
|
||||
aStream << " bbow=" << mBackBufferOnWhite.get();
|
||||
}
|
||||
if (mFrontBufferOnWhite) {
|
||||
aStream << " fbow=" << mFrontBufferOnWhite.get();
|
||||
}
|
||||
aStream << ")";
|
||||
}
|
||||
|
||||
void
|
||||
TileClient::Flip()
|
||||
|
|
|
@ -213,6 +213,11 @@ struct TileClient
|
|||
|
||||
TileDescriptor GetTileDescriptor();
|
||||
|
||||
/**
|
||||
* For debugging.
|
||||
*/
|
||||
void Dump(std::stringstream& aStream);
|
||||
|
||||
/**
|
||||
* Swaps the front and back buffers.
|
||||
*/
|
||||
|
|
|
@ -106,6 +106,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void Dump(std::stringstream& aStream) {
|
||||
aStream << "TileHost(...)"; // fill in as needed
|
||||
}
|
||||
|
||||
void DumpTexture(std::stringstream& aStream) {
|
||||
// TODO We should combine the OnWhite/OnBlack here an just output a single image.
|
||||
CompositableHost::DumpTextureHost(aStream, mTextureHost);
|
||||
|
|
Загрузка…
Ссылка в новой задаче