Flutter Engine
The Flutter Engine
Functions
malioc_cores Namespace Reference

Functions

def parse_args (argv)
 
def validate_args (args)
 
def malioc_core_list (malioc)
 
def malioc_core_info (malioc, core)
 
def main (argv)
 

Function Documentation

◆ main()

def malioc_cores.main (   argv)

Definition at line 82 of file malioc_cores.py.

82def main(argv):
83 args = parse_args(argv[1:])
84 if not validate_args(args):
85 return 1
86
87 infos = []
88 for core in malioc_core_list(args.malioc):
89 infos.append(malioc_core_info(args.malioc, core))
90
91 if args.output:
92 with open(args.output, 'w') as file:
93 json.dump(infos, file, sort_keys=True)
94 else:
95 print(infos)
96
97 return 0
98
99
def validate_args(args)
Definition: malioc_cores.py:35
def malioc_core_list(malioc)
Definition: malioc_cores.py:42
def main(argv)
Definition: malioc_cores.py:82
def malioc_core_info(malioc, core)
Definition: malioc_cores.py:54
def print(*args, **kwargs)
Definition: run_tests.py:49
static void parse_args(int argc, char *argv[], Args *args)
Definition: skqp_main.cpp:97

◆ malioc_core_info()

def malioc_cores.malioc_core_info (   malioc,
  core 
)

Definition at line 54 of file malioc_cores.py.

54def malioc_core_info(malioc, core):
55 malioc_info = subprocess.check_output(
56 [malioc, '--info', '--core', core, '--format', 'json'],
57 stderr=subprocess.STDOUT,
58 )
59 info_json = json.loads(malioc_info)
60
61 apis = info_json['apis']
62
63 opengles_max_version = 0
64 if 'opengles' in apis:
65 opengles = apis['opengles']
66 if opengles['max_version'] is not None:
67 opengles_max_version = opengles['max_version']
68 vulkan_max_version = 0
69 if 'vulkan' in apis:
70 vulkan = apis['vulkan']
71 if vulkan['max_version'] is not None:
72 vulkan_max_version = int(vulkan['max_version'] * 100)
73
74 info = {
75 'core': core,
76 'opengles_max_version': opengles_max_version,
77 'vulkan_max_version': vulkan_max_version,
78 }
79 return info
80
81

◆ malioc_core_list()

def malioc_cores.malioc_core_list (   malioc)

Definition at line 42 of file malioc_cores.py.

42def malioc_core_list(malioc):
43 malioc_cores = subprocess.check_output(
44 [malioc, '--list', '--format', 'json'],
45 stderr=subprocess.STDOUT,
46 )
47 cores_json = json.loads(malioc_cores)
48 cores = []
49 for core in cores_json['cores']:
50 cores.append(core['core'])
51 return cores
52
53

◆ parse_args()

def malioc_cores.parse_args (   argv)

Definition at line 16 of file malioc_cores.py.

16def parse_args(argv):
17 parser = argparse.ArgumentParser(
18 description='This script sanitizes GPU core info output from malioc',
19 )
20 parser.add_argument(
21 '--malioc',
22 '-m',
23 type=str,
24 help='The path to malioc.',
25 )
26 parser.add_argument(
27 '--output',
28 '-o',
29 type=str,
30 help='The output path.',
31 )
32 return parser.parse_args(argv)
33
34

◆ validate_args()

def malioc_cores.validate_args (   args)

Definition at line 35 of file malioc_cores.py.

35def validate_args(args):
36 if not args.malioc or not os.path.isfile(args.malioc):
37 print('The --malioc argument must refer to the malioc binary.')
38 return False
39 return True
40
41