aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bench_pictures_cfg_helper.py
blob: c010f3b3aa7512581f3457299bb08e626e003a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 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.


""" Helper functions to be used in bench_pictures.cfg. """


def Config(**kwargs):
  config = {}
  for key in kwargs:
    config[key] = kwargs[key]
  return config


def TileArgs(tile_x, tile_y, timeIndividualTiles=True):
  config = {'mode': ['tile', str(tile_x), str(tile_y)]}
  if timeIndividualTiles:
    config['timeIndividualTiles'] = True
  return config


def BitmapConfig(**kwargs):
  return Config(config='8888', **kwargs)


def GPUConfig(**kwargs):
  return Config(config='gpu', **kwargs)


def TiledBitmapConfig(tile_x, tile_y, timeIndividualTiles=True, **kwargs):
  return BitmapConfig(**dict(TileArgs(tile_x, tile_y,
      timeIndividualTiles=timeIndividualTiles).items() + kwargs.items()))


def TiledGPUConfig(tile_x, tile_y, **kwargs):
  return GPUConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))


def TiledConfig(tile_x, tile_y, timeIndividualTiles=True, **kwargs):
  return Config(**dict(TileArgs(tile_x, tile_y,
      timeIndividualTiles=timeIndividualTiles).items() + kwargs.items()))


def ViewportBitmapConfig(viewport_x, viewport_y, **kwargs):
  return BitmapConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs)


def ViewportGPUConfig(viewport_x, viewport_y, **kwargs):
  return GPUConfig(viewport=[str(viewport_x), str(viewport_y)], **kwargs)


def ViewportRTreeConfig(viewport_x, viewport_y, **kwargs):
  return RTreeConfig(mode='simple', viewport=[str(viewport_x), str(viewport_y)],
                     **kwargs)


def ViewportGridConfig(viewport_x, viewport_y, **kwargs):
  return GridConfig(viewport_x, viewport_y, mode='simple',
                    viewport=[str(viewport_x), str(viewport_y)], **kwargs)


def CopyTilesConfig(tile_x, tile_y, **kwargs):
  return BitmapConfig(mode=['copyTile', str(tile_x), str(tile_y)], **kwargs)


def RecordConfig(**kwargs):
  return BitmapConfig(mode='record', **kwargs)


def PlaybackCreationConfig(**kwargs):
  return BitmapConfig(mode='playbackCreation', **kwargs)


def MultiThreadTileConfig(threads, tile_x, tile_y, **kwargs):
  return TiledBitmapConfig(tile_x=tile_x, tile_y=tile_y,
                           timeIndividualTiles=False, multi=str(threads),
                           **kwargs)


def RTreeConfig(**kwargs):
  return BitmapConfig(bbh='rtree', **kwargs)


def GridConfig(tile_x, tile_y, mode, **kwargs):
  return BitmapConfig(mode=mode, bbh=['grid', str(tile_x), str(tile_y)],
                      **kwargs)


def RecordRTreeConfig(**kwargs):
  return RTreeConfig(mode='record', **kwargs)


def PlaybackCreationRTreeConfig(**kwargs):
  return RTreeConfig(mode='playbackCreation', **kwargs)


def TileRTreeConfig(tile_x, tile_y, **kwargs):
  return RTreeConfig(**dict(TileArgs(tile_x, tile_y).items() + kwargs.items()))


def RecordGridConfig(tile_x, tile_y, **kwargs):
  return GridConfig(tile_x=tile_x, tile_y=tile_y, mode='record', **kwargs)


def PlaybackCreationGridConfig(tile_x, tile_y, **kwargs):
  return GridConfig(tile_x, tile_y, mode='playbackCreation')