feature: add ohos build
Change-Id: I297770ae07d71987c74b18c475f28b1c5d734ce7
This commit is contained in:
@@ -85,7 +85,7 @@ MESON_GEN_NINJA := \
|
||||
-Ddri-search-path=/vendor/$(MESA3D_LIB_DIR)/dri \
|
||||
-Dplatforms=android \
|
||||
-Dplatform-sdk-version=$(PLATFORM_SDK_VERSION) \
|
||||
-Ddri-drivers= \
|
||||
-Ddri-drivers=$(subst $(space),$(comma),$(BOARD_MESA3D_CLASSIC_DRIVERS)) \
|
||||
-Dgallium-drivers=$(subst $(space),$(comma),$(BOARD_MESA3D_GALLIUM_DRIVERS)) \
|
||||
-Dvulkan-drivers=$(subst $(space),$(comma),$(subst radeon,amd,$(BOARD_MESA3D_VULKAN_DRIVERS))) \
|
||||
-Dgbm=enabled \
|
||||
@@ -302,13 +302,17 @@ endef
|
||||
|
||||
$(foreach driver,$(BOARD_MESA3D_VULKAN_DRIVERS), $(eval $(call vulkan_target,$(driver))))
|
||||
|
||||
$($(M_TARGET_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)/dri/.symlinks.timestamp: MESA3D_GALLIUM_DRI_DIR:=$(MESA3D_GALLIUM_DRI_DIR)
|
||||
$($(M_TARGET_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)/dri/.symlinks.timestamp: $(MESON_OUT_DIR)/install/.install.timestamp
|
||||
# Create Symlinks
|
||||
$($(M_TARGET_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)/dri/.targets.timestamp: MESA3D_GALLIUM_DRI_DIR:=$(MESA3D_GALLIUM_DRI_DIR)
|
||||
$($(M_TARGET_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)/dri/.targets.timestamp: $(MESON_OUT_DIR)/install/.install.timestamp
|
||||
mkdir -p $(dir $@)
|
||||
# Create Symlinks for gallium and kmsro drivers
|
||||
ls -1 $(MESA3D_GALLIUM_DRI_DIR)/ | PATH=/usr/bin:$$PATH xargs -I{} ln -s -f libgallium_dri.so $(dir $@)/{}
|
||||
# Remove unwanted Symlinks created for classic dri drivers
|
||||
$(foreach d,$(BOARD_MESA3D_CLASSIC_DRIVERS), rm $(dir $@)/$(d)_dri.so;)
|
||||
# Copy classic dri drivers
|
||||
$(foreach d,$(BOARD_MESA3D_CLASSIC_DRIVERS), cp $(MESA3D_GALLIUM_DRI_DIR)/$(d)_dri.so $(dir $@)/$(d)_dri.so;)
|
||||
touch $@
|
||||
|
||||
$($(M_TARGET_PREFIX)MESA3D_GALLIUM_DRI_BIN): $(TARGET_OUT_VENDOR)/$(MESA3D_LIB_DIR)/dri/.symlinks.timestamp
|
||||
$($(M_TARGET_PREFIX)MESA3D_GALLIUM_DRI_BIN): $(TARGET_OUT_VENDOR)/$(MESA3D_LIB_DIR)/dri/.targets.timestamp
|
||||
echo "Build $@"
|
||||
touch $@
|
||||
|
54
cross_file
Normal file
54
cross_file
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
|
||||
c_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl',
|
||||
'-fno-emulated-tls',
|
||||
'-fPIC']
|
||||
|
||||
cpp_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl',
|
||||
'-fno-emulated-tls',
|
||||
'-fPIC']
|
||||
|
||||
c_link_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'-fPIC',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl/usr/lib/aarch64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
cpp_link_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl/usr/lib/aarch64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++',
|
||||
'-fPIC',
|
||||
'-Wl,--exclude-libs=libunwind_llvm.a',
|
||||
'-Wl,--exclude-libs=libc++_static.a',
|
||||
'-Wl,--exclude-libs=libvpx_assembly_arm.a',
|
||||
'-Wl,--warn-shared-textrel',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
[binaries]
|
||||
ar = '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-ar'
|
||||
c = ['ccache', '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang']
|
||||
cpp = ['ccache', '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++']
|
||||
c_ld= 'lld'
|
||||
cpp_ld = 'lld'
|
||||
strip = '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip'
|
||||
pkgconfig = '/usr/bin/pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv8'
|
||||
endian = 'little'
|
@@ -276,6 +276,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface
|
||||
#define EGL_PLATFORM_GBM_KHR 0x31D7
|
||||
#endif /* EGL_KHR_platform_gbm */
|
||||
|
||||
#ifndef EGL_KHR_platform_ohos
|
||||
#define EGL_KHR_platform_ohos 1
|
||||
#define EGL_PLATFORM_OHOS_KHR 0x34E0
|
||||
#endif /* EGL_KHR_platform_ohos */
|
||||
|
||||
#ifndef EGL_KHR_platform_wayland
|
||||
#define EGL_KHR_platform_wayland 1
|
||||
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
|
||||
@@ -1402,6 +1407,11 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#define EGL_TRIPLE_BUFFER_NV 0x3230
|
||||
#endif /* EGL_NV_triple_buffer */
|
||||
|
||||
#ifndef EGL_OHOS_image_native_buffer
|
||||
#define EGL_OHOS_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_OHOS 0x34E1
|
||||
#endif /* EGL_OHOS_image_native_buffer */
|
||||
|
||||
#ifndef EGL_TIZEN_image_native_buffer
|
||||
#define EGL_TIZEN_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
|
||||
|
129
include/ohos_log.h
Normal file
129
include/ohos_log.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef DISP_COMMON_H
|
||||
#define DISP_COMMON_H
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "hilog/log.h"
|
||||
#ifdef HDF_LOG_TAG
|
||||
#undef HDF_LOG_TAG
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FENCE_TIMEOUT 3000
|
||||
|
||||
#undef LOG_TAG
|
||||
#undef LOG_DOMAIN
|
||||
#define LOG_TAG "DISP"
|
||||
#define LOG_DOMAIN 0xD001400
|
||||
|
||||
#ifndef DISPLAY_UNUSED
|
||||
#define DISPLAY_UNUSED(x) ((void)(x))
|
||||
#endif
|
||||
|
||||
#define DISP_FILENAME (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__)
|
||||
|
||||
#ifndef DISPLAY_DEBUG_ENABLE
|
||||
#define DISPLAY_DEBUG_ENABLE 1
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_LOGD
|
||||
#define DISPLAY_LOGD(format, ...) \
|
||||
do { \
|
||||
if (DISPLAY_DEBUG_ENABLE) { \
|
||||
HILOG_DEBUG(LOG_CORE, "[%{public}s@%{public}s:%{public}d] " format "\n", \
|
||||
__FUNCTION__, DISP_FILENAME, __LINE__, \
|
||||
##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_LOGI
|
||||
#define DISPLAY_LOGI(format, ...) \
|
||||
do { \
|
||||
HILOG_INFO(LOG_CORE, "[%{public}s@%{public}s:%{public}d] " format "\n", __FUNCTION__, DISP_FILENAME, __LINE__, \
|
||||
##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_LOGW
|
||||
#define DISPLAY_LOGW(format, ...) \
|
||||
do { \
|
||||
HILOG_WARN(LOG_CORE, "[%{public}s@%{public}s:%{public}d] " format "\n", __FUNCTION__, DISP_FILENAME, __LINE__, \
|
||||
##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_LOGE
|
||||
#define DISPLAY_LOGE(format, ...) \
|
||||
do { \
|
||||
HILOG_ERROR(LOG_CORE, \
|
||||
"\033[0;32;31m" \
|
||||
"[%{public}s@%{public}s:%{public}d] " format "\033[m" \
|
||||
"\n", \
|
||||
__FUNCTION__, DISP_FILENAME, __LINE__, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_NULLPOINTER_RETURN_VALUE
|
||||
#define CHECK_NULLPOINTER_RETURN_VALUE(pointer, ret) \
|
||||
do { \
|
||||
if ((pointer) == NULL) { \
|
||||
DISPLAY_LOGE("pointer is null and return ret\n"); \
|
||||
return (ret); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_NULLPOINTER_RETURN
|
||||
#define CHECK_NULLPOINTER_RETURN(pointer) \
|
||||
do { \
|
||||
if ((pointer) == NULL) { \
|
||||
DISPLAY_LOGE("pointer is null and return\n"); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_CHK_RETURN
|
||||
#define DISPLAY_CHK_RETURN(val, ret, ...) \
|
||||
do { \
|
||||
if (val) { \
|
||||
__VA_ARGS__; \
|
||||
return (ret); \
|
||||
} \
|
||||
} while (0)extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_CHK_RETURN_NOT_VALUE
|
||||
#define DISPLAY_CHK_RETURN_NOT_VALUE(val, ...) \
|
||||
do { \
|
||||
if (val) { \
|
||||
__VA_ARGS__; \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DISP_COMMON_H */
|
22
meson.build
22
meson.build
@@ -346,10 +346,11 @@ with_platform_x11 = _platforms.contains('x11')
|
||||
with_platform_wayland = _platforms.contains('wayland')
|
||||
with_platform_haiku = _platforms.contains('haiku')
|
||||
with_platform_windows = _platforms.contains('windows')
|
||||
with_platform_ohos = _platforms.contains('ohos')
|
||||
|
||||
with_glx = get_option('glx')
|
||||
if with_glx == 'auto'
|
||||
if with_platform_android
|
||||
if with_platform_android or with_platform_ohos
|
||||
with_glx = 'disabled'
|
||||
elif with_dri
|
||||
with_glx = 'dri'
|
||||
@@ -482,7 +483,7 @@ endif
|
||||
|
||||
if with_egl
|
||||
_platforms += 'surfaceless'
|
||||
if with_gbm and not with_platform_android
|
||||
if with_gbm and not with_platform_android and not with_platform_ohos
|
||||
_platforms += 'drm'
|
||||
endif
|
||||
|
||||
@@ -1006,7 +1007,18 @@ if with_platform_android
|
||||
]
|
||||
endif
|
||||
|
||||
prog_python = import('python').find_installation('python3')
|
||||
if with_platform_ohos
|
||||
pre_args += '-DHAVE_OHOS_PLATFORM'
|
||||
dep_ohos = [
|
||||
dependency('libsurface'),
|
||||
dependency('libhilog'),
|
||||
]
|
||||
c_args += '-I../ohos'
|
||||
endif
|
||||
|
||||
#prog_python = import('python').find_installation('python3')
|
||||
prog_python = '/usr/bin/python3'
|
||||
|
||||
has_mako = run_command(
|
||||
prog_python, '-c',
|
||||
'''
|
||||
@@ -1682,6 +1694,10 @@ foreach d : _libdrm_checks
|
||||
endif
|
||||
endforeach
|
||||
|
||||
dep_hilog = dependency(
|
||||
'libhilog'
|
||||
)
|
||||
|
||||
with_gallium_drisw_kms = false
|
||||
dep_libdrm = dependency(
|
||||
'libdrm', version : '>=' + _drm_ver,
|
||||
|
@@ -23,7 +23,7 @@ option(
|
||||
type : 'array',
|
||||
value : ['auto'],
|
||||
choices : [
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'ohos',
|
||||
],
|
||||
description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.'
|
||||
)
|
||||
@@ -33,7 +33,7 @@ option(
|
||||
value : 'auto',
|
||||
choices : [
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',
|
||||
'surfaceless', 'drm',
|
||||
'surfaceless', 'drm', 'ohos',
|
||||
],
|
||||
description : 'the window system EGL assumes for EGL_DEFAULT_DISPLAY',
|
||||
)
|
||||
|
106
ohos/BUILD.gn
Executable file
106
ohos/BUILD.gn
Executable file
@@ -0,0 +1,106 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
|
||||
import("//build/config/clang/clang.gni")
|
||||
|
||||
# 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.
|
||||
import("//build/ohos.gni")
|
||||
import("dependency_inputs.gni")
|
||||
mesa3d_libs_dir = "$root_build_dir/packages/phone/mesa3d"
|
||||
|
||||
mesa3d_gallium_symlinks = [ "panfrost_dri.so" ]
|
||||
|
||||
mesa3d_all_lib_items = [
|
||||
[
|
||||
"libEGL.so.1.0.0",
|
||||
[
|
||||
"libEGL.so",
|
||||
"libEGL.so.1",
|
||||
"libEGL_impl.so",
|
||||
],
|
||||
],
|
||||
[
|
||||
"libgbm.so.1.0.0",
|
||||
[
|
||||
"libgbm.so",
|
||||
"libgbm.so.1",
|
||||
],
|
||||
],
|
||||
[
|
||||
"libglapi.so.0.0.0",
|
||||
[
|
||||
"libglapi.so",
|
||||
"libglapi.so.0",
|
||||
],
|
||||
],
|
||||
[
|
||||
"libGLESv1_CM.so.1.1.0",
|
||||
[
|
||||
"libGLESv1_CM.so",
|
||||
"libGLESv1_CM.so.1",
|
||||
"libGLESv1_impl.so",
|
||||
],
|
||||
],
|
||||
[
|
||||
"libGLESv2.so.2.0.0",
|
||||
[
|
||||
"libGLESv2.so",
|
||||
"libGLESv2.so.2",
|
||||
"libGLESv3.so",
|
||||
"libGLESv2_impl.so",
|
||||
"libGLESv3_impl.so",
|
||||
],
|
||||
],
|
||||
[
|
||||
"libgallium_dri.so",
|
||||
mesa3d_gallium_symlinks,
|
||||
],
|
||||
]
|
||||
|
||||
action("mesa3d_build") {
|
||||
inputs = deps_inputs
|
||||
script = "build_mesa3d.py"
|
||||
deps = [ "//third_party/expat:expat" ]
|
||||
external_deps = [ "graphic_surface:surface" ]
|
||||
outputs = []
|
||||
foreach(item, mesa3d_all_lib_items) {
|
||||
name = item[0]
|
||||
outputs += [ "$mesa3d_libs_dir/$name" ]
|
||||
}
|
||||
args = [ rebase_path(root_build_dir) ]
|
||||
}
|
||||
|
||||
mesa3d_all_lib_deps = []
|
||||
|
||||
foreach(item, mesa3d_all_lib_items) {
|
||||
name = item[0]
|
||||
ohos_prebuilt_shared_library(name) {
|
||||
source = "$mesa3d_libs_dir/$name"
|
||||
deps = [ ":mesa3d_build" ]
|
||||
symlink_target_name = item[1]
|
||||
install_enable = true
|
||||
install_images = [ system_base_dir ]
|
||||
subsystem_name = "rockchip_products"
|
||||
part_name = "rockchip_products"
|
||||
}
|
||||
mesa3d_all_lib_deps += [ ":$name" ]
|
||||
}
|
||||
|
||||
group("mesa3d_all_libs") {
|
||||
deps = mesa3d_all_lib_deps
|
||||
}
|
41
ohos/README_zh.md
Normal file
41
ohos/README_zh.md
Normal file
@@ -0,0 +1,41 @@
|
||||
### 编译环境依赖:
|
||||
1. meson
|
||||
mesa是使用meson进行编译的并要求版本>= 0.52,可执行以下命令安装meson
|
||||
```
|
||||
sudo apt-get install python3 python3-pip ninja-build
|
||||
pip3 install --user meson
|
||||
```
|
||||
2. pkg-config
|
||||
meson配置编译环境时会使用pkg-config查找依赖库和头文件,可以执行以下命令安装
|
||||
```
|
||||
sudo apt-get install pkg-config
|
||||
```
|
||||
|
||||
### 编译步骤如下:
|
||||
1. 下载openharmony整个工程代码,并完成编译
|
||||
2. 因为有些依赖库是静态库,整编后会被删除需要执行以下命令单独编译以rk3568为例
|
||||
```
|
||||
./build.sh --product-name=rk3568 --build-target=expat
|
||||
./build.sh --product-name=rk3568 --build-target=libwayland_server.0
|
||||
./build.sh --product-name=rk3568 --build-target=libwayland_client.0
|
||||
./build.sh --product-name=rk3568 --build-target=libwayland_server
|
||||
./build.sh --product-name=rk3568 --build-target=libwayland_client
|
||||
```
|
||||
|
||||
3. 编译mesa
|
||||
编译鸿蒙系统下的mesa库时,需要配置鸿蒙的交叉编译链和依赖的库,相关配置和编译步骤已经封装到ohos目录下的python脚本中,编译时只需执行 build_wayland_and_gbm.py 脚本即可,执行命名需要输入三个参数
|
||||
|
||||
| 参数 | 说明 |
|
||||
| ---- | ---- |
|
||||
| arg1 | openharmony代码路径 |
|
||||
| arg2 | 产品名字,实际上为out目录下存放系统编译结果的那个目录 如hi3516dv300 或者 rk3568, 注: LTS3.0 的版本必须是 ohos-arm-release|
|
||||
| arg3 | mesa 源码路径|
|
||||
|
||||
示例如下:
|
||||
~/openharmony 是openharmony源码路径, rk3568是对应的产品输出目录,~/mesa3d为mesa源码路径, 执行完命令后会生成一个名叫builddir的文件夹,该文件夹是mesa的编译目录. 编译完成后相关的库存放在builddir/install/lib 下
|
||||
|
||||
```
|
||||
cd ~/mesa3d
|
||||
python ohos/build_ohos.py ~/openharmony rk3568 ~/mesa3d
|
||||
|
||||
```
|
90
ohos/build_mesa3d.py
Executable file
90
ohos/build_mesa3d.py
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Institute of Software, CAS
|
||||
# Author: xiaofan@iscas.ac.cn
|
||||
|
||||
# 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.
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
import glob
|
||||
import shutil
|
||||
from meson_cross_process import prepare_environment
|
||||
|
||||
# input /path/to/openharmony/out/rk3568
|
||||
|
||||
nproc = multiprocessing.cpu_count()
|
||||
out_dir = sys.argv[1]
|
||||
mesa3d_install_dir = os.path.join(out_dir, 'packages', 'phone', 'mesa3d')
|
||||
product = os.path.basename(out_dir)
|
||||
project_dir = os.path.dirname(os.path.dirname(out_dir))
|
||||
project_dir = os.path.abspath(project_dir)
|
||||
mesa3d_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
mesa3d_dir = os.path.abspath(mesa3d_dir)
|
||||
pkgconf_dir = os.path.join(mesa3d_dir, './pkgconfig')
|
||||
os.environ['PKG_CONFIG_PATH'] = pkgconf_dir
|
||||
|
||||
# workaround: using system python instead of prebuilt python
|
||||
path_old = os.environ['PATH'].split(':')
|
||||
path_filter = lambda p: not p.endswith('/prebuilts/python/linux-x86/3.8.5/bin')
|
||||
path_new = ':'.join(filter(path_filter, path_old))
|
||||
os.environ['PATH'] = path_new
|
||||
|
||||
os.chdir(mesa3d_dir)
|
||||
prepare_environment(project_dir, product)
|
||||
|
||||
meson_cmd = [
|
||||
'meson',
|
||||
'setup',
|
||||
mesa3d_dir,
|
||||
'build-ohos',
|
||||
'-Dplatforms=ohos',
|
||||
'-Degl-native-platform=ohos',
|
||||
'-Ddri-drivers=',
|
||||
'-Dgallium-drivers=panfrost',
|
||||
'-Dvulkan-drivers=',
|
||||
'-Dgbm=enabled',
|
||||
'-Degl=enabled',
|
||||
'-Dcpp_rtti=false',
|
||||
'-Dglx=disabled',
|
||||
'-Dtools=panfrost',
|
||||
'-Ddri-search-path=/system/lib',
|
||||
'--cross-file=cross_file',
|
||||
F'--prefix={mesa3d_dir}/build-ohos/install',
|
||||
]
|
||||
|
||||
subprocess.run(meson_cmd, check=True)
|
||||
subprocess.run(F'ninja -C build-ohos -j{nproc}', shell=True, check=True)
|
||||
subprocess.run(F'ninja -C build-ohos install', shell=True, check=True)
|
||||
|
||||
build_lib = os.path.join(mesa3d_dir, 'build-ohos', 'install', 'lib')
|
||||
build_lib_dri = os.path.join(build_lib, 'dri')
|
||||
|
||||
# install to out/rk3568/packages/phone/mesa3d
|
||||
shutil.rmtree(mesa3d_install_dir, ignore_errors=True)
|
||||
os.makedirs(mesa3d_install_dir, exist_ok=True)
|
||||
for item in glob.glob(os.path.join(build_lib, 'lib*.so.*.*.*')):
|
||||
shutil.copy(item, mesa3d_install_dir)
|
||||
for item in glob.glob(os.path.join(build_lib_dri, '*_dri.so')):
|
||||
# all *_dir.so are same file, we need only copy one and rename it to libgallium_dri.so
|
||||
shutil.copy(item, os.path.join(mesa3d_install_dir, 'libgallium_dri.so')) # consider create symlink or hardlink
|
||||
break
|
43
ohos/build_ohos.py
Normal file
43
ohos/build_ohos.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 4:
|
||||
print("must input the OpenHarmony directory and the product name and the source dir")
|
||||
exit(-1)
|
||||
script_dir = os.path.split(os.path.abspath( __file__))[0]
|
||||
run_cross_pross_cmd = 'python3 ' + script_dir + '/meson_cross_process.py ' + sys.argv[1] + ' ' + sys.argv[2]
|
||||
os.system(run_cross_pross_cmd)
|
||||
|
||||
run_build_cmd = 'PKG_CONFIG_PATH=./pkgconfig '
|
||||
run_build_cmd += 'meson setup '+ sys.argv[3] + ' build-ohos '
|
||||
run_build_cmd += '-Dplatforms=ohos -Degl-native-platform=ohos -Ddri-drivers= -Dgallium-drivers=panfrost \
|
||||
-Dvulkan-drivers= -Dgbm=enabled -Degl=enabled -Dcpp_rtti=false -Dglx=disabled -Dtools=panfrost -Ddri-search-path=/system/lib '
|
||||
run_build_cmd += '--cross-file=cross_file '
|
||||
run_build_cmd += '--prefix=' + os.getcwd() + '/build-ohos/install'
|
||||
print("build command: %s" %run_build_cmd)
|
||||
os.system(run_build_cmd)
|
||||
os.system('ninja -C build-ohos -j26')
|
||||
os.system('ninja -C build-ohos install')
|
43
ohos/build_ohos_arm64.py
Normal file
43
ohos/build_ohos_arm64.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 4:
|
||||
print("must input the OpenHarmony directory and the product name and the source dir")
|
||||
exit(-1)
|
||||
script_dir = os.path.split(os.path.abspath( __file__))[0]
|
||||
run_cross_pross_cmd = 'python3 ' + script_dir + '/meson_cross_process_arm64.py ' + sys.argv[1] + ' ' + sys.argv[2]
|
||||
os.system(run_cross_pross_cmd)
|
||||
|
||||
run_build_cmd = 'PKG_CONFIG_PATH=./pkgconfig '
|
||||
run_build_cmd += 'meson setup '+ sys.argv[3] + ' build-ohos '
|
||||
run_build_cmd += '-Dplatforms=ohos -Degl-native-platform=ohos -Ddri-drivers= -Dgallium-drivers=panfrost \
|
||||
-Dvulkan-drivers= -Dgbm=enabled -Degl=enabled -Dgles1=enabled -Dgles2=enabled -Dcpp_rtti=false -Dglx=disabled -Dtools=panfrost -Ddri-search-path=/vendor/lib64/chipsetsdk '
|
||||
run_build_cmd += '--cross-file=cross_file '
|
||||
run_build_cmd += '--prefix=' + os.getcwd() + '/build-ohos/install'
|
||||
print("build command: %s" %run_build_cmd)
|
||||
os.system(run_build_cmd)
|
||||
os.system('ninja -C build-ohos -j126')
|
||||
os.system('ninja -C build-ohos install')
|
44
ohos/build_wayland_and_gbm.py
Normal file
44
ohos/build_wayland_and_gbm.py
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 4:
|
||||
print("must input the OpenHarmony directory and the product name and the source dir")
|
||||
exit(-1)
|
||||
script_dir = os.path.split(os.path.abspath( __file__))[0]
|
||||
run_cross_pross_cmd = 'python3 ' + script_dir + '/meson_cross_process.py ' + sys.argv[1] + ' ' + sys.argv[2]
|
||||
os.system(run_cross_pross_cmd)
|
||||
|
||||
run_build_cmd = 'PKG_CONFIG_PATH=./pkgconfig '
|
||||
run_build_cmd += 'meson setup '+ sys.argv[3] + ' builddir '
|
||||
run_build_cmd += '-Dvulkan-drivers= -Ddri-drivers= -Dgallium-drivers=panfrost \
|
||||
-Dplatforms=wayland -Dglx=disabled -Dtools=panfrost --buildtype=release '
|
||||
run_build_cmd += '--cross-file=cross_file '
|
||||
run_build_cmd += '--prefix=' + os.getcwd() + '/builddir/install'
|
||||
print("build command: %s" %run_build_cmd)
|
||||
os.system(run_build_cmd)
|
||||
os.system('ninja -C builddir -j26')
|
||||
os.system('ninja -C builddir install')
|
6980
ohos/dependency_inputs.gni
Normal file
6980
ohos/dependency_inputs.gni
Normal file
File diff suppressed because it is too large
Load Diff
134
ohos/meson_cross_process.py
Normal file
134
ohos/meson_cross_process.py
Normal file
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
|
||||
sysroot_stub = 'sysroot_stub'
|
||||
project_stub = 'project_stub'
|
||||
|
||||
corss_file_content='''
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
|
||||
c_args = [
|
||||
'-march=armv7-a',
|
||||
'-mfloat-abi=softfp',
|
||||
'-mtune=generic-armv7-a',
|
||||
'-mfpu=neon',
|
||||
'-mthumb',
|
||||
'--target=arm-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fPIC']
|
||||
|
||||
cpp_args = [
|
||||
'-march=armv7-a',
|
||||
'--target=arm-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fPIC']
|
||||
|
||||
c_link_args = [
|
||||
'-march=armv7-a',
|
||||
'--target=arm-linux-ohosmusl',
|
||||
'-fPIC',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-Lsysroot_stub/usr/lib/arm-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/10.0.1/lib/arm-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x87_64/llvm/lib/arm-linux-ohos/c++',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
cpp_link_args = [
|
||||
'-march=armv7-a',
|
||||
'--target=arm-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-Lsysroot_stub/usr/lib/arm-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/10.0.1/lib/arm-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x87_64/llvm/lib/arm-linux-ohos/c++',
|
||||
'-fPIC',
|
||||
'-Wl,--exclude-libs=libunwind_llvm.a',
|
||||
'-Wl,--exclude-libs=libc++_static.a',
|
||||
'-Wl,--exclude-libs=libvpx_assembly_arm.a',
|
||||
'-Wl,--warn-shared-textrel',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
[binaries]
|
||||
ar = 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-ar'
|
||||
c = ['ccache', 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang']
|
||||
cpp = ['ccache', 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++']
|
||||
c_ld= 'lld'
|
||||
cpp_ld = 'lld'
|
||||
strip = 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip'
|
||||
pkgconfig = '/usr/bin/pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv7'
|
||||
endian = 'little'
|
||||
'''
|
||||
|
||||
def generate_cross_file(project_stub_in, sysroot_stub_in):
|
||||
with open("cross_file", 'w+') as file:
|
||||
result = corss_file_content.replace("project_stub", project_stub_in)
|
||||
result = result.replace("sysroot_stub", sysroot_stub_in)
|
||||
file.write(result)
|
||||
print("generate_cross_file")
|
||||
|
||||
def generate_pc_file(file_raw, project_dir, product_name):
|
||||
print(file_raw)
|
||||
if not os.path.exists('pkgconfig'):
|
||||
os.makedirs('pkgconfig')
|
||||
filename = 'pkgconfig/'+ ntpath.basename(file_raw)
|
||||
with open(file_raw, 'r+') as file_raw:
|
||||
with open(filename, "w+") as pc_file:
|
||||
raw_content = file_raw.read()
|
||||
raw_content = raw_content.replace("ohos_project_directory_stub", project_dir)
|
||||
raw_content = raw_content.replace("ohos-arm-release", product_name)
|
||||
pc_file.write(raw_content)
|
||||
print("generate_pc_file")
|
||||
|
||||
def process_pkgconfig(project_dir, product_name):
|
||||
template_dir = os.path.split(os.path.abspath( __file__))[0] + r"/pkgconfig_template"
|
||||
templates = os.listdir(template_dir)
|
||||
for template in templates:
|
||||
if not os.path.isdir(template):
|
||||
generate_pc_file(template_dir + '/' + template, project_dir, product_name)
|
||||
print("process_pkgconfig")
|
||||
|
||||
def prepare_environment(project_path, product):
|
||||
global project_stub
|
||||
global sysroot_stub
|
||||
product = product.lower()
|
||||
project_stub = project_path
|
||||
sysroot_stub = os.path.join(project_stub, "out", product, "obj", "third_party", "musl")
|
||||
generate_cross_file(project_path, sysroot_stub)
|
||||
process_pkgconfig(project_path, product)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
print("must input the OpenHarmony directory and the product name")
|
||||
exit(-1)
|
||||
prepare_environment(sys.argv[1], sys.argv[2])
|
129
ohos/meson_cross_process_arm64.py
Normal file
129
ohos/meson_cross_process_arm64.py
Normal file
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import ntpath
|
||||
import os
|
||||
|
||||
sysroot_stub = 'sysroot_stub'
|
||||
project_stub = 'project_stub'
|
||||
|
||||
corss_file_content='''
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
|
||||
c_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fno-emulated-tls',
|
||||
'-fPIC']
|
||||
|
||||
cpp_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fno-emulated-tls',
|
||||
'-fPIC']
|
||||
|
||||
c_link_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'-fPIC',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-Lsysroot_stub/usr/lib/aarch64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
cpp_link_args = [
|
||||
'--target=aarch64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-Lsysroot_stub/usr/lib/aarch64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++',
|
||||
'-fPIC',
|
||||
'-Wl,--exclude-libs=libunwind_llvm.a',
|
||||
'-Wl,--exclude-libs=libc++_static.a',
|
||||
'-Wl,--exclude-libs=libvpx_assembly_arm.a',
|
||||
'-Wl,--warn-shared-textrel',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
[binaries]
|
||||
ar = 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-ar'
|
||||
c = ['ccache', 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang']
|
||||
cpp = ['ccache', 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++']
|
||||
c_ld= 'lld'
|
||||
cpp_ld = 'lld'
|
||||
strip = 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip'
|
||||
pkgconfig = '/usr/bin/pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv8'
|
||||
endian = 'little'
|
||||
'''
|
||||
|
||||
def generate_cross_file(project_stub_in, sysroot_stub_in):
|
||||
with open("cross_file", 'w+') as file:
|
||||
result = corss_file_content.replace("project_stub", project_stub_in)
|
||||
result = result.replace("sysroot_stub", sysroot_stub_in)
|
||||
file.write(result)
|
||||
print("generate_cross_file")
|
||||
|
||||
def generate_pc_file(file_raw, project_dir, product_name):
|
||||
print(file_raw)
|
||||
if not os.path.exists('pkgconfig'):
|
||||
os.makedirs('pkgconfig')
|
||||
filename = 'pkgconfig/'+ ntpath.basename(file_raw)
|
||||
with open(file_raw, 'r+') as file_raw:
|
||||
with open(filename, "w+") as pc_file:
|
||||
raw_content = file_raw.read()
|
||||
raw_content = raw_content.replace("ohos_project_directory_stub", project_dir)
|
||||
raw_content = raw_content.replace("ohos-arm-release", product_name)
|
||||
raw_content = raw_content.replace("ohos-arm", "ohos-arm64")
|
||||
pc_file.write(raw_content)
|
||||
print("generate_pc_file")
|
||||
|
||||
def process_pkgconfig(project_dir, product_name):
|
||||
template_dir = os.path.split(os.path.abspath( __file__))[0] + r"/pkgconfig_template"
|
||||
templates = os.listdir(template_dir)
|
||||
for template in templates:
|
||||
if not os.path.isdir(template):
|
||||
generate_pc_file(template_dir + '/' + template, project_dir, product_name)
|
||||
print("process_pkgconfig")
|
||||
|
||||
def prepare_environment(project_path, product):
|
||||
global project_stub
|
||||
global sysroot_stub
|
||||
product = product.lower()
|
||||
project_stub = project_path
|
||||
sysroot_stub = os.path.join(project_stub, "out", product, "obj", "third_party", "musl")
|
||||
generate_cross_file(project_path, sysroot_stub)
|
||||
process_pkgconfig(project_path, product)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
print("must input the OpenHarmony directory and the product name")
|
||||
exit(-1)
|
||||
prepare_environment(sys.argv[1], sys.argv[2])
|
112
ohos/modifyDtsi.py
Executable file
112
ohos/modifyDtsi.py
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
|
||||
# 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.
|
||||
|
||||
from ast import Delete
|
||||
import sys, os
|
||||
|
||||
class Modify():
|
||||
def __init__(self, filePath) -> None:
|
||||
self.filePath = filePath
|
||||
self.lines = []
|
||||
|
||||
fp = open(self.filePath, 'r')
|
||||
for line in fp:
|
||||
self.lines.append(line)
|
||||
fp.close()
|
||||
|
||||
def saveAndClose(self):
|
||||
s = ''.join(self.lines)
|
||||
self.lines.clear()
|
||||
fp = open(self.filePath, 'w')
|
||||
fp.write(s)
|
||||
fp.close()
|
||||
|
||||
def positionSearch(self, positionText, startLineNum = 0):
|
||||
linesLen = len(self.lines)
|
||||
for lineNum in range(startLineNum + 1, linesLen):
|
||||
if(positionText in self.lines[lineNum]):
|
||||
return lineNum
|
||||
return -1
|
||||
|
||||
def addItem(self, newText, positionInedx, rowNume):
|
||||
assert rowNume >= 0,"rowNum含义为“要将newText添加到positionSearch所定位的条目下的第几行”,可以等于0及添加到当前行,将当前行往下挤,但不可以为负数,如需要在positionSearch所定位的条目上方添加复数行,请按顺序调用addItem函数,且rowNum都填入0"
|
||||
item = ''
|
||||
if("is not set" in newText):
|
||||
item = newText[2:-11]
|
||||
else:
|
||||
item = newText[:-2]
|
||||
|
||||
# 如果要添加的内容已经存在则直接返回
|
||||
for line in self.lines:
|
||||
if(item in line):
|
||||
if ((item + "=y" in line) or (item + " is not set" in line)):
|
||||
print("Already has this item: " + item)
|
||||
return
|
||||
|
||||
assert positionInedx >= 0, "If want to add an item, first 'positionInedx' must be >= 0"
|
||||
lineNum = positionInedx + rowNume
|
||||
self.lines.insert(lineNum, newText+'\n')
|
||||
if(rowNume <= 0):
|
||||
positionInedx += 1
|
||||
print("Add item: "+item)
|
||||
|
||||
def deleteLines(self, startLineIndex, endLineIndex):
|
||||
for i in range(endLineIndex - startLineIndex):
|
||||
self.lines.pop(startLineIndex)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
path = sys.argv[1]
|
||||
modify = Modify(path)
|
||||
print("Start to modifying file", sys.argv[1])
|
||||
|
||||
test = [' compatible = "rockchip, rk3568-mali", "arm,mali-bifrost";',
|
||||
' reg = <0x0 0xfde60000 0x0 0x20000>;',
|
||||
'',
|
||||
' interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,',
|
||||
' <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,',
|
||||
' <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;',
|
||||
' interrupt-names = "job", "mmu", "gpu";',
|
||||
' clocks = <&scmi_clk 1>, <&cru CLK_GPU>;',
|
||||
' clock-names = "core", "bus";',
|
||||
' operating-points-v2 = <&gpu_opp_table>;',
|
||||
'',
|
||||
' #cooling-cells = <2>;',
|
||||
' power-domains = <&power RK3568_PD_GPU>;',
|
||||
' status = "disabled";']
|
||||
|
||||
if(modify.positionSearch("gpu_power_model: power-model",0) == -1):
|
||||
print("rk3568.dtsi arealy modified")
|
||||
exit()
|
||||
|
||||
positionInedx1 = modify.positionSearch("gpu: gpu@fde60000",0)
|
||||
if(positionInedx1 >= 0):
|
||||
positionInedx2 = modify.positionSearch("};",positionInedx1)
|
||||
modify.deleteLines(positionInedx1 + 1, positionInedx2 + 1)
|
||||
|
||||
for i in range(len(test)):
|
||||
modify.addItem(test[i], positionInedx1, i + 1)
|
||||
|
||||
modify.saveAndClose()
|
||||
|
||||
print("Succese")
|
10
ohos/pkgconfig_template/expat.pc
Normal file
10
ohos/pkgconfig_template/expat.pc
Normal file
@@ -0,0 +1,10 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/obj/third_party/skia/third_party/expat
|
||||
includedir=${ohos_project_dir}/third_party/skia/third_party/externals/expat/expat/lib
|
||||
|
||||
Name: expat
|
||||
Version: 2.4.1
|
||||
Description: expat XML parser
|
||||
Libs: -L${libdir} -lexpat
|
||||
Cflags: -I${includedir}
|
||||
expat
|
9
ohos/pkgconfig_template/gbm.pc
Normal file
9
ohos/pkgconfig_template/gbm.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/device/rockchip/hardware/gpu
|
||||
includedir=${ohos_project_dir}/device/rockchip/hardware/gpu/include
|
||||
|
||||
Name: gbm
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -llibgbm
|
||||
Cflags: -I${ohos_project_dir}/device/rockchip/hardware/gpu/include
|
9
ohos/pkgconfig_template/libdrm.pc
Normal file
9
ohos/pkgconfig_template/libdrm.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/thirdparty/libdrm/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/
|
9
ohos/pkgconfig_template/libhilog.pc
Normal file
9
ohos/pkgconfig_template/libhilog.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/hiviewdfx/hilog
|
||||
includedir=${ohos_project_dir}/base/hiviewdfx/hilog/interfaces/native/innerkits/include
|
||||
|
||||
Name: libhilog
|
||||
Version: 2.4.1
|
||||
Description: libhilog
|
||||
Libs: -L${libdir} -lhilog
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/libjpeg.pc
Normal file
9
ohos/pkgconfig_template/libjpeg.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/obj/third_party/libjpeg/
|
||||
includedir=${ohos_project_dir}/third_party/libjpeg
|
||||
|
||||
Name: jpeg
|
||||
Description: jpeg
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ljpeg_static
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/libpng.pc
Normal file
9
ohos/pkgconfig_template/libpng.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out//ohos-arm-release/common/graphic_2d/
|
||||
includedir=${ohos_project_dir}/third_party/libpng
|
||||
|
||||
Name: png
|
||||
Description: png
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -lpng.z
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/libsurface.pc
Normal file
9
ohos/pkgconfig_template/libsurface.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/graphic/graphic_surface/
|
||||
includedir=${ohos_project_dir}/out/ohos-arm-release/innerkits/ohos-arm/graphic_surface/surface/include/
|
||||
|
||||
Name: libsurface
|
||||
Version: 2.4.1
|
||||
Description: libsurface
|
||||
Libs: -L${libdir} -lsurface.z
|
||||
Cflags: -I${includedir} -I${ohos_project_dir}/drivers/peripheral/display/interfaces/include -I${ohos_project_dir}/drivers/peripheral/base
|
9
ohos/pkgconfig_template/libudev.pc
Normal file
9
ohos/pkgconfig_template/libudev.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/packages/phone/system/lib/
|
||||
includedir=${ohos_project_dir}/third_party/eudev/export_include
|
||||
|
||||
Name: eudev
|
||||
Description: eudev
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ludev.z
|
||||
Cflags: -I${includedir}
|
11
ohos/pkgconfig_template/wayland-client.pc
Normal file
11
ohos/pkgconfig_template/wayland-client.pc
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
libdir=${prefix}/out/ohos-arm-release/graphic/graphic_2d
|
||||
includedir=${prefix}/third_party/wayland_standard/src
|
||||
|
||||
Name: Wayland Client
|
||||
Description: Server side implementation of the Wayland protocol
|
||||
Version: 1.18.0
|
||||
Cflags: -I${includedir} -I${prefix}/out/ohos-arm-release/gen/third_party/wayland_standard/protocol
|
||||
Libs: -L${libdir} -lwayland_client.0.z
|
9
ohos/pkgconfig_template/wayland-cursor.pc
Normal file
9
ohos/pkgconfig_template/wayland-cursor.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
libdir=${prefix}/out/ohos-arm-release/obj/third_party/wayland_standard/
|
||||
includedir=${prefix}/third_party/wayland_standard/cursor
|
||||
|
||||
Name: wayland_cursor
|
||||
Description: Server side implementation of the Wayland cursor
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -llibwayland_cursor
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/wayland-egl-backend.pc
Normal file
9
ohos/pkgconfig_template/wayland-egl-backend.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
includedir=${prefix}/third_party/wayland_standard/egl
|
||||
|
||||
Name: wayland-egl-backend
|
||||
Description: Backend wayland-egl interface
|
||||
Version: 3
|
||||
Libs:
|
||||
Cflags: -I${includedir}
|
||||
|
11
ohos/pkgconfig_template/wayland-egl.pc
Normal file
11
ohos/pkgconfig_template/wayland-egl.pc
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/out/ohos-arm-release/graphic/graphic_2d/
|
||||
includedir=${prefix}/third_party/wayland_standard/egl
|
||||
|
||||
Name: wayland-egl
|
||||
Description: Frontend wayland-egl library
|
||||
Version: 18.1.0
|
||||
Requires: wayland-client
|
||||
Libs: -L${libdir} -lwayland_client.0.z
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/wayland-protocols.pc
Normal file
9
ohos/pkgconfig_template/wayland-protocols.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
datarootdir=${prefix}/third_party
|
||||
pkgdatadir=${datarootdir}/wayland-protocols_standard
|
||||
includedir = ${prefix}/out/ohos-arm-release/gen/third_party/wayland_standard/protocol
|
||||
Name: Wayland Protocols
|
||||
Description: Wayland protocol files
|
||||
Version: 1.24
|
||||
Cflags: -I${includedir} -I${prefix}/third_party/wayland_standard/egl
|
||||
|
10
ohos/pkgconfig_template/wayland-scanner.pc
Normal file
10
ohos/pkgconfig_template/wayland-scanner.pc
Normal file
@@ -0,0 +1,10 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
exec_prefix=${prefix}
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
wayland_scanner=${prefix}/out/ohos-arm-release/clang_x64/graphic/graphic_2d/wayland_scanner
|
||||
|
||||
Name: Wayland Scanner
|
||||
Description: Wayland scanner
|
||||
Version: 1.19.0
|
||||
|
12
ohos/pkgconfig_template/wayland-server.pc
Normal file
12
ohos/pkgconfig_template/wayland-server.pc
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
exec_prefix=${prefix}
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
libdir=${prefix}/out/ohos-arm-release/graphic/graphic_2d
|
||||
includedir=${prefix}/third_party/wayland_standard/src
|
||||
|
||||
Name: Wayland Server
|
||||
Description: Server side implementation of the Wayland protocol
|
||||
Version: 1.18.0
|
||||
Cflags: -I${includedir} -I${prefix}/out/ohos-arm-release/gen/third_party/wayland_standard/protocol
|
||||
Libs: -L${libdir} -lwayland_server.0.z
|
13
ohos/pkgconfig_template/zlib.pc
Normal file
13
ohos/pkgconfig_template/zlib.pc
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=ohos_project_directory_stub
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/out/ohos-arm-release/obj/third_party/zlib
|
||||
sharedlibdir=${libdir}
|
||||
includedir=${prefix}/third_party/zlib
|
||||
|
||||
Name: zlib
|
||||
Description: zlib compression library
|
||||
Version: 1.2.12
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -L${sharedlibdir} -lz
|
||||
Cflags: -I${includedir}
|
10
pkgconfig/expat.pc
Normal file
10
pkgconfig/expat.pc
Normal file
@@ -0,0 +1,10 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/obj/third_party/skia/third_party/expat
|
||||
includedir=${ohos_project_dir}/third_party/skia/third_party/externals/expat/expat/lib
|
||||
|
||||
Name: expat
|
||||
Version: 2.4.1
|
||||
Description: expat XML parser
|
||||
Libs: -L${libdir} -lexpat
|
||||
Cflags: -I${includedir}
|
||||
expat
|
9
pkgconfig/gbm.pc
Normal file
9
pkgconfig/gbm.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/device/rockchip/hardware/gpu
|
||||
includedir=${ohos_project_dir}/device/rockchip/hardware/gpu/include
|
||||
|
||||
Name: gbm
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -llibgbm
|
||||
Cflags: -I${ohos_project_dir}/device/rockchip/hardware/gpu/include
|
9
pkgconfig/libdrm.pc
Normal file
9
pkgconfig/libdrm.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/thirdparty/libdrm/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/
|
9
pkgconfig/libhilog.pc
Normal file
9
pkgconfig/libhilog.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/hiviewdfx/hilog
|
||||
includedir=${ohos_project_dir}/base/hiviewdfx/hilog/interfaces/native/innerkits/include
|
||||
|
||||
Name: libhilog
|
||||
Version: 2.4.1
|
||||
Description: libhilog
|
||||
Libs: -L${libdir} -lhilog
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/libjpeg.pc
Normal file
9
pkgconfig/libjpeg.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/obj/third_party/libjpeg/
|
||||
includedir=${ohos_project_dir}/third_party/libjpeg
|
||||
|
||||
Name: jpeg
|
||||
Description: jpeg
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ljpeg_static
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/libpng.pc
Normal file
9
pkgconfig/libpng.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out//dyrk3568/common/graphic_2d/
|
||||
includedir=${ohos_project_dir}/third_party/libpng
|
||||
|
||||
Name: png
|
||||
Description: png
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -lpng.z
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/libsurface.pc
Normal file
9
pkgconfig/libsurface.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/graphic/graphic_surface/
|
||||
includedir=${ohos_project_dir}/out/dyrk3568/innerkits/ohos-arm64/graphic_surface/surface/include/
|
||||
|
||||
Name: libsurface
|
||||
Version: 2.4.1
|
||||
Description: libsurface
|
||||
Libs: -L${libdir} -lsurface.z
|
||||
Cflags: -I${includedir} -I${ohos_project_dir}/drivers/peripheral/display/interfaces/include -I${ohos_project_dir}/drivers/peripheral/base
|
9
pkgconfig/libudev.pc
Normal file
9
pkgconfig/libudev.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/dyrk3568/packages/phone/system/lib/
|
||||
includedir=${ohos_project_dir}/third_party/eudev/export_include
|
||||
|
||||
Name: eudev
|
||||
Description: eudev
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ludev.z
|
||||
Cflags: -I${includedir}
|
11
pkgconfig/wayland-client.pc
Normal file
11
pkgconfig/wayland-client.pc
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
libdir=${prefix}/out/dyrk3568/graphic/graphic_2d
|
||||
includedir=${prefix}/third_party/wayland_standard/src
|
||||
|
||||
Name: Wayland Client
|
||||
Description: Server side implementation of the Wayland protocol
|
||||
Version: 1.18.0
|
||||
Cflags: -I${includedir} -I${prefix}/out/dyrk3568/gen/third_party/wayland_standard/protocol
|
||||
Libs: -L${libdir} -lwayland_client.0.z
|
9
pkgconfig/wayland-cursor.pc
Normal file
9
pkgconfig/wayland-cursor.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${prefix}/out/dyrk3568/obj/third_party/wayland_standard/
|
||||
includedir=${prefix}/third_party/wayland_standard/cursor
|
||||
|
||||
Name: wayland_cursor
|
||||
Description: Server side implementation of the Wayland cursor
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -llibwayland_cursor
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/wayland-egl-backend.pc
Normal file
9
pkgconfig/wayland-egl-backend.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
includedir=${prefix}/third_party/wayland_standard/egl
|
||||
|
||||
Name: wayland-egl-backend
|
||||
Description: Backend wayland-egl interface
|
||||
Version: 3
|
||||
Libs:
|
||||
Cflags: -I${includedir}
|
||||
|
11
pkgconfig/wayland-egl.pc
Normal file
11
pkgconfig/wayland-egl.pc
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/out/dyrk3568/graphic/graphic_2d/
|
||||
includedir=${prefix}/third_party/wayland_standard/egl
|
||||
|
||||
Name: wayland-egl
|
||||
Description: Frontend wayland-egl library
|
||||
Version: 18.1.0
|
||||
Requires: wayland-client
|
||||
Libs: -L${libdir} -lwayland_client.0.z
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/wayland-protocols.pc
Normal file
9
pkgconfig/wayland-protocols.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
datarootdir=${prefix}/third_party
|
||||
pkgdatadir=${datarootdir}/wayland-protocols_standard
|
||||
includedir = ${prefix}/out/dyrk3568/gen/third_party/wayland_standard/protocol
|
||||
Name: Wayland Protocols
|
||||
Description: Wayland protocol files
|
||||
Version: 1.24
|
||||
Cflags: -I${includedir} -I${prefix}/third_party/wayland_standard/egl
|
||||
|
10
pkgconfig/wayland-scanner.pc
Normal file
10
pkgconfig/wayland-scanner.pc
Normal file
@@ -0,0 +1,10 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
exec_prefix=${prefix}
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
wayland_scanner=${prefix}/out/dyrk3568/clang_x64/graphic/graphic_2d/wayland_scanner
|
||||
|
||||
Name: Wayland Scanner
|
||||
Description: Wayland scanner
|
||||
Version: 1.19.0
|
||||
|
12
pkgconfig/wayland-server.pc
Normal file
12
pkgconfig/wayland-server.pc
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
exec_prefix=${prefix}
|
||||
datarootdir=${prefix}/share
|
||||
pkgdatadir=${datarootdir}/wayland
|
||||
libdir=${prefix}/out/dyrk3568/graphic/graphic_2d
|
||||
includedir=${prefix}/third_party/wayland_standard/src
|
||||
|
||||
Name: Wayland Server
|
||||
Description: Server side implementation of the Wayland protocol
|
||||
Version: 1.18.0
|
||||
Cflags: -I${includedir} -I${prefix}/out/dyrk3568/gen/third_party/wayland_standard/protocol
|
||||
Libs: -L${libdir} -lwayland_server.0.z
|
13
pkgconfig/zlib.pc
Normal file
13
pkgconfig/zlib.pc
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/out/dyrk3568/obj/third_party/zlib
|
||||
sharedlibdir=${libdir}
|
||||
includedir=${prefix}/third_party/zlib
|
||||
|
||||
Name: zlib
|
||||
Description: zlib compression library
|
||||
Version: 1.2.12
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -L${sharedlibdir} -lz
|
||||
Cflags: -I${includedir}
|
@@ -39,6 +39,7 @@
|
||||
#include "main/errors.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/shaderobj.h"
|
||||
#include "main/context.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
/*
|
||||
@@ -2722,6 +2723,13 @@ nir_shader *
|
||||
glsl_float64_funcs_to_nir(struct gl_context *ctx,
|
||||
const nir_shader_compiler_options *options)
|
||||
{
|
||||
/* It's not possible to use float64 on GLSL ES, so don't bother trying to
|
||||
* build the support code. The support code depends on higher versions of
|
||||
* desktop GLSL, so it will fail to compile (below) anyway.
|
||||
*/
|
||||
if (!_mesa_is_desktop_gl(ctx) || ctx->Const.GLSLVersion < 400)
|
||||
return NULL;
|
||||
|
||||
/* We pretend it's a vertex shader. Ultimately, the stage shouldn't
|
||||
* matter because we're not optimizing anything here.
|
||||
*/
|
||||
|
@@ -71,6 +71,8 @@
|
||||
#include "util/driconf.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "ohos_log.h"
|
||||
|
||||
#define NUM_ATTRIBS 12
|
||||
|
||||
static const struct dri2_pbuffer_visual {
|
||||
@@ -1188,6 +1190,10 @@ dri2_initialize(_EGLDisplay *disp)
|
||||
case _EGL_PLATFORM_ANDROID:
|
||||
ret = dri2_initialize_android(disp);
|
||||
break;
|
||||
case _EGL_PLATFORM_OHOS:
|
||||
// NEED add openharmony init for dri2
|
||||
ret = dri2_initialize_ohos(disp);
|
||||
break;
|
||||
default:
|
||||
unreachable("Callers ensure we cannot get here.");
|
||||
return EGL_FALSE;
|
||||
@@ -1924,6 +1930,7 @@ dri2_surface_get_dri_drawable(_EGLSurface *surf)
|
||||
static _EGLProc
|
||||
dri2_get_proc_address(const char *procname)
|
||||
{
|
||||
DISPLAY_LOGI("procname = %{public}s", procname);
|
||||
return _glapi_get_proc_address(procname);
|
||||
}
|
||||
|
||||
|
@@ -75,6 +75,10 @@ struct zwp_linux_dmabuf_feedback_v1;
|
||||
#include <system/window.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
#include "window.h"
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
#include "eglconfig.h"
|
||||
@@ -364,9 +368,9 @@ struct dri2_egl_surface
|
||||
} color_buffers[4], *back, *current;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ANDROID_PLATFORM
|
||||
struct ANativeWindow *window;
|
||||
struct ANativeWindowBuffer *buffer;
|
||||
#if defined(HAVE_ANDROID_PLATFORM) || defined (HAVE_OHOS_PLATFORM)
|
||||
struct NativeWindow *window;
|
||||
struct NativeWindowBuffer *buffer;
|
||||
|
||||
/* in-fence associated with buffer, -1 once passed down to dri layer: */
|
||||
int in_fence_fd;
|
||||
@@ -380,7 +384,7 @@ struct dri2_egl_surface
|
||||
*/
|
||||
int color_buffers_count;
|
||||
struct {
|
||||
struct ANativeWindowBuffer *buffer;
|
||||
struct NativeWindowBuffer *buffer;
|
||||
int age;
|
||||
} *color_buffers, *back;
|
||||
uint32_t gralloc_usage;
|
||||
@@ -559,6 +563,17 @@ dri2_initialize_android(_EGLDisplay *disp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
EGLBoolean
|
||||
dri2_initialize_ohos(_EGLDisplay *disp);
|
||||
#else
|
||||
static inline EGLBoolean
|
||||
dri2_initialize_ohos(_EGLDisplay *disp)
|
||||
{
|
||||
return _eglError(EGL_NOT_INITIALIZED, "ohos platform not built");
|
||||
}
|
||||
#endif
|
||||
|
||||
EGLBoolean
|
||||
dri2_initialize_surfaceless(_EGLDisplay *disp);
|
||||
|
||||
|
1295
src/egl/drivers/dri2/platform_ohos.c
Normal file
1295
src/egl/drivers/dri2/platform_ohos.c
Normal file
File diff suppressed because it is too large
Load Diff
112
src/egl/drivers/dri2/platform_ohos.h
Normal file
112
src/egl/drivers/dri2/platform_ohos.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
*
|
||||
* Based on platform_android, which has
|
||||
*
|
||||
* Copyright © 2021, Google Inc.
|
||||
* Copyright (C) 2021, GlobalLogic Ukraine
|
||||
*
|
||||
* 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 (including the next
|
||||
* paragraph) 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.
|
||||
*/
|
||||
|
||||
#ifndef EGL_OHOS_INCLUDED
|
||||
#define EGL_OHOS_INCLUDED
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
||||
#include "egl_dri2.h"
|
||||
#include "display_type.h"
|
||||
#include "window.h"
|
||||
|
||||
#define ANativeWindow NativeWindow
|
||||
#define ANativeWindowBuffer NativeWindowBuffer
|
||||
static inline void
|
||||
ANativeWindow_acquire(struct ANativeWindow *window)
|
||||
{
|
||||
NativeObjectReference(window);
|
||||
}
|
||||
|
||||
static inline void
|
||||
ANativeWindow_release(struct ANativeWindow *window)
|
||||
{
|
||||
NativeObjectReference(window);
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_getFormat(struct ANativeWindow *window)
|
||||
{
|
||||
int32_t format = PIXEL_FMT_RGBA_8888;
|
||||
int32_t res = NativeWindowHandleOpt(window, GET_FORMAT, &format);
|
||||
return res == 0 ? format : res;
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_dequeueBuffer(struct ANativeWindow *window,
|
||||
struct ANativeWindowBuffer **buffer,
|
||||
int *fenceFd)
|
||||
{
|
||||
return NativeWindowRequestBuffer(window, buffer, fenceFd);
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_queueBuffer(struct ANativeWindow *window,
|
||||
struct ANativeWindowBuffer *buffer,
|
||||
int fenceFd)
|
||||
{
|
||||
struct Region dirty;
|
||||
dirty.rectNumber = 0;
|
||||
dirty.rects = NULL;
|
||||
return NativeWindowFlushBuffer(window, buffer, fenceFd, dirty);
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_cancelBuffer(struct ANativeWindow *window,
|
||||
struct ANativeWindowBuffer *buffer,
|
||||
int fenceFd)
|
||||
{
|
||||
return NativeWindowCancelBuffer(window, buffer);
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_setUsage(struct ANativeWindow *window, uint64_t usage)
|
||||
{
|
||||
return NativeWindowHandleOpt(window, SET_USAGE, usage);
|
||||
}
|
||||
|
||||
struct buffer_info {
|
||||
int width;
|
||||
int height;
|
||||
uint32_t drm_fourcc;
|
||||
int num_planes;
|
||||
int fds[4];
|
||||
uint64_t modifier;
|
||||
int offsets[4];
|
||||
int pitches[4];
|
||||
enum __DRIYUVColorSpace yuv_color_space;
|
||||
enum __DRISampleRange sample_range;
|
||||
enum __DRIChromaSiting horizontal_siting;
|
||||
enum __DRIChromaSiting vertical_siting;
|
||||
};
|
||||
|
||||
#endif /* EGL_OHOS_INCLUDED */
|
@@ -406,6 +406,11 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
|
||||
case EGL_PLATFORM_ANDROID_KHR:
|
||||
disp = _eglGetAndroidDisplay(native_display, attrib_list);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
case EGL_PLATFORM_OHOS_KHR:
|
||||
disp = _eglGetOHOSDisplay(native_display, attrib_list);
|
||||
break;
|
||||
#endif
|
||||
case EGL_PLATFORM_DEVICE_EXT:
|
||||
disp = _eglGetDeviceDisplay(native_display, attrib_list);
|
||||
|
@@ -85,6 +85,7 @@ static const struct {
|
||||
{ _EGL_PLATFORM_SURFACELESS, "surfaceless" },
|
||||
{ _EGL_PLATFORM_DEVICE, "device" },
|
||||
{ _EGL_PLATFORM_WINDOWS, "windows" },
|
||||
{ _EGL_PLATFORM_OHOS, "openharmony" },
|
||||
};
|
||||
|
||||
|
||||
@@ -608,6 +609,22 @@ _eglGetAndroidDisplay(void *native_display,
|
||||
}
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
_EGLDisplay*
|
||||
_eglGetOHOSDisplay(void *native_display,
|
||||
const EGLAttrib *attrib_list)
|
||||
{
|
||||
/* This platform recognizes no display attributes. */
|
||||
if (attrib_list != NULL && attrib_list[0] != EGL_NONE) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _eglFindDisplay(_EGL_PLATFORM_OHOS, native_display,
|
||||
attrib_list);
|
||||
}
|
||||
#endif /* HAVE_OHOS_PLATFORM */
|
||||
|
||||
_EGLDisplay*
|
||||
_eglGetDeviceDisplay(void *native_display,
|
||||
const EGLAttrib *attrib_list)
|
||||
|
@@ -52,6 +52,7 @@ enum _egl_platform_type {
|
||||
_EGL_PLATFORM_SURFACELESS,
|
||||
_EGL_PLATFORM_DEVICE,
|
||||
_EGL_PLATFORM_WINDOWS,
|
||||
_EGL_PLATFORM_OHOS,
|
||||
|
||||
_EGL_NUM_PLATFORMS,
|
||||
_EGL_INVALID_PLATFORM = -1
|
||||
@@ -329,6 +330,12 @@ _eglGetAndroidDisplay(void *native_display,
|
||||
const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OHOS_PLATFORM
|
||||
_EGLDisplay*
|
||||
_eglGetOHOSDisplay(void *native_display,
|
||||
const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
|
||||
_EGLDisplay*
|
||||
_eglGetDeviceDisplay(void *native_display,
|
||||
const EGLAttrib *attrib_list);
|
||||
|
@@ -109,7 +109,7 @@ if with_dri2
|
||||
endif
|
||||
deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes]
|
||||
endif
|
||||
if with_gbm and not with_platform_android
|
||||
if with_gbm and not with_platform_android and not with_platform_ohos
|
||||
files_egl += files('drivers/dri2/platform_drm.c')
|
||||
link_for_egl += libgbm
|
||||
incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
|
||||
@@ -136,6 +136,10 @@ if with_dri2
|
||||
override_for_egl += 'cpp_std=c++17'
|
||||
endif
|
||||
endif
|
||||
if with_platform_ohos
|
||||
deps_for_egl += dep_ohos
|
||||
files_egl += files('drivers/dri2/platform_ohos.c')
|
||||
endif
|
||||
elif with_platform_haiku
|
||||
incs_for_egl += inc_haikugl
|
||||
c_args_for_egl += [
|
||||
|
@@ -68,26 +68,59 @@
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#include "ohos_log.h"
|
||||
|
||||
static void default_logger(int level, const char *fmt, ...)
|
||||
{
|
||||
const int MAX_BUFFER_LEN = 1024;
|
||||
char log_string[MAX_BUFFER_LEN];
|
||||
if (level <= _LOADER_WARNING) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
DISPLAY_LOGI();
|
||||
}
|
||||
|
||||
static loader_logger *log_ = default_logger;
|
||||
static void ohos_logger(int level, const char *fmt, ...)
|
||||
{
|
||||
const int MAX_BUFFER_LEN = 1024;
|
||||
char log_string[MAX_BUFFER_LEN];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
(void)snprintf(log_string, MAX_BUFFER_LEN, fmt, args);
|
||||
va_end(args);
|
||||
switch (level) {
|
||||
case _LOADER_WARNING:
|
||||
DISPLAY_LOGW("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_DEBUG:
|
||||
DISPLAY_LOGD("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_FATAL:
|
||||
DISPLAY_LOGE("%{public}s", log_string);
|
||||
break;
|
||||
case _LOADER_INFO:
|
||||
DISPLAY_LOGI("%{public}s", log_string);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DISPLAY_LOGI();
|
||||
}
|
||||
|
||||
static loader_logger *log_ = ohos_logger;
|
||||
|
||||
int
|
||||
loader_open_device(const char *device_name)
|
||||
{
|
||||
log_(_LOADER_WARNING, "loader_open_device %s", device_name);
|
||||
int fd;
|
||||
#ifdef O_CLOEXEC
|
||||
fd = open(device_name, O_RDWR | O_CLOEXEC);
|
||||
if (fd == -1 && errno == EINVAL)
|
||||
#endif
|
||||
if (fd == -1 && errno == EINVAL)
|
||||
{
|
||||
fd = open(device_name, O_RDWR);
|
||||
if (fd != -1)
|
||||
@@ -326,11 +359,14 @@ int loader_get_user_preferred_fd(int default_fd, bool *different_device)
|
||||
drmDevicePtr devices[MAX_DRM_DEVICES];
|
||||
int i, num_devices, fd = -1;
|
||||
|
||||
#ifdef USE_DRICONF
|
||||
if (dri_prime)
|
||||
prime = strdup(dri_prime);
|
||||
#ifdef USE_DRICONF
|
||||
else
|
||||
prime = loader_get_dri_config_device_id();
|
||||
#else
|
||||
if (dri_prime)
|
||||
prime = strdup(dri_prime);
|
||||
#endif
|
||||
|
||||
if (prime == NULL) {
|
||||
|
@@ -39,7 +39,7 @@ struct __DRIextensionRec;
|
||||
/* Helpers to figure out driver and device name, eg. from pci-id, etc. */
|
||||
|
||||
int
|
||||
loader_open_device(const char *);
|
||||
loader_open_device(const char *device_name);
|
||||
|
||||
int
|
||||
loader_open_render_node(const char *name);
|
||||
|
@@ -46,6 +46,6 @@ libloader = static_library(
|
||||
c_args : loader_c_args,
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_util],
|
||||
dependencies : [dep_libdrm, dep_thread],
|
||||
dependencies : [dep_libdrm, dep_thread, dep_hilog],
|
||||
build_by_default : false,
|
||||
)
|
||||
|
@@ -91,6 +91,13 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_)
|
||||
size_t offset = sizeof(ElfW(Nhdr)) +
|
||||
ALIGN_POT(note->nhdr.n_namesz, 4) +
|
||||
ALIGN_POT(note->nhdr.n_descsz, 4);
|
||||
|
||||
// 05 00 00 00 04 00 00 00 4f 48 4f 53 00 01 00 00 00 00 00 00
|
||||
if ((note->nhdr.n_type == 0x534f484f) && (len > 20)) {
|
||||
// .note.ohos.ident is not a valid PT_NOTE section, use offset in section header later
|
||||
offset = 20;
|
||||
}
|
||||
|
||||
note = (struct build_id_note *)((char *)note + offset);
|
||||
len -= offset;
|
||||
}
|
||||
|
Reference in New Issue
Block a user