зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1112476
- Support dumping texture data on the ClientLayerManager. r=mstange
--HG-- extra : rebase_source : 5d5cf3372993ca4af78e12236fc64836a56eff4b
This commit is contained in:
Родитель
2e80a88820
Коммит
d74cb4fa05
|
@ -176,6 +176,8 @@ public:
|
|||
Iterator TilesBegin() { return mRetainedTiles.Elements(); }
|
||||
Iterator TilesEnd() { return mRetainedTiles.Elements() + mRetainedTiles.Length(); }
|
||||
|
||||
void Dump(std::stringstream& aStream, const char* aPrefix, bool aDumpHtml);
|
||||
|
||||
protected:
|
||||
// The implementor should call Update() to change
|
||||
// the new valid region. This implementation will call
|
||||
|
@ -307,6 +309,38 @@ TiledLayerBuffer<Derived, Tile>::RemoveTile(int x, int y, Tile& aRemovedTile)
|
|||
return false;
|
||||
}
|
||||
|
||||
template<typename Derived, typename Tile> void
|
||||
TiledLayerBuffer<Derived, Tile>::Dump(std::stringstream& aStream,
|
||||
const char* aPrefix,
|
||||
bool aDumpHtml)
|
||||
{
|
||||
nsIntRect visibleRect = GetValidRegion().GetBounds();
|
||||
gfx::IntSize scaledTileSize = GetScaledTileSize();
|
||||
for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
|
||||
int32_t tileStartX = GetTileStart(x, scaledTileSize.width);
|
||||
int32_t w = scaledTileSize.width - tileStartX;
|
||||
|
||||
for (int32_t y = visibleRect.y; y < visibleRect.y + visibleRect.height;) {
|
||||
int32_t tileStartY = GetTileStart(y, scaledTileSize.height);
|
||||
Tile tileTexture =
|
||||
GetTile(nsIntPoint(RoundDownToTileEdge(x, scaledTileSize.width),
|
||||
RoundDownToTileEdge(y, scaledTileSize.height)));
|
||||
int32_t h = scaledTileSize.height - tileStartY;
|
||||
|
||||
aStream << "\n" << aPrefix << "Tile (x=" <<
|
||||
RoundDownToTileEdge(x, scaledTileSize.width) << ", y=" <<
|
||||
RoundDownToTileEdge(y, scaledTileSize.height) << "): ";
|
||||
if (tileTexture != AsDerived().GetPlaceholderTile()) {
|
||||
tileTexture.DumpTexture(aStream);
|
||||
} else {
|
||||
aStream << "empty tile";
|
||||
}
|
||||
y += h;
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Derived, typename Tile> void
|
||||
TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
|
||||
const nsIntRegion& aPaintRegion)
|
||||
|
|
|
@ -176,6 +176,17 @@ ClientLayerManager::CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ClientPaintedLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
PaintedLayer::PrintInfo(aStream, aPrefix);
|
||||
if (mContentClient) {
|
||||
aStream << "\n";
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
mContentClient->PrintInfo(aStream, pfx.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,9 @@ public:
|
|||
|
||||
protected:
|
||||
void PaintThebes();
|
||||
|
||||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
|
||||
|
||||
void DestroyBackBuffer()
|
||||
{
|
||||
mContentClient = nullptr;
|
||||
|
|
|
@ -470,5 +470,17 @@ ClientTiledPaintedLayer::RenderLayer()
|
|||
EndPaint();
|
||||
}
|
||||
|
||||
void
|
||||
ClientTiledPaintedLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
PaintedLayer::PrintInfo(aStream, aPrefix);
|
||||
if (mContentClient) {
|
||||
aStream << "\n";
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
mContentClient->PrintInfo(aStream, pfx.get());
|
||||
}
|
||||
}
|
||||
|
||||
} // mozilla
|
||||
} // layers
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
protected:
|
||||
~ClientTiledPaintedLayer();
|
||||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// Override name to distinguish it from ClientPaintedLayer in layer dumps
|
||||
virtual const char* Name() const { return "TiledPaintedLayer"; }
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/layers/TextureD3D11.h"
|
||||
#include "mozilla/layers/TextureD3D9.h"
|
||||
#endif
|
||||
#include "gfxUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -258,5 +259,18 @@ CompositableClient::GetTextureClientRecycler()
|
|||
return mTextureClientRecycler;
|
||||
}
|
||||
|
||||
void
|
||||
CompositableClient::DumpTextureClient(std::stringstream& aStream, TextureClient* aTexture)
|
||||
{
|
||||
if (!aTexture) {
|
||||
return;
|
||||
}
|
||||
RefPtr<gfx::DataSourceSurface> dSurf = aTexture->GetAsSurface();
|
||||
if (!dSurf) {
|
||||
return;
|
||||
}
|
||||
aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -232,6 +232,7 @@ public:
|
|||
|
||||
TextureClientRecycleAllocator* GetTextureClientRecycler();
|
||||
|
||||
static void DumpTextureClient(std::stringstream& aStream, TextureClient* aTexture);
|
||||
protected:
|
||||
CompositableChild* mCompositableChild;
|
||||
CompositableForwarder* mForwarder;
|
||||
|
|
|
@ -118,6 +118,20 @@ ContentClient::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
|
|||
OnTransaction();
|
||||
}
|
||||
|
||||
void
|
||||
ContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
aStream << aPrefix;
|
||||
aStream << nsPrintfCString("ContentClient (0x%p)", this).get();
|
||||
|
||||
if (profiler_feature_active("displaylistdump")) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
||||
Dump(aStream, pfx.get(), false);
|
||||
}
|
||||
}
|
||||
|
||||
// We pass a null pointer for the ContentClient Forwarder argument, which means
|
||||
// this client will not have a ContentHost on the other side.
|
||||
ContentClientBasic::ContentClientBasic()
|
||||
|
@ -401,6 +415,15 @@ ContentClientRemoteBuffer::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion)
|
|||
mFrontAndBackBufferDiffer = true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientRemoteBuffer::Dump(std::stringstream& aStream,
|
||||
const char* aPrefix,
|
||||
bool aDumpHtml)
|
||||
{
|
||||
// TODO We should combine the OnWhite/OnBlack here an just output a single image.
|
||||
CompositableClient::DumpTextureClient(aStream, mTextureClient);
|
||||
}
|
||||
|
||||
void
|
||||
ContentClientDoubleBuffered::DestroyFrontBuffer()
|
||||
{
|
||||
|
|
|
@ -89,6 +89,11 @@ public:
|
|||
virtual ~ContentClient()
|
||||
{}
|
||||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
||||
|
||||
virtual void Dump(std::stringstream& aStream,
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false) {};
|
||||
|
||||
virtual void Clear() = 0;
|
||||
virtual RotatedContentBuffer::PaintState BeginPaintBuffer(PaintedLayer* aLayer,
|
||||
|
@ -208,6 +213,10 @@ public:
|
|||
mTextureClientOnWhite = nullptr;
|
||||
}
|
||||
|
||||
virtual void Dump(std::stringstream& aStream,
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false) MOZ_OVERRIDE;
|
||||
|
||||
virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
|
||||
uint32_t aFlags) MOZ_OVERRIDE
|
||||
{
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "mozilla/layers/PTextureChild.h"
|
||||
#include "SharedSurface.h"
|
||||
#include "GLContext.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h" // for CreateDataSourceSurfaceByCloning
|
||||
#include "nsPrintfCString.h" // for nsPrintfCString
|
||||
#include "LayersLogging.h" // for AppendToString
|
||||
#include "gfxUtils.h" // for gfxUtils::GetAsLZ4Base64Str
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/layers/TextureD3D9.h"
|
||||
|
@ -572,6 +576,28 @@ TextureClient::ShouldDeallocateInDestructor() const
|
|||
return !IsSharedWithCompositor() || (GetFlags() & TextureFlags::DEALLOCATE_CLIENT);
|
||||
}
|
||||
|
||||
void
|
||||
TextureClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
aStream << aPrefix;
|
||||
aStream << nsPrintfCString("TextureClient (0x%p)", this).get();
|
||||
AppendToString(aStream, GetSize(), " [size=", "]");
|
||||
AppendToString(aStream, GetFormat(), " [format=", "]");
|
||||
AppendToString(aStream, mFlags, " [flags=", "]");
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
||||
aStream << "\n" << pfx.get() << "Surface: ";
|
||||
RefPtr<gfx::DataSourceSurface> dSurf = GetAsSurface();
|
||||
if (dSurf) {
|
||||
aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
bool
|
||||
ShmemTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor)
|
||||
{
|
||||
|
@ -866,6 +892,20 @@ BufferTextureClient::GetLockedData() const
|
|||
return serializer.GetData();
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::DataSourceSurface>
|
||||
BufferTextureClient::GetAsSurface()
|
||||
{
|
||||
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
|
||||
MOZ_ASSERT(serializer.IsValid());
|
||||
|
||||
RefPtr<gfx::DataSourceSurface> wrappingSurf =
|
||||
gfx::Factory::CreateWrappingDataSourceSurface(serializer.GetData(),
|
||||
serializer.GetStride(),
|
||||
serializer.GetSize(),
|
||||
serializer.GetFormat());
|
||||
return gfx::CreateDataSourceSurfaceByCloning(wrappingSurf);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// SharedSurfaceTextureClient
|
||||
|
||||
|
|
|
@ -281,6 +281,10 @@ public:
|
|||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() { return nullptr; }
|
||||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
||||
|
||||
/**
|
||||
* Copies a rectangle from this texture client to a position in aTarget.
|
||||
* It is assumed that the necessary locks are in place; so this should at
|
||||
|
@ -584,6 +588,8 @@ public:
|
|||
gfx::IntSize aCbCrSize,
|
||||
StereoMode aStereoMode) MOZ_OVERRIDE;
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
// XXX - Bug 908196 - Make Allocate(uint32_t) and GetBufferSize() protected.
|
||||
|
|
|
@ -1598,5 +1598,27 @@ ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
|
|||
return isBufferChanged;
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
aStream << aPrefix;
|
||||
aStream << nsPrintfCString("TiledContentClient (0x%p)", this).get();
|
||||
|
||||
if (profiler_feature_active("displaylistdump")) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
|
||||
Dump(aStream, pfx.get(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TiledContentClient::Dump(std::stringstream& aStream,
|
||||
const char* aPrefix,
|
||||
bool aDumpHtml)
|
||||
{
|
||||
mTiledBuffer.Dump(aStream, aPrefix, aDumpHtml);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,11 @@ struct TileClient
|
|||
*/
|
||||
void Flip();
|
||||
|
||||
void DumpTexture(std::stringstream& aStream) {
|
||||
// TODO We should combine the OnWhite/OnBlack here an just output a single image.
|
||||
CompositableClient::DumpTextureClient(aStream, mFrontBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unlocked TextureClient that can be used for writing new
|
||||
* data to the tile. This may flip the front-buffer to the back-buffer if
|
||||
|
@ -527,6 +532,12 @@ protected:
|
|||
mLowPrecisionTiledBuffer.Release();
|
||||
}
|
||||
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
||||
|
||||
virtual void Dump(std::stringstream& aStream,
|
||||
const char* aPrefix="",
|
||||
bool aDumpHtml=false);
|
||||
|
||||
public:
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
|
|
|
@ -642,38 +642,7 @@ TiledContentHost::Dump(std::stringstream& aStream,
|
|||
const char* aPrefix,
|
||||
bool aDumpHtml)
|
||||
{
|
||||
nsIntRect visibleRect = mTiledBuffer.GetValidRegion().GetBounds();
|
||||
gfx::IntSize scaledTileSize = mTiledBuffer.GetScaledTileSize();
|
||||
for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
|
||||
int32_t tileStartX = mTiledBuffer.GetTileStart(x, scaledTileSize.width);
|
||||
int32_t w = scaledTileSize.width - tileStartX;
|
||||
if (x + w > visibleRect.x + visibleRect.width) {
|
||||
w = visibleRect.x + visibleRect.width - x;
|
||||
}
|
||||
|
||||
for (int32_t y = visibleRect.y; y < visibleRect.y + visibleRect.height;) {
|
||||
int32_t tileStartY = mTiledBuffer.GetTileStart(y, scaledTileSize.height);
|
||||
TileHost tileTexture = mTiledBuffer.
|
||||
GetTile(nsIntPoint(mTiledBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
|
||||
mTiledBuffer.RoundDownToTileEdge(y, scaledTileSize.height)));
|
||||
int32_t h = scaledTileSize.height - tileStartY;
|
||||
if (y + h > visibleRect.y + visibleRect.height) {
|
||||
h = visibleRect.y + visibleRect.height - y;
|
||||
}
|
||||
|
||||
aStream << "\n" << aPrefix << "Tile (x=" <<
|
||||
mTiledBuffer.RoundDownToTileEdge(x, scaledTileSize.width) << ", y=" <<
|
||||
mTiledBuffer.RoundDownToTileEdge(y, scaledTileSize.height) << "): ";
|
||||
if (tileTexture != mTiledBuffer.GetPlaceholderTile()) {
|
||||
DumpTextureHost(aStream, tileTexture.mTextureHost);
|
||||
// TODO We should combine the OnWhite/OnBlack here an just output a single image.
|
||||
} else {
|
||||
aStream << "empty tile";
|
||||
}
|
||||
y += h;
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
mTiledBuffer.Dump(aStream, aPrefix, aDumpHtml);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -106,6 +106,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void DumpTexture(std::stringstream& aStream) {
|
||||
// TODO We should combine the OnWhite/OnBlack here an just output a single image.
|
||||
CompositableHost::DumpTextureHost(aStream, mTextureHost);
|
||||
}
|
||||
|
||||
RefPtr<gfxSharedReadLock> mSharedLock;
|
||||
CompositableTextureHostRef mTextureHost;
|
||||
CompositableTextureHostRef mTextureHostOnWhite;
|
||||
|
|
|
@ -65,5 +65,11 @@ MacIOSurfaceTextureClientOGL::GetSize() const
|
|||
return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
|
||||
}
|
||||
|
||||
TemporaryRef<gfx::DataSourceSurface>
|
||||
MacIOSurfaceTextureClientOGL::GetAsSurface()
|
||||
{
|
||||
RefPtr<gfx::SourceSurface> surf = mSurface->GetAsSurface();
|
||||
return surf->GetDataSurface();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
|
||||
virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
|
||||
|
||||
// This TextureClient should not be used in a context where we use CreateSimilar
|
||||
// (ex. component alpha) because the underlying texture data is always created by
|
||||
// an external producer.
|
||||
|
|
Загрузка…
Ссылка в новой задаче