Bug 1309200 - Add gfx::Factory::GetDefaultSoftwareBackend. r=Bas

This commit is contained in:
Nicolas Silva 2016-10-28 18:27:37 +02:00
parent 73df3d530d
commit 9af48bd777
5 changed files with 15 additions and 4 deletions

View File

@ -1296,11 +1296,13 @@ struct Config {
LogForwarder* mLogForwarder;
int32_t mMaxTextureSize;
int32_t mMaxAllocSize;
BackendType mDefaultSoftwareBackend;
Config()
: mLogForwarder(nullptr)
, mMaxTextureSize(8192)
, mMaxAllocSize(52000000)
, mDefaultSoftwareBackend(BackendType::CAIRO)
{}
};
@ -1438,6 +1440,8 @@ public:
static uint32_t GetMaxSurfaceSize(BackendType aType);
static BackendType GetDefaultSoftwareBackend();
static LogForwarder* GetLogForwarder() { return sConfig ? sConfig->mLogForwarder : nullptr; }
private:

View File

@ -217,6 +217,12 @@ Factory::HasSSE2()
#endif
}
BackendType
Factory::GetDefaultSoftwareBackend()
{
return sConfig ? sConfig->mDefaultSoftwareBackend : BackendType::CAIRO;
}
// If the size is "reasonable", we want gfxCriticalError to assert, so
// this is the option set up for it.
inline int LoggerOptionsBasedOnSize(const IntSize& aSize)

View File

@ -92,7 +92,7 @@ GPUParent::Init(base::ProcessId aParentPid,
gfxVars::Initialize();
gfxPlatform::InitNullMetadata();
// Ensure our Factory is initialised, mainly for gfx logging to work.
gfxPlatform::InitMoz2DLogging();
gfxPlatform::InitMoz2D();
#if defined(XP_WIN)
DeviceManagerDx::Init();
DeviceManagerD3D9::Init();

View File

@ -653,7 +653,7 @@ gfxPlatform::Init()
ScopedGfxFeatureReporter::AppNote(forcedPrefs);
}
InitMoz2DLogging();
InitMoz2D();
gGfxPlatformPrefsLock = new Mutex("gfxPlatform::gGfxPlatformPrefsLock");
@ -793,7 +793,7 @@ gfxPlatform::Init()
}
/* static */ void
gfxPlatform::InitMoz2DLogging()
gfxPlatform::InitMoz2D()
{
auto fwd = new CrashStatsLogForwarder("GraphicsCriticalError");
fwd->SetCircularBufferSize(gfxPrefs::GfxLoggingCrashLength());
@ -802,6 +802,7 @@ gfxPlatform::InitMoz2DLogging()
cfg.mLogForwarder = fwd;
cfg.mMaxTextureSize = gfxPrefs::MaxTextureSize();
cfg.mMaxAllocSize = gfxPrefs::MaxAllocSize();
cfg.mDefaultSoftwareBackend = gPlatform->GetSoftwareBackend();
gfx::Factory::Init(cfg);
}

View File

@ -178,7 +178,7 @@ public:
*/
static void InitNullMetadata();
static void InitMoz2DLogging();
static void InitMoz2D();
/**
* Create an offscreen surface of the given dimensions