Bug 899583 - Disallow BigImage with YCbCr compositing. r=BenWa

This commit is contained in:
Nicolas Silva 2013-08-02 01:02:06 +02:00
Родитель 7a2a3b36a8
Коммит 6d7cde1795
12 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -221,7 +221,7 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL,
, mGL(aGL)
, mTextureState(Created)
{
if (!(aFlags & TextureImage::ForceSingleTile) && mGL->WantsSmallTiles()) {
if (!(aFlags & TextureImage::DisallowBigImage) && mGL->WantsSmallTiles()) {
mTileSize = 256;
} else {
mGL->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, (GLint*) &mTileSize);

Просмотреть файл

@ -57,7 +57,7 @@ public:
NoFlags = 0x0,
UseNearestFilter = 0x1,
NeedsYFlip = 0x2,
ForceSingleTile = 0x4
DisallowBigImage = 0x4
};
typedef gfxASurface::gfxContentType ContentType;

Просмотреть файл

@ -29,7 +29,7 @@ const TextureFlags UseNearestFilter = 1 << 0;
const TextureFlags NeedsYFlip = 1 << 1;
// Force the texture to be represented using a single tile (note that this means
// tiled textures, not tiled layers).
const TextureFlags ForceSingleTile = 1 << 2;
const TextureFlags TEXTURE_DISALLOW_BIGIMAGE = 1 << 2;
// Allow using 'repeat' mode for wrapping.
const TextureFlags AllowRepeat = 1 << 3;
// The texture represents a tile which is newly created.

Просмотреть файл

@ -11,7 +11,7 @@ namespace layers {
ImageLayer::ImageLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData), mFilter(gfxPattern::FILTER_GOOD)
, mScaleMode(SCALE_NONE), mForceSingleTile(false)
, mScaleMode(SCALE_NONE), mDisallowBigImage(false)
{}
ImageLayer::~ImageLayer()

Просмотреть файл

@ -75,11 +75,11 @@ public:
/**
* if true, the image will only be backed by a single tile texture
*/
void SetForceSingleTile(bool aForceSingleTile)
void SetDisallowBigImage(bool aDisallowBigImage)
{
if (mForceSingleTile != aForceSingleTile) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ForceSingleTile", this));
mForceSingleTile = aForceSingleTile;
if (mDisallowBigImage != aDisallowBigImage) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) DisallowBigImage", this));
mDisallowBigImage = aDisallowBigImage;
Mutated();
}
}
@ -94,7 +94,7 @@ protected:
gfxPattern::GraphicsFilter mFilter;
gfxIntSize mScaleToSize;
ScaleMode mScaleMode;
bool mForceSingleTile;
bool mDisallowBigImage;
};
}

Просмотреть файл

@ -212,7 +212,7 @@ AppendToString(nsACString& s, TextureFlags flags,
bool previous = false;
AppendFlag(UseNearestFilter);
AppendFlag(NeedsYFlip);
AppendFlag(ForceSingleTile);
AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
AppendFlag(AllowRepeat);
AppendFlag(NewTile);
AppendFlag(TEXTURE_DEALLOCATE_HOST);

Просмотреть файл

@ -127,8 +127,8 @@ ClientImageLayer::RenderLayer()
}
mImageClient = ImageClient::CreateImageClient(type,
ClientManager(),
mForceSingleTile
? ForceSingleTile
mDisallowBigImage
? TEXTURE_DISALLOW_BIGIMAGE
: 0);
if (type == BUFFER_BRIDGE) {
static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);

Просмотреть файл

@ -316,9 +316,10 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
RefPtr<DataTextureSource> srcU;
RefPtr<DataTextureSource> srcV;
if (!mFirstSource) {
srcY = mCompositor->CreateDataTextureSource(mFlags);
srcU = mCompositor->CreateDataTextureSource(mFlags);
srcV = mCompositor->CreateDataTextureSource(mFlags);
// We don't support BigImages for YCbCr compositing.
srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
mFirstSource = srcY;
srcY->SetNextSibling(srcU);
srcU->SetNextSibling(srcV);

Просмотреть файл

@ -1415,7 +1415,8 @@ TemporaryRef<DataTextureSource>
CompositorOGL::CreateDataTextureSource(TextureFlags aFlags)
{
RefPtr<DataTextureSource> result =
new TextureImageTextureSourceOGL(mGLContext, !(aFlags & ForceSingleTile));
new TextureImageTextureSourceOGL(mGLContext,
!(aFlags & TEXTURE_DISALLOW_BIGIMAGE));
return result;
}

Просмотреть файл

@ -114,8 +114,8 @@ FlagsToGLFlags(TextureFlags aFlags)
result |= TextureImage::UseNearestFilter;
if (aFlags & NeedsYFlip)
result |= TextureImage::NeedsYFlip;
if (aFlags & ForceSingleTile)
result |= TextureImage::ForceSingleTile;
if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
result |= TextureImage::DisallowBigImage;
return static_cast<gl::TextureImage::Flags>(result);
}
@ -148,7 +148,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
if (!mTexImage ||
mTexImage->GetSize() != size ||
mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
if (mAllowTiling) {
if (mAllowBigImage) {
// XXX - clarify the which size we want to use. Some use cases may
// require the size of the destnation surface to be different from
// the size of aSurface.

Просмотреть файл

@ -105,9 +105,9 @@ class TextureImageTextureSourceOGL : public DataTextureSource
, public TileIterator
{
public:
TextureImageTextureSourceOGL(gl::GLContext* aGL, bool aAllowTiling = true)
TextureImageTextureSourceOGL(gl::GLContext* aGL, bool aAllowBiImage = true)
: mGL(aGL)
, mAllowTiling(aAllowTiling)
, mAllowBigImage(aAllowBiImage)
, mIterating(false)
{}
@ -179,7 +179,7 @@ public:
protected:
nsRefPtr<gl::TextureImage> mTexImage;
gl::GLContext* mGL;
bool mAllowTiling;
bool mAllowBigImage;
bool mIterating;
};

Просмотреть файл

@ -1230,7 +1230,7 @@ ContainerState::CreateOrRecycleMaskImageLayerFor(Layer* aLayer)
if (!result)
return nullptr;
result->SetUserData(&gMaskLayerUserData, new MaskLayerUserData());
result->SetForceSingleTile(true);
result->SetDisallowBigImage(true);
}
return result.forget();