Allow specifying the max texture count on the bots

https://codereview.chromium.org/50413011/



git-svn-id: http://skia.googlecode.com/svn/trunk@12020 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-10-30 17:04:16 +00:00
parent 35fe7372b1
commit 4e5559af89
6 changed files with 40 additions and 18 deletions

View File

@ -84,7 +84,8 @@
'skia_nv_path_rendering%': 0,
'skia_stroke_path_rendering%': 0,
'skia_android_path_rendering%': 0,
'skia_texture_cache_mb_limit%': 0,
'skia_resource_cache_mb_limit%': 0,
'skia_resource_cache_count_limit%': 0,
'skia_angle%': 0,
'skia_directwrite%': 0,
'skia_gpu%': 1,
@ -140,7 +141,8 @@
'skia_nv_path_rendering%': '<(skia_nv_path_rendering)',
'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
'skia_android_path_rendering%': '<(skia_android_path_rendering)',
'skia_texture_cache_mb_limit%': '<(skia_texture_cache_mb_limit)',
'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
'skia_angle%': '<(skia_angle)',
'skia_arch_width%': '<(skia_arch_width)',
'skia_arch_type%': '<(skia_arch_type)',

View File

@ -50,9 +50,14 @@
],
},
}],
[ 'skia_texture_cache_mb_limit != 0', {
[ 'skia_resource_cache_mb_limit != 0', {
'defines': [
'GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT=<(skia_texture_cache_mb_limit)',
'GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT=<(skia_resource_cache_mb_limit)',
],
}],
[ 'skia_resource_cache_count_limit != 0', {
'defines': [
'GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT=<(skia_resource_cache_count_limit)',
],
}],
],

View File

@ -72,7 +72,7 @@ typedef unsigned __int64 uint64_t;
* GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h
*
* e.g. it can change the BUILD target or supply its own defines for anything
* else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
* else (e.g. GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT)
*/
#if !defined(GR_USER_CONFIG_FILE)
#include "GrUserConfig.h"
@ -216,12 +216,21 @@ inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); }
#endif
/**
* GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
* GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT gives a threshold (in megabytes) for the
* maximum size of the texture cache in vram. The value is only a default and
* can be overridden at runtime.
*/
#if !defined(GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT)
#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
#if !defined(GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT)
#define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
#endif
/**
* GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT specifies the maximum number of
* textures the texture cache can hold in vram. The value is only a default and
* can be overridden at runtime.
*/
#if !defined(GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT)
#define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
#endif
/**

View File

@ -23,6 +23,12 @@
* This gives a threshold in megabytes for the maximum size of the texture cache
* in vram. The value is only a default and can be overridden at runtime.
*/
//#define GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT 96
//#define GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT 96
/**
* This specifies the maximum number of textures the texture cache can hold
* in vram. The value is only a default and can be overridden at runtime.
*/
//#define GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT 2048
#endif

View File

@ -179,7 +179,7 @@ setup_device() {
case $TARGET_DEVICE in
nexus_s)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=24"
DEFINES="${DEFINES} skia_resource_cache_mb_limit=24"
ANDROID_ARCH="arm"
;;
nexus_4 | nexus_7 | nexus_10)
@ -192,17 +192,17 @@ setup_device() {
;;
galaxy_nexus)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="arm"
;;
intel_rhb)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
razr_i)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
arm_v7)
@ -223,7 +223,7 @@ setup_device() {
;;
x86)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
DEFINES="${DEFINES} skia_resource_cache_mb_limit=32"
ANDROID_ARCH="x86"
;;
*)

View File

@ -54,8 +54,8 @@ SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true,
#define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0
#endif
static const size_t MAX_TEXTURE_CACHE_COUNT = 2048;
static const size_t MAX_TEXTURE_CACHE_BYTES = GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT * 1024 * 1024;
static const size_t MAX_RESOURCE_CACHE_COUNT = GR_DEFAULT_RESOURCE_CACHE_COUNT_LIMIT;
static const size_t MAX_RESOURCE_CACHE_BYTES = GR_DEFAULT_RESOURCE_CACHE_MB_LIMIT * 1024 * 1024;
static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15;
static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4;
@ -134,8 +134,8 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext) {
fGpu->setDrawState(fDrawState);
fTextureCache = SkNEW_ARGS(GrResourceCache,
(MAX_TEXTURE_CACHE_COUNT,
MAX_TEXTURE_CACHE_BYTES));
(MAX_RESOURCE_CACHE_COUNT,
MAX_RESOURCE_CACHE_BYTES));
fTextureCache->setOverbudgetCallback(OverbudgetCB, this);
fFontCache = SkNEW_ARGS(GrFontCache, (fGpu));