# 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 Recommendation 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.
