mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 17:43:44 +00:00
Back out b6f9dbc91dc4 (bug 947038) for Cipc crashes
This commit is contained in:
parent
86b703757e
commit
ef063fb0d4
@ -72,7 +72,6 @@
|
||||
#include "APZCCallbackHelper.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "ipc/nsGUIEventIPC.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
@ -2282,10 +2281,6 @@ TabChild::InitRenderingState()
|
||||
NS_WARNING("failed to properly allocate layer transaction");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Track which compositor backend is in use (see bug 947038). This can
|
||||
// be removed when deprecated textures are removed.
|
||||
gfxPlatform::GetPlatform()->SetCompositorBackend(mTextureFactoryIdentifier.mParentBackend);
|
||||
} else {
|
||||
// Pushing transactions to the parent content.
|
||||
shadowManager = remoteFrame->SendPLayerTransactionConstructor();
|
||||
|
@ -63,6 +63,161 @@ public:
|
||||
RefPtr<gfx::DataSourceSurface> mSurface;
|
||||
};
|
||||
|
||||
/**
|
||||
* Texture source and host implementaion for software compositing.
|
||||
*/
|
||||
class DeprecatedTextureHostBasic : public DeprecatedTextureHost
|
||||
, public TextureSourceBasic
|
||||
{
|
||||
public:
|
||||
DeprecatedTextureHostBasic()
|
||||
: mCompositor(nullptr)
|
||||
{}
|
||||
|
||||
SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||
|
||||
virtual IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||
|
||||
virtual TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
|
||||
|
||||
SourceSurface *GetSurface() MOZ_OVERRIDE { return mSurface; }
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mCompositor = static_cast<BasicCompositor*>(aCompositor);
|
||||
}
|
||||
|
||||
virtual const char *Name() { return "DeprecatedTextureHostBasic"; }
|
||||
|
||||
protected:
|
||||
virtual void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
nsIntPoint*) MOZ_OVERRIDE
|
||||
{
|
||||
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
|
||||
nsRefPtr<gfxASurface> surface = ShadowLayerForwarder::OpenDescriptor(OPEN_READ_ONLY, aImage);
|
||||
nsRefPtr<gfxImageSurface> image = surface->GetAsImageSurface();
|
||||
mFormat = ImageFormatToSurfaceFormat(image->Format());
|
||||
mSize = IntSize(image->Width(), image->Height());
|
||||
mSurface = Factory::CreateWrappingDataSourceSurface(image->Data(),
|
||||
image->Stride(),
|
||||
mSize,
|
||||
mFormat);
|
||||
}
|
||||
|
||||
virtual bool EnsureSurface() {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Lock() MOZ_OVERRIDE {
|
||||
return EnsureSurface();
|
||||
}
|
||||
|
||||
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE {
|
||||
if (!mSurface) {
|
||||
return nullptr;
|
||||
}
|
||||
return mSurface->GetDataSurface();
|
||||
}
|
||||
|
||||
BasicCompositor *mCompositor;
|
||||
RefPtr<SourceSurface> mSurface;
|
||||
IntSize mSize;
|
||||
SurfaceFormat mFormat;
|
||||
};
|
||||
|
||||
void
|
||||
DeserializerToPlanarYCbCrImageData(YCbCrImageDataDeserializer& aDeserializer, PlanarYCbCrData& aData)
|
||||
{
|
||||
aData.mYChannel = aDeserializer.GetYData();
|
||||
aData.mYStride = aDeserializer.GetYStride();
|
||||
aData.mYSize = aDeserializer.GetYSize();
|
||||
aData.mCbChannel = aDeserializer.GetCbData();
|
||||
aData.mCrChannel = aDeserializer.GetCrData();
|
||||
aData.mCbCrStride = aDeserializer.GetCbCrStride();
|
||||
aData.mCbCrSize = aDeserializer.GetCbCrSize();
|
||||
aData.mPicSize = aDeserializer.GetYSize();
|
||||
}
|
||||
|
||||
class YCbCrDeprecatedTextureHostBasic : public DeprecatedTextureHostBasic
|
||||
{
|
||||
public:
|
||||
virtual void UpdateImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion *aRegion,
|
||||
nsIntPoint*) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
|
||||
mSurface = nullptr;
|
||||
ConvertImageToRGB(aImage);
|
||||
}
|
||||
|
||||
virtual void SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
nsIntRegion* aRegion) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
|
||||
mSurface = nullptr;
|
||||
}
|
||||
|
||||
virtual bool EnsureSurface() MOZ_OVERRIDE
|
||||
{
|
||||
if (mSurface) {
|
||||
return true;
|
||||
}
|
||||
if (!mBuffer) {
|
||||
return false;
|
||||
}
|
||||
return ConvertImageToRGB(*mBuffer);
|
||||
}
|
||||
|
||||
bool ConvertImageToRGB(const SurfaceDescriptor& aImage)
|
||||
{
|
||||
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
|
||||
PlanarYCbCrData data;
|
||||
DeserializerToPlanarYCbCrImageData(deserializer, data);
|
||||
|
||||
gfxImageFormat format = gfxImageFormatRGB24;
|
||||
gfxIntSize size;
|
||||
gfxUtils::GetYCbCrToRGBDestFormatAndSize(data, format, size);
|
||||
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
|
||||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
|
||||
NS_ERROR("Illegal image dest width or height");
|
||||
return false;
|
||||
}
|
||||
|
||||
mSize = ToIntSize(size);
|
||||
mFormat = (format == gfxImageFormatRGB24)
|
||||
? FORMAT_B8G8R8X8
|
||||
: FORMAT_B8G8R8A8;
|
||||
|
||||
RefPtr<DataSourceSurface> surface = Factory::CreateDataSourceSurface(mSize, mFormat);
|
||||
gfxUtils::ConvertYCbCrToRGB(data, format, size,
|
||||
surface->GetData(),
|
||||
surface->Stride());
|
||||
|
||||
mSurface = surface;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
TemporaryRef<DeprecatedTextureHost>
|
||||
CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aTextureHostFlags,
|
||||
uint32_t aTextureFlags)
|
||||
{
|
||||
RefPtr<DeprecatedTextureHost> result = nullptr;
|
||||
if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
|
||||
result = new YCbCrDeprecatedTextureHostBasic();
|
||||
} else {
|
||||
MOZ_ASSERT(aDescriptorType == SurfaceDescriptor::TShmem ||
|
||||
aDescriptorType == SurfaceDescriptor::TMemoryImage,
|
||||
"We can only support Shmem currently");
|
||||
result = new DeprecatedTextureHostBasic();
|
||||
}
|
||||
|
||||
result->SetFlags(aTextureFlags);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
BasicCompositor::BasicCompositor(nsIWidget *aWidget)
|
||||
: mWidget(aWidget)
|
||||
{
|
||||
|
@ -58,11 +58,6 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
|
||||
useDeprecatedTextures = gfxPlatform::GetPlatform()->UseDeprecatedTextures();
|
||||
#endif
|
||||
|
||||
// Always use new textures for the basic compositor.
|
||||
if (backend == LAYERS_BASIC) {
|
||||
useDeprecatedTextures = false;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (backend == LAYERS_D3D11) {
|
||||
useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD2DDevice();
|
||||
|
@ -84,6 +84,10 @@ TextureHost::AsTextureHost(PTextureParent* actor)
|
||||
TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
// implemented in BasicCompositor.cpp
|
||||
TemporaryRef<DeprecatedTextureHost> CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
|
||||
uint32_t aDeprecatedTextureHostFlags,
|
||||
uint32_t aTextureFlags);
|
||||
|
||||
#ifdef XP_WIN
|
||||
TemporaryRef<DeprecatedTextureHost> CreateDeprecatedTextureHostD3D9(SurfaceDescriptorType aDescriptorType,
|
||||
@ -123,6 +127,10 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
#endif
|
||||
case LAYERS_BASIC:
|
||||
return CreateBasicDeprecatedTextureHost(aDescriptorType,
|
||||
aDeprecatedTextureHostFlags,
|
||||
aTextureFlags);
|
||||
default:
|
||||
MOZ_CRASH("Couldn't create texture host");
|
||||
}
|
||||
|
@ -138,7 +138,6 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect)
|
||||
|
||||
mBuffer->SetPaintWillResample(MayResample());
|
||||
|
||||
mBuffer->SetCompositor(mCompositeManager->GetCompositor());
|
||||
mBuffer->Composite(effectChain,
|
||||
GetEffectiveOpacity(),
|
||||
transform,
|
||||
|
@ -281,7 +281,6 @@ gfxPlatform::gfxPlatform()
|
||||
, mDrawLayerBorders(false)
|
||||
, mDrawTileBorders(false)
|
||||
, mDrawBigImageBorders(false)
|
||||
, mCompositorBackend(LAYERS_NONE)
|
||||
{
|
||||
mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
|
||||
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
|
||||
@ -2214,22 +2213,3 @@ gfxPlatform::ComponentAlphaEnabled()
|
||||
InitLayersAccelerationPrefs();
|
||||
return sComponentAlphaEnabled;
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::SetCompositorBackend(mozilla::layers::LayersBackend backend)
|
||||
{
|
||||
// The compositor backend should always be the same after one has been chosen.
|
||||
MOZ_ASSERT(mCompositorBackend == LAYERS_NONE || mCompositorBackend == backend);
|
||||
if (mCompositorBackend == LAYERS_NONE) {
|
||||
mCompositorBackend = backend;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatform::UseDeprecatedTextures() const
|
||||
{
|
||||
if (mCompositorBackend == LAYERS_BASIC) {
|
||||
return false;
|
||||
}
|
||||
return mLayersUseDeprecated;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "GfxInfoCollector.h"
|
||||
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
|
||||
#ifdef XP_OS2
|
||||
@ -620,8 +619,7 @@ public:
|
||||
* This method should not be called from the compositor thread.
|
||||
*/
|
||||
bool PreferMemoryOverShmem() const;
|
||||
bool UseDeprecatedTextures() const;
|
||||
void SetCompositorBackend(mozilla::layers::LayersBackend backend);
|
||||
bool UseDeprecatedTextures() const { return mLayersUseDeprecated; }
|
||||
|
||||
protected:
|
||||
gfxPlatform();
|
||||
@ -738,7 +736,6 @@ private:
|
||||
bool mDrawLayerBorders;
|
||||
bool mDrawTileBorders;
|
||||
bool mDrawBigImageBorders;
|
||||
mozilla::layers::LayersBackend mCompositorBackend;
|
||||
};
|
||||
|
||||
#endif /* GFX_PLATFORM_H */
|
||||
|
@ -988,8 +988,6 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
|
||||
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
|
||||
WindowUsesOMTC();
|
||||
|
||||
gfxPlatform::GetPlatform()->SetCompositorBackend(textureFactoryIdentifier.mParentBackend);
|
||||
|
||||
mLayerManager = lm;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user