Files
rk35xx-android14/hardware/rockchip/hw_output/Android.go
T
hmz007 70e34291f6 Rockchip Anroid14_SDK 20241219-rkr6 (2f87fee1)
[kernel] 97200b6a: ARM64: dts: rockchip: adapt to android for nanopi6
[u-boot] 97fe060f: standalone: add rkspi to .gitignore

Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: I26394f188bb4b88fd8e9cb14a9a707f02b6cb2e0
2025-04-10 18:11:34 +08:00

93 lines
2.7 KiB
Go

// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hw_output
import (
"android/soong/android"
"android/soong/cc"
"fmt"
)
func init() {
// resister a module "hw_output_defaults"
android.RegisterModuleType("cc_hw_output", HwOutputDefaultsFactory)
}
func HwOutputDefaultsFactory() (android.Module) {
module := cc.DefaultsFactory()
android.AddLoadHook(module, HwOutputDefaults)
return module
}
func HwOutputDefaults(ctx android.LoadHookContext) {
var use_hwc_proxy string
use_hwc_proxy = ctx.Config().Getenv("BOARD_USES_HWC_PROXY_SERVICE")
if (use_hwc_proxy == "") {
use_hwc_proxy = ctx.Config().VendorConfig("graphic_rockchip").String("use_hwc_proxy_service")
}
fmt.Println("hw_output_defaults BOARD_USES_HWC_PROXY_SERVICE: " + use_hwc_proxy)
type props struct {
Srcs []string
Cflags []string
Shared_libs []string
Include_dirs []string
}
p := &props{}
p.Cflags = getCflags(ctx, use_hwc_proxy)
p.Shared_libs = getSharedLibs(ctx, use_hwc_proxy)
p.Srcs = getSrcs(ctx, use_hwc_proxy)
p.Include_dirs = getIncludeDirs(ctx, use_hwc_proxy)
ctx.AppendProperties(p)
}
func getCflags(ctx android.BaseContext, use_hwc_proxy string) ([]string) {
var cppflags []string
if (use_hwc_proxy == "true") {
cppflags = append(cppflags,"-DUSE_HWC_PROXY_SERVICE")
}
return cppflags
}
func getSharedLibs(ctx android.BaseContext, use_hwc_proxy string) ([]string) {
var libs []string
if (use_hwc_proxy == "true") {
libs = append(libs, "libbase")
libs = append(libs, "libbinder_ndk")
libs = append(libs, "rockchip.hwc.proxy.aidl-V1-ndk")
libs = append(libs, "librkhwcproxy")
}
return libs
}
func getSrcs(ctx android.BaseContext, use_hwc_proxy string) ([]string) {
var src []string
if (use_hwc_proxy == "true") {
src = append(src, "rk_hwc_proxy_client.cpp")
}
return src
}
func getIncludeDirs(ctx android.BaseContext, use_hwc_proxy string) ([]string) {
var dirs []string
if (use_hwc_proxy == "true") {
dirs = append(dirs, "hardware/rockchip/hwc_proxy_service/rockchip/hwc/proxy/drm_api")
}
return dirs
}