2012-04-16 16:02:45 -07:00
|
|
|
/* 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/. */
|
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
#ifndef GFX_CLIENTTILEDTHEBESLAYER_H
|
|
|
|
#define GFX_CLIENTTILEDTHEBESLAYER_H
|
2012-04-16 16:02:45 -07:00
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "ClientLayerManager.h" // for ClientLayer, etc
|
|
|
|
#include "Layers.h" // for ThebesLayer, etc
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
|
|
|
#include "mozilla/layers/TiledContentClient.h"
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
|
|
|
|
|
|
|
class gfxContext;
|
2012-04-16 16:02:45 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class ShadowableLayer;
|
|
|
|
class SpecificLayerAttributes;
|
2012-04-16 16:02:45 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An implementation of ThebesLayer that ONLY supports remote
|
|
|
|
* composition that is backed by tiles. This thebes layer implementation
|
|
|
|
* is better suited to mobile hardware to work around slow implementation
|
|
|
|
* of glTexImage2D (for OGL compositors), and restrait memory bandwidth.
|
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
|
|
|
*
|
|
|
|
* Tiled Thebes layers use a different protocol compared with other
|
|
|
|
* layers. A copy of the tiled buffer is made and sent to the compositing
|
|
|
|
* thread via the layers protocol. Tiles are uploaded by the buffers
|
|
|
|
* asynchonously without using IPC, that means they are not safe for cross-
|
|
|
|
* process use (bug 747811). Each tile has a TextureHost/Client pair but
|
|
|
|
* they communicate directly rather than using the Texture protocol.
|
|
|
|
*
|
|
|
|
* There is no ContentClient for tiled layers. There is a ContentHost, however.
|
2012-04-16 16:02:45 -07:00
|
|
|
*/
|
2013-04-30 22:03:25 -07:00
|
|
|
class ClientTiledThebesLayer : public ThebesLayer,
|
|
|
|
public ClientLayer
|
2012-04-16 16:02:45 -07:00
|
|
|
{
|
|
|
|
typedef ThebesLayer Base;
|
|
|
|
|
|
|
|
public:
|
2014-06-13 09:11:08 -07:00
|
|
|
ClientTiledThebesLayer(ClientLayerManager* const aManager,
|
|
|
|
ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
|
2014-07-15 08:37:45 -07:00
|
|
|
|
|
|
|
protected:
|
2013-04-30 22:03:25 -07:00
|
|
|
~ClientTiledThebesLayer();
|
2012-04-16 16:02:45 -07:00
|
|
|
|
2014-07-15 08:37:45 -07:00
|
|
|
public:
|
2014-04-23 14:12:31 -07:00
|
|
|
// Override name to distinguish it from ClientThebesLayer in layer dumps
|
|
|
|
virtual const char* Name() const { return "TiledThebesLayer"; }
|
|
|
|
|
2012-04-16 16:02:45 -07:00
|
|
|
// Thebes Layer
|
|
|
|
virtual Layer* AsLayer() { return this; }
|
|
|
|
virtual void InvalidateRegion(const nsIntRegion& aRegion) {
|
2012-08-28 22:47:18 -07:00
|
|
|
mInvalidRegion.Or(mInvalidRegion, aRegion);
|
2012-07-03 17:24:55 -07:00
|
|
|
mValidRegion.Sub(mValidRegion, aRegion);
|
2012-11-21 14:34:19 -08:00
|
|
|
mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion);
|
2012-04-16 16:02:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Shadow methods
|
|
|
|
virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
|
|
|
|
virtual ShadowableLayer* AsShadowableLayer() { return this; }
|
|
|
|
|
|
|
|
virtual void Disconnect()
|
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientLayer::Disconnect();
|
2012-04-16 16:02:45 -07:00
|
|
|
}
|
|
|
|
|
2013-04-30 22:03:25 -07:00
|
|
|
virtual void RenderLayer();
|
2012-04-16 16:02:45 -07:00
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
virtual void ClearCachedResources() MOZ_OVERRIDE;
|
|
|
|
|
2014-06-23 05:41:09 -07:00
|
|
|
/**
|
|
|
|
* Helper method to find the nearest ancestor layers which
|
|
|
|
* scroll and have a displayport. The parameters are out-params
|
|
|
|
* which hold the return values; the values passed in may be null.
|
|
|
|
*/
|
2014-08-11 17:00:36 -07:00
|
|
|
void GetAncestorLayers(Layer** aOutScrollAncestor,
|
|
|
|
Layer** aOutDisplayPortAncestor);
|
2014-06-23 05:41:09 -07:00
|
|
|
|
2012-04-16 16:02:45 -07:00
|
|
|
private:
|
2013-04-30 22:03:25 -07:00
|
|
|
ClientLayerManager* ClientManager()
|
2012-04-16 16:02:45 -07:00
|
|
|
{
|
2013-04-30 22:03:25 -07:00
|
|
|
return static_cast<ClientLayerManager*>(mManager);
|
2012-04-16 16:02:45 -07:00
|
|
|
}
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
/**
|
|
|
|
* For the initial PaintThebes of a transaction, calculates all the data
|
|
|
|
* needed for that paint and any repeated transactions.
|
|
|
|
*/
|
|
|
|
void BeginPaint();
|
|
|
|
|
2014-06-11 09:42:44 -07:00
|
|
|
/**
|
|
|
|
* Determine if we can use a fast path to just do a single high-precision,
|
|
|
|
* non-progressive paint.
|
|
|
|
*/
|
|
|
|
bool UseFastPath();
|
|
|
|
|
2014-06-11 09:42:45 -07:00
|
|
|
/**
|
2014-06-11 09:42:45 -07:00
|
|
|
* Helper function to do the high-precision paint.
|
2014-06-11 09:42:45 -07:00
|
|
|
* This function returns true if it updated the paint buffer.
|
|
|
|
*/
|
|
|
|
bool RenderHighPrecision(nsIntRegion& aInvalidRegion,
|
2014-08-03 20:29:55 -07:00
|
|
|
const nsIntRegion& aVisibleRegion,
|
2014-06-11 09:42:45 -07:00
|
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData);
|
|
|
|
|
2014-06-11 09:42:45 -07:00
|
|
|
/**
|
|
|
|
* Helper function to do the low-precision paint.
|
|
|
|
* This function returns true if it updated the paint buffer.
|
|
|
|
*/
|
|
|
|
bool RenderLowPrecision(nsIntRegion& aInvalidRegion,
|
2014-08-03 20:29:55 -07:00
|
|
|
const nsIntRegion& aVisibleRegion,
|
2014-06-11 09:42:45 -07:00
|
|
|
LayerManager::DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData);
|
|
|
|
|
2012-11-29 05:08:40 -08:00
|
|
|
/**
|
2014-06-11 09:42:46 -07:00
|
|
|
* This causes the paint to be marked as finished, and updates any data
|
|
|
|
* necessary to persist until the next paint.
|
2012-11-29 05:08:40 -08:00
|
|
|
*/
|
2014-06-11 09:42:46 -07:00
|
|
|
void EndPaint();
|
2012-11-29 05:08:40 -08:00
|
|
|
|
2013-04-16 14:36:06 -07:00
|
|
|
RefPtr<TiledContentClient> mContentClient;
|
2012-11-21 14:34:19 -08:00
|
|
|
nsIntRegion mLowPrecisionValidRegion;
|
2012-11-29 05:08:40 -08:00
|
|
|
BasicTiledLayerPaintData mPaintData;
|
2012-04-16 16:02:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // layers
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif
|