Skip to content

Commit

Permalink
Add Android.bp for v24.3.4
Browse files Browse the repository at this point in the history
Test: make iHD_drv_video for x86_64

Change-Id: I9582630dc52b0780c1a63ab8ead63a1823186445
Signed-off-by: JeevakaPrabu <[email protected]>
  • Loading branch information
JeevakaPrabu committed Oct 23, 2024
1 parent 11e4301 commit 869a466
Show file tree
Hide file tree
Showing 112 changed files with 2,931 additions and 2,365 deletions.
2,259 changes: 2,259 additions & 0 deletions Android.bp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#! /usr/bin/env python3

"""
* Copyright (c) 2018, Intel Corporation
*
* Copyright (c) 2024, Intel Corporation
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
Expand Down Expand Up @@ -34,16 +35,16 @@
import os.path as path
import re

INDENT = " "
INDENT = " "
INDENT1 = " "
TOOL_DIR = "Tools/MediaDriverTools/Android/"
TEMPLATE_DIR = path.join(TOOL_DIR, "mk")
TEMPLATE_DIR = path.join(TOOL_DIR, "bp")


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


def getDriverName(root):
driver = "mod"
if not path.exists(path.join(root, driver)):
Expand All @@ -52,9 +53,8 @@ def getDriverName(root):
raise Exception("driver path " + driver + " not existed")
return driver


class Generator:
def __init__(self, src, root, makefile=None):
def __init__(self, src, root, driver_name = "", makefile=None):
# where to put the Android makefile
self.makefile = makefile if makefile else src

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

# driver name
driver = getDriverName(root)

self.driver_name = driver_name
# where to put build file and template
self.tool = path.join(root, driver, TOOL_DIR)

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

if not path.exists(self.src):
if path.exists(self.src) == False:
raise Exception(self.src + "not existed")
self.generateMakefile(debug=True)
self.generateMakefile()

mk = path.join(self.makefile, "Android.mk")
mk = path.join(self.makefile, "Android.bp")
# remove old Android.mk
remove(mk)

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

# virtuall functions
# virtual functions
def getTemplate(self):
raise Exception("pure virtul function")
raise Exception("pure virtual function")

def getFlagsfile(self):
raise Exception("pure virtul function")
raise Exception("pure virtual function")

def getMakefile(self):
return "Makefile"
Expand Down Expand Up @@ -144,8 +146,12 @@ def getIncludes(self):
continue

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

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

line = line.replace(name + " = ", "").strip()
return INDENT + line.replace(" ", " \\\n" + INDENT) if line else ""
line = line.replace(" ", "\",\n") if line else ""
lines = line.split("\n")
lines[-1] = lines[-1] + '",'

# media-driver have common flags so indentation will be different
if (self.driver_name == "media-driver"):
print("driver name"+ self.driver_name)
return INDENT1 + '"' + ("\n" + INDENT1 + '"').join(lines)

return INDENT + '"' + ("\n" + INDENT + '"').join(lines)

def getSources(self):
makefile = path.join(self.getBuildDir(), self.getMakefile())
with open(makefile) as f:
text = f.read()
lines = re.findall(".*?\\.o:\\n", text)
lines = [l.replace(".o:\n", " \\") for l in lines]
lines = [l.replace(".o:\n", "\",") for l in lines]
self.adjustSources(lines)
# make source pretty
return INDENT + ("\n" + INDENT).join(lines)
return INDENT + '"' + ("\n" + INDENT + '"').join(lines)


class GmmGeneator(Generator):
Expand Down Expand Up @@ -217,24 +232,16 @@ def adjustSources(self, lines):

class DriverGeneator(Generator):
def __init__(self, root):
src = path.join(root, getDriverName(root), "media_driver")
super(DriverGeneator, self).__init__(src, root)
src = path.join(root, getDriverName(root))
super(DriverGeneator, self).__init__(src, root,"media-driver")

def getCmakeCmd(self):
wd = path.join(self.src, "..")
wd = self.src
cmd = 'cmake ' + wd + ' -DCMAKE_INSTALL_PREFIX=/usr'
cmd += ' -DBUILD_ALONG_WITH_CMRTLIB=1 -DBS_DIR_GMMLIB=' + path.join(wd, '../gmmlib/Source/GmmLib/')
cmd += ' -DBS_DIR_COMMON=' + path.join(wd, '../gmmlib/Source/Common/')
cmd += ' -DBS_DIR_INC=' + path.join(wd, '../gmmlib/Source/inc/')
cmd += ' -DBS_DIR_MEDIA=' + wd
cmd += (' -DSKIP_GMM_CHECK=ON'
' -DGEN12=ON'
' -DXe_M=ON'
' -DXEHP_SDV=ON'
' -DENABLE_PRODUCTION_KMD=ON' # For /media_softlet/agnostic/Xe_R/Xe_HPC/renderhal
# ' -DGEN10=ON' # For /media_interface/media_interfaces_m10_cnl
' -DGEN12_RKL=ON' # For /media_interface/media_interfaces_m12_rkl
)
return cmd

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

def adjustSources(self, lines):
lines[:] = [l.replace('__/', '../') for l in lines
if "media_libva_putsurface_linux.cpp" not in l
and '/private/' not in l
]

for i, l in enumerate(lines):
j = l.find("__/")
if j == -1:
lines[i] = "media_driver/" + l
else:
lines[i] = l[j + 3:]
lines[:] = [l for l in lines if "media_libva_putsurface_linux.cpp" not in l
and '/private/' not in l and 'Tools' not in l]

class Main:

Expand Down
78 changes: 78 additions & 0 deletions Tools/MediaDriverTools/Android/bp/cmrt.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright (c) 2024, Intel Corporation

// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

cc_library_shared {
name: "libigfxcmrt",
srcs: [
@LOCAL_SRC_FILES
],
local_include_dirs: [
@LOCAL_C_INCLUDES
],
cflags: [
"-Werror",
"-Wno-unused-variable",
"-Wno-unused-parameter",
"-Wno-unused-private-field",
"-Wno-non-virtual-dtor",
"-Wno-implicit-fallthrough",
@LOCAL_CFLAGS
],
header_libs: [
"libva_headers",
],
shared_libs: [
"libc",
"libdl",
"libcutils",
"liblog",
"libutils",
"libm",
"libva",
"libva-android",
],
vendor: true,
enabled: false,
arch: {
x86_64: {
enabled: true,
},
},
}

cc_library_headers {
name: "libcmrt_headers",
export_include_dirs: [
"linux/hardware",
],
vendor: true,
enabled: false,
arch: {
x86_64: {
enabled: true,
},
},
}
93 changes: 93 additions & 0 deletions Tools/MediaDriverTools/Android/bp/gmm.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Copyright (c) 2024, Intel Corporation

// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

package {
default_applicable_licenses: ["external_gmmlib_license"],
}

license {
name: "external_gmmlib_license",
visibility: [":__subpackages__"],
license_text: [
"LICENSE.md",
],
}

cc_library_shared {
name: "libigdgmm_android",
vendor: true,
srcs: [
@LOCAL_SRC_FILES
],
cflags: [
@LOCAL_CFLAGS
"-fvisibility=hidden",
"-fno-omit-frame-pointer",
"-march=corei7",
"-Werror",
"-Wno-logical-op-parentheses",
"-Wno-shift-negative-value",
"-Wno-unused-parameter",
],
cppflags: [
"-Wno-implicit-fallthrough",
"-Wno-missing-braces",
"-Wno-unknown-pragmas",
"-Wno-parentheses",
"-Wno-pragma-pack",
"-fexceptions",
"-std=c++11",
"-fvisibility-inlines-hidden",
"-fno-use-cxa-atexit",
"-fno-rtti",
"-fcheck-new",
"-pthread",
],
local_include_dirs: [
@LOCAL_C_INCLUDES
],
enabled: false,
arch: {
x86_64: {
enabled: true,
},
},
}

cc_library_headers {
name: "libigdgmm_headers",
vendor: true,
export_include_dirs: [
"Source/GmmLib/inc",
"Source/inc",
"Source/inc/common",
],
enabled: false,
arch: {
x86_64: {
enabled: true,
},
},
}
Loading

0 comments on commit 869a466

Please sign in to comment.