# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.


"""
This file defines the configurations in which bench_pictures should be run
on various platforms. The buildbots read these configurations from the
bench_pictures_cfg dictionary. Everything else in this file exists to help in
constructing that dictionary.

This code is executed directly on the buildbot so that convenient things like
variables and loops can be used to avoid unnecessary verbosity. With great power
comes great responsibility; don't put any nasty code here. To reiterate, code in
this file will be directly executed on the build slaves.
"""


import os
import sys


if 'import_path' in globals():
  sys.path.append(import_path)


from bench_pictures_cfg_helper import *


# Default tile sizes
DEFAULT_TILE_X = '256'
DEFAULT_TILE_Y = '256'


# Configs to run on most bots
default_configs = [
  # Basic CPU and GPU configs
  TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
  TiledGPUConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),

  # CopyTiles
  CopyTilesConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),

  # Record
  RecordConfig(),

  # Multi-threaded
  MultiThreadTileConfig(2, DEFAULT_TILE_X, DEFAULT_TILE_Y),
  MultiThreadTileConfig(3, DEFAULT_TILE_X, DEFAULT_TILE_Y),
  MultiThreadTileConfig(4, DEFAULT_TILE_X, DEFAULT_TILE_Y),

  # Different tile sizes
  TiledBitmapConfig(512, 512),
  TiledBitmapConfig(1024, 256),
  TiledBitmapConfig(1024, 64),

  # Different bounding box heirarchies, for different modes.
  RecordRTreeConfig(),
  PlaybackCreationRTreeConfig(),
  TileRTreeConfig(            DEFAULT_TILE_X, DEFAULT_TILE_Y),
  RecordGridConfig(           DEFAULT_TILE_X, DEFAULT_TILE_Y),
  PlaybackCreationGridConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
  TileGridConfig(             DEFAULT_TILE_X, DEFAULT_TILE_Y),
]


def AndroidConfigList(tile_size, scale, cores, viewport, do_gpu=True):
  tile_x = tile_size[0]
  tile_y = tile_size[1]

  viewport_x = viewport[0]
  viewport_y = viewport[1]

  configs = [
    # Record
    RecordConfig(     scale=str(scale)),
    RecordRTreeConfig(scale=str(scale)),
    RecordGridConfig( tile_x, tile_y, scale=str(scale)),

    # Tiled playback
    TiledBitmapConfig(tile_x, tile_y, scale=str(scale)),
    TileRTreeConfig(  tile_x, tile_y, scale=str(scale)),
    TileGridConfig(   tile_x, tile_y, scale=str(scale)),

    # Viewport playback
    ViewportBitmapConfig(viewport_x, viewport_y, scale=str(scale)),
    ViewportRTreeConfig( viewport_x, viewport_y, scale=str(scale)),
  ]

  if do_gpu:
    configs.append(TiledGPUConfig(tile_x, tile_y, scale=str(scale)))
    configs.append(ViewportGPUConfig(viewport_x, viewport_y, scale=str(scale)))

  # Multicore
  for num_cores in cores:
    configs.append(MultiThreadTileConfig(num_cores, tile_x, tile_y,
                                         scale=str(scale)))

  return configs


msaa4 = Config(config='msaa4')


# This dictionary defines the sets of configs for all platforms. Each config is
# a dictionary of key/value pairs directly corresponding to the command-line
# flags passed to bench_pictures.
bench_pictures_cfg = {
  'angle': [TiledConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y, config='angle')],
  'debug': [TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y)],
  'default': default_configs,
  'no_gpu': [cfg for cfg in default_configs if cfg['config'] != 'gpu'],
  'nexus_s':      AndroidConfigList((256, 256), 0.4897, [],  (480,  800),
                                    do_gpu=False),
  'xoom':         AndroidConfigList((256, 256), 1.2244, [],  (1200, 800)),
  'galaxy_nexus': AndroidConfigList((256, 256), 0.8163, [],  (800,  1280)) + \
                      [msaa4],
  'nexus_4':      AndroidConfigList((256, 256), 0.7836, [],  (768,  1280)),
  'nexus_7':      AndroidConfigList((256, 256), 1.3061, [2], (1280, 800)),
  'nexus_10':     AndroidConfigList((512, 512), 2.6122, [],  (2560, 1600)) + \
                      [msaa4],
  'razr_i':       AndroidConfigList((256, 256), 0.5510, [],  (540, 960)) + \
                      [msaa4],
}
