Home | History | Annotate | Download | only in tools
      1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 
      6 """
      7 This file defines the configurations in which bench_pictures should be run
      8 on various platforms. The buildbots read these configurations from the
      9 bench_pictures_cfg dictionary. Everything else in this file exists to help in
     10 constructing that dictionary.
     11 
     12 This code is executed directly on the buildbot so that convenient things like
     13 variables and loops can be used to avoid unnecessary verbosity. With great power
     14 comes great responsibility; don't put any nasty code here. To reiterate, code in
     15 this file will be directly executed on the build slaves.
     16 """
     17 
     18 
     19 import os
     20 import sys
     21 
     22 
     23 if 'import_path' in globals():
     24   sys.path.append(import_path)
     25 
     26 
     27 from bench_pictures_cfg_helper import *
     28 
     29 
     30 # Default tile sizes
     31 DEFAULT_TILE_X = '256'
     32 DEFAULT_TILE_Y = '256'
     33 
     34 
     35 # Configs to run on most bots
     36 default_configs = [
     37   # Basic CPU and GPU configs
     38   TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
     39   TiledGPUConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
     40 
     41   # CopyTiles
     42   CopyTilesConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y),
     43 
     44   # Record
     45   RecordConfig(),
     46 
     47   # Multi-threaded
     48   MultiThreadTileConfig(2, DEFAULT_TILE_X, DEFAULT_TILE_Y),
     49   MultiThreadTileConfig(3, DEFAULT_TILE_X, DEFAULT_TILE_Y),
     50   MultiThreadTileConfig(4, DEFAULT_TILE_X, DEFAULT_TILE_Y),
     51 
     52   # Different tile sizes
     53   TiledBitmapConfig(512, 512),
     54   TiledBitmapConfig(1024, 256),
     55   TiledBitmapConfig(1024, 64),
     56 
     57   # Different bounding box heirarchies, for different modes.
     58   RecordRTreeConfig(),
     59   PlaybackCreationRTreeConfig(),
     60   TileRTreeConfig(            DEFAULT_TILE_X, DEFAULT_TILE_Y),
     61   RecordGridConfig(           DEFAULT_TILE_X, DEFAULT_TILE_Y),
     62   PlaybackCreationGridConfig( DEFAULT_TILE_X, DEFAULT_TILE_Y),
     63   TileGridConfig(             DEFAULT_TILE_X, DEFAULT_TILE_Y),
     64 ]
     65 
     66 
     67 def AndroidConfigList(tile_size, scale, cores, viewport, do_gpu=True):
     68   tile_x = tile_size[0]
     69   tile_y = tile_size[1]
     70 
     71   viewport_x = viewport[0]
     72   viewport_y = viewport[1]
     73 
     74   configs = [
     75     # Record
     76     RecordConfig(     scale=str(scale)),
     77     RecordRTreeConfig(scale=str(scale)),
     78     RecordGridConfig( tile_x, tile_y, scale=str(scale)),
     79 
     80     # Tiled playback
     81     TiledBitmapConfig(tile_x, tile_y, scale=str(scale)),
     82     TileRTreeConfig(  tile_x, tile_y, scale=str(scale)),
     83     TileGridConfig(   tile_x, tile_y, scale=str(scale)),
     84 
     85     # Viewport playback
     86     ViewportBitmapConfig(viewport_x, viewport_y, scale=str(scale)),
     87     ViewportRTreeConfig( viewport_x, viewport_y, scale=str(scale)),
     88   ]
     89 
     90   if do_gpu:
     91     configs.append(TiledGPUConfig(tile_x, tile_y, scale=str(scale)))
     92     configs.append(ViewportGPUConfig(viewport_x, viewport_y, scale=str(scale)))
     93 
     94   # Multicore
     95   for num_cores in cores:
     96     configs.append(MultiThreadTileConfig(num_cores, tile_x, tile_y,
     97                                          scale=str(scale)))
     98 
     99   return configs
    100 
    101 
    102 # This dictionary defines the sets of configs for all platforms. Each config is
    103 # a dictionary of key/value pairs directly corresponding to the command-line
    104 # flags passed to bench_pictures.
    105 bench_pictures_cfg = {
    106   'debug': [TiledBitmapConfig(DEFAULT_TILE_X, DEFAULT_TILE_Y)],
    107   'default': default_configs,
    108   'no_gpu': [cfg for cfg in default_configs if cfg['device'] != 'gpu'],
    109   'nexus_s':      AndroidConfigList((256, 256), 0.4897, [],  (480,  800),
    110                                     do_gpu=False),
    111   'xoom':         AndroidConfigList((256, 256), 1.2244, [],  (1200, 800)),
    112   'galaxy_nexus': AndroidConfigList((256, 256), 0.8163, [],  (800,  1280)),
    113   'nexus_4':      AndroidConfigList((256, 256), 0.7836, [],  (768,  1280)),
    114   'nexus_7':      AndroidConfigList((256, 256), 1.3061, [2], (1280, 800)),
    115   'nexus_10':     AndroidConfigList((512, 512), 2.6122, [],  (2560, 1600)),
    116 }