Backed out changeset bf184a7a1d63 (bug 990608) for Android crashes.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-04-04 15:20:49 -04:00
Родитель 6df7229f81
Коммит 27af4d423e
15 изменённых файлов: 106 добавлений и 124 удалений

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

@ -404,8 +404,7 @@ nsDOMWindowUtils::SetDisplayPortMarginsForElement(float aLeftMargin,
float aTopMargin,
float aRightMargin,
float aBottomMargin,
uint32_t aAlignmentX,
uint32_t aAlignmentY,
uint32_t aAlignment,
nsIDOMElement* aElement,
uint32_t aPriority)
{
@ -446,7 +445,7 @@ nsDOMWindowUtils::SetDisplayPortMarginsForElement(float aLeftMargin,
aLeftMargin);
content->SetProperty(nsGkAtoms::DisplayPortMargins,
new DisplayPortMarginsPropertyData(displayportMargins, aAlignmentX, aAlignmentY, aPriority),
new DisplayPortMarginsPropertyData(displayportMargins, aAlignment, aPriority),
nsINode::DeleteProperty<DisplayPortMarginsPropertyData>);
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();

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

@ -175,8 +175,7 @@ interface nsIDOMWindowUtils : nsISupports {
in float aTopMargin,
in float aRightMargin,
in float aBottomMargin,
in uint32_t aAlignmentX,
in uint32_t aAlignmentY,
in uint32_t aAlignment,
in nsIDOMElement aElement,
in uint32_t aPriority);

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

@ -75,11 +75,10 @@ GetBitsPerTexel(GLenum format, GLenum type)
/* static */ void
GfxTexturesReporter::UpdateAmount(MemoryUse action, GLenum format,
GLenum type, int32_t tileWidth,
int32_t tileHeight)
GLenum type, uint16_t tileSize)
{
int64_t bitsPerTexel = GetBitsPerTexel(format, type);
int64_t bytes = int64_t(tileWidth) * int64_t(tileHeight) * bitsPerTexel/8;
int64_t bytes = int64_t(tileSize) * int64_t(tileSize) * bitsPerTexel/8;
if (action == MemoryFreed) {
sAmount -= bytes;
} else {

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

@ -39,7 +39,7 @@ public:
// When memory is used/freed for tile textures, call this method to update
// the value reported by this memory reporter.
static void UpdateAmount(MemoryUse action, GLenum format, GLenum type,
int32_t tileWidth, int32_t tileHeight);
uint16_t tileSize);
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData)

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

@ -5,13 +5,14 @@
#ifndef GFX_TILEDLAYERBUFFER_H
#define GFX_TILEDLAYERBUFFER_H
#define TILEDLAYERBUFFER_TILE_SIZE 256
// Debug defines
//#define GFX_TILEDLAYER_DEBUG_OVERLAY
//#define GFX_TILEDLAYER_PREF_WARNINGS
#include <stdint.h> // for uint16_t, uint32_t
#include <sys/types.h> // for int32_t
#include "gfxPrefs.h" // for gfxPrefs::LayersTileWidth/Height
#include "nsDebug.h" // for NS_ABORT_IF_FALSE
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
@ -31,8 +32,8 @@ namespace layers {
// template pattern.
//
// Tiles are aligned to a grid with one of the grid points at (0,0) and other
// grid points spaced evenly in the x- and y-directions by GetTileSize()
// multiplied by mResolution. GetScaledTileSize() provides convenience for
// grid points spaced evenly in the x- and y-directions by GetTileLength()
// multiplied by mResolution. GetScaledTileLength() provides convenience for
// accessing these values.
//
// This tile buffer stores a valid region, which defines the areas that have
@ -84,23 +85,22 @@ public:
: mRetainedWidth(0)
, mRetainedHeight(0)
, mResolution(1)
, mTileSize(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight())
{}
~TiledLayerBuffer() {}
// Given a tile origin aligned to a multiple of GetScaledTileSize,
// Given a tile origin aligned to a multiple of GetScaledTileLength,
// return the tile that describes that region.
// NOTE: To get the valid area of that tile you must intersect
// (aTileOrigin.x, aTileOrigin.y,
// GetScaledTileSize().width, GetScaledTileSize().height)
// GetScaledTileLength(), GetScaledTileLength())
// and GetValidRegion() to get the area of the tile that is valid.
Tile GetTile(const nsIntPoint& aTileOrigin) const;
// Given a tile x, y relative to the top left of the layer, this function
// will return the tile for
// (x*GetScaledTileSize().width, y*GetScaledTileSize().height,
// GetScaledTileSize().width, GetScaledTileSize().height)
// (x*GetScaledTileLength(), y*GetScaledTileLength(),
// GetScaledTileLength(), GetScaledTileLength())
Tile GetTile(int x, int y) const;
// This operates the same as GetTile(aTileOrigin), but will also replace the
@ -113,9 +113,12 @@ public:
// on the removed tile.
bool RemoveTile(int x, int y, Tile& aRemovedTile);
const gfx::IntSize& GetTileSize() const { return mTileSize; }
uint16_t GetTileLength() const { return TILEDLAYERBUFFER_TILE_SIZE; }
gfx::IntSize GetScaledTileSize() const { return mTileSize / mResolution; }
#ifdef MOZ_WIDGET_ANDROID
MOZ_NEVER_INLINE // bug 881018 causes wrong results when GetScaledTileLength is inlined
#endif
uint32_t GetScaledTileLength() const { return TILEDLAYERBUFFER_TILE_SIZE / mResolution; }
unsigned int GetTileCount() const { return mRetainedTiles.Length(); }
@ -124,14 +127,14 @@ public:
void ClearPaintedRegion() { mPaintedRegion.SetEmpty(); }
// Given a position i, this function returns the position inside the current tile.
int GetTileStart(int i, int aTileLength) const {
return (i >= 0) ? (i % aTileLength)
: ((aTileLength - (-i % aTileLength)) %
aTileLength);
int GetTileStart(int i) const {
return (i >= 0) ? (i % GetScaledTileLength())
: ((GetScaledTileLength() - (-i % GetScaledTileLength())) %
GetScaledTileLength());
}
// Rounds the given coordinate down to the nearest tile boundary.
int RoundDownToTileEdge(int aX, int aTileLength) const { return aX - GetTileStart(aX, aTileLength); }
int RoundDownToTileEdge(int aX) const { return aX - GetTileStart(aX); }
// Get and set draw scaling. mResolution affects the resolution at which the
// contents of the buffer are drawn. mResolution has no effect on the
@ -175,7 +178,6 @@ protected:
int mRetainedWidth; // in tiles
int mRetainedHeight; // in tiles
float mResolution;
gfx::IntSize mTileSize;
private:
const Derived& AsDerived() const { return *static_cast<const Derived*>(this); }
@ -242,11 +244,10 @@ TiledLayerBuffer<Derived, Tile>::GetTile(const nsIntPoint& aTileOrigin) const
// TODO Cache firstTileOriginX/firstTileOriginY
// Find the tile x/y of the first tile and the target tile relative to the (0, 0)
// origin, the difference is the tile x/y relative to the start of the tile buffer.
gfx::IntSize scaledTileSize = GetScaledTileSize();
int firstTileX = floor_div(mValidRegion.GetBounds().x, scaledTileSize.width);
int firstTileY = floor_div(mValidRegion.GetBounds().y, scaledTileSize.height);
return GetTile(floor_div(aTileOrigin.x, scaledTileSize.width) - firstTileX,
floor_div(aTileOrigin.y, scaledTileSize.height) - firstTileY);
int firstTileX = floor_div(mValidRegion.GetBounds().x, GetScaledTileLength());
int firstTileY = floor_div(mValidRegion.GetBounds().y, GetScaledTileLength());
return GetTile(floor_div(aTileOrigin.x, GetScaledTileLength()) - firstTileX,
floor_div(aTileOrigin.y, GetScaledTileLength()) - firstTileY);
}
template<typename Derived, typename Tile> Tile
@ -260,11 +261,10 @@ template<typename Derived, typename Tile> bool
TiledLayerBuffer<Derived, Tile>::RemoveTile(const nsIntPoint& aTileOrigin,
Tile& aRemovedTile)
{
gfx::IntSize scaledTileSize = GetScaledTileSize();
int firstTileX = floor_div(mValidRegion.GetBounds().x, scaledTileSize.width);
int firstTileY = floor_div(mValidRegion.GetBounds().y, scaledTileSize.height);
return RemoveTile(floor_div(aTileOrigin.x, scaledTileSize.width) - firstTileX,
floor_div(aTileOrigin.y, scaledTileSize.height) - firstTileY,
int firstTileX = floor_div(mValidRegion.GetBounds().x, GetScaledTileLength());
int firstTileY = floor_div(mValidRegion.GetBounds().y, GetScaledTileLength());
return RemoveTile(floor_div(aTileOrigin.x, GetScaledTileLength()) - firstTileX,
floor_div(aTileOrigin.y, GetScaledTileLength()) - firstTileY,
aRemovedTile);
}
@ -285,16 +285,14 @@ template<typename Derived, typename Tile> void
TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
const nsIntRegion& aPaintRegion)
{
gfx::IntSize scaledTileSize = GetScaledTileSize();
nsTArray<Tile> newRetainedTiles;
nsTArray<Tile>& oldRetainedTiles = mRetainedTiles;
const nsIntRect oldBound = mValidRegion.GetBounds();
const nsIntRect newBound = aNewValidRegion.GetBounds();
const nsIntPoint oldBufferOrigin(RoundDownToTileEdge(oldBound.x, scaledTileSize.width),
RoundDownToTileEdge(oldBound.y, scaledTileSize.height));
const nsIntPoint newBufferOrigin(RoundDownToTileEdge(newBound.x, scaledTileSize.width),
RoundDownToTileEdge(newBound.y, scaledTileSize.height));
const nsIntPoint oldBufferOrigin(RoundDownToTileEdge(oldBound.x),
RoundDownToTileEdge(oldBound.y));
const nsIntPoint newBufferOrigin(RoundDownToTileEdge(newBound.x),
RoundDownToTileEdge(newBound.y));
const nsIntRegion& oldValidRegion = mValidRegion;
const nsIntRegion& newValidRegion = aNewValidRegion;
const int oldRetainedHeight = mRetainedHeight;
@ -311,14 +309,14 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
for (int32_t x = newBound.x; x < newBound.XMost(); tileX++) {
// Compute tileRect(x,y,width,height) in layer space coordinate
// giving us the rect of the tile that hits the newBounds.
int width = scaledTileSize.width - GetTileStart(x, scaledTileSize.width);
int width = GetScaledTileLength() - GetTileStart(x);
if (x + width > newBound.XMost()) {
width = newBound.x + newBound.width - x;
}
tileY = 0;
for (int32_t y = newBound.y; y < newBound.YMost(); tileY++) {
int height = scaledTileSize.height - GetTileStart(y, scaledTileSize.height);
int height = GetScaledTileLength() - GetTileStart(y);
if (y + height > newBound.y + newBound.height) {
height = newBound.y + newBound.height - y;
}
@ -328,8 +326,8 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
// This old tiles contains some valid area so move it to the new tile
// buffer. Replace the tile in the old buffer with a placeholder
// to leave the old buffer index unaffected.
int tileX = floor_div(x - oldBufferOrigin.x, scaledTileSize.width);
int tileY = floor_div(y - oldBufferOrigin.y, scaledTileSize.height);
int tileX = floor_div(x - oldBufferOrigin.x, GetScaledTileLength());
int tileY = floor_div(y - oldBufferOrigin.y, GetScaledTileLength());
int index = tileX * oldRetainedHeight + tileY;
// The tile may have been removed, skip over it in this case.
@ -411,15 +409,15 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
for (int x = newBound.x; x < newBound.x + newBound.width; tileX++) {
// Compute tileRect(x,y,width,height) in layer space coordinate
// giving us the rect of the tile that hits the newBounds.
int tileStartX = RoundDownToTileEdge(x, scaledTileSize.width);
int width = scaledTileSize.width - GetTileStart(x, scaledTileSize.width);
int tileStartX = RoundDownToTileEdge(x);
int width = GetScaledTileLength() - GetTileStart(x);
if (x + width > newBound.XMost())
width = newBound.XMost() - x;
tileY = 0;
for (int y = newBound.y; y < newBound.y + newBound.height; tileY++) {
int tileStartY = RoundDownToTileEdge(y, scaledTileSize.height);
int height = scaledTileSize.height - GetTileStart(y, scaledTileSize.height);
int tileStartY = RoundDownToTileEdge(y);
int height = GetScaledTileLength() - GetTileStart(y);
if (y + height > newBound.YMost()) {
height = newBound.YMost() - y;
}
@ -434,8 +432,8 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
// because we can reuse all of the content from the
// previous buffer.
#ifdef DEBUG
int currTileX = floor_div(x - newBufferOrigin.x, scaledTileSize.width);
int currTileY = floor_div(y - newBufferOrigin.y, scaledTileSize.height);
int currTileX = floor_div(x - newBufferOrigin.x, GetScaledTileLength());
int currTileY = floor_div(y - newBufferOrigin.y, GetScaledTileLength());
int index = currTileX * mRetainedHeight + currTileY;
NS_ABORT_IF_FALSE(!newValidRegion.Intersects(tileRect) ||
!IsPlaceholder(newRetainedTiles.
@ -446,8 +444,8 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& aNewValidRegion,
continue;
}
int tileX = floor_div(x - newBufferOrigin.x, scaledTileSize.width);
int tileY = floor_div(y - newBufferOrigin.y, scaledTileSize.height);
int tileX = floor_div(x - newBufferOrigin.x, GetScaledTileLength());
int tileY = floor_div(y - newBufferOrigin.y, GetScaledTileLength());
int index = tileX * mRetainedHeight + tileY;
NS_ABORT_IF_FALSE(index >= 0 &&
static_cast<unsigned>(index) < newRetainedTiles.Length(),

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

@ -7,7 +7,6 @@
#include "CompositorChild.h" // for CompositorChild
#include "GeckoProfiler.h" // for PROFILER_LABEL
#include "gfxASurface.h" // for gfxASurface, etc
#include "gfxPrefs.h" // for gfxPrefs::LayersTileWidth/Height
#include "ipc/AutoOpenSurface.h" // for AutoOpenSurface
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Hal.h"
@ -458,8 +457,8 @@ ClientLayerManager::GetTexturePool(SurfaceFormat aFormat)
}
mTexturePools.AppendElement(
new TextureClientPool(aFormat, IntSize(gfxPrefs::LayersTileWidth(),
gfxPrefs::LayersTileHeight()),
new TextureClientPool(aFormat, IntSize(TILEDLAYERBUFFER_TILE_SIZE,
TILEDLAYERBUFFER_TILE_SIZE),
mForwarder));
return mTexturePools.LastElement();
@ -472,8 +471,8 @@ ClientLayerManager::GetSimpleTileTexturePool(SurfaceFormat aFormat)
mSimpleTilePools.EnsureLengthAtLeast(index+1);
if (mSimpleTilePools[index].get() == nullptr) {
mSimpleTilePools[index] = new SimpleTextureClientPool(aFormat, IntSize(gfxPrefs::LayersTileWidth(),
gfxPrefs::LayersTileHeight()),
mSimpleTilePools[index] = new SimpleTextureClientPool(aFormat, IntSize(TILEDLAYERBUFFER_TILE_SIZE,
TILEDLAYERBUFFER_TILE_SIZE),
mForwarder);
}

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

@ -14,7 +14,6 @@
#include "CompositorChild.h" // for CompositorChild
#include "gfxContext.h" // for gfxContext, etc
#include "gfxPlatform.h" // for gfxPlatform
#include "gfxPrefs.h" // for gfxPrefs::LayersTileWidth/Height
#include "gfxRect.h" // for gfxRect
#include "mozilla/Attributes.h" // for MOZ_THIS_IN_INITIALIZER_LIST
#include "mozilla/MathAlgorithms.h" // for Abs
@ -75,7 +74,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
const nsIntRegion& aDirtyRegion)
{
PROFILER_LABEL("SimpleTiledLayerBuffer", "ValidateTile");
static gfx::IntSize kTileSize(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight());
static gfx::IntSize kTileSize(TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
gfx::SurfaceFormat tileFormat = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType());
@ -130,7 +129,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
tileFormat);
if (fullPaint) {
drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileSize().width, GetScaledTileSize().height);
drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileLength(), GetScaledTileLength());
drawRegion = nsIntRegion(drawBounds);
} else {
drawBounds = aDirtyRegion.GetBounds();
@ -150,7 +149,7 @@ SimpleTiledLayerBuffer::ValidateTile(SimpleTiledLayerTile aTile,
drawTarget = textureClient->AsTextureClientDrawTarget()->GetAsDrawTarget();
fullPaint = true;
drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileSize().width, GetScaledTileSize().height);
drawBounds = nsIntRect(aTileOrigin.x, aTileOrigin.y, GetScaledTileLength(), GetScaledTileLength());
drawRegion = nsIntRegion(drawBounds);
if (GetContentType() == gfxContentType::COLOR_ALPHA)

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

@ -29,7 +29,7 @@
// This is the minimum area that we deem reasonable to copy from the front buffer to the
// back buffer on tile updates. If the valid region is smaller than this, we just
// redraw it and save on the copy (and requisite surface-locking involved).
#define MINIMUM_TILE_COPY_AREA (1.f/16.f)
#define MINIMUM_TILE_COPY_AREA ((TILEDLAYERBUFFER_TILE_SIZE * TILEDLAYERBUFFER_TILE_SIZE)/16)
#ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
#include "cairo.h"
@ -423,8 +423,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
bool aCanRerasterizeValidRegion)
{
if (mBackBuffer && mFrontBuffer) {
gfx::IntSize tileSize = mFrontBuffer->GetSize();
const nsIntRect tileRect = nsIntRect(0, 0, tileSize.width, tileSize.height);
const nsIntRect tileRect = nsIntRect(0, 0, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
if (aDirtyRegion.Contains(tileRect)) {
// The dirty region means that we no longer need the front buffer, so
@ -438,7 +437,7 @@ TileClient::ValidateBackBufferFromFront(const nsIntRegion& aDirtyRegion,
if (regionToCopy.IsEmpty() ||
(aCanRerasterizeValidRegion &&
regionToCopy.Area() < tileSize.width * tileSize.height * MINIMUM_TILE_COPY_AREA)) {
regionToCopy.Area() < MINIMUM_TILE_COPY_AREA)) {
// Just redraw it all.
return;
}
@ -527,7 +526,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion, TextureClientPool *aP
MOZ_ASSERT(mBackLock->IsValid());
*aCreatedTextureClient = true;
mInvalidBack = nsIntRect(0, 0, mBackBuffer->GetSize().width, mBackBuffer->GetSize().height);
mInvalidBack = nsIntRect(0, 0, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE);
}
ValidateBackBufferFromFront(aDirtyRegion, aCanRerasterizeValidRegion);
@ -783,13 +782,13 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
}
// The new buffer is now validated, remove the dirty region from it.
aTile.mInvalidBack.Sub(nsIntRect(0, 0, GetTileSize().width, GetTileSize().height),
aTile.mInvalidBack.Sub(nsIntRect(0, 0, TILEDLAYERBUFFER_TILE_SIZE, TILEDLAYERBUFFER_TILE_SIZE),
offsetScaledDirtyRegion);
} else {
// Area of the full tile...
nsIntRegion tileRegion =
nsIntRect(aTileOrigin.x, aTileOrigin.y,
GetScaledTileSize().width, GetScaledTileSize().height);
GetScaledTileLength(), GetScaledTileLength());
// Intersect this area with the portion that's dirty.
tileRegion = tileRegion.Intersect(aDirtyRegion);
@ -998,25 +997,25 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
nsIntRect paintBounds = aRegionToPaint.GetBounds();
int startX, incX, startY, incY;
gfx::IntSize scaledTileSize = GetScaledTileSize();
int tileLength = GetScaledTileLength();
if (aPaintData->mScrollOffset.x >= aPaintData->mLastScrollOffset.x) {
startX = RoundDownToTileEdge(paintBounds.x, scaledTileSize.width);
incX = scaledTileSize.width;
startX = RoundDownToTileEdge(paintBounds.x);
incX = tileLength;
} else {
startX = RoundDownToTileEdge(paintBounds.XMost() - 1, scaledTileSize.width);
incX = -scaledTileSize.width;
startX = RoundDownToTileEdge(paintBounds.XMost() - 1);
incX = -tileLength;
}
if (aPaintData->mScrollOffset.y >= aPaintData->mLastScrollOffset.y) {
startY = RoundDownToTileEdge(paintBounds.y, scaledTileSize.height);
incY = scaledTileSize.height;
startY = RoundDownToTileEdge(paintBounds.y);
incY = tileLength;
} else {
startY = RoundDownToTileEdge(paintBounds.YMost() - 1, scaledTileSize.height);
incY = -scaledTileSize.height;
startY = RoundDownToTileEdge(paintBounds.YMost() - 1);
incY = -tileLength;
}
// Find a tile to draw.
nsIntRect tileBounds(startX, startY, scaledTileSize.width, scaledTileSize.height);
nsIntRect tileBounds(startX, startY, tileLength, tileLength);
int32_t scrollDiffX = aPaintData->mScrollOffset.x - aPaintData->mLastScrollOffset.x;
int32_t scrollDiffY = aPaintData->mScrollOffset.y - aPaintData->mLastScrollOffset.y;
// This loop will always terminate, as there is at least one tile area

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

@ -429,25 +429,24 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
uint32_t rowCount = 0;
uint32_t tileX = 0;
nsIntRect visibleRect = aVisibleRegion.GetBounds();
gfx::IntSize scaledTileSize = aLayerBuffer.GetScaledTileSize();
for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) {
rowCount++;
int32_t tileStartX = aLayerBuffer.GetTileStart(x, scaledTileSize.width);
int32_t w = scaledTileSize.width - tileStartX;
int32_t tileStartX = aLayerBuffer.GetTileStart(x);
int32_t w = aLayerBuffer.GetScaledTileLength() - tileStartX;
if (x + w > visibleRect.x + visibleRect.width) {
w = visibleRect.x + visibleRect.width - x;
}
int tileY = 0;
for (int32_t y = visibleRect.y; y < visibleRect.y + visibleRect.height;) {
int32_t tileStartY = aLayerBuffer.GetTileStart(y, scaledTileSize.height);
int32_t h = scaledTileSize.height - tileStartY;
int32_t tileStartY = aLayerBuffer.GetTileStart(y);
int32_t h = aLayerBuffer.GetScaledTileLength() - tileStartY;
if (y + h > visibleRect.y + visibleRect.height) {
h = visibleRect.y + visibleRect.height - y;
}
TileHost tileTexture = aLayerBuffer.
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width),
aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height)));
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x),
aLayerBuffer.RoundDownToTileEdge(y)));
if (tileTexture != aLayerBuffer.GetPlaceholderTile()) {
nsIntRegion tileDrawRegion;
tileDrawRegion.And(nsIntRect(x, y, w, h), aLayerBuffer.GetValidRegion());
@ -458,9 +457,9 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
tileDrawRegion.ScaleRoundOut(resolution, resolution);
nsIntPoint tileOffset((x - tileStartX) * resolution,
(y - tileStartY) * resolution);
gfx::IntSize tileSize = aLayerBuffer.GetTileSize();
uint32_t tileSize = aLayerBuffer.GetTileLength();
RenderTile(tileTexture, aEffectChain, aOpacity, aTransform, aFilter, aClipRect, tileDrawRegion,
tileOffset, nsIntSize(tileSize.width, tileSize.height));
tileOffset, nsIntSize(tileSize, tileSize));
}
}
tileY++;

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

@ -13,9 +13,9 @@
#include "SharedSurfaceGL.h" // for SharedSurface_GLTexture, etc
#include "SurfaceStream.h" // for SurfaceStream
#include "SurfaceTypes.h" // for SharedSurfaceType, etc
#include "TiledLayerBuffer.h" // for TILEDLAYERBUFFER_TILE_SIZE
#include "gfx2DGlue.h" // for ContentForFormat, etc
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxPrefs.h" // for gfxPrefs::LayersTileWidth/Height
#include "gfxReusableSurfaceWrapper.h" // for gfxReusableSurfaceWrapper
#include "ipc/AutoOpenSurface.h" // for AutoOpenSurface
#include "mozilla/gfx/2D.h" // for DataSourceSurface

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

@ -61,8 +61,8 @@ TEST(TiledLayerBuffer, TileConstructor) {
TEST(TiledLayerBuffer, TileStart) {
TestTiledLayerBuffer buffer;
ASSERT_EQ(buffer.RoundDownToTileEdge(10, 256), 0);
ASSERT_EQ(buffer.RoundDownToTileEdge(-10, 256), -256);
ASSERT_EQ(buffer.RoundDownToTileEdge(10), 0);
ASSERT_EQ(buffer.RoundDownToTileEdge(-10), -256);
}
TEST(TiledLayerBuffer, EmptyUpdate) {

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

@ -179,11 +179,6 @@ private:
DECL_GFX_PREF(Once, "layers.enable-tiles", LayersTilesEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.simple-tiles", LayersUseSimpleTiles, bool, false);
DECL_GFX_PREF(Once, "layers.force-per-tile-drawing", PerTileDrawing, bool, false);
// We allow for configurable and rectangular tile size to avoid wasting memory on devices whose
// screen size does not align nicely to the default tile size. Although layers can be any size,
// they are often the same size as the screen, especially for width.
DECL_GFX_PREF(Once, "layers.tile-width", LayersTileWidth, int32_t, 256);
DECL_GFX_PREF(Once, "layers.tile-height", LayersTileHeight, int32_t, 256);
DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking", OverzealousGrallocUnlocking, bool, false);
DECL_GFX_PREF(Once, "layers.force-shmem-tiles", ForceShmemTiles, bool, false);
DECL_GFX_PREF(Live, "layers.frame-counter", DrawFrameCounter, bool, false);

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

@ -725,7 +725,7 @@ nsLayoutUtils::GetDisplayPort(nsIContent* aContent, nsRect *aResult)
nsIScrollableFrame* scrollableFrame = frame->GetScrollTargetFrame();
nsPoint scrollPos(
scrollableFrame ? scrollableFrame->GetScrollPosition() : nsPoint(0,0));
if (marginsData->mAlignmentX > 0 || marginsData->mAlignmentY > 0) {
if (marginsData->mAlignment > 0) {
LayerPoint scrollPosLayer(
res.width * NSAppUnitsToFloatPixels(scrollPos.x, auPerDevPixel),
res.height * NSAppUnitsToFloatPixels(scrollPos.y, auPerDevPixel));
@ -738,13 +738,13 @@ nsLayoutUtils::GetDisplayPort(nsIContent* aContent, nsRect *aResult)
rect.Inflate(1);
float left =
marginsData->mAlignmentX * floor(rect.x / marginsData->mAlignmentX);
marginsData->mAlignment * floor(rect.x / marginsData->mAlignment);
float top =
marginsData->mAlignmentY * floor(rect.y / marginsData->mAlignmentY);
marginsData->mAlignment * floor(rect.y / marginsData->mAlignment);
float right =
marginsData->mAlignmentX * ceil(rect.XMost() / marginsData->mAlignmentX);
marginsData->mAlignment * ceil(rect.XMost() / marginsData->mAlignment);
float bottom =
marginsData->mAlignmentY * ceil(rect.YMost() / marginsData->mAlignmentY);
marginsData->mAlignment * ceil(rect.YMost() / marginsData->mAlignment);
rect = LayerRect(left, top, right - left, bottom - top);
rect -= scrollPosLayer;
}

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

@ -87,16 +87,13 @@ struct DisplayPortPropertyData {
struct DisplayPortMarginsPropertyData {
DisplayPortMarginsPropertyData(const LayerMargin& aMargins,
uint32_t aAlignmentX, uint32_t aAlignmentY,
uint32_t aPriority)
uint32_t aAlignment, uint32_t aPriority)
: mMargins(aMargins)
, mAlignmentX(aAlignmentX)
, mAlignmentY(aAlignmentY)
, mAlignment(aAlignment)
, mPriority(aPriority)
{}
LayerMargin mMargins;
uint32_t mAlignmentX;
uint32_t mAlignmentY;
uint32_t mAlignment;
uint32_t mPriority;
};

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

@ -4,12 +4,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "APZCCallbackHelper.h"
#include "gfxPrefs.h" // For gfxPrefs::LayersTilesEnabled, LayersTileWidth/Height
#include "gfxPrefs.h" // For gfxPrefs::LayersTilesEnabled
#include "mozilla/Preferences.h"
#include "nsIScrollableFrame.h"
#include "nsLayoutUtils.h"
#include "nsIDOMElement.h"
#include "nsIInterfaceRequestorUtils.h"
#include "TiledLayerBuffer.h" // For TILEDLAYERBUFFER_TILE_SIZE
namespace mozilla {
namespace widget {
@ -45,12 +46,14 @@ static CSSRect ExpandDisplayPortToTileBoundaries(
displayPortInLayerSpace.Inflate(1);
// Now nudge the rectangle to the nearest equal or larger tile boundary.
int32_t tileWidth = gfxPrefs::LayersTileWidth();
int32_t tileHeight = gfxPrefs::LayersTileHeight();
gfxFloat left = tileWidth * floor(displayPortInLayerSpace.x / tileWidth);
gfxFloat right = tileWidth * ceil(displayPortInLayerSpace.XMost() / tileWidth);
gfxFloat top = tileHeight * floor(displayPortInLayerSpace.y / tileHeight);
gfxFloat bottom = tileHeight * ceil(displayPortInLayerSpace.YMost() / tileHeight);
gfxFloat left = TILEDLAYERBUFFER_TILE_SIZE
* floor(displayPortInLayerSpace.x / TILEDLAYERBUFFER_TILE_SIZE);
gfxFloat top = TILEDLAYERBUFFER_TILE_SIZE
* floor(displayPortInLayerSpace.y / TILEDLAYERBUFFER_TILE_SIZE);
gfxFloat right = TILEDLAYERBUFFER_TILE_SIZE
* ceil(displayPortInLayerSpace.XMost() / TILEDLAYERBUFFER_TILE_SIZE);
gfxFloat bottom = TILEDLAYERBUFFER_TILE_SIZE
* ceil(displayPortInLayerSpace.YMost() / TILEDLAYERBUFFER_TILE_SIZE);
displayPortInLayerSpace = LayerRect(left, top, right - left, bottom - top);
CSSRect displayPort = displayPortInLayerSpace / aLayerPixelsPerCSSPixel;
@ -228,16 +231,14 @@ APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
aMetrics.mDisplayPort.height,
element, 0);
} else {
gfx::IntSize alignment = gfxPrefs::LayersTilesEnabled()
? gfx::IntSize(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight()) :
gfx::IntSize(1, 1);
uint32_t alignment = gfxPrefs::LayersTilesEnabled()
? TILEDLAYERBUFFER_TILE_SIZE : 1;
LayerMargin margins = aMetrics.GetDisplayPortMargins();
aUtils->SetDisplayPortMarginsForElement(margins.left,
margins.top,
margins.right,
margins.bottom,
alignment.width,
alignment.height,
alignment,
element, 0);
CSSRect baseCSS = aMetrics.mCompositionBounds / aMetrics.GetZoomToParent();
nsRect base(baseCSS.x * nsPresContext::AppUnitsPerCSSPixel(),
@ -283,16 +284,14 @@ APZCCallbackHelper::UpdateSubFrame(nsIContent* aContent,
aMetrics.mDisplayPort.height,
element, 0);
} else {
gfx::IntSize alignment = gfxPrefs::LayersTilesEnabled()
? gfx::IntSize(gfxPrefs::LayersTileWidth(), gfxPrefs::LayersTileHeight()) :
gfx::IntSize(1, 1);
uint32_t alignment = gfxPrefs::LayersTilesEnabled()
? TILEDLAYERBUFFER_TILE_SIZE : 1;
LayerMargin margins = aMetrics.GetDisplayPortMargins();
utils->SetDisplayPortMarginsForElement(margins.left,
margins.top,
margins.right,
margins.bottom,
alignment.width,
alignment.height,
alignment,
element, 0);
CSSRect baseCSS = aMetrics.mCompositionBounds / aMetrics.GetZoomToParent();
nsRect base(baseCSS.x * nsPresContext::AppUnitsPerCSSPixel(),