Bug 1303054 - use dynamic cache size with SkiaGL on desktop. r=milan

MozReview-Commit-ID: 3Hhsa1SNcXw
This commit is contained in:
Lee Salzman 2016-09-23 11:40:25 -04:00
parent 31d21069da
commit 4649ee4713
3 changed files with 12 additions and 7 deletions

View File

@ -100,8 +100,6 @@
#include "mozilla/layers/GrallocTextureHost.h"
#endif
#include "mozilla/Hal.h"
#ifdef USE_SKIA
# ifdef __GNUC__
# pragma GCC diagnostic push
@ -144,6 +142,7 @@ class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted {
#include "gfxVR.h"
#include "VRManagerChild.h"
#include "mozilla/gfx/GPUParent.h"
#include "prsystem.h"
namespace mozilla {
namespace layers {
@ -506,7 +505,8 @@ gfxPlatform::gfxPlatform()
#endif
InitBackendPrefs(canvasMask, BackendType::CAIRO,
contentMask, BackendType::CAIRO);
mTotalSystemMemory = mozilla::hal::GetTotalSystemMemory();
mTotalSystemMemory = PR_GetPhysicalMemorySize();
VRManager::ManagerInit();
}
@ -1274,7 +1274,7 @@ gfxPlatform::InitializeSkiaCacheLimits()
#ifdef USE_SKIA_GPU
bool usingDynamicCache = gfxPrefs::CanvasSkiaGLDynamicCache();
int cacheItemLimit = gfxPrefs::CanvasSkiaGLCacheItems();
int cacheSizeLimit = gfxPrefs::CanvasSkiaGLCacheSize();
uint64_t cacheSizeLimit = std::max(gfxPrefs::CanvasSkiaGLCacheSize(), (int32_t)0);
// Prefs are in megabytes, but we want the sizes in bytes
cacheSizeLimit *= 1024*1024;
@ -1289,11 +1289,14 @@ gfxPlatform::InitializeSkiaCacheLimits()
}
}
// Ensure cache size doesn't overflow on 32-bit platforms.
cacheSizeLimit = std::min(cacheSizeLimit, (uint64_t)SIZE_MAX);
#ifdef DEBUG
printf_stderr("Determined SkiaGL cache limits: Size %i, Items: %i\n", cacheSizeLimit, cacheItemLimit);
printf_stderr("Determined SkiaGL cache limits: Size %" PRIu64 ", Items: %i\n", cacheSizeLimit, cacheItemLimit);
#endif
mSkiaGlue->GetGrContext()->setResourceCacheLimits(cacheItemLimit, cacheSizeLimit);
mSkiaGlue->GetGrContext()->setResourceCacheLimits(cacheItemLimit, (size_t)cacheSizeLimit);
#endif
}
}

View File

@ -770,7 +770,7 @@ protected:
// max number of entries in word cache
int32_t mWordCacheMaxEntries;
uint32_t mTotalSystemMemory;
uint64_t mTotalSystemMemory;
// Hardware vsync source. Only valid on parent process
RefPtr<mozilla::gfx::VsyncSource> mVsyncSource;

View File

@ -786,6 +786,8 @@ pref("gfx.content.azure.backends", "skia");
#endif
#endif
pref("gfx.canvas.skiagl.dynamic-cache", true);
pref("gfx.text.disable-aa", false);
pref("gfx.work-around-driver-bugs", true);