blob: cfcd8162dbdabc77ee59a54f3bd938dbbdd0e724 [file] [log] [blame]
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Import platform-specific defaults
import("//$starboard_path/configuration.gni")
# Import starboard variables
import("//starboard/build/config/base.gni")
# Cobalt variables.
# Enable support for the map to mesh filter, which is primarily used to
# implement spherical video playback.
if (!defined(enable_map_to_mesh)) {
enable_map_to_mesh = false
}
# This variable defines what Cobalt's preferred strategy should be for
# handling internally triggered application exit requests (e.g. the user
# chooses to back out of the application).
# "stop" -- The application should call SbSystemRequestStop() on exit,
# resulting in a complete shutdown of the application.
# "suspend" -- The application should call SbSystemRequestSuspend() on
# exit, resulting in the application being "minimized".
# "noexit" -- The application should never allow the user to trigger an
# exit, this will be managed by the system.
if (!defined(cobalt_user_on_exit_strategy)) {
cobalt_user_on_exit_strategy = "stop"
}
# Contains the current font package selection. This can be used to trade
# font quality, coverage, and latency for different font package sizes.
# The font package can be one of the following options:
# "standard" -- The default package. It includes all sans-serif, serif, and
# FCC fonts, non-CJK fallback fonts in both 'normal' and 'bold'
# weights, 'normal' weight CJK ('bold' weight CJK is synthesized
# from it), historic script fonts, and color emojis. This
# package is ~38.3MB.
# 'limited' -- A significantly smaller package than 'standard'. This package
# removes all but 'normal' and 'bold' weighted sans-serif and
# serif, removes the FCC fonts (which must be provided by the
# system or downloaded from the web), replaces standard CJK with
# low quality CJK, removes historic script fonts, and replaces
# colored emojis with uncolored ones. Because low quality CJK
# cannot synthesize bold, bold glyphs are unavailable in
# Chinese, Japanese and Korean. This package is ~8.3MB.
# "minimal" -- The smallest possible font package. It only includes Roboto's
# Basic Latin characters. Everything else must be provided by
# the system or downloaded from the web. This package is
# ~40.0KB.
# NOTE: When bold is needed, but unavailable, it is typically synthesized,
# resulting in lower quality glyphs than those generated directly from
# a bold font. However, this does not occur with low quality CJK,
# which is not high enough quality to synthesize. Its glyphs always
# have a 'normal' weight.
if (!defined(cobalt_font_package)) {
cobalt_font_package = "standard"
}
# Font package overrides can be used to modify the files included within the
# selected package. The following values are available:
# -1 -- The package value for the specified category is not overridden.
# 0 -- The package value is overridden and no fonts for the specified
# category are included.
# 1 -- The package value is overridden and fonts from the specified
# category with a weight of 'normal' and a style of 'normal' are
# included.
# 2 -- The package value is overridden and fonts from the specified
# category with a weight of either 'normal' or bold' and a style of
# 'normal' are included.
# 3 -- The package value is overridden and fonts from the specified
# category with a weight of either 'normal' or 'bold' and a style of
# either 'normal' or 'italic' are included.
# 4 -- The package value is overridden and all available fonts from the
# specified category are included. This may include additional
# weights beyond 'normal' and 'bold'.
# See content/fonts/README.md for details on the specific values used by
# each of the packages use for the various font categories.
if (!defined(cobalt_font_package_override_named_sans_serif)) {
cobalt_font_package_override_named_sans_serif = -1
}
if (!defined(cobalt_font_package_override_named_serif)) {
cobalt_font_package_override_named_serif = -1
}
if (!defined(cobalt_font_package_override_named_fcc_fonts)) {
cobalt_font_package_override_named_fcc_fonts = -1
}
if (!defined(cobalt_font_package_override_fallback_lang_non_cjk)) {
cobalt_font_package_override_fallback_lang_non_cjk = -1
}
if (!defined(cobalt_font_package_override_fallback_lang_cjk)) {
cobalt_font_package_override_fallback_lang_cjk = -1
}
if (!defined(cobalt_font_package_override_fallback_lang_cjk_low_quality)) {
cobalt_font_package_override_fallback_lang_cjk_low_quality = -1
}
if (!defined(cobalt_font_package_override_fallback_historic)) {
cobalt_font_package_override_fallback_historic = -1
}
if (!defined(cobalt_font_package_override_fallback_emoji)) {
cobalt_font_package_override_fallback_emoji = -1
}
if (!defined(cobalt_font_package_override_fallback_symbols)) {
cobalt_font_package_override_fallback_symbols = -1
}
# The target platform id as a string, like "ps4", etc..
# TODO: eliminate when all platforms are fully starboard.
if (!defined(sb_target_platform)) {
sb_target_platform = ""
}
# Defines what kind of rasterizer will be used. This can be adjusted to
# force a stub graphics implementation or software graphics implementation.
# It can be one of the following options:
# 'direct-gles' -- Uses a light wrapper over OpenGL ES to handle most
# draw elements. This will fall back to the skia hardware
# rasterizer for some render tree node types, but is
# generally faster on the CPU and GPU. This can handle
# 360 rendering.
# 'hardware' -- As much hardware acceleration of graphics commands as
# possible. This uses skia to wrap OpenGL ES commands.
# Required for 360 rendering.
# 'software' -- Perform most rasterization using the CPU and only
# interact with the GPU to send the final image to the
# output window.
# 'stub' -- Stub graphics rasterization. A rasterizer object will
# still be available and valid, but it will do nothing.
if (!defined(rasterizer_type)) {
rasterizer_type = "direct-gles"
}
# If set to true, will enable support for rendering only the regions of the
# display that are modified due to animations, instead of re-rendering the
# entire scene each frame. This feature can reduce startup time where
# usually there is a small loading spinner animating on the screen. On GLES
# renderers, Cobalt will attempt to implement this support by using
# eglSurfaceAttrib(..., EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED), otherwise
# the dirty region will be silently disabled. On Blitter API platforms,
# if this is enabled, we explicitly create an extra offscreen full-size
# intermediate surface to render into. Note that some GLES driver
# implementations may internally allocate an extra full screen surface to
# support this feature, and many have been noticed to not properly support
# this functionality (but they report that they do), and for these reasons
# this value is defaulted to false.
if (!defined(render_dirty_region_only)) {
render_dirty_region_only = false
}
# Modify this value to adjust the default rasterizer setting for your
# platform.
if (!defined(default_renderer_options_dependency)) {
default_renderer_options_dependency = "//cobalt/renderer:default_options"
}
# Allow throttling of the frame rate. This is expressed in terms of
# milliseconds and can be a floating point number. Keep in mind that
# swapping frames may take some additional processing time, so it may be
# better to specify a lower delay. For example, "33" instead of "33.33"
# for 30 Hz refresh.
if (!defined(cobalt_minimum_frame_time_in_milliseconds)) {
cobalt_minimum_frame_time_in_milliseconds = "16.4"
}
# Cobalt will call eglSwapInterval() and specify this value before calling
# eglSwapBuffers() each frame.
if (!defined(cobalt_egl_swap_interval)) {
cobalt_egl_swap_interval = 1
}
# Set to true to build with DIAL support.
if (!defined(enable_in_app_dial)) {
enable_in_app_dial = false
}
# Set to true to enable a custom MediaSessionClient.
if (!defined(enable_custom_media_session_client)) {
enable_custom_media_session_client = false
}
# Set to true to enable H5vccAccountManager.
if (!defined(enable_account_manager)) {
enable_account_manager = false
}
# Set to true to enable H5vccCrashLog.
if (!defined(enable_crash_log)) {
enable_crash_log = false
}
# Set to true to enable H5vccSSO (Single Sign On).
if (!defined(enable_sso)) {
enable_sso = false
}
# Set to true to compile with SPDY support.
if (!defined(enable_spdy)) {
enable_spdy = false
}
# Set to true to enable filtering of HTTP headers before sending.
if (!defined(enable_xhr_header_filtering)) {
enable_xhr_header_filtering = false
}
# Used by //cobalt/media to pick a proper media platform.
if (!defined(sb_media_platform)) {
sb_media_platform = "starboard"
}
# List of platform-specific targets that get compiled into cobalt.
if (!defined(cobalt_platform_dependencies)) {
cobalt_platform_dependencies = []
}
# The URL of default build time splash screen - see
# cobalt/doc/splash_screen.md for information about this.
if (!defined(fallback_splash_screen_url)) {
fallback_splash_screen_url = "none"
}
# The path to a splash screen to copy into content/data/web which can be
# accessed via a file URL starting with
# "file:///cobalt/browser/splash_screen/". If "", no file is copied.
if (!defined(cobalt_splash_screen_file)) {
cobalt_splash_screen_file = ""
}
# Cache parameters
# The following set of parameters define how much memory is reserved for
# different Cobalt caches. These caches affect CPU *and* GPU memory usage.
#
# The sum of the following caches effectively describes the maximum GPU
# texture memory usage (though it doesn't consider video textures and
# display color buffers):
# - skia_cache_size_in_bytes (GLES2 rasterizer only)
# - scratch_surface_cache_size_in_bytes
# - surface_cache_size_in_bytes
# - image_cache_size_in_bytes
# - skia_glyph_atlas_width * skia_glyph_atlas_height
#
# The other caches affect CPU memory usage.
# Determines the capacity of the skia cache. The Skia cache is maintained
# within Skia and is used to cache the results of complicated effects such
# as shadows, so that Skia draw calls that are used repeatedly across
# frames can be cached into surfaces. This setting is only relevant when
# using the hardware-accelerated Skia rasterizer (e.g. as opposed to the
# Blitter API).
if (!defined(skia_cache_size_in_bytes)) {
skia_cache_size_in_bytes = "(4 * 1024 * 1024)"
}
# Determines the capacity of the scratch surface cache. The scratch
# surface cache facilitates the reuse of temporary offscreen surfaces
# within a single frame. This setting is only relevant when using the
# hardware-accelerated Skia rasterizer.
if (!defined(scratch_surface_cache_size_in_bytes)) {
scratch_surface_cache_size_in_bytes = 0
}
# Determines the capacity of the surface cache. The surface cache tracks
# which render tree nodes are being re-used across frames and stores the
# nodes that are most CPU-expensive to render into surfaces.
if (!defined(surface_cache_size_in_bytes)) {
surface_cache_size_in_bytes = 0
}
# Determines the amount of GPU memory the offscreen target atlases will
# use. This is specific to the direct-GLES rasterizer and serves a similar
# purpose as the surface_cache_size_in_bytes, but caches any render tree
# nodes which require skia for rendering. Two atlases will be allocated
# from this memory or multiple atlases of the frame size if the limit
# allows. It is recommended that enough memory be reserved for two RGBA
# atlases about a quarter of the frame size.
if (!defined(offscreen_target_cache_size_in_bytes)) {
offscreen_target_cache_size_in_bytes = -1
}
# Determines the capacity of the image cache, which manages image surfaces
# downloaded from a web page. While it depends on the platform, often (and
# ideally) these images are cached within GPU memory.
# Set to -1 to automatically calculate the value at runtime, based on
# features like windows dimensions and the value of
# SbSystemGetTotalGPUMemory().
if (!defined(image_cache_size_in_bytes)) {
image_cache_size_in_bytes = -1
}
# Determines the capacity of the local font cache, which manages all fonts
# loaded from local files. Newly encountered sections of font files are
# lazily loaded into the cache, enabling subsequent requests to the same
# file sections to be handled via direct memory access. Once the limit is
# reached, further requests are handled via file stream.
# Setting the value to 0 disables memory caching and causes all font file
# accesses to be done using file streams.
if (!defined(local_font_cache_size_in_bytes)) {
local_font_cache_size_in_bytes = "(16 * 1024 * 1024)"
}
# Determines the capacity of the remote font cache, which manages all
# fonts downloaded from a web page.
if (!defined(remote_font_cache_size_in_bytes)) {
remote_font_cache_size_in_bytes = "(4 * 1024 * 1024)"
}
# Determines the capacity of the mesh cache. Each mesh is held compressed
# in main memory, to be inflated into a GPU buffer when needed for
# projection. When set to "auto", will be adjusted according to whether
# the enable_map_to_mesh is true or not. If enable_map_to_mesh is false,
# then the mesh cache size will be set to 0.
if (!defined(mesh_cache_size_in_bytes)) {
mesh_cache_size_in_bytes = "auto"
}
# Only relevant if you are using the Blitter API.
# Determines the capacity of the software surface cache, which is used to
# cache all surfaces that are rendered via a software rasterizer to avoid
# re-rendering them.
if (!defined(software_surface_cache_size_in_bytes)) {
software_surface_cache_size_in_bytes = "(8 * 1024 * 1024)"
}
# Modifying this value to be non-1.0f will result in the image cache
# capacity being cleared and then temporarily reduced for the duration that
# a video is playing. This can be useful for some platforms if they are
# particularly constrained for (GPU) memory during video playback. When
# playing a video, the image cache is reduced to:
# image_cache_size_in_bytes *
# image_cache_capacity_multiplier_when_playing_video.
if (!defined(image_cache_capacity_multiplier_when_playing_video)) {
image_cache_capacity_multiplier_when_playing_video = "1.0f"
}
# Determines the size in pixels of the glyph atlas where rendered glyphs are
# cached. The resulting memory usage is 2 bytes of GPU memory per pixel.
# When a value is used that is too small, thrashing may occur that will
# result in visible stutter. Such thrashing is more likely to occur when CJK
# language glyphs are rendered and when the size of the glyphs in pixels is
# larger, such as for higher resolution displays.
# The negative default values indicates to the engine that these settings
# should be automatically set.
if (!defined(skia_glyph_atlas_width)) {
skia_glyph_atlas_width = "-1"
}
if (!defined(skia_glyph_atlas_height)) {
skia_glyph_atlas_height = "-1"
}
# Determines the size of garbage collection threshold. After this many bytes
# have been allocated, the mozjs garbage collector will run. Lowering this
# has been found to reduce performance and decrease JavaScript memory usage.
# For example, we have measured on at least one platform that performance
# becomes 7% worse on average in certain cases when adjusting this number
# from 8MB to 1MB.
if (!defined(mozjs_garbage_collection_threshold_in_bytes)) {
mozjs_garbage_collection_threshold_in_bytes = "(8 * 1024 * 1024)"
}
# Max Cobalt CPU usage specifies that the cobalt program should
# keep it's size below the specified size. A value of -1 causes this
# value to be assumed from the starboard API function:
# SbSystemGetTotalCPUMemory().
if (!defined(max_cobalt_cpu_usage)) {
max_cobalt_cpu_usage = -1
}
if (!defined(max_cobalt_gpu_usage)) {
# Max Cobalt GPU usage specifies that the cobalt program should
# keep it's size below the specified size. A value of -1 causes this
# value to be assumed from the starboard API function:
# SbSystemGetTotalGPUMemory().
max_cobalt_gpu_usage = -1
}
# When specified this value will reduce the cpu memory consumption by
# the specified amount. -1 disables the value.
# When this value is specified then max_cobalt_cpu_usage will not be
# used in memory_constrainer, but will still be used for triggering
# a warning if the engine consumes more memory than this value specifies.
if (!defined(reduce_cpu_memory_by)) {
reduce_cpu_memory_by = -1
}
# When specified this value will reduce the gpu memory consumption by
# the specified amount. -1 disables the value.
# When this value is specified then max_cobalt_gpu_usage will not be
# used in memory_constrainer, but will still be used for triggering
# a warning if the engine consumes more memory than this value specifies.
if (!defined(reduce_gpu_memory_by)) {
reduce_gpu_memory_by = -1
}
# The only currently-supported Javascript engine is "mozjs-45". (However,
# this may potentially change in the future.)
if (!defined(javascript_engine)) {
javascript_engine = "mozjs-45"
}
# Enable jit instead of running in interpreter-only mode by default.
# We have found that disabling jit often results in faster JavaScript
# execution and lower memory usage.
# Setting this to true on a platform or engine for which there is no JIT
# implementation has no effect.
if (!defined(cobalt_enable_jit)) {
cobalt_enable_jit = false
}
# Use media source extension implementation that is conformed to the
# Candidate Recommandation of July 5th 2016.
if (!defined(cobalt_use_media_source_2016)) {
cobalt_use_media_source_2016 = true
}
# Note that the following media buffer related variables are only used when
# |cobalt_use_media_source_2016| is set to true.
# This can be set to "memory" or "file". When it is set to "memory", the
# media buffers will be stored in main memory allocated by SbMemory
# functions. When it is set to "file", the media buffers will be stored in
# a temporary file in the system cache folder acquired by calling
# SbSystemGetPath() with "kSbSystemPathCacheDirectory". Note that when its
# value is "file" the media stack will still allocate memory to cache the
# the buffers in use.
if (!defined(cobalt_media_buffer_storage_type)) {
cobalt_media_buffer_storage_type = "memory"
}
# When either |cobalt_media_buffer_initial_capacity| or
# |cobalt_media_buffer_allocation_unit| isn't zero, media buffers will be
# allocated using a memory pool. Set the following variable to true to
# allocate the media buffer pool memory on demand and return all memory to
# the system when there is no media buffer allocated. Setting the following
# value to false results in that Cobalt will allocate
# |cobalt_media_buffer_initial_capacity| bytes for media buffer on startup
# and will not release any media buffer memory back to the system even if
# there is no media buffers allocated.
if (!defined(cobalt_media_buffer_pool_allocate_on_demand)) {
cobalt_media_buffer_pool_allocate_on_demand = true
}
# The amount of memory that will be used to store media buffers allocated
# during system startup. To allocate a large chunk at startup helps with
# reducing fragmentation and can avoid failures to allocate incrementally.
# This can be set to 0.
if (!defined(cobalt_media_buffer_initial_capacity)) {
cobalt_media_buffer_initial_capacity = "(21 * 1024 * 1024)"
}
# The maximum amount of memory that will be used to store media buffers when
# video resolution is no larger than 1080p. If 0, then memory can grow
# without bound. This must be larger than sum of 1080p video budget and non-
# video budget.
if (!defined(cobalt_media_buffer_max_capacity_1080p)) {
cobalt_media_buffer_max_capacity_1080p = "(36 * 1024 * 1024)",
}
# The maximum amount of memory that will be used to store media buffers when
# video resolution is no larger than 4k. If 0, then memory can grow
# without bound. This must be larger than sum of 4k video budget and non-
# video budget.
if (!defined(cobalt_buffer_max_capacity_4k)) {
cobalt_media_buffer_max_capacity_4k = "(65 * 1024 * 1024)",
}
# When the media stack needs more memory to store media buffers, it will
# allocate extra memory in units of |cobalt_media_buffer_allocation_unit|.
# This can be set to 0, in which case the media stack will allocate extra
# memory on demand. When |cobalt_media_buffer_initial_capacity| and this
# value are both set to 0, the media stack will allocate individual buffers
# directly using SbMemory functions.
if (!defined(cobalt_media_buffer_allocation_unit)) {
cobalt_media_buffer_allocation_unit = "(1 * 1024 * 1024)"
}
# The media buffer will be allocated using the following alignment. Set
# this to a larger value may increase the memory consumption of media
# buffers.
if (!defined(cobalt_media_buffer_alignment)) {
cobalt_media_buffer_alignment = 0
}
# Extra bytes allocated at the end of a media buffer to ensure that the
# buffer can be use optimally by specific instructions like SIMD. Set to 0
# to remove any padding.
if (!defined(cobalt_media_buffer_padding)) {
cobalt_media_buffer_padding = 0
}
# The memory used when playing mp4 videos that is not in DASH format. The
# resolution of such videos shouldn't go beyond 1080p. Its value should be
# less than the sum of 'cobalt_media_buffer_non_video_budget' and
# 'cobalt_media_buffer_video_budget_1080p' but not less than 8 MB.
if (!defined(cobalt_media_buffer_progressive_budget)) {
cobalt_media_buffer_progressive_budget = "(12 * 1024 * 1024)"
}
# Specifies the maximum amount of memory used by audio or text buffers of
# media source before triggering a garbage collection. A large value will
# cause more memory being used by audio buffers but will also make
# JavaScript app less likely to re-download audio data. Note that the
# JavaScript app may experience significant difficulty if this value is too
# low.
if (!defined(cobalt_media_buffer_non_video_budget)) {
cobalt_media_buffer_non_video_budget = "(5 * 1024 * 1024)"
}
# Specifies the maximum amount of memory used by video buffers of media
# source before triggering a garbage collection when the video resolution is
# lower than 1080p (1920x1080). A large value will cause more memory being
# used by video buffers but will also make JavaScript app less likely to
# re-download video data. Note that the JavaScript app may experience
# significant difficulty if this value is too low.
if (!defined(cobalt_media_buffer_video_budget_1080p)) {
cobalt_media_buffer_video_budget_1080p = "(16 * 1024 * 1024)"
}
# Specifies the maximum amount of memory used by video buffers of media
# source before triggering a garbage collection when the video resolution is
# lower than 4k (3840x2160). A large value will cause more memory being
# used by video buffers but will also make JavaScript app less likely to
# re-download video data. Note that the JavaScript app may experience
# significant difficulty if this value is too low.
if (!defined(cobalt_media_buffer_video_budget_4k)) {
cobalt_media_buffer_video_budget_4k = "(60 * 1024 * 1024)"
}
# Specifies the duration threshold of media source garbage collection. When the
# accumulated duration in a source buffer exceeds this value, the media source
# implementation will try to eject existing buffers from the cache.
# This is usually triggered when the video being played has a simple content and
# the encoded data is small. In such case this can limit how much is allocated
# for the book keeping data of the media buffers and avoid OOM of system heap.
# This should be set to 170 for most of the platforms. But it can be further
# reduced on systems with extremely low memory.
if (!defined(cobalt_media_source_garbage_collection_duration_threshold_in_seconds)) {
cobalt_media_source_garbage_collection_duration_threshold_in_seconds = "(170)"
}
# Enables embedding Cobalt as a shared library within another app. This
# requires a 'lib' starboard implementation for the corresponding platform.
if (!defined(cobalt_enable_lib)) {
cobalt_enable_lib = sb_enable_lib
}
# For configurations other than Gold, set the flag that lets test data files be
# copied and carried along with the build.
# Clients must copy over all content; to avoid having to copy over extra data,
# we omit the test data
_copy_test_data = (cobalt_config != "gold" && !cobalt_enable_lib)
if (!defined(cobalt_copy_debug_console)) {
cobalt_copy_debug_console = _copy_test_data
}
if (!defined(cobalt_copy_test_data)) {
cobalt_copy_test_data = _copy_test_data
}
if (!defined(enable_about_scheme)) {
enable_about_scheme = _copy_test_data
}
if (!defined(enable_fake_microphone)) {
enable_fake_microphone = _copy_test_data
}
if (!defined(enable_network_logging)) {
enable_network_logging = _copy_test_data
}
if (!defined(enable_remote_debugging)) {
enable_remote_debugging = _copy_test_data
}
if (!defined(enable_webdriver)) {
enable_webdriver = _copy_test_data
}
# Use system libjpeg.
if (!defined(use_system_libjpeg)) {
use_system_libjpeg = false
}
# TODO: add ARM compilation flags to the starboard platform config
# TODO: implement remaining flags like clang_type_profiler, build_for_tool, order_profiling, etc.