1bf215546Sopenharmony_ci# Copyright © 2017 Intel Corporation
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
11bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19bf215546Sopenharmony_ci# SOFTWARE.
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_cigen_xml_files = [
22bf215546Sopenharmony_ci  'gen4.xml',
23bf215546Sopenharmony_ci  'gen45.xml',
24bf215546Sopenharmony_ci  'gen5.xml',
25bf215546Sopenharmony_ci  'gen6.xml',
26bf215546Sopenharmony_ci  'gen7.xml',
27bf215546Sopenharmony_ci  'gen75.xml',
28bf215546Sopenharmony_ci  'gen8.xml',
29bf215546Sopenharmony_ci  'gen9.xml',
30bf215546Sopenharmony_ci  'gen11.xml',
31bf215546Sopenharmony_ci  'gen12.xml',
32bf215546Sopenharmony_ci  'gen125.xml',
33bf215546Sopenharmony_ci]
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_cigen_pack_header_deps = files('util.py')
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_cigenX_xml_h = custom_target(
38bf215546Sopenharmony_ci  'genX_xml.h',
39bf215546Sopenharmony_ci  input : ['gen_zipped_file.py', gen_xml_files],
40bf215546Sopenharmony_ci  output : 'genX_xml.h',
41bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@'],
42bf215546Sopenharmony_ci  capture : true,
43bf215546Sopenharmony_ci)
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_cigenX_bits_included_symbols = [
46bf215546Sopenharmony_ci  # instructions
47bf215546Sopenharmony_ci  'MI_BATCH_BUFFER_START::Batch Buffer Start Address',
48bf215546Sopenharmony_ci  'MI_REPORT_PERF_COUNT::Memory Address',
49bf215546Sopenharmony_ci  'MI_STORE_DATA_IMM::Address',
50bf215546Sopenharmony_ci  'MI_STORE_DATA_IMM::Immediate Data',
51bf215546Sopenharmony_ci  'MI_STORE_REGISTER_MEM::Memory Address',
52bf215546Sopenharmony_ci  '3DSTATE_DEPTH_BUFFER::Surface Base Address',
53bf215546Sopenharmony_ci  '3DSTATE_DEPTH_BUFFER::Surface Pitch',
54bf215546Sopenharmony_ci  '3DSTATE_STENCIL_BUFFER::Surface Base Address',
55bf215546Sopenharmony_ci  '3DSTATE_STENCIL_BUFFER::Surface Pitch',
56bf215546Sopenharmony_ci  '3DSTATE_HIER_DEPTH_BUFFER::Surface Base Address',
57bf215546Sopenharmony_ci  '3DSTATE_HIER_DEPTH_BUFFER::Surface Pitch',
58bf215546Sopenharmony_ci  '3DSTATE_CLEAR_PARAMS',
59bf215546Sopenharmony_ci  '3DSTATE_SO_BUFFER::Surface Base Address',
60bf215546Sopenharmony_ci  '3DSTATE_SO_BUFFER::Stream Offset',
61bf215546Sopenharmony_ci  '3DSTATE_CPSIZE_CONTROL_BUFFER::Surface Base Address',
62bf215546Sopenharmony_ci  '3DSTATE_CPSIZE_CONTROL_BUFFER::Surface Pitch',
63bf215546Sopenharmony_ci  # structures
64bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Surface Base Address',
65bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Surface Pitch',
66bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Auxiliary Surface Base Address',
67bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Auxiliary Surface Pitch',
68bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Clear Value Address',
69bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Red Clear Color',
70bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Green Clear Color',
71bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Blue Clear Color',
72bf215546Sopenharmony_ci  'RENDER_SURFACE_STATE::Alpha Clear Color',
73bf215546Sopenharmony_ci  'CLEAR_COLOR',
74bf215546Sopenharmony_ci  'VERTEX_BUFFER_STATE::Buffer Starting Address',
75bf215546Sopenharmony_ci  'CPS_STATE',
76bf215546Sopenharmony_ci]
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_cigenX_bits_h = custom_target(
79bf215546Sopenharmony_ci  'genX_bits.h',
80bf215546Sopenharmony_ci  input : ['gen_bits_header.py', gen_xml_files],
81bf215546Sopenharmony_ci  output : 'genX_bits.h',
82bf215546Sopenharmony_ci  command : [prog_python, '@INPUT@', '-o', '@OUTPUT@',
83bf215546Sopenharmony_ci             '--include-symbols', ','.join(genX_bits_included_symbols)],
84bf215546Sopenharmony_ci  depend_files: gen_pack_header_deps
85bf215546Sopenharmony_ci)
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_cigen_xml_pack = []
88bf215546Sopenharmony_ciforeach f : gen_xml_files + ['gen_rt.xml']
89bf215546Sopenharmony_ci  _name = '@0@_pack.h'.format(f.split('.')[0])
90bf215546Sopenharmony_ci  gen_xml_pack += custom_target(
91bf215546Sopenharmony_ci    _name,
92bf215546Sopenharmony_ci    input : ['gen_pack_header.py', f],
93bf215546Sopenharmony_ci    output : _name,
94bf215546Sopenharmony_ci    command : [prog_python, '@INPUT@', '--engines=render,blitter,video'],
95bf215546Sopenharmony_ci    capture : true,
96bf215546Sopenharmony_ci    depend_files: gen_pack_header_deps
97bf215546Sopenharmony_ci  )
98bf215546Sopenharmony_ciendforeach
99bf215546Sopenharmony_ci
100bf215546Sopenharmony_cigen_pack_header_py = files('gen_pack_header.py')
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_ciidep_genxml = declare_dependency(sources : [gen_xml_pack, genX_bits_h, genX_xml_h])
103