Skip to content

Commit b7aa05c

Browse files
committed
Add Android.bp for v24.3.4
Test: make iHD_drv_video for x86_64 Change-Id: I9582630dc52b0780c1a63ab8ead63a1823186445 Signed-off-by: JeevakaPrabu <jeevaka.badrappan@intel.com>
1 parent 11e4301 commit b7aa05c

File tree

112 files changed

+2930
-2365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2930
-2365
lines changed

Android.bp

+2,258
Large diffs are not rendered by default.

Tools/MediaDriverTools/Android/GenerateAndroidMk.py Tools/MediaDriverTools/Android/GenerateAndroidBp.py

+44-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#! /usr/bin/env python3
2+
23
"""
3-
* Copyright (c) 2018, Intel Corporation
4-
*
4+
* Copyright (c) 2024, Intel Corporation
5+
56
* Permission is hereby granted, free of charge, to any person obtaining a
67
* copy of this software and associated documentation files (the "Software"),
78
* to deal in the Software without restriction, including without limitation
@@ -34,16 +35,16 @@
3435
import os.path as path
3536
import re
3637

37-
INDENT = " "
38+
INDENT = " "
39+
INDENT1 = " "
3840
TOOL_DIR = "Tools/MediaDriverTools/Android/"
39-
TEMPLATE_DIR = path.join(TOOL_DIR, "mk")
41+
TEMPLATE_DIR = path.join(TOOL_DIR, "bp")
4042

4143

4244
def remove(f):
4345
cmd = "rm " + f + "> /dev/null 2>&1"
4446
os.system(cmd)
4547

46-
4748
def getDriverName(root):
4849
driver = "mod"
4950
if not path.exists(path.join(root, driver)):
@@ -52,9 +53,8 @@ def getDriverName(root):
5253
raise Exception("driver path " + driver + " not existed")
5354
return driver
5455

55-
5656
class Generator:
57-
def __init__(self, src, root, makefile=None):
57+
def __init__(self, src, root, driver_name = "", makefile=None):
5858
# where to put the Android makefile
5959
self.makefile = makefile if makefile else src
6060

@@ -63,6 +63,8 @@ def __init__(self, src, root, makefile=None):
6363

6464
# driver name
6565
driver = getDriverName(root)
66+
67+
self.driver_name = driver_name
6668
# where to put build file and template
6769
self.tool = path.join(root, driver, TOOL_DIR)
6870

@@ -72,11 +74,11 @@ def __init__(self, src, root, makefile=None):
7274
# major function
7375
def generate(self):
7476

75-
if not path.exists(self.src):
77+
if path.exists(self.src) == False:
7678
raise Exception(self.src + "not existed")
77-
self.generateMakefile(debug=True)
79+
self.generateMakefile()
7880

79-
mk = path.join(self.makefile, "Android.mk")
81+
mk = path.join(self.makefile, "Android.bp")
8082
# remove old Android.mk
8183
remove(mk)
8284

@@ -90,12 +92,12 @@ def generate(self):
9092
f.write(tpl)
9193
print("generated " + self.getName() + " to " + self.makefile)
9294

93-
# virtuall functions
95+
# virtual functions
9496
def getTemplate(self):
95-
raise Exception("pure virtul function")
97+
raise Exception("pure virtual function")
9698

9799
def getFlagsfile(self):
98-
raise Exception("pure virtul function")
100+
raise Exception("pure virtual function")
99101

100102
def getMakefile(self):
101103
return "Makefile"
@@ -144,8 +146,12 @@ def getIncludes(self):
144146
continue
145147

146148
p = path.normpath(l)
147-
includes.append(path.join("$(LOCAL_PATH)", path.relpath(p, self.src)))
148-
return INDENT + ("\n" + INDENT).join(includes) if includes else ""
149+
j = p.find(self.src)
150+
if j != -1:
151+
if ("Tools" in p[j:]):
152+
continue
153+
includes.append((p[j:].replace(self.src, "")).lstrip("/"))
154+
return INDENT + '"' + ("\n" + INDENT + '"').join(includes) if includes else ""
149155

150156
def getDefines(self, name):
151157
flags = path.join(self.getBuildDir(), self.getFlagsfile())
@@ -156,17 +162,26 @@ def getDefines(self, name):
156162
return ""
157163

158164
line = line.replace(name + " = ", "").strip()
159-
return INDENT + line.replace(" ", " \\\n" + INDENT) if line else ""
165+
line = line.replace(" ", "\",\n") if line else ""
166+
lines = line.split("\n")
167+
lines[-1] = lines[-1] + '",'
168+
169+
# media-driver have common flags so indentation will be different
170+
if (self.driver_name == "media-driver"):
171+
print("driver name"+ self.driver_name)
172+
return INDENT1 + '"' + ("\n" + INDENT1 + '"').join(lines)
173+
174+
return INDENT + '"' + ("\n" + INDENT + '"').join(lines)
160175

161176
def getSources(self):
162177
makefile = path.join(self.getBuildDir(), self.getMakefile())
163178
with open(makefile) as f:
164179
text = f.read()
165180
lines = re.findall(".*?\\.o:\\n", text)
166-
lines = [l.replace(".o:\n", " \\") for l in lines]
181+
lines = [l.replace(".o:\n", "\",") for l in lines]
167182
self.adjustSources(lines)
168183
# make source pretty
169-
return INDENT + ("\n" + INDENT).join(lines)
184+
return INDENT + '"' + ("\n" + INDENT + '"').join(lines)
170185

171186

172187
class GmmGeneator(Generator):
@@ -217,24 +232,16 @@ def adjustSources(self, lines):
217232

218233
class DriverGeneator(Generator):
219234
def __init__(self, root):
220-
src = path.join(root, getDriverName(root), "media_driver")
221-
super(DriverGeneator, self).__init__(src, root)
235+
src = path.join(root, getDriverName(root))
236+
super(DriverGeneator, self).__init__(src, root,"media-driver")
222237

223238
def getCmakeCmd(self):
224-
wd = path.join(self.src, "..")
239+
wd = self.src
225240
cmd = 'cmake ' + wd + ' -DCMAKE_INSTALL_PREFIX=/usr'
226241
cmd += ' -DBUILD_ALONG_WITH_CMRTLIB=1 -DBS_DIR_GMMLIB=' + path.join(wd, '../gmmlib/Source/GmmLib/')
227242
cmd += ' -DBS_DIR_COMMON=' + path.join(wd, '../gmmlib/Source/Common/')
228243
cmd += ' -DBS_DIR_INC=' + path.join(wd, '../gmmlib/Source/inc/')
229244
cmd += ' -DBS_DIR_MEDIA=' + wd
230-
cmd += (' -DSKIP_GMM_CHECK=ON'
231-
' -DGEN12=ON'
232-
' -DXe_M=ON'
233-
' -DXEHP_SDV=ON'
234-
' -DENABLE_PRODUCTION_KMD=ON' # For /media_softlet/agnostic/Xe_R/Xe_HPC/renderhal
235-
# ' -DGEN10=ON' # For /media_interface/media_interfaces_m10_cnl
236-
' -DGEN12_RKL=ON' # For /media_interface/media_interfaces_m12_rkl
237-
)
238245
return cmd
239246

240247
def getTemplate(self):
@@ -247,11 +254,14 @@ def getFlagsfile(self):
247254
return "media_driver/CMakeFiles/iHD_drv_video.dir/flags.make"
248255

249256
def adjustSources(self, lines):
250-
lines[:] = [l.replace('__/', '../') for l in lines
251-
if "media_libva_putsurface_linux.cpp" not in l
252-
and '/private/' not in l
253-
]
254-
257+
for i, l in enumerate(lines):
258+
j = l.find("__/")
259+
if j == -1:
260+
lines[i] = "media_driver/" + l
261+
else:
262+
lines[i] = l[j + 3:]
263+
lines[:] = [l for l in lines if "media_libva_putsurface_linux.cpp" not in l
264+
and '/private/' not in l and 'Tools' not in l]
255265

256266
class Main:
257267

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright (c) 2024, Intel Corporation
2+
3+
// Permission is hereby granted, free of charge, to any person obtaining a
4+
// copy of this software and associated documentation files (the "Software"),
5+
// to deal in the Software without restriction, including without limitation
6+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
// and/or sell copies of the Software, and to permit persons to whom the
8+
// Software is furnished to do so, subject to the following conditions:
9+
10+
// The above copyright notice and this permission notice shall be included
11+
// in all copies or substantial portions of the Software.
12+
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16+
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
17+
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19+
// OTHER DEALINGS IN THE SOFTWARE.
20+
21+
cc_library_shared {
22+
name: "libigfxcmrt",
23+
24+
srcs: [
25+
@LOCAL_SRC_FILES
26+
],
27+
28+
local_include_dirs: [
29+
@LOCAL_C_INCLUDES
30+
],
31+
32+
cflags: [
33+
"-Werror",
34+
"-Wno-unused-variable",
35+
"-Wno-unused-parameter",
36+
"-Wno-unused-private-field",
37+
"-Wno-non-virtual-dtor",
38+
"-Wno-implicit-fallthrough",
39+
@LOCAL_CFLAGS
40+
],
41+
42+
header_libs: [
43+
"libva_headers",
44+
],
45+
46+
shared_libs: [
47+
"libc",
48+
"libdl",
49+
"libcutils",
50+
"liblog",
51+
"libutils",
52+
"libm",
53+
"libva",
54+
"libva-android",
55+
],
56+
vendor: true,
57+
enabled: false,
58+
arch: {
59+
x86_64: {
60+
enabled: true,
61+
},
62+
},
63+
}
64+
65+
cc_library_headers {
66+
name: "libcmrt_headers",
67+
export_include_dirs: [
68+
"linux/hardware",
69+
],
70+
71+
vendor: true,
72+
enabled: false,
73+
arch: {
74+
x86_64: {
75+
enabled: true,
76+
},
77+
},
78+
}
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright (c) 2024, Intel Corporation
2+
3+
// Permission is hereby granted, free of charge, to any person obtaining a
4+
// copy of this software and associated documentation files (the "Software"),
5+
// to deal in the Software without restriction, including without limitation
6+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
// and/or sell copies of the Software, and to permit persons to whom the
8+
// Software is furnished to do so, subject to the following conditions:
9+
10+
// The above copyright notice and this permission notice shall be included
11+
// in all copies or substantial portions of the Software.
12+
13+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16+
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
17+
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19+
// OTHER DEALINGS IN THE SOFTWARE.
20+
21+
package {
22+
default_applicable_licenses: ["external_gmmlib_license"],
23+
}
24+
25+
license {
26+
name: "external_gmmlib_license",
27+
visibility: [":__subpackages__"],
28+
license_text: [
29+
"LICENSE.md",
30+
],
31+
}
32+
33+
cc_library_shared {
34+
name: "libigdgmm_android",
35+
vendor: true,
36+
srcs: [
37+
@LOCAL_SRC_FILES
38+
],
39+
40+
cflags: [
41+
@LOCAL_CFLAGS
42+
"-fvisibility=hidden",
43+
"-fno-omit-frame-pointer",
44+
"-march=corei7",
45+
"-Werror",
46+
"-Wno-logical-op-parentheses",
47+
"-Wno-shift-negative-value",
48+
"-Wno-unused-parameter",
49+
],
50+
51+
cppflags: [
52+
"-Wno-implicit-fallthrough",
53+
"-Wno-missing-braces",
54+
"-Wno-unknown-pragmas",
55+
"-Wno-parentheses",
56+
"-Wno-pragma-pack",
57+
"-fexceptions",
58+
"-std=c++11",
59+
"-fvisibility-inlines-hidden",
60+
"-fno-use-cxa-atexit",
61+
"-fno-rtti",
62+
"-fcheck-new",
63+
"-pthread",
64+
],
65+
66+
local_include_dirs: [
67+
@LOCAL_C_INCLUDES
68+
],
69+
70+
enabled: false,
71+
arch: {
72+
x86_64: {
73+
enabled: true,
74+
},
75+
},
76+
}
77+
78+
cc_library_headers {
79+
name: "libigdgmm_headers",
80+
vendor: true,
81+
export_include_dirs: [
82+
"Source/GmmLib/inc",
83+
"Source/inc",
84+
"Source/inc/common",
85+
],
86+
87+
enabled: false,
88+
arch: {
89+
x86_64: {
90+
enabled: true,
91+
},
92+
},
93+
}

0 commit comments

Comments
 (0)