mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
Bug 1317656 - Cleanup more gonk/b2g dependent code r=nical
This commit is contained in:
parent
0e176830ff
commit
92926a0f41
@ -1810,8 +1810,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* Supported properties:
|
||||
* "overdraw": Report a percentage between 0 and 999 indicate how many times
|
||||
* each pixels on the destination window have been touched.
|
||||
* "missed_hwc": Report a bool if hardware composer is supported but was
|
||||
* not used for the last frame.
|
||||
*/
|
||||
float requestCompositorProperty(in AString aProperty);
|
||||
|
||||
|
@ -330,8 +330,7 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo,
|
||||
if (!v->mImage) {
|
||||
return nullptr;
|
||||
}
|
||||
NS_ASSERTION(v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR ||
|
||||
v->mImage->GetFormat() == ImageFormat::GRALLOC_PLANAR_YCBCR,
|
||||
NS_ASSERTION(v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR,
|
||||
"Wrong format?");
|
||||
PlanarYCbCrImage* videoImage = v->mImage->AsPlanarYCbCrImage();
|
||||
MOZ_ASSERT(videoImage);
|
||||
|
@ -260,7 +260,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
|
||||
break;
|
||||
#ifdef ANDROID
|
||||
case ConvertSurfaceTexture:
|
||||
case ConvertGralloc:
|
||||
programPtr = &mTexExternalBlit_Program;
|
||||
fragShaderPtr = &mTexExternalBlit_FragShader;
|
||||
fragShaderSource = kTexExternalBlit_FragShaderSource;
|
||||
@ -401,7 +400,6 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
|
||||
switch (target) {
|
||||
#ifdef ANDROID
|
||||
case ConvertSurfaceTexture:
|
||||
case ConvertGralloc:
|
||||
#endif
|
||||
case BlitTex2D:
|
||||
case BlitTexRect:
|
||||
|
@ -18,7 +18,6 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
class Image;
|
||||
class PlanarYCbCrImage;
|
||||
class GrallocImage;
|
||||
class SurfaceTextureImage;
|
||||
class MacIOSurfaceImage;
|
||||
class EGLImageImage;
|
||||
@ -45,8 +44,6 @@ class GLBlitHelper final
|
||||
* The difference between BlitTex2D and BlitTexRect is the texture type, which affect
|
||||
* the fragment shader a bit.
|
||||
*
|
||||
* ConvertGralloc is used to color convert copy blit the GrallocImage into a
|
||||
* normal RGB texture by egl_image_external extension
|
||||
* ConvertPlnarYcbCr is used to color convert copy blit the PlanarYCbCrImage
|
||||
* into a normal RGB texture by create textures of each color channel, and
|
||||
* convert it in GPU.
|
||||
@ -56,7 +53,6 @@ class GLBlitHelper final
|
||||
{
|
||||
BlitTex2D,
|
||||
BlitTexRect,
|
||||
ConvertGralloc,
|
||||
ConvertPlanarYCbCr,
|
||||
ConvertSurfaceTexture,
|
||||
ConvertEGLImage,
|
||||
|
@ -74,7 +74,6 @@ enum class SharedSurfaceType : uint8_t {
|
||||
EGLSurfaceANGLE,
|
||||
DXGLInterop,
|
||||
DXGLInterop2,
|
||||
Gralloc,
|
||||
IOSurface,
|
||||
GLXDrawable,
|
||||
SharedGLTexture,
|
||||
|
@ -173,9 +173,7 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
uint32_t aFlashCounter)
|
||||
{
|
||||
#ifdef MOZ_B2G
|
||||
int lWidth = 4;
|
||||
#elif defined(ANDROID)
|
||||
#ifdef ANDROID
|
||||
int lWidth = 10;
|
||||
#else
|
||||
int lWidth = 2;
|
||||
|
@ -123,7 +123,6 @@ namespace layers {
|
||||
struct Effect;
|
||||
struct EffectChain;
|
||||
class Image;
|
||||
class ImageHostOverlay;
|
||||
class Layer;
|
||||
class TextureSource;
|
||||
class DataTextureSource;
|
||||
@ -173,10 +172,6 @@ enum SurfaceInitMode
|
||||
* construct an EffectChain for the quad,
|
||||
* call DrawQuad,
|
||||
* call EndFrame.
|
||||
* If the compositor is usually used for compositing but compositing is
|
||||
* temporarily done without the compositor, call EndFrameForExternalComposition
|
||||
* after compositing each frame so the compositor can remain internally
|
||||
* consistent.
|
||||
*
|
||||
* By default, the compositor will render to the screen, to render to a target,
|
||||
* call SetTargetContext or SetRenderTarget, the latter with a target created
|
||||
@ -434,13 +429,6 @@ public:
|
||||
|
||||
virtual void SetDispAcquireFence(Layer* aLayer);
|
||||
|
||||
/**
|
||||
* Post-rendering stuff if the rendering is done outside of this Compositor
|
||||
* e.g., by Composer2D.
|
||||
* aTransform is the transform from user space to window space.
|
||||
*/
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) = 0;
|
||||
|
||||
/**
|
||||
* Whether textures created by this compositor can receive partial updates.
|
||||
*/
|
||||
@ -523,12 +511,6 @@ public:
|
||||
|
||||
widget::CompositorWidget* GetWidget() const { return mWidget; }
|
||||
|
||||
virtual bool HasImageHostOverlays() { return false; }
|
||||
|
||||
virtual void AddImageHostOverlay(ImageHostOverlay* aOverlay) {}
|
||||
|
||||
virtual void RemoveImageHostOverlay(ImageHostOverlay* aOverlay) {}
|
||||
|
||||
/**
|
||||
* Debug-build assertion that can be called to ensure code is running on the
|
||||
* compositor thread.
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
||||
#include "mozilla/gfx/Point.h" // For IntSize
|
||||
#include "mozilla/layers/GonkNativeHandle.h"
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend, etc
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
#include "mozilla/mozalloc.h" // for operator delete, etc
|
||||
|
@ -22,23 +22,6 @@ enum class ImageFormat {
|
||||
*/
|
||||
NV_IMAGE,
|
||||
|
||||
/**
|
||||
* The GRALLOC_PLANAR_YCBCR format creates a GrallocImage, a subtype of
|
||||
* PlanarYCbCrImage. It takes a PlanarYCbCrImage data or the raw gralloc
|
||||
* data and can be used as a texture by Gonk backend directly.
|
||||
*/
|
||||
GRALLOC_PLANAR_YCBCR,
|
||||
|
||||
/**
|
||||
* The GONK_CAMERA_IMAGE format creates a GonkCameraImage, which contains two
|
||||
* parts. One is GrallocImage image for preview image. Another one is
|
||||
* MediaBuffer from Gonk recording image. The preview image can be rendered in
|
||||
* a layer for display. And the MediaBuffer will be used in component like OMX
|
||||
* encoder. It is for GUM to support preview and recording image on Gonk
|
||||
* camera.
|
||||
*/
|
||||
GONK_CAMERA_IMAGE,
|
||||
|
||||
/**
|
||||
* The SHARED_RGB format creates a SharedRGBImage, which stores RGB data in
|
||||
* shared memory. Some Android hardware video decoders require this format.
|
||||
|
@ -364,8 +364,6 @@ AppendToString(std::stringstream& aStream, ImageFormat format,
|
||||
switch (format) {
|
||||
case ImageFormat::PLANAR_YCBCR:
|
||||
aStream << "ImageFormat::PLANAR_YCBCR"; break;
|
||||
case ImageFormat::GRALLOC_PLANAR_YCBCR:
|
||||
aStream << "ImageFormat::GRALLOC_PLANAR_YCBCR"; break;
|
||||
case ImageFormat::SHARED_RGB:
|
||||
aStream << "ImageFormat::SHARED_RGB"; break;
|
||||
case ImageFormat::CAIRO_SURFACE:
|
||||
|
@ -66,8 +66,6 @@ enum class SurfaceMode : int8_t {
|
||||
};
|
||||
|
||||
// LayerRenderState for Composer2D
|
||||
// We currently only support Composer2D using gralloc. If we want to be backed
|
||||
// by other surfaces we will need a more generic LayerRenderState.
|
||||
enum class LayerRenderStateFlags : int8_t {
|
||||
LAYER_RENDER_STATE_DEFAULT = 0,
|
||||
ORIGIN_BOTTOM_LEFT = 1 << 0,
|
||||
|
@ -200,7 +200,6 @@ public:
|
||||
|
||||
BasicCompositor::BasicCompositor(CompositorBridgeParent* aParent, widget::CompositorWidget* aWidget)
|
||||
: Compositor(aWidget, aParent)
|
||||
, mDidExternalComposition(false)
|
||||
, mIsPendingEndRemoteDrawing(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(BasicCompositor);
|
||||
@ -784,16 +783,9 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
IntRect rect = IntRect(0, 0, intRect.width, intRect.height);
|
||||
|
||||
LayoutDeviceIntRegion invalidRegionSafe;
|
||||
if (mDidExternalComposition) {
|
||||
// We do not know rendered region during external composition, just redraw
|
||||
// whole widget.
|
||||
invalidRegionSafe = intRect;
|
||||
mDidExternalComposition = false;
|
||||
} else {
|
||||
// Sometimes the invalid region is larger than we want to draw.
|
||||
invalidRegionSafe.And(
|
||||
// Sometimes the invalid region is larger than we want to draw.
|
||||
invalidRegionSafe.And(
|
||||
LayoutDeviceIntRegion::FromUnknownRegion(aInvalidRegion), intRect);
|
||||
}
|
||||
|
||||
mInvalidRegion = invalidRegionSafe;
|
||||
mInvalidRect = mInvalidRegion.GetBounds();
|
||||
@ -973,16 +965,6 @@ BasicCompositor::FinishPendingComposite()
|
||||
TryToEndRemoteDrawing(/* aForceToEnd */ true);
|
||||
}
|
||||
|
||||
void
|
||||
BasicCompositor::EndFrameForExternalComposition(const gfx::Matrix& aTransform)
|
||||
{
|
||||
MOZ_ASSERT(!mTarget);
|
||||
MOZ_ASSERT(!mDrawTarget);
|
||||
MOZ_ASSERT(!mRenderTarget);
|
||||
|
||||
mDidExternalComposition = true;
|
||||
}
|
||||
|
||||
BasicCompositor*
|
||||
AssertBasicCompositor(Compositor* aCompositor)
|
||||
{
|
||||
|
@ -106,7 +106,6 @@ public:
|
||||
gfx::IntRect *aClipRectOut = nullptr,
|
||||
gfx::IntRect *aRenderBoundsOut = nullptr) override;
|
||||
virtual void EndFrame() override;
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) override;
|
||||
|
||||
virtual bool SupportsPartialTextureUpdate() override { return true; }
|
||||
virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) override { return true; }
|
||||
@ -148,7 +147,6 @@ private:
|
||||
|
||||
LayoutDeviceIntRect mInvalidRect;
|
||||
LayoutDeviceIntRegion mInvalidRegion;
|
||||
bool mDidExternalComposition;
|
||||
|
||||
uint32_t mMaxTextureSize;
|
||||
bool mIsPendingEndRemoteDrawing;
|
||||
|
@ -151,7 +151,7 @@ ClientTiledPaintedLayer::BeginPaint()
|
||||
if (!displayPortAncestor || !scrollAncestor) {
|
||||
// No displayport or scroll ancestor, so we can't do progressive rendering.
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
// Both Android and b2g on phones are guaranteed to have a displayport set, so this
|
||||
// Android are guaranteed to have a displayport set, so this
|
||||
// should never happen.
|
||||
NS_WARNING("Tiled PaintedLayer with no scrollable container ancestor");
|
||||
#endif
|
||||
@ -591,7 +591,7 @@ bool
|
||||
ClientTiledPaintedLayer::IsOptimizedFor(LayerManager::PaintedLayerCreationHint aHint)
|
||||
{
|
||||
// The only creation hint is whether the layer is scrollable or not, and this
|
||||
// is only respected on B2G and OSX, where it's used to determine whether to
|
||||
// is only respected on OSX, where it's used to determine whether to
|
||||
// use a tiled content client or not.
|
||||
// There are pretty nasty performance consequences for not using tiles on
|
||||
// large, scrollable layers, so we want the layer to be recreated in this
|
||||
|
@ -154,8 +154,7 @@ public:
|
||||
|
||||
/**
|
||||
* Should be called when deataching a TextureClient from a Compositable, because
|
||||
* some platforms need to do some extra book keeping when this happens (for
|
||||
* example to properly keep track of fences on Gonk).
|
||||
* some platforms need to do some extra book keeping when this happens.
|
||||
*
|
||||
* See AutoRemoveTexture to automatically invoke this at the end of a scope.
|
||||
*/
|
||||
|
@ -392,7 +392,7 @@ DeallocateTextureClient(TextureDeallocParams params)
|
||||
// ..except if the lovely mWorkaroundAnnoyingSharedSurfaceOwnershipIssues member
|
||||
// is set to true. In this case we are in a special situation where this
|
||||
// TextureClient is in wrapped into another TextureClient which assumes it owns
|
||||
// our data. This is specific to the gralloc SharedSurface.
|
||||
// our data.
|
||||
bool shouldDeallocate = !params.workAroundSharedSurfaceOwnershipIssue;
|
||||
DestroyTextureData(params.data, params.allocator,
|
||||
shouldDeallocate,
|
||||
|
@ -157,9 +157,6 @@ private:
|
||||
/// existence is always mOutstandingClients + the size of mTextureClients.
|
||||
uint32_t mOutstandingClients;
|
||||
|
||||
// On b2g gonk, std::queue might be a better choice.
|
||||
// On ICS, fence wait happens implicitly before drawing.
|
||||
// Since JB, fence wait happens explicitly when fetching a client from the pool.
|
||||
std::stack<RefPtr<TextureClient> > mTextureClients;
|
||||
|
||||
std::list<RefPtr<TextureClient>> mTextureClientsDeferred;
|
||||
|
@ -125,9 +125,6 @@ protected:
|
||||
|
||||
std::map<TextureClient*, RefPtr<TextureClientHolder> > mInUseClients;
|
||||
|
||||
// On b2g gonk, std::queue might be a better choice.
|
||||
// On ICS, fence wait happens implicitly before drawing.
|
||||
// Since JB, fence wait happens explicitly when fetching a client from the pool.
|
||||
// stack is good from Graphics cache usage point of view.
|
||||
std::stack<RefPtr<TextureClientHolder> > mPooledClients;
|
||||
Mutex mLock;
|
||||
|
@ -1234,8 +1234,6 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
||||
// we use a coherent update rect that is intersected with the screen at the
|
||||
// time of issuing the draw command. This will paint faster but also potentially
|
||||
// make the progressive paint more visible to the user while scrolling.
|
||||
// On B2G uploads are cheaper and we value coherency more, especially outside
|
||||
// the browser, so we always use the entire user-visible area.
|
||||
IntRect coherentUpdateRect(RoundedOut(
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
transformedCompositionBounds->Intersect(aPaintData->mCompositionBounds)
|
||||
|
@ -159,14 +159,6 @@ void
|
||||
ImageHost::UseOverlaySource(OverlaySource aOverlay,
|
||||
const gfx::IntRect& aPictureRect)
|
||||
{
|
||||
if (ImageHostOverlay::IsValid(aOverlay)) {
|
||||
if (!mImageHostOverlay) {
|
||||
mImageHostOverlay = new ImageHostOverlay();
|
||||
}
|
||||
mImageHostOverlay->UseOverlaySource(aOverlay, aPictureRect);
|
||||
} else {
|
||||
mImageHostOverlay = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static TimeStamp
|
||||
@ -304,20 +296,6 @@ ImageHost::Composite(LayerComposite* aLayer,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mImageHostOverlay) {
|
||||
mImageHostOverlay->Composite(GetCompositor(),
|
||||
mFlashCounter,
|
||||
aLayer,
|
||||
aEffectChain,
|
||||
aOpacity,
|
||||
aTransform,
|
||||
aSamplingFilter,
|
||||
aClipRect,
|
||||
aVisibleRegion);
|
||||
mBias = BIAS_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
int imageIndex = ChooseImageIndex();
|
||||
if (imageIndex < 0) {
|
||||
return;
|
||||
@ -463,9 +441,6 @@ ImageHost::SetCompositor(Compositor* aCompositor)
|
||||
img.mTextureHost->SetCompositor(aCompositor);
|
||||
}
|
||||
}
|
||||
if (mImageHostOverlay) {
|
||||
mImageHostOverlay->SetCompositor(aCompositor);
|
||||
}
|
||||
CompositableHost::SetCompositor(aCompositor);
|
||||
}
|
||||
|
||||
@ -482,10 +457,6 @@ ImageHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
img.mTextureHost->PrintInfo(aStream, pfx.get());
|
||||
AppendToString(aStream, img.mPictureRect, " [picture-rect=", "]");
|
||||
}
|
||||
|
||||
if (mImageHostOverlay) {
|
||||
mImageHostOverlay->PrintInfo(aStream, aPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -505,10 +476,6 @@ ImageHost::Dump(std::stringstream& aStream,
|
||||
LayerRenderState
|
||||
ImageHost::GetRenderState()
|
||||
{
|
||||
if (mImageHostOverlay) {
|
||||
return mImageHostOverlay->GetRenderState();
|
||||
}
|
||||
|
||||
TimedImage* img = ChooseImage();
|
||||
if (img) {
|
||||
SetCurrentTextureHost(img->mTextureHost);
|
||||
@ -520,10 +487,6 @@ ImageHost::GetRenderState()
|
||||
already_AddRefed<gfx::DataSourceSurface>
|
||||
ImageHost::GetAsSurface()
|
||||
{
|
||||
if (mImageHostOverlay) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TimedImage* img = ChooseImage();
|
||||
if (img) {
|
||||
return img->mTextureHost->GetAsSurface();
|
||||
@ -563,10 +526,6 @@ ImageHost::Unlock()
|
||||
IntSize
|
||||
ImageHost::GetImageSize() const
|
||||
{
|
||||
if (mImageHostOverlay) {
|
||||
return mImageHostOverlay->GetImageSize();
|
||||
}
|
||||
|
||||
const TimedImage* img = ChooseImage();
|
||||
if (img) {
|
||||
return IntSize(img->mPictureRect.width, img->mPictureRect.height);
|
||||
@ -630,110 +589,5 @@ ImageHost::SetImageContainer(ImageContainerParent* aImageContainer)
|
||||
}
|
||||
}
|
||||
|
||||
ImageHostOverlay::ImageHostOverlay()
|
||||
{
|
||||
MOZ_COUNT_CTOR(ImageHostOverlay);
|
||||
}
|
||||
|
||||
ImageHostOverlay::~ImageHostOverlay()
|
||||
{
|
||||
if (mCompositor) {
|
||||
mCompositor->RemoveImageHostOverlay(this);
|
||||
}
|
||||
MOZ_COUNT_DTOR(ImageHostOverlay);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ImageHostOverlay::IsValid(OverlaySource aOverlay)
|
||||
{
|
||||
if ((aOverlay.handle().type() == OverlayHandle::Tint32_t) &&
|
||||
aOverlay.handle().get_int32_t() != INVALID_OVERLAY) {
|
||||
return true;
|
||||
} else if (aOverlay.handle().type() == OverlayHandle::TGonkNativeHandle) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
if (mCompositor && (mCompositor != aCompositor)) {
|
||||
mCompositor->RemoveImageHostOverlay(this);
|
||||
}
|
||||
if (aCompositor) {
|
||||
aCompositor->AddImageHostOverlay(this);
|
||||
}
|
||||
mCompositor = aCompositor;
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::Composite(Compositor* aCompositor,
|
||||
uint32_t aFlashCounter,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const gfx::SamplingFilter aSamplingFilter,
|
||||
const gfx::IntRect& aClipRect,
|
||||
const nsIntRegion* aVisibleRegion)
|
||||
{
|
||||
MOZ_ASSERT(mCompositor == aCompositor);
|
||||
|
||||
if (mOverlay.handle().type() == OverlayHandle::Tnull_t) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color hollow(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
aEffectChain.mPrimaryEffect = new EffectSolidColor(hollow);
|
||||
aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] = new EffectBlendMode(CompositionOp::OP_SOURCE);
|
||||
|
||||
gfx::Rect rect;
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y,
|
||||
aClipRect.width, aClipRect.height);
|
||||
rect.SetRect(mPictureRect.x, mPictureRect.y,
|
||||
mPictureRect.width, mPictureRect.height);
|
||||
|
||||
aCompositor->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
|
||||
aCompositor->DrawDiagnostics(DiagnosticFlags::IMAGE | DiagnosticFlags::BIGIMAGE,
|
||||
rect, aClipRect, aTransform, aFlashCounter);
|
||||
}
|
||||
|
||||
LayerRenderState
|
||||
ImageHostOverlay::GetRenderState()
|
||||
{
|
||||
LayerRenderState state;
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::UseOverlaySource(OverlaySource aOverlay,
|
||||
const nsIntRect& aPictureRect)
|
||||
{
|
||||
mOverlay = aOverlay;
|
||||
mPictureRect = aPictureRect;
|
||||
}
|
||||
|
||||
IntSize
|
||||
ImageHostOverlay::GetImageSize() const
|
||||
{
|
||||
return IntSize(mPictureRect.width, mPictureRect.height);
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
aStream << aPrefix;
|
||||
aStream << nsPrintfCString("ImageHostOverlay (0x%p)", this).get();
|
||||
|
||||
AppendToString(aStream, mPictureRect, " [picture-rect=", "]");
|
||||
|
||||
if (mOverlay.handle().type() == OverlayHandle::Tint32_t) {
|
||||
nsAutoCString pfx(aPrefix);
|
||||
pfx += " ";
|
||||
aStream << nsPrintfCString("Overlay: %d", mOverlay.handle().get_int32_t()).get();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
@ -30,7 +30,6 @@ namespace layers {
|
||||
class Compositor;
|
||||
struct EffectChain;
|
||||
class ImageContainerParent;
|
||||
class ImageHostOverlay;
|
||||
|
||||
/**
|
||||
* ImageHost. Works with ImageClientSingle and ImageClientBuffered
|
||||
@ -156,43 +155,6 @@ protected:
|
||||
Bias mBias;
|
||||
|
||||
bool mLocked;
|
||||
|
||||
RefPtr<ImageHostOverlay> mImageHostOverlay;
|
||||
};
|
||||
|
||||
/**
|
||||
* ImageHostOverlay handles OverlaySource compositing
|
||||
*/
|
||||
class ImageHostOverlay {
|
||||
protected:
|
||||
virtual ~ImageHostOverlay();
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(ImageHostOverlay)
|
||||
ImageHostOverlay();
|
||||
|
||||
static bool IsValid(OverlaySource aOverlay);
|
||||
|
||||
void SetCompositor(Compositor* aCompositor);
|
||||
|
||||
virtual void Composite(Compositor* aCompositor,
|
||||
uint32_t aFlashCounter,
|
||||
LayerComposite* aLayer,
|
||||
EffectChain& aEffectChain,
|
||||
float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const gfx::SamplingFilter aSamplingFilter,
|
||||
const gfx::IntRect& aClipRect,
|
||||
const nsIntRegion* aVisibleRegion);
|
||||
virtual LayerRenderState GetRenderState();
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay,
|
||||
const gfx::IntRect& aPictureRect);
|
||||
virtual gfx::IntSize GetImageSize() const;
|
||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
||||
protected:
|
||||
RefPtr<Compositor> mCompositor;
|
||||
gfx::IntRect mPictureRect;
|
||||
OverlaySource mOverlay;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <stdint.h> // for uint16_t, uint32_t
|
||||
#include "CanvasLayerComposite.h" // for CanvasLayerComposite
|
||||
#include "ColorLayerComposite.h" // for ColorLayerComposite
|
||||
#include "Composer2D.h" // for Composer2D
|
||||
#include "CompositableHost.h" // for CompositableHost
|
||||
#include "ContainerLayerComposite.h" // for ContainerLayerComposite, etc
|
||||
#include "FPSCounter.h" // for FPSState, FPSCounter
|
||||
@ -123,7 +122,6 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
|
||||
, mIsCompositorReady(false)
|
||||
, mDebugOverlayWantsNextFrame(false)
|
||||
, mGeometryChanged(true)
|
||||
, mLastFrameMissedHWC(false)
|
||||
, mWindowOverlayChanged(false)
|
||||
, mLastPaintTime(TimeDuration::Forever())
|
||||
, mRenderStartTime(TimeStamp::Now())
|
||||
@ -886,32 +884,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
|
||||
LayerScope::SendLayerDump(Move(packet));
|
||||
}
|
||||
|
||||
/** Our more efficient but less powerful alter ego, if one is available. */
|
||||
RefPtr<Composer2D> composer2D;
|
||||
composer2D = mCompositor->GetWidget()->GetComposer2D();
|
||||
|
||||
// We can't use composert2D if we have layer effects
|
||||
if (!mTarget && !haveLayerEffects &&
|
||||
gfxPrefs::Composer2DCompositionEnabled() &&
|
||||
composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot,
|
||||
mCompositor->GetWidget()->RealWidget(),
|
||||
mGeometryChanged,
|
||||
mCompositor->HasImageHostOverlays()))
|
||||
{
|
||||
LayerScope::SetHWComposed();
|
||||
if (mFPS) {
|
||||
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
||||
if (gfxPrefs::LayersDrawFPS()) {
|
||||
printf_stderr("HWComposer: FPS is %g\n", fps);
|
||||
}
|
||||
}
|
||||
mCompositor->EndFrameForExternalComposition(Matrix());
|
||||
mLastFrameMissedHWC = false;
|
||||
return;
|
||||
} else if (!mTarget && !haveLayerEffects) {
|
||||
mLastFrameMissedHWC = !!composer2D;
|
||||
}
|
||||
|
||||
mozilla::widget::WidgetRenderingContext widgetContext;
|
||||
#if defined(XP_MACOSX)
|
||||
widgetContext.mLayerManager = this;
|
||||
@ -1003,10 +975,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
|
||||
mCompositor->SetDispAcquireFence(mRoot);
|
||||
}
|
||||
|
||||
if (composer2D) {
|
||||
composer2D->Render(mCompositor->GetWidget()->RealWidget());
|
||||
}
|
||||
|
||||
mCompositor->GetWidget()->PostRender(&widgetContext);
|
||||
|
||||
RecordFrame();
|
||||
|
@ -281,8 +281,6 @@ public:
|
||||
mDisabledApzWarning = true;
|
||||
}
|
||||
|
||||
bool LastFrameMissedHWC() { return mLastFrameMissedHWC; }
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
void AppendImageCompositeNotification(const ImageCompositeNotification& aNotification)
|
||||
@ -387,10 +385,6 @@ private:
|
||||
RefPtr<TextRenderer> mTextRenderer;
|
||||
bool mGeometryChanged;
|
||||
|
||||
// Testing property. If hardware composer is supported, this will return
|
||||
// true if the last frame was deemed 'too complicated' to be rendered.
|
||||
bool mLastFrameMissedHWC;
|
||||
|
||||
bool mWindowOverlayChanged;
|
||||
RefPtr<PaintCounter> mPaintCounter;
|
||||
TimeDuration mLastPaintTime;
|
||||
|
@ -115,12 +115,6 @@ public:
|
||||
*/
|
||||
virtual void EndFrame() override;
|
||||
|
||||
/**
|
||||
* Post rendering stuff if the rendering is outside of this Compositor
|
||||
* e.g., by Composer2D
|
||||
*/
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) override {}
|
||||
|
||||
/**
|
||||
* Setup the viewport and projection matrix for rendering
|
||||
* to a window of the given dimensions.
|
||||
|
@ -71,8 +71,6 @@ public:
|
||||
|
||||
virtual void EndFrame() override;
|
||||
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) override {}
|
||||
|
||||
virtual void PrepareViewport(const gfx::IntSize& aSize);
|
||||
|
||||
virtual bool SupportsPartialTextureUpdate() override{ return true; }
|
||||
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* 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 <unistd.h>
|
||||
|
||||
#include "GonkNativeHandle.h"
|
||||
|
||||
using namespace mozilla::layers;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
GonkNativeHandle::GonkNativeHandle()
|
||||
: mNhObj(new NhObj())
|
||||
{
|
||||
}
|
||||
|
||||
GonkNativeHandle::GonkNativeHandle(NhObj* aNhObj)
|
||||
: mNhObj(aNhObj)
|
||||
{
|
||||
MOZ_ASSERT(aNhObj);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GonkNativeHandle::TransferToAnother(GonkNativeHandle& aHandle)
|
||||
{
|
||||
aHandle.mNhObj = this->GetAndResetNhObj();
|
||||
}
|
||||
|
||||
already_AddRefed<GonkNativeHandle::NhObj>
|
||||
GonkNativeHandle::GetAndResetNhObj()
|
||||
{
|
||||
RefPtr<NhObj> nhObj = mNhObj;
|
||||
mNhObj = new NhObj();
|
||||
return nhObj.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<GonkNativeHandle::NhObj>
|
||||
GonkNativeHandle::GetDupNhObj()
|
||||
{
|
||||
if (!IsValid()) {
|
||||
return GonkNativeHandle::CreateDupNhObj(nullptr);
|
||||
}
|
||||
return GonkNativeHandle::CreateDupNhObj(mNhObj->mHandle);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<GonkNativeHandle::NhObj>
|
||||
GonkNativeHandle::CreateDupNhObj(native_handle_t* aHandle)
|
||||
{
|
||||
RefPtr<NhObj> nhObj;
|
||||
if (aHandle) {
|
||||
native_handle* nativeHandle =
|
||||
native_handle_create(aHandle->numFds, aHandle->numInts);
|
||||
if (!nativeHandle) {
|
||||
nhObj = new GonkNativeHandle::NhObj();
|
||||
return nhObj.forget();
|
||||
}
|
||||
|
||||
for (int i = 0; i < aHandle->numFds; ++i) {
|
||||
nativeHandle->data[i] = dup(aHandle->data[i]);
|
||||
}
|
||||
|
||||
memcpy(nativeHandle->data + nativeHandle->numFds,
|
||||
aHandle->data + aHandle->numFds,
|
||||
sizeof(int) * aHandle->numInts);
|
||||
|
||||
nhObj = new GonkNativeHandle::NhObj(nativeHandle);
|
||||
} else {
|
||||
nhObj = new GonkNativeHandle::NhObj();
|
||||
}
|
||||
return nhObj.forget();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* 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/. */
|
||||
|
||||
#ifndef IPC_GonkNativeHandle_h
|
||||
#define IPC_GonkNativeHandle_h
|
||||
|
||||
#include "mozilla/RefPtr.h" // for RefPtr
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
struct GonkNativeHandle {
|
||||
bool operator==(const GonkNativeHandle&) const { return false; }
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // IPC_GonkNativeHandle_h
|
@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* 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 "GonkNativeHandleUtils.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
using namespace mozilla::layers;
|
||||
|
||||
namespace IPC {
|
||||
|
||||
namespace {
|
||||
|
||||
class native_handle_Delete
|
||||
{
|
||||
public:
|
||||
void operator()(native_handle* aNativeHandle) const
|
||||
{
|
||||
native_handle_close(aNativeHandle); // closes file descriptors
|
||||
native_handle_delete(aNativeHandle);
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void
|
||||
ParamTraits<GonkNativeHandle>::Write(Message* aMsg,
|
||||
const paramType& aParam)
|
||||
{
|
||||
GonkNativeHandle handle = aParam;
|
||||
MOZ_ASSERT(handle.IsValid());
|
||||
|
||||
RefPtr<GonkNativeHandle::NhObj> nhObj = handle.GetAndResetNhObj();
|
||||
native_handle_t* nativeHandle = nhObj->GetAndResetNativeHandle();
|
||||
|
||||
size_t nbytes = nativeHandle->numInts * sizeof(int);
|
||||
aMsg->WriteSize(nbytes);
|
||||
aMsg->WriteBytes((nativeHandle->data + nativeHandle->numFds), nbytes);
|
||||
|
||||
for (size_t i = 0; i < static_cast<size_t>(nativeHandle->numFds); ++i) {
|
||||
aMsg->WriteFileDescriptor(base::FileDescriptor(nativeHandle->data[i], true));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<GonkNativeHandle>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
size_t nbytes;
|
||||
if (!aMsg->ReadSize(aIter, &nbytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nbytes % sizeof(int) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t numInts = nbytes / sizeof(int);
|
||||
size_t numFds = aMsg->num_fds();
|
||||
mozilla::UniquePtr<native_handle, native_handle_Delete> nativeHandle(
|
||||
native_handle_create(numFds, numInts));
|
||||
if (!nativeHandle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto data =
|
||||
reinterpret_cast<char*>(nativeHandle->data + nativeHandle->numFds);
|
||||
if (!aMsg->ReadBytesInto(aIter, data, nbytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < numFds; ++i) {
|
||||
base::FileDescriptor fd;
|
||||
if (!aMsg->ReadFileDescriptor(aIter, &fd)) {
|
||||
return false;
|
||||
}
|
||||
nativeHandle->data[i] = fd.fd;
|
||||
nativeHandle->numFds = i + 1; // set number of valid file descriptors
|
||||
}
|
||||
|
||||
GonkNativeHandle handle(new GonkNativeHandle::NhObj(nativeHandle.get()));
|
||||
handle.TransferToAnother(*aResult);
|
||||
|
||||
mozilla::Unused << nativeHandle.release();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace IPC
|
@ -1,26 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* 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/. */
|
||||
|
||||
#ifndef IPC_GonkNativeHandleUtils_h
|
||||
#define IPC_GonkNativeHandleUtils_h
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
#include "GonkNativeHandle.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::GonkNativeHandle> {
|
||||
typedef mozilla::layers::GonkNativeHandle paramType;
|
||||
static void Write(Message*, const paramType&) {}
|
||||
static bool Read(const Message*, PickleIterator*, paramType*) { return false; }
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // IPC_GonkNativeHandleUtils_h
|
@ -57,7 +57,7 @@ mozilla::ipc::SharedMemory::SharedMemoryType OptimalShmemType();
|
||||
|
||||
/**
|
||||
* An interface used to create and destroy surfaces that are shared with the
|
||||
* Compositor process (using shmem, or gralloc, or other platform specific memory)
|
||||
* Compositor process (using shmem, or other platform specific memory)
|
||||
*
|
||||
* Most of the methods here correspond to methods that are implemented by IPDL
|
||||
* actors without a common polymorphic interface.
|
||||
|
@ -177,7 +177,7 @@ ImageBridgeChild::UseTextures(CompositableClient* aCompositable,
|
||||
t.mTimeStamp, t.mPictureRect,
|
||||
t.mFrameID, t.mProducerID));
|
||||
|
||||
// Wait end of usage on host side if TextureFlags::RECYCLE is set or GrallocTextureData case
|
||||
// Wait end of usage on host side if TextureFlags::RECYCLE is set
|
||||
HoldUntilCompositableRefReleasedIfNecessary(t.mTextureClient);
|
||||
}
|
||||
mTxn->AddNoSwapEdit(CompositableOperation(nullptr, aCompositable->GetIPDLActor(),
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "mozilla/layers/CompositableTransactionParent.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/LayersMessages.h" // for EditReply
|
||||
#include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferParent
|
||||
#include "mozilla/layers/PCompositableParent.h"
|
||||
#include "mozilla/layers/PImageBridgeParent.h"
|
||||
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
||||
|
@ -72,15 +72,6 @@ void
|
||||
LayerTransactionChild::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
mDestroyed = true;
|
||||
#ifdef MOZ_B2G
|
||||
// Due to poor lifetime management of gralloc (and possibly shmems) we will
|
||||
// crash at some point in the future when we get destroyed due to abnormal
|
||||
// shutdown. Its better just to crash here. On desktop though, we have a chance
|
||||
// of recovering.
|
||||
if (why == AbnormalShutdown) {
|
||||
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at LayerTransactionChild");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "mozilla/layers/ImageLayerComposite.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/LayersMessages.h" // for EditReply, etc
|
||||
#include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferParent
|
||||
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
||||
#include "mozilla/layers/PCompositableParent.h"
|
||||
#include "mozilla/layers/PLayerParent.h" // for PLayerParent
|
||||
@ -921,8 +920,6 @@ LayerTransactionParent::RecvRequestProperty(const nsString& aProperty, float* aV
|
||||
{
|
||||
if (aProperty.Equals(NS_LITERAL_STRING("overdraw"))) {
|
||||
*aValue = layer_manager()->GetCompositor()->GetFillRatio();
|
||||
} else if (aProperty.Equals(NS_LITERAL_STRING("missed_hwc"))) {
|
||||
*aValue = layer_manager()->LastFrameMissedHWC() ? 1 : 0;
|
||||
} else {
|
||||
*aValue = -1;
|
||||
}
|
||||
|
@ -13,14 +13,12 @@ using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
|
||||
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
|
||||
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
|
||||
using gfxImageFormat from "gfxTypes.h";
|
||||
using struct mozilla::layers::GonkNativeHandle from "mozilla/layers/GonkNativeHandleUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
union OverlayHandle {
|
||||
int32_t;
|
||||
GonkNativeHandle;
|
||||
null_t;
|
||||
};
|
||||
|
||||
|
@ -304,7 +304,6 @@ function parseLayers(layersDumpLines) {
|
||||
}
|
||||
|
||||
if (matches[2].indexOf("TiledContentHost") != -1 ||
|
||||
matches[2].indexOf("GrallocTextureHostOGL") != -1 ||
|
||||
matches[2].indexOf("ContentHost") != -1 ||
|
||||
matches[2].indexOf("ContentClient") != -1 ||
|
||||
matches[2].indexOf("MemoryTextureHost") != -1 ||
|
||||
|
@ -169,8 +169,6 @@ EXPORTS.mozilla.layers += [
|
||||
'ipc/CompositorBridgeParent.h',
|
||||
'ipc/CompositorThread.h',
|
||||
'ipc/CrossProcessCompositorBridgeParent.h',
|
||||
'ipc/GonkNativeHandle.h',
|
||||
'ipc/GonkNativeHandleUtils.h',
|
||||
'ipc/ImageBridgeChild.h',
|
||||
'ipc/ImageBridgeParent.h',
|
||||
'ipc/ImageContainerChild.h',
|
||||
|
@ -1628,15 +1628,6 @@ CompositorOGL::EndFrame()
|
||||
Compositor::EndFrame();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorOGL::EndFrameForExternalComposition(const gfx::Matrix& aTransform)
|
||||
{
|
||||
MOZ_ASSERT(!mTarget);
|
||||
if (mTexturePool) {
|
||||
mTexturePool->EndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorOGL::SetDestinationSurfaceSize(const IntSize& aSize)
|
||||
{
|
||||
@ -1813,89 +1804,5 @@ PerUnitTexturePoolOGL::DestroyTextures()
|
||||
mTextures.SetLength(0);
|
||||
}
|
||||
|
||||
void
|
||||
PerFrameTexturePoolOGL::DestroyTextures()
|
||||
{
|
||||
if (!mGL->MakeCurrent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mUnusedTextures.Length() > 0) {
|
||||
mGL->fDeleteTextures(mUnusedTextures.Length(), &mUnusedTextures[0]);
|
||||
mUnusedTextures.Clear();
|
||||
}
|
||||
|
||||
if (mCreatedTextures.Length() > 0) {
|
||||
mGL->fDeleteTextures(mCreatedTextures.Length(), &mCreatedTextures[0]);
|
||||
mCreatedTextures.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
GLuint
|
||||
PerFrameTexturePoolOGL::GetTexture(GLenum aTarget, GLenum)
|
||||
{
|
||||
if (mTextureTarget == 0) {
|
||||
mTextureTarget = aTarget;
|
||||
}
|
||||
|
||||
// The pool should always use the same texture target because it is illegal
|
||||
// to change the target of an already exisiting gl texture.
|
||||
// If we need to use several targets, a pool with several sub-pools (one per
|
||||
// target) will have to be implemented.
|
||||
// At the moment this pool is only used with tiling on b2g so we always need
|
||||
// the same target.
|
||||
MOZ_ASSERT(mTextureTarget == aTarget);
|
||||
|
||||
GLuint texture = 0;
|
||||
|
||||
if (!mUnusedTextures.IsEmpty()) {
|
||||
// Try to reuse one from the unused pile first
|
||||
texture = mUnusedTextures[0];
|
||||
mUnusedTextures.RemoveElementAt(0);
|
||||
} else if (mGL->MakeCurrent()) {
|
||||
// There isn't one to reuse, create one.
|
||||
mGL->fGenTextures(1, &texture);
|
||||
mGL->fBindTexture(aTarget, texture);
|
||||
mGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
mGL->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
if (texture) {
|
||||
mCreatedTextures.AppendElement(texture);
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
void
|
||||
PerFrameTexturePoolOGL::EndFrame()
|
||||
{
|
||||
if (!mGL->MakeCurrent()) {
|
||||
// this means the context got destroyed underneith us somehow, and the driver
|
||||
// already has destroyed the textures.
|
||||
mCreatedTextures.Clear();
|
||||
mUnusedTextures.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// Some platforms have issues unlocking Gralloc buffers even when they're
|
||||
// rebound.
|
||||
if (gfxPrefs::OverzealousGrallocUnlocking()) {
|
||||
mUnusedTextures.AppendElements(mCreatedTextures);
|
||||
mCreatedTextures.Clear();
|
||||
}
|
||||
|
||||
// Delete unused textures
|
||||
for (size_t i = 0; i < mUnusedTextures.Length(); i++) {
|
||||
GLuint texture = mUnusedTextures[i];
|
||||
mGL->fDeleteTextures(1, &texture);
|
||||
}
|
||||
mUnusedTextures.Clear();
|
||||
|
||||
// Move all created textures into the unused pile
|
||||
mUnusedTextures.AppendElements(mCreatedTextures);
|
||||
mCreatedTextures.Clear();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
@ -106,46 +106,6 @@ protected:
|
||||
RefPtr<gl::GLContext> mGL;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reuse gl textures from a pool of textures that haven't yet been
|
||||
* used during the current frame.
|
||||
* All the textures that are not used at the end of a frame are
|
||||
* deleted.
|
||||
* This strategy seems to work well with gralloc textures because destroying
|
||||
* unused textures which are bound to gralloc buffers let drivers know that it
|
||||
* can unlock the gralloc buffers.
|
||||
*/
|
||||
class PerFrameTexturePoolOGL : public CompositorTexturePoolOGL
|
||||
{
|
||||
public:
|
||||
explicit PerFrameTexturePoolOGL(gl::GLContext* aGL)
|
||||
: mTextureTarget(0) // zero is never a valid texture target
|
||||
, mGL(aGL)
|
||||
{}
|
||||
|
||||
virtual ~PerFrameTexturePoolOGL()
|
||||
{
|
||||
DestroyTextures();
|
||||
}
|
||||
|
||||
virtual void Clear() override
|
||||
{
|
||||
DestroyTextures();
|
||||
}
|
||||
|
||||
virtual GLuint GetTexture(GLenum aTarget, GLenum aUnit) override;
|
||||
|
||||
virtual void EndFrame() override;
|
||||
|
||||
protected:
|
||||
void DestroyTextures();
|
||||
|
||||
GLenum mTextureTarget;
|
||||
RefPtr<gl::GLContext> mGL;
|
||||
nsTArray<GLuint> mCreatedTextures;
|
||||
nsTArray<GLuint> mUnusedTextures;
|
||||
};
|
||||
|
||||
// If you want to make this class not final, first remove calls to virtual
|
||||
// methods (Destroy) that are made in the destructor.
|
||||
class CompositorOGL final : public Compositor
|
||||
@ -212,7 +172,6 @@ public:
|
||||
const gfx::Rect& aVisibleRect) override;
|
||||
|
||||
virtual void EndFrame() override;
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) override;
|
||||
|
||||
virtual bool SupportsPartialTextureUpdate() override;
|
||||
|
||||
@ -249,19 +208,6 @@ public:
|
||||
virtual void Pause() override;
|
||||
virtual bool Resume() override;
|
||||
|
||||
virtual bool HasImageHostOverlays() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void AddImageHostOverlay(ImageHostOverlay* aOverlay) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual void RemoveImageHostOverlay(ImageHostOverlay* aOverlay) override
|
||||
{
|
||||
}
|
||||
|
||||
GLContext* gl() const { return mGLContext; }
|
||||
/**
|
||||
* Clear the program state. This must be called
|
||||
@ -276,9 +222,7 @@ public:
|
||||
|
||||
/**
|
||||
* The compositor provides with temporary textures for use with direct
|
||||
* textruing like gralloc texture.
|
||||
* Doing so lets us use gralloc the way it has been designed to be used
|
||||
* (see https://wiki.mozilla.org/Platform/GFX/Gralloc)
|
||||
* textruing.
|
||||
*/
|
||||
GLuint GetTemporaryTexture(GLenum aTarget, GLenum aUnit);
|
||||
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
// Notified when this display's vsync occurs, on the vsync thread
|
||||
// The aVsyncTimestamp should normalize to the Vsync time that just occured
|
||||
// However, different platforms give different vsync notification times.
|
||||
// b2g - The vsync timestamp of the previous frame that was just displayed
|
||||
// OSX - The vsync timestamp of the upcoming frame, in the future
|
||||
// Windows: It's messy, see gfxWindowsPlatform.
|
||||
// Android: TODO
|
||||
|
@ -322,8 +322,7 @@ gfxAndroidPlatform::RequiresLinearZoom()
|
||||
// content that can always be be non-reflow-zoomed.
|
||||
//
|
||||
// XXX when gecko-android-java is used as an "app runtime", we may
|
||||
// want to treat it like B2G and use linear zoom only for the web
|
||||
// browser process, not other apps.
|
||||
// want to use linear zoom only for the web browser process, not other apps.
|
||||
return true;
|
||||
#endif
|
||||
|
||||
|
@ -653,10 +653,9 @@ gfxPlatform::Init()
|
||||
gfxPrefs::WebGLForceLayersReadback(),
|
||||
gfxPrefs::WebGLForceMSAA());
|
||||
// Prefs that don't fit into any of the other sections
|
||||
forcedPrefs.AppendPrintf("-T%d%d%d%d) ",
|
||||
forcedPrefs.AppendPrintf("-T%d%d%d) ",
|
||||
gfxPrefs::AndroidRGB16Force(),
|
||||
gfxPrefs::CanvasAzureAccelerated(),
|
||||
gfxPrefs::DisableGralloc(),
|
||||
gfxPrefs::ForceShmemTiles());
|
||||
ScopedGfxFeatureReporter::AppNote(forcedPrefs);
|
||||
}
|
||||
@ -2407,9 +2406,9 @@ gfxPlatform::GetTilesSupportInfo(mozilla::widget::InfoObject& aObj)
|
||||
/*static*/ bool
|
||||
gfxPlatform::AsyncPanZoomEnabled()
|
||||
{
|
||||
#if !defined(MOZ_B2G) && !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_UIKIT)
|
||||
// For XUL applications (everything but B2G on mobile and desktop, and
|
||||
// Firefox on Android) we only want to use APZ when E10S is enabled. If
|
||||
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_UIKIT)
|
||||
// For XUL applications (everything but Firefox on Android)
|
||||
// we only want to use APZ when E10S is enabled. If
|
||||
// we ever get input events off the main thread we can consider relaxing
|
||||
// this requirement.
|
||||
if (!BrowserTabsRemoteAutostart()) {
|
||||
|
@ -405,9 +405,7 @@ public:
|
||||
* True when zooming should not require reflow, so glyph metrics and
|
||||
* positioning should not be adjusted for device pixels.
|
||||
* If this is TRUE, then FontHintingEnabled() should be FALSE,
|
||||
* but the converse is not necessarily required; in particular,
|
||||
* B2G always has FontHintingEnabled FALSE, but RequiresLinearZoom
|
||||
* is only true for the browser process, not Gaia or other apps.
|
||||
* but the converse is not necessarily required;
|
||||
*
|
||||
* Like FontHintingEnabled (above), this setting shouldn't
|
||||
* change per gecko process, while the process is live. If so the
|
||||
|
@ -380,7 +380,6 @@ private:
|
||||
DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device", Direct3D11ReuseDecoderDevice, int32_t, -1);
|
||||
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
||||
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
|
||||
DECL_GFX_PREF(Live, "gfx.gralloc.fence-with-readpixels", GrallocFenceWithReadPixels, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.layerscope.enabled", LayerScopeEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.layerscope.port", LayerScopePort, int32_t, 23456);
|
||||
// Note that "gfx.logging.level" is defined in Logging.h.
|
||||
@ -417,8 +416,6 @@ private:
|
||||
DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust", TouchVsyncSampleAdjust, int32_t, 5);
|
||||
|
||||
DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms", CollectScrollTransforms, bool, false);
|
||||
// On b2g, in really bad cases, I've seen up to 80 ms delays between touch events and the main thread
|
||||
// processing them. So 80 ms / 16 = 5 vsync events. Double it up just to be on the safe side, so 10.
|
||||
DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count", CompositorUnobserveCount, int32_t, 10);
|
||||
// Use vsync events generated by hardware
|
||||
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
|
||||
@ -494,7 +491,6 @@ private:
|
||||
DECL_GFX_PREF(Once, "layers.gpu-process.dev.force-enabled", GPUProcessDevForceEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.gpu-process.dev.timeout_ms", GPUProcessDevTimeoutMs, int32_t, 5000);
|
||||
DECL_GFX_PREF(Live, "layers.gpu-process.dev.max_restarts", GPUProcessDevMaxRestarts, int32_t, 0);
|
||||
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.low-precision-buffer", UseLowPrecisionBuffer, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.low-precision-opacity", LowPrecisionOpacity, float, 1.0f);
|
||||
DECL_GFX_PREF(Live, "layers.low-precision-resolution", LowPrecisionResolution, float, 0.25f);
|
||||
@ -502,7 +498,6 @@ private:
|
||||
DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
|
||||
DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
|
||||
DECL_GFX_PREF(Once, "layers.overzealous-gralloc-unlocking", OverzealousGrallocUnlocking, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
|
||||
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
|
||||
DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaint, bool, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user