Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "TiledContentHost.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "ThebesLayerComposite.h" // for ThebesLayerComposite
|
|
|
|
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
|
|
|
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
|
|
|
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
|
|
|
|
#include "nsAString.h"
|
|
|
|
#include "nsDebug.h" // for NS_WARNING
|
|
|
|
#include "nsPoint.h" // for nsIntPoint
|
|
|
|
#include "nsPrintfCString.h" // for nsPrintfCString
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsSize.h" // for nsIntSize
|
|
|
|
|
|
|
|
class gfxReusableSurfaceWrapper;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
using namespace gfx;
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class Layer;
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void
|
|
|
|
TiledLayerBufferComposite::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
|
|
|
|
const nsIntRegion& aNewValidRegion,
|
|
|
|
const nsIntRegion& aInvalidateRegion,
|
2013-11-27 09:33:27 -08:00
|
|
|
const CSSToScreenScale& aResolution)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
|
|
|
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
|
|
|
printf_stderr("Upload %i, %i, %i, %i\n", aInvalidateRegion.GetBounds().x, aInvalidateRegion.GetBounds().y, aInvalidateRegion.GetBounds().width, aInvalidateRegion.GetBounds().height);
|
|
|
|
long start = PR_IntervalNow();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mFrameResolution = aResolution;
|
|
|
|
mMainMemoryTiledBuffer = aMainMemoryTiledBuffer;
|
|
|
|
Update(aNewValidRegion, aInvalidateRegion);
|
|
|
|
mMainMemoryTiledBuffer = nullptr;
|
|
|
|
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
|
|
|
if (PR_IntervalNow() - start > 10) {
|
|
|
|
printf_stderr("Time to upload %i\n", PR_IntervalNow() - start);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
TiledTexture
|
|
|
|
TiledLayerBufferComposite::ValidateTile(TiledTexture aTile,
|
|
|
|
const nsIntPoint& aTileOrigin,
|
|
|
|
const nsIntRegion& aDirtyRect)
|
|
|
|
{
|
|
|
|
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
|
|
|
printf_stderr("Upload tile %i, %i\n", aTileOrigin.x, aTileOrigin.y);
|
|
|
|
long start = PR_IntervalNow();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
aTile.Validate(mMainMemoryTiledBuffer->GetTile(aTileOrigin).GetSurface(), mCompositor, GetTileLength());
|
|
|
|
|
|
|
|
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
|
|
|
if (PR_IntervalNow() - start > 1) {
|
|
|
|
printf_stderr("Tile Time to upload %i\n", PR_IntervalNow() - start);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return aTile;
|
|
|
|
}
|
|
|
|
|
2013-04-16 14:36:06 -07:00
|
|
|
void
|
2013-08-20 18:28:53 -07:00
|
|
|
TiledContentHost::Attach(Layer* aLayer,
|
|
|
|
Compositor* aCompositor,
|
|
|
|
AttachFlags aFlags /* = NO_FLAGS */)
|
2013-04-16 14:36:06 -07:00
|
|
|
{
|
2013-08-20 18:28:53 -07:00
|
|
|
CompositableHost::Attach(aLayer, aCompositor, aFlags);
|
2013-04-16 14:36:06 -07:00
|
|
|
static_cast<ThebesLayerComposite*>(aLayer)->EnsureTiled();
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void
|
2013-08-19 06:59:22 -07:00
|
|
|
TiledContentHost::PaintedTiledLayerBuffer(ISurfaceAllocator* aAllocator,
|
|
|
|
const SurfaceDescriptorTiles& aTiledDescriptor)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
2013-08-19 06:59:22 -07:00
|
|
|
if (aTiledDescriptor.resolution() < 1) {
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer = BasicTiledLayerBuffer::OpenDescriptor(aAllocator, aTiledDescriptor);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mLowPrecisionRegionToUpload.Or(mLowPrecisionRegionToUpload,
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer.GetPaintedRegion());
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer.ClearPaintedRegion();
|
|
|
|
mPendingLowPrecisionUpload = true;
|
|
|
|
} else {
|
2013-08-19 06:59:22 -07:00
|
|
|
mMainMemoryTiledBuffer = BasicTiledLayerBuffer::OpenDescriptor(aAllocator, aTiledDescriptor);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mRegionToUpload.Or(mRegionToUpload, mMainMemoryTiledBuffer.GetPaintedRegion());
|
|
|
|
mMainMemoryTiledBuffer.ClearPaintedRegion();
|
|
|
|
mPendingUpload = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::ProcessLowPrecisionUploadQueue()
|
|
|
|
{
|
|
|
|
if (!mPendingLowPrecisionUpload) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mLowPrecisionRegionToUpload.And(mLowPrecisionRegionToUpload,
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer.GetValidRegion());
|
|
|
|
mLowPrecisionVideoMemoryTiledBuffer.SetResolution(
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer.GetResolution());
|
|
|
|
// It's assumed that the video memory tiled buffer has an up-to-date
|
|
|
|
// frame resolution. As it's always updated first when zooming, this
|
|
|
|
// should always be true.
|
|
|
|
mLowPrecisionVideoMemoryTiledBuffer.Upload(&mLowPrecisionMainMemoryTiledBuffer,
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer.GetValidRegion(),
|
|
|
|
mLowPrecisionRegionToUpload,
|
|
|
|
mVideoMemoryTiledBuffer.GetFrameResolution());
|
|
|
|
nsIntRegion validRegion = mLowPrecisionVideoMemoryTiledBuffer.GetValidRegion();
|
|
|
|
|
|
|
|
mLowPrecisionMainMemoryTiledBuffer = BasicTiledLayerBuffer();
|
|
|
|
mLowPrecisionRegionToUpload = nsIntRegion();
|
|
|
|
mPendingLowPrecisionUpload = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::ProcessUploadQueue(nsIntRegion* aNewValidRegion,
|
|
|
|
TiledLayerProperties* aLayerProperties)
|
|
|
|
{
|
|
|
|
if (!mPendingUpload)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// If we coalesce uploads while the layers' valid region is changing we will
|
|
|
|
// end up trying to upload area outside of the valid region. (bug 756555)
|
|
|
|
mRegionToUpload.And(mRegionToUpload, mMainMemoryTiledBuffer.GetValidRegion());
|
|
|
|
|
|
|
|
mVideoMemoryTiledBuffer.Upload(&mMainMemoryTiledBuffer,
|
|
|
|
mMainMemoryTiledBuffer.GetValidRegion(),
|
|
|
|
mRegionToUpload, aLayerProperties->mEffectiveResolution);
|
|
|
|
|
|
|
|
*aNewValidRegion = mVideoMemoryTiledBuffer.GetValidRegion();
|
|
|
|
|
|
|
|
// Release all the tiles by replacing the tile buffer with an empty
|
2013-08-19 06:59:22 -07:00
|
|
|
// tiled buffer.
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mMainMemoryTiledBuffer = BasicTiledLayerBuffer();
|
|
|
|
mRegionToUpload = nsIntRegion();
|
|
|
|
mPendingUpload = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::Composite(EffectChain& aEffectChain,
|
|
|
|
float aOpacity,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
const gfx::Filter& aFilter,
|
|
|
|
const gfx::Rect& aClipRect,
|
|
|
|
const nsIntRegion* aVisibleRegion /* = nullptr */,
|
|
|
|
TiledLayerProperties* aLayerProperties /* = nullptr */)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aLayerProperties, "aLayerProperties required for TiledContentHost");
|
|
|
|
|
|
|
|
// note that ProcessUploadQueue updates the valid region which is then used by
|
|
|
|
// the RenderLayerBuffer calls below and then sent back to the layer.
|
|
|
|
ProcessUploadQueue(&aLayerProperties->mValidRegion, aLayerProperties);
|
|
|
|
ProcessLowPrecisionUploadQueue();
|
|
|
|
|
|
|
|
// Render valid tiles.
|
|
|
|
nsIntRect visibleRect = aVisibleRegion->GetBounds();
|
|
|
|
|
|
|
|
RenderLayerBuffer(mLowPrecisionVideoMemoryTiledBuffer,
|
|
|
|
mLowPrecisionVideoMemoryTiledBuffer.GetValidRegion(), aEffectChain, aOpacity,
|
2013-11-07 01:53:08 -08:00
|
|
|
aFilter, aClipRect, aLayerProperties->mValidRegion, visibleRect, aTransform);
|
|
|
|
RenderLayerBuffer(mVideoMemoryTiledBuffer, aLayerProperties->mValidRegion, aEffectChain, aOpacity,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
aFilter, aClipRect, nsIntRegion(), visibleRect, aTransform);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::RenderTile(const TiledTexture& aTile,
|
|
|
|
EffectChain& aEffectChain,
|
|
|
|
float aOpacity,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
const gfx::Filter& aFilter,
|
|
|
|
const gfx::Rect& aClipRect,
|
|
|
|
const nsIntRegion& aScreenRegion,
|
|
|
|
const nsIntPoint& aTextureOffset,
|
|
|
|
const nsIntSize& aTextureBounds)
|
|
|
|
{
|
2013-07-08 14:30:44 -07:00
|
|
|
MOZ_ASSERT(aTile.mDeprecatedTextureHost, "Trying to render a placeholder tile?");
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
RefPtr<TexturedEffect> effect =
|
2013-07-08 14:30:44 -07:00
|
|
|
CreateTexturedEffect(aTile.mDeprecatedTextureHost, aFilter);
|
2013-11-21 14:07:56 -08:00
|
|
|
if (!effect) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
if (aTile.mDeprecatedTextureHost->Lock()) {
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
aEffectChain.mPrimaryEffect = effect;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIntRegionRectIterator it(aScreenRegion);
|
|
|
|
for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) {
|
|
|
|
Rect graphicsRect(rect->x, rect->y, rect->width, rect->height);
|
|
|
|
Rect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y,
|
|
|
|
rect->width, rect->height);
|
|
|
|
|
|
|
|
effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width,
|
|
|
|
textureRect.y / aTextureBounds.height,
|
|
|
|
textureRect.width / aTextureBounds.width,
|
|
|
|
textureRect.height / aTextureBounds.height);
|
2013-11-07 01:53:08 -08:00
|
|
|
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
|
2013-08-02 15:50:17 -07:00
|
|
|
mCompositor->DrawDiagnostics(DIAGNOSTIC_CONTENT|DIAGNOSTIC_TILE,
|
2013-11-07 01:53:08 -08:00
|
|
|
graphicsRect, aClipRect, aTransform);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
aTile.mDeprecatedTextureHost->Unlock();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|
|
|
const nsIntRegion& aValidRegion,
|
|
|
|
EffectChain& aEffectChain,
|
|
|
|
float aOpacity,
|
|
|
|
const gfx::Filter& aFilter,
|
|
|
|
const gfx::Rect& aClipRect,
|
|
|
|
const nsIntRegion& aMaskRegion,
|
|
|
|
nsIntRect aVisibleRect,
|
|
|
|
gfx::Matrix4x4 aTransform)
|
|
|
|
{
|
2013-06-13 13:19:39 -07:00
|
|
|
if (!mCompositor) {
|
|
|
|
NS_WARNING("Can't render tiled content host - no compositor");
|
|
|
|
return;
|
|
|
|
}
|
2013-07-24 08:10:55 -07:00
|
|
|
float resolution = aLayerBuffer.GetResolution();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
gfxSize layerScale(1, 1);
|
|
|
|
// We assume that the current frame resolution is the one used in our primary
|
|
|
|
// layer buffer. Compensate for a changing frame resolution.
|
|
|
|
if (aLayerBuffer.GetFrameResolution() != mVideoMemoryTiledBuffer.GetFrameResolution()) {
|
2013-11-27 09:33:27 -08:00
|
|
|
const CSSToScreenScale& layerResolution = aLayerBuffer.GetFrameResolution();
|
|
|
|
const CSSToScreenScale& localResolution = mVideoMemoryTiledBuffer.GetFrameResolution();
|
|
|
|
layerScale.width = layerScale.height = layerResolution.scale / localResolution.scale;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);
|
|
|
|
}
|
|
|
|
aTransform.Scale(1/(resolution * layerScale.width),
|
|
|
|
1/(resolution * layerScale.height), 1);
|
|
|
|
|
|
|
|
uint32_t rowCount = 0;
|
|
|
|
uint32_t tileX = 0;
|
|
|
|
for (int32_t x = aVisibleRect.x; x < aVisibleRect.x + aVisibleRect.width;) {
|
|
|
|
rowCount++;
|
|
|
|
int32_t tileStartX = aLayerBuffer.GetTileStart(x);
|
|
|
|
int32_t w = aLayerBuffer.GetScaledTileLength() - tileStartX;
|
|
|
|
if (x + w > aVisibleRect.x + aVisibleRect.width) {
|
|
|
|
w = aVisibleRect.x + aVisibleRect.width - x;
|
|
|
|
}
|
|
|
|
int tileY = 0;
|
|
|
|
for (int32_t y = aVisibleRect.y; y < aVisibleRect.y + aVisibleRect.height;) {
|
|
|
|
int32_t tileStartY = aLayerBuffer.GetTileStart(y);
|
|
|
|
int32_t h = aLayerBuffer.GetScaledTileLength() - tileStartY;
|
|
|
|
if (y + h > aVisibleRect.y + aVisibleRect.height) {
|
|
|
|
h = aVisibleRect.y + aVisibleRect.height - y;
|
|
|
|
}
|
|
|
|
|
|
|
|
TiledTexture tileTexture = aLayerBuffer.
|
|
|
|
GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x),
|
|
|
|
aLayerBuffer.RoundDownToTileEdge(y)));
|
|
|
|
if (tileTexture != aLayerBuffer.GetPlaceholderTile()) {
|
|
|
|
nsIntRegion tileDrawRegion;
|
|
|
|
tileDrawRegion.And(aValidRegion,
|
|
|
|
nsIntRect(x * layerScale.width,
|
|
|
|
y * layerScale.height,
|
|
|
|
w * layerScale.width,
|
|
|
|
h * layerScale.height));
|
|
|
|
tileDrawRegion.Sub(tileDrawRegion, aMaskRegion);
|
|
|
|
|
|
|
|
if (!tileDrawRegion.IsEmpty()) {
|
|
|
|
tileDrawRegion.ScaleRoundOut(resolution / layerScale.width,
|
|
|
|
resolution / layerScale.height);
|
|
|
|
|
|
|
|
nsIntPoint tileOffset((x - tileStartX) * resolution,
|
|
|
|
(y - tileStartY) * resolution);
|
|
|
|
uint32_t tileSize = aLayerBuffer.GetTileLength();
|
2013-11-07 01:53:08 -08:00
|
|
|
RenderTile(tileTexture, aEffectChain, aOpacity, aTransform, aFilter, aClipRect, tileDrawRegion,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
tileOffset, nsIntSize(tileSize, tileSize));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tileY++;
|
|
|
|
y += h;
|
|
|
|
}
|
|
|
|
tileX++;
|
|
|
|
x += w;
|
|
|
|
}
|
2013-08-02 15:50:17 -07:00
|
|
|
gfx::Rect rect(aVisibleRect.x, aVisibleRect.y,
|
|
|
|
aVisibleRect.width, aVisibleRect.height);
|
|
|
|
GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTENT,
|
2013-11-07 01:53:08 -08:00
|
|
|
rect, aClipRect, aTransform);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledTexture::Validate(gfxReusableSurfaceWrapper* aReusableSurface, Compositor* aCompositor, uint16_t aSize)
|
|
|
|
{
|
|
|
|
TextureFlags flags = 0;
|
2013-07-08 14:30:44 -07:00
|
|
|
if (!mDeprecatedTextureHost) {
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// convert placeholder tile to a real tile
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureHost = DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptor::Tnull_t,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
TEXTURE_HOST_TILED,
|
2013-09-12 19:39:26 -07:00
|
|
|
flags,
|
|
|
|
nullptr);
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureHost->SetCompositor(aCompositor);
|
2013-08-06 10:36:35 -07:00
|
|
|
flags |= TEXTURE_NEW_TILE;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2013-07-08 14:30:44 -07:00
|
|
|
mDeprecatedTextureHost->Update(aReusableSurface, flags, gfx::IntSize(aSize, aSize));
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TiledContentHost::PrintInfo(nsACString& aTo, const char* aPrefix)
|
|
|
|
{
|
|
|
|
aTo += aPrefix;
|
|
|
|
aTo += nsPrintfCString("TiledContentHost (0x%p)", this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-08 05:53:12 -07:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
2013-05-25 19:44:24 -07:00
|
|
|
void
|
|
|
|
TiledContentHost::Dump(FILE* aFile,
|
|
|
|
const char* aPrefix,
|
|
|
|
bool aDumpHtml)
|
|
|
|
{
|
|
|
|
if (!aFile) {
|
|
|
|
aFile = stderr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TiledLayerBufferComposite::Iterator it = mVideoMemoryTiledBuffer.TilesBegin();
|
|
|
|
TiledLayerBufferComposite::Iterator stop = mVideoMemoryTiledBuffer.TilesEnd();
|
|
|
|
if (aDumpHtml) {
|
2013-11-23 14:44:18 -08:00
|
|
|
fprintf_stderr(aFile, "<ul>");
|
2013-05-25 19:44:24 -07:00
|
|
|
}
|
|
|
|
for (;it != stop; ++it) {
|
2013-11-23 14:44:18 -08:00
|
|
|
fprintf_stderr(aFile, "%s", aPrefix);
|
|
|
|
fprintf_stderr(aFile, aDumpHtml ? "<li> <a href=" : "Tile ");
|
2013-07-08 14:30:44 -07:00
|
|
|
DumpDeprecatedTextureHost(aFile, it->mDeprecatedTextureHost);
|
2013-11-23 14:44:18 -08:00
|
|
|
fprintf_stderr(aFile, aDumpHtml ? " >Tile</a></li>" : " ");
|
2013-05-25 19:44:24 -07:00
|
|
|
}
|
|
|
|
if (aDumpHtml) {
|
2013-11-23 14:44:18 -08:00
|
|
|
fprintf_stderr(aFile, "</ul>");
|
2013-05-25 19:44:24 -07:00
|
|
|
}
|
|
|
|
}
|
2013-08-08 05:53:12 -07:00
|
|
|
#endif
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
} // namespace
|