You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.7 KiB

// 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
}