mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
a7ea204c19
- fix restore button on MacOS 10.6 fullscreen (08151078bd)
- Bug 1216580 - Make background-position:fixed clip stealing work with display items that create their own layer. r=mattwoodrow (7760c8ddd8)
- Bug 1222661 - Replace ToUntyped(obj) calls with obj.ToUnknown*(). r=nical (76e36824f0)
- Bug 1223310 (part 1) - Pass a LayoutDeviceIntPoint instead of an nsIntPoint to InitEvent(). r=kats. (ea95207afe)
- Bug 1223310 (part 2) - Use LayoutDeviceIntRect for bounds-related functions in nsIWidget. r=kats. (4993cccff8)
- Bug 1218552 - Fix GTK drag-and-drop coordinate scaling on HiDPI displays (r=karlt) (d03cf04136)
- fix preprocessing (2f4c1a1c94)
- Bug 1205923: Make VectorImage::GetWidth/GetHeight set outparam to 0 (not -1) on failure, to accomodate callers that don't check error codes. r=seth (487de31340)
- Bug 1212954 - Make BaseSize::IsEmpty return true for negative sizes to avoid NS_ERROR in VectorImage::GetFrameAtSize when root svg doesn't have intrinsic width or height. r=roc (402b154f56)
- fix ordering (ac8483c966)
- Bug 1216056 - Always sent OpRemoveTextureAsync as pending async Messages r=nica (66c9ee8708)
- Bug 121976 - Add a destruction handshake to PCompositable so as to avoid races between messages and the protocol. r=sotaro (636a669e44)
- Bug 1209724 - Cancel ImageBridge proxy functions if they are called too late. r=sotao (5bf81453ef)
- Bug 1221371 - Switch chromium IPC code to use mozilla::Tuple (r=jld,cpearce,kats) (eebcd419e9)
- Bug 1221371 - Remove unused Chromium callback code (r=jld) (3f2e882485)
- Bug 1221368 - Change MakeTuple to decay the types of its arguments (r=froydnj) (bed635f565)
- Bug 1181303. Set composition time earlier so that computing invalid regions works properly. r=mattwoodrow (7a3e41cd96)
- Bug 1150552 - Fix partial present bug with FPS counter. r=mattwoodrow (6e6ae92909)
- Bug 1216287 - Properly invalidate the debug overlay. r=mattwoodrow (60d4f3451a)
- Compute the compositor's damage region before composites, rather than layers updates. (bug 1217560, r=mattwoodrow) (6efcac085b)
- Bug 1216248 - Recomposite when the window overlay changes. r=mattwoodrow (8a8c5ccd07)
- Bug 1224021 - Support fractional async scroll offsets in the reftest harness. r=tn (353f75d3aa)
- Bug 1121072 - Always notify when layers cleared (r=dvander) (aa6ffc67e2)
- Bug 1224403 (part 1) - Make Configuration::mBounds a LayoutDeviceIntRect. r=kats. (7617b9da7e)
- Bug 1224403 (part 2) - Split GetClientOffset() into typed and untyped versions. r=kats. (06916479b1)
- Bug 1224403 (part 3) - Make mNonClientOffset a LayoutDeviceIntMargin. r=kats. (76efba1fb6)
- Bug 1224403 (part 4) - Make {Get,Set}NonClientMargins() return/take aLayoutDeviceIntMargin. r=kats. (99cfc2fdbc)
- Bug 1224403 (part 5) - Make OnDefaultButtonLoaded() return/take a LayoutDeviceIntMargin. r=kats (c402452f97)
- Bug 1224403 (part 6) - Remove one WidgetToScreenOffsetUntyped() call. r=kats. (8e4485a404)
- Bug 1224403 (part 7) - Use LayoutDeviceIntMargin more in IMMHandler. r=kats. (6b5e9124fc)
- Bug 1224403 (part 8) - Use LayoutDeviceIntMargin more in HyperTextAccessible. r=kats. (5bc1a04cc7)
- Bug 1224403 (part 9) - Remove GetRestoredBoundsUntyped(). r=kats. (20e2b28335)
- Bug 1224403 (part 10) - Make nsScreenGonk::GetNaturalBoundsUntyped() typed. r=kats. (9d19986f22)
- Bug 1224403 (part 11) - Remove a GetBoundsUntyped() call. r=kats. (58ce962157)
- Bug 1214267 - Followup to fix missing propagation of 'fixedPositionSides' to the compositor, and add it to the layers dump. r=mattwoodrow (7dc122eb62)
- Use compositor clip rects, not client clip rects, when computing the compositor's backbuffer damage region. (bug 1189159, r=mattwoodrow) (b70d71b1b7)
- Bug 1210784 - Layer tree invalidation with Preserves3D. r=roc (8a7bfa1a22)
- Bug 1166165 - Check if the timestamp is null to prevent assertion. r=nical (189a8d42d0)
- Bug 1137004 - Changed the location of the counter so when it is used in a maximized window it is no longer cut off, and added a little left padding. r=mattwoodrow (140d294445)
- Bug 1222661 - Replace FromUntyped(obj) calls with FromUnknown*(obj). r=nical (b399ccef2e)
- Bug 1216506. Properly initialize min inset box shadow color to black. r=mstange (335259200c)
- Bug 1223690 - Remove implicit Rect conversions. r=jrmuizel. (5aef25158f)
- Bug 1056356 - Allow calling NewRunnableMethod() with a const pointer to the callee object. r=froydnj (145279b91c)
- Bug 1209649. Part 2: Reftest to test box shadows and border radii. r=mstange (9405ccfe23)
- Bug 1211363. Part 2: reftest with int border radius. r=mstange (9edb37635e)
- Bug 1216200. Inset box shadow reftest with negative spread value. r=mstange (8350478107)
- Bug 1211264. Fallback to render dest rect with outer box shadows on non-int transforms. r=mstange (a244775d24)
- Bug 1216200. Correct for negative spread values with inset box shadows. r=mstange (4851e9c792)
- cleanup (1f78332ad8)
- Bug 1213970 - Enable APZ on iOS r=kats (1d170e32e3)
- Bug 1217939 - part 1 - remove nsContentUtils::GetViewportInfo; r=smaug (8c25236851)
- Bug 1217939 - part 2 - move nsContentUtils::GetSelectionBoundingRect to nsLayoutUtils; r=smaug (6beb37157c)
- Bug 1146713 - Don't export NO_PKG_FILES (fix ssltunnel in b2g); r=glandium (a21152c79c)
- Bug 1222323 - Avoid passing extra defines to the compiler from config.mk. r=gps (2d1076d513)
- Bug 1222321 - Avoid the duplication of OS_CPPFLAGS on the compiler command line. r=gps (cf762f1644)
- Bug 1210687 - Separate out jar.mn parsing in a separate class. r=gps (d54cc5576b)
- Bug 1219147 - Use addEntriesToListFile in mozbuild.jar.JarMaker.updateManifest. r=mshal (3cd74ff478)
- Bug 1208160 - Show information when Xcode requires accepting license agreement; r=gps (352bb43d73)
- Bug 1174524 - Make objdir path comparison case-insensitive on Windows. r=mshal (6f74f10845)
- Bug 1158898 - Cache config.guess output; r=mshal (a7b01184fa)
- Bug 1187245 - Make .mozconfig.mk environment variables available to mach valgrind-test. r=gps (2033642ceb)
436 lines
13 KiB
C++
436 lines
13 KiB
C++
/* -*- 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 "CompositorBench.h"
|
|
|
|
#ifdef MOZ_COMPOSITOR_BENCH
|
|
#include "mozilla/gfx/2D.h"
|
|
#include "mozilla/layers/Compositor.h"
|
|
#include "mozilla/layers/Effects.h"
|
|
#include "mozilla/TimeStamp.h"
|
|
#include "gfxPrefs.h"
|
|
#include <math.h>
|
|
#include "GeckoProfiler.h"
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
#include "mozilla/layers/GrallocTextureHost.h"
|
|
#endif
|
|
|
|
#define TEST_STEPS 1000
|
|
#define DURATION_THRESHOLD 30
|
|
#define THRESHOLD_ABORT_COUNT 5
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
static float SimplePseudoRandom(int aStep, int aCount) {
|
|
srand(aStep * 1000 + aCount);
|
|
return static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
|
|
}
|
|
|
|
class BenchTest {
|
|
public:
|
|
BenchTest(const char* aTestName)
|
|
: mTestName(aTestName)
|
|
{}
|
|
|
|
virtual ~BenchTest() {}
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {}
|
|
virtual void Teardown(Compositor* aCompositor) {}
|
|
virtual void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) = 0;
|
|
|
|
const char* ToString() { return mTestName; }
|
|
private:
|
|
const char* mTestName;
|
|
};
|
|
|
|
static void
|
|
DrawFrameTrivialQuad(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep, const EffectChain& effects) {
|
|
for (size_t i = 0; i < aStep * 10; i++) {
|
|
const gfx::Rect& rect = gfx::Rect(i % (int)aScreenRect.width,
|
|
(int)(i / aScreenRect.height),
|
|
1, 1);
|
|
const gfx::Rect& clipRect = aScreenRect;
|
|
|
|
float opacity = 1.f;
|
|
|
|
gfx::Matrix transform2d;
|
|
|
|
gfx::Matrix4x4 transform = gfx::Matrix4x4::From2D(transform2d);
|
|
|
|
aCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
|
|
}
|
|
}
|
|
|
|
static void
|
|
DrawFrameStressQuad(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep, const EffectChain& effects)
|
|
{
|
|
for (size_t i = 0; i < aStep * 10; i++) {
|
|
const gfx::Rect& rect = gfx::Rect(aScreenRect.width * SimplePseudoRandom(i, 0),
|
|
aScreenRect.height * SimplePseudoRandom(i, 1),
|
|
aScreenRect.width * SimplePseudoRandom(i, 2),
|
|
aScreenRect.height * SimplePseudoRandom(i, 3));
|
|
const gfx::Rect& clipRect = aScreenRect;
|
|
|
|
float opacity = 1.f;
|
|
|
|
gfx::Matrix transform2d;
|
|
transform2d = transform2d.PreRotate(SimplePseudoRandom(i, 4) * 70.f);
|
|
|
|
gfx::Matrix4x4 transform = gfx::Matrix4x4::From2D(transform2d);
|
|
|
|
aCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
|
|
}
|
|
}
|
|
|
|
class EffectSolidColorBench : public BenchTest {
|
|
public:
|
|
EffectSolidColorBench()
|
|
: BenchTest("EffectSolidColorBench (clear frame with EffectSolidColor)")
|
|
{}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
float tmp;
|
|
float red = modff(aStep * 0.03f, &tmp);
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect =
|
|
new EffectSolidColor(gfx::Color(red, 0.4f, 0.4f, 1.0f));
|
|
|
|
const gfx::Rect& rect = aScreenRect;
|
|
const gfx::Rect& clipRect = aScreenRect;
|
|
|
|
float opacity = 1.f;
|
|
|
|
gfx::Matrix4x4 transform;
|
|
aCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
|
|
}
|
|
};
|
|
|
|
class EffectSolidColorTrivialBench : public BenchTest {
|
|
public:
|
|
EffectSolidColorTrivialBench()
|
|
: BenchTest("EffectSolidColorTrivialBench (10s 1x1 EffectSolidColor)")
|
|
{}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameTrivialQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
float tmp;
|
|
float red = modff(i * 0.03f, &tmp);
|
|
EffectChain effects;
|
|
return MakeAndAddRef<EffectSolidColor>(gfx::Color(red, 0.4f, 0.4f, 1.0f));
|
|
}
|
|
};
|
|
|
|
class EffectSolidColorStressBench : public BenchTest {
|
|
public:
|
|
EffectSolidColorStressBench()
|
|
: BenchTest("EffectSolidColorStressBench (10s various EffectSolidColor)")
|
|
{}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameStressQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
float tmp;
|
|
float red = modff(i * 0.03f, &tmp);
|
|
EffectChain effects;
|
|
return MakeAndAddRef<EffectSolidColor>(gfx::Color(red, 0.4f, 0.4f, 1.0f));
|
|
}
|
|
};
|
|
|
|
class UploadBench : public BenchTest {
|
|
public:
|
|
UploadBench()
|
|
: BenchTest("Upload Bench (10s 256x256 upload)")
|
|
{}
|
|
|
|
uint32_t* mBuf;
|
|
RefPtr<DataSourceSurface> mSurface;
|
|
RefPtr<DataTextureSource> mTexture;
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {
|
|
int bytesPerPixel = 4;
|
|
int w = 256;
|
|
int h = 256;
|
|
mBuf = (uint32_t *) malloc(w * h * sizeof(uint32_t));
|
|
|
|
mSurface = Factory::CreateWrappingDataSourceSurface(
|
|
reinterpret_cast<uint8_t*>(mBuf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8);
|
|
mTexture = aCompositor->CreateDataTextureSource();
|
|
}
|
|
|
|
virtual void Teardown(Compositor* aCompositor) {
|
|
mSurface = nullptr;
|
|
mTexture = nullptr;
|
|
free(mBuf);
|
|
}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
for (size_t i = 0; i < aStep * 10; i++) {
|
|
mTexture->Update(mSurface);
|
|
}
|
|
}
|
|
};
|
|
|
|
class TrivialTexturedQuadBench : public BenchTest {
|
|
public:
|
|
TrivialTexturedQuadBench()
|
|
: BenchTest("Trvial Textured Quad (10s 256x256 quads)")
|
|
{}
|
|
|
|
uint32_t* mBuf;
|
|
RefPtr<DataSourceSurface> mSurface;
|
|
RefPtr<DataTextureSource> mTexture;
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {
|
|
int bytesPerPixel = 4;
|
|
size_t w = 256;
|
|
size_t h = 256;
|
|
mBuf = (uint32_t *) malloc(w * h * sizeof(uint32_t));
|
|
for (size_t i = 0; i < w * h; i++) {
|
|
mBuf[i] = 0xFF00008F;
|
|
}
|
|
|
|
mSurface = Factory::CreateWrappingDataSourceSurface(
|
|
reinterpret_cast<uint8_t*>(mBuf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8);
|
|
mTexture = aCompositor->CreateDataTextureSource();
|
|
mTexture->Update(mSurface);
|
|
}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameTrivialQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
virtual void Teardown(Compositor* aCompositor) {
|
|
mSurface = nullptr;
|
|
mTexture = nullptr;
|
|
free(mBuf);
|
|
}
|
|
|
|
already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT, true);
|
|
}
|
|
};
|
|
|
|
class StressTexturedQuadBench : public BenchTest {
|
|
public:
|
|
StressTexturedQuadBench()
|
|
: BenchTest("Stress Textured Quad (10s 256x256 quads)")
|
|
{}
|
|
|
|
uint32_t* mBuf;
|
|
RefPtr<DataSourceSurface> mSurface;
|
|
RefPtr<DataTextureSource> mTexture;
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {
|
|
int bytesPerPixel = 4;
|
|
size_t w = 256;
|
|
size_t h = 256;
|
|
mBuf = (uint32_t *) malloc(w * h * sizeof(uint32_t));
|
|
for (size_t i = 0; i < w * h; i++) {
|
|
mBuf[i] = 0xFF00008F;
|
|
}
|
|
|
|
mSurface = Factory::CreateWrappingDataSourceSurface(
|
|
reinterpret_cast<uint8_t*>(mBuf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8);
|
|
mTexture = aCompositor->CreateDataTextureSource();
|
|
mTexture->Update(mSurface);
|
|
}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameStressQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
virtual void Teardown(Compositor* aCompositor) {
|
|
mSurface = nullptr;
|
|
mTexture = nullptr;
|
|
free(mBuf);
|
|
}
|
|
|
|
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT, true);
|
|
}
|
|
};
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
class TrivialGrallocQuadBench : public BenchTest {
|
|
public:
|
|
TrivialGrallocQuadBench()
|
|
: BenchTest("Travial Gralloc Quad (10s 256x256 quads)")
|
|
{}
|
|
|
|
uint32_t* mBuf;
|
|
android::sp<android::GraphicBuffer> mGralloc;
|
|
RefPtr<TextureSource> mTexture;
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {
|
|
mBuf = nullptr;
|
|
int w = 256;
|
|
int h = 256;
|
|
int32_t format = android::PIXEL_FORMAT_RGBA_8888;;
|
|
mGralloc = new android::GraphicBuffer(w, h,
|
|
format,
|
|
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
|
|
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
|
|
android::GraphicBuffer::USAGE_HW_TEXTURE);
|
|
mTexture = new mozilla::layers::GrallocTextureSourceOGL((CompositorOGL*)aCompositor, mGralloc.get(), SurfaceFormat::B8G8R8A8);
|
|
}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameTrivialQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
virtual void Teardown(Compositor* aCompositor) {
|
|
mGralloc = nullptr;
|
|
mTexture = nullptr;
|
|
free(mBuf);
|
|
}
|
|
|
|
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT);
|
|
}
|
|
};
|
|
|
|
class StressGrallocQuadBench : public BenchTest {
|
|
public:
|
|
StressGrallocQuadBench()
|
|
: BenchTest("Stress Gralloc Quad (10s 256x256 quads)")
|
|
{}
|
|
|
|
uint32_t* mBuf;
|
|
android::sp<android::GraphicBuffer> mGralloc;
|
|
RefPtr<TextureSource> mTexture;
|
|
|
|
virtual void Setup(Compositor* aCompositor, size_t aStep) {
|
|
mBuf = nullptr;
|
|
int w = 256;
|
|
int h = 256;
|
|
int32_t format = android::PIXEL_FORMAT_RGBA_8888;;
|
|
mGralloc = new android::GraphicBuffer(w, h,
|
|
format,
|
|
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
|
|
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
|
|
android::GraphicBuffer::USAGE_HW_TEXTURE);
|
|
mTexture = new mozilla::layers::GrallocTextureSourceOGL((CompositorOGL*)aCompositor, mGralloc.get(), SurfaceFormat::B8G8R8A8);
|
|
}
|
|
|
|
void DrawFrame(Compositor* aCompositor, const gfx::Rect& aScreenRect, size_t aStep) {
|
|
EffectChain effects;
|
|
effects.mPrimaryEffect = CreateEffect(aStep);
|
|
|
|
DrawFrameStressQuad(aCompositor, aScreenRect, aStep, effects);
|
|
}
|
|
|
|
virtual void Teardown(Compositor* aCompositor) {
|
|
mGralloc = nullptr;
|
|
mTexture = nullptr;
|
|
free(mBuf);
|
|
}
|
|
|
|
virtual already_AddRefed<Effect> CreateEffect(size_t i) {
|
|
return CreateTexturedEffect(SurfaceFormat::B8G8R8A8, mTexture, Filter::POINT);
|
|
}
|
|
};
|
|
#endif
|
|
|
|
static void RunCompositorBench(Compositor* aCompositor, const gfx::Rect& aScreenRect)
|
|
{
|
|
std::vector<BenchTest*> tests;
|
|
|
|
tests.push_back(new EffectSolidColorBench());
|
|
tests.push_back(new UploadBench());
|
|
tests.push_back(new EffectSolidColorTrivialBench());
|
|
tests.push_back(new EffectSolidColorStressBench());
|
|
tests.push_back(new TrivialTexturedQuadBench());
|
|
tests.push_back(new StressTexturedQuadBench());
|
|
#ifdef MOZ_WIDGET_GONK
|
|
tests.push_back(new TrivialGrallocQuadBench());
|
|
tests.push_back(new StressGrallocQuadBench());
|
|
#endif
|
|
|
|
for (size_t i = 0; i < tests.size(); i++) {
|
|
BenchTest* test = tests[i];
|
|
std::vector<TimeDuration> results;
|
|
int testsOverThreshold = 0;
|
|
PROFILER_MARKER(test->ToString());
|
|
for (size_t j = 0; j < TEST_STEPS; j++) {
|
|
test->Setup(aCompositor, j);
|
|
|
|
TimeStamp start = TimeStamp::Now();
|
|
IntRect screenRect(aScreenRect.x, aScreenRect.y,
|
|
aScreenRect.width, aScreenRect.height);
|
|
aCompositor->BeginFrame(
|
|
IntRect(screenRect.x, screenRect.y,
|
|
screenRect.width, screenRect.height),
|
|
nullptr, aScreenRect, nullptr, nullptr);
|
|
|
|
test->DrawFrame(aCompositor, aScreenRect, j);
|
|
|
|
aCompositor->EndFrame();
|
|
results.push_back(TimeStamp::Now() - start);
|
|
|
|
if (results[j].ToMilliseconds() > DURATION_THRESHOLD) {
|
|
testsOverThreshold++;
|
|
if (testsOverThreshold == THRESHOLD_ABORT_COUNT) {
|
|
test->Teardown(aCompositor);
|
|
break;
|
|
}
|
|
} else {
|
|
testsOverThreshold = 0;
|
|
}
|
|
test->Teardown(aCompositor);
|
|
}
|
|
|
|
printf_stderr("%s\n", test->ToString());
|
|
printf_stderr("Run step, Time (ms)\n");
|
|
for (size_t j = 0; j < results.size(); j++) {
|
|
printf_stderr("%i,%f\n", j, (float)results[j].ToMilliseconds());
|
|
}
|
|
printf_stderr("\n", test->ToString());
|
|
}
|
|
|
|
for (size_t i = 0; i < tests.size(); i++) {
|
|
delete tests[i];
|
|
}
|
|
}
|
|
|
|
void CompositorBench(Compositor* aCompositor, const gfx::Rect& aScreenRect)
|
|
{
|
|
static bool sRanBenchmark = false;
|
|
bool wantBenchmark = gfxPrefs::LayersBenchEnabled();
|
|
if (wantBenchmark && !sRanBenchmark) {
|
|
RunCompositorBench(aCompositor, aScreenRect);
|
|
}
|
|
sRanBenchmark = wantBenchmark;
|
|
}
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|
|
|
|
#endif
|
|
|