add ohos
Change-Id: I00a99b2b7e437c9b4b27a2cc426052929cc23f9e
This commit is contained in:
6
cpmesa.sh
Executable file
6
cpmesa.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
cp build-ohos/src/gallium/targets/dri/libgallium_dri.so ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
||||
cp build-ohos/src/egl/libEGL.so.1.0.0 ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
||||
cp build-ohos/install/lib/libGLESv1_CM.so.1.1.0 ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
||||
cp build-ohos/install/lib/libGLESv2.so.2.0.0 ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
||||
cp build-ohos/install/lib/libgbm.so.1.0.0 ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
||||
cp build-ohos/install/lib/libglapi.so.0.0.0 ../../device/soc/vortexnova/x86_general/hardware/gpu/lib64
|
145
cross_file
Normal file
145
cross_file
Normal file
@@ -0,0 +1,145 @@
|
||||
|
||||
[properties]
|
||||
needs_exe_wrapper = true
|
||||
|
||||
c_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl',
|
||||
'-fPIC',
|
||||
'-fno-emulated-tls']
|
||||
|
||||
cpp_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl',
|
||||
'-fPIC',
|
||||
'-fno-emulated-tls']
|
||||
|
||||
c_link_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'-fPIC',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl/usr/lib/x86_64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/15.0.4/lib/x86_64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/15.0.4/llvm/include/x86_64-linux-ohos/c++',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
cpp_link_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl',
|
||||
'-fPIC',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/surface/obj/third_party/musl/usr/lib/x86_64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/15.0.4/lib/x86_64-linux-ohos',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/include/x86_64-linux-ohos/c++',
|
||||
'-Wl,--exclude-libs=libunwind_llvm.a',
|
||||
'-Wl,--exclude-libs=libc++_static.a',
|
||||
'-Wl,--warn-shared-textrel',
|
||||
'--rtlib=compiler-rt',
|
||||
'-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/third_party/mesa3d/subprojects/llvm',
|
||||
'-lLLVMMCDisassembler',
|
||||
'-lLLVMSelectionDAG',
|
||||
'-lLLVMExtensions',
|
||||
'-lLLVMRemarks',
|
||||
'-lLLVMRuntimeDyld',
|
||||
'-lLLVMDemangle',
|
||||
'-lLLVMBinaryFormat',
|
||||
'-lLLVMAsmParser',
|
||||
'-lLLVMTarget',
|
||||
'-lLLVMX86Disassembler',
|
||||
'-lLLVMInterfaceStub',
|
||||
'-lLLVMX86Info',
|
||||
'-lLLVMLTO',
|
||||
'-lLLVMMCA',
|
||||
'-lLLVMOption',
|
||||
'-lLLVMFuzzerCLI',
|
||||
'-lLLVMDlltoolDriver',
|
||||
'-lLLVMDebugInfoPDB',
|
||||
'-lLLVMTextAPI',
|
||||
'-lLLVMMCJIT',
|
||||
'-lLLVMAggressiveInstCombine',
|
||||
'-lLLVMCore',
|
||||
'-lLLVMOrcTargetProcess',
|
||||
'-lLLVMAnalysis',
|
||||
'-lLLVMBitWriter',
|
||||
'-lLLVMObjCopy',
|
||||
'-lLLVMBitstreamReader',
|
||||
'-lLLVMTransformUtils',
|
||||
'-lLLVMExecutionEngine',
|
||||
'-lLLVMObjCARCOpts',
|
||||
'-lLLVMAMDGPUCodeGen',
|
||||
'-lLLVMFrontendOpenACC',
|
||||
'-lLLVMAMDGPUInfo',
|
||||
'-lLLVMDWARFLinker',
|
||||
'-lLLVMTableGen',
|
||||
'-lLLVMX86Desc',
|
||||
'-lLLVMMCParser',
|
||||
'-lLLVMInstrumentation',
|
||||
'-lLLVMOrcShared',
|
||||
'-lLLVMInstCombine',
|
||||
'-lLLVMSupport',
|
||||
'-lLLVMAsmPrinter',
|
||||
'-lLLVMWindowsManifest',
|
||||
'-lLLVMLineEditor',
|
||||
'-lLLVMAMDGPUDisassembler',
|
||||
'-lLLVMDebugInfoGSYM',
|
||||
'-lLLVMDebugInfoCodeView',
|
||||
'-lLLVMInterpreter',
|
||||
'-lLLVMVectorize',
|
||||
'-lLLVMX86CodeGen',
|
||||
'-lLLVMAMDGPUUtils',
|
||||
'-lLLVMParts',
|
||||
'-lLLVMDebugInfoMSF',
|
||||
'-lLLVMXRay',
|
||||
'-lLLVMPasses',
|
||||
'-lLLVMTableGenGlobalISel',
|
||||
'-lLLVMGlobalISel',
|
||||
'-lLLVMBitReader',
|
||||
'-lLLVMipo',
|
||||
'-lLLVMLinker',
|
||||
'-lLLVMX86TargetMCA',
|
||||
'-lLLVMProfileData',
|
||||
'-lLLVMCoroutines',
|
||||
'-lLLVMScalarOpts',
|
||||
'-lLLVMCodeGen',
|
||||
'-lLLVMObject',
|
||||
'-lLLVMWindowsDriver',
|
||||
'-lLLVMCFGuard',
|
||||
'-lLLVMDebugInfoDWARF',
|
||||
'-lLLVMAMDGPUAsmParser',
|
||||
'-lLLVMFrontendOpenMP',
|
||||
'-lLLVMJITLink',
|
||||
'-lLLVMIRReader',
|
||||
'-lLLVMX86AsmParser',
|
||||
'-lLLVMMC',
|
||||
'-lLLVMSymbolize',
|
||||
'-lLLVMLibDriver',
|
||||
'-lLLVMObjectYAML',
|
||||
'-lLLVMFileCheck',
|
||||
'-lLLVMDWP',
|
||||
'-lLLVMAMDGPUTargetMCA',
|
||||
'-lLLVMMIRParser',
|
||||
'-lLLVMAMDGPUDesc',
|
||||
'-lLLVMFuzzMutate',
|
||||
'-lLLVMCoverage',
|
||||
'-lLLVMOrcJIT',
|
||||
]
|
||||
|
||||
[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/tools/llvm-project-llvmorg-18.1.8/build/bin/llvm-strip'
|
||||
llvm-config = '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/tools/llvm-project-llvmorg-18.1.8/build/bin/llvm-config'
|
||||
pkgconfig = '/usr/bin/pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'x86_64'
|
||||
cpu = 'x86_64'
|
||||
endian = 'little'
|
@@ -134,7 +134,7 @@ typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLen
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
#if defined(EGL_EGLEXT_PROTOTYPES) || defined(HAVE_OHOS_PLATFORM)
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
@@ -188,7 +188,7 @@ typedef void *EGLImageKHR;
|
||||
#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
#if defined(EGL_EGLEXT_PROTOTYPES) || defined(HAVE_OHOS_PLATFORM)
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
@@ -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
|
||||
@@ -438,7 +443,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSu
|
||||
#ifndef EGL_KHR_wait_sync
|
||||
#define EGL_KHR_wait_sync 1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
#if defined(EGL_EGLEXT_PROTOTYPES) || defined(HAVE_OHOS_PLATFORM)
|
||||
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#endif
|
||||
#endif /* EGL_KHR_wait_sync */
|
||||
@@ -533,7 +538,7 @@ EGLAPI EGLClientBuffer EGLAPIENTRY eglGetNativeClientBufferANDROID (const struct
|
||||
#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
|
||||
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
#if defined(EGL_EGLEXT_PROTOTYPES) || defined(HAVE_OHOS_PLATFORM)
|
||||
EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_native_fence_sync */
|
||||
@@ -1456,6 +1461,11 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#define EGL_PLATFORM_SCREEN_QNX 0x3550
|
||||
#endif /* EGL_QNX_platform_screen */
|
||||
|
||||
#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
|
||||
|
@@ -2082,7 +2082,7 @@ typedef void* GLeglImageOES;
|
||||
|
||||
#ifndef GL_OES_EGL_image
|
||||
#define GL_OES_EGL_image 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
#if defined(GL_GLEXT_PROTOTYPES) || defined(HAVE_OHOS_PLATFORM)
|
||||
GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
|
||||
GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
|
||||
#endif
|
||||
|
@@ -109,6 +109,8 @@
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#elif defined(HAVE_OHOS_PLATFORM)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
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 */
|
26
meson.build
26
meson.build
@@ -125,7 +125,7 @@ with_any_opengl = with_opengl or with_gles1 or with_gles2
|
||||
# Only build shared_glapi if at least one OpenGL API is enabled
|
||||
with_shared_glapi = with_shared_glapi and with_any_opengl
|
||||
|
||||
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm'].contains(host_machine.system())
|
||||
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'managarm', 'ohos'].contains(host_machine.system())
|
||||
|
||||
gallium_drivers = get_option('gallium-drivers')
|
||||
if gallium_drivers.contains('auto')
|
||||
@@ -410,6 +410,7 @@ with_platform_wayland = _platforms.contains('wayland')
|
||||
with_platform_haiku = _platforms.contains('haiku')
|
||||
with_platform_windows = _platforms.contains('windows')
|
||||
with_platform_macos = _platforms.contains('macos')
|
||||
with_platform_ohos = _platforms.contains('ohos')
|
||||
|
||||
with_glx = get_option('glx')
|
||||
if with_glx == 'auto'
|
||||
@@ -470,7 +471,7 @@ with_egl = get_option('egl') \
|
||||
|
||||
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
|
||||
|
||||
@@ -902,7 +903,18 @@ if get_option('allow-kcmp') \
|
||||
pre_args += '-DALLOW_KCMP'
|
||||
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',
|
||||
'''
|
||||
@@ -1638,7 +1650,7 @@ dep_libdrm_intel = null_dep
|
||||
|
||||
_drm_amdgpu_ver = '2.4.121'
|
||||
_drm_radeon_ver = '2.4.71'
|
||||
_drm_intel_ver = '2.4.75'
|
||||
_drm_intel_ver = '2.4.111'
|
||||
_drm_ver = '2.4.109'
|
||||
|
||||
_libdrm_checks = [
|
||||
@@ -1671,6 +1683,10 @@ foreach d : _libdrm_checks
|
||||
endif
|
||||
endforeach
|
||||
|
||||
dep_hilog = dependency(
|
||||
'libhilog'
|
||||
)
|
||||
|
||||
with_gallium_drisw_kms = false
|
||||
if system_has_kms_drm
|
||||
dep_libdrm = dependency(
|
||||
@@ -1691,7 +1707,7 @@ endif
|
||||
|
||||
dep_libudev = dependency('libudev', required : false)
|
||||
if dep_libudev.found()
|
||||
pre_args += '-DHAVE_LIBUDEV'
|
||||
# pre_args += '-DHAVE_LIBUDEV'
|
||||
endif
|
||||
|
||||
llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
|
||||
|
@@ -12,7 +12,7 @@ option(
|
||||
type : 'array',
|
||||
value : ['auto'],
|
||||
choices : [
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'macos',
|
||||
'auto', 'x11', 'wayland', 'haiku', 'android', 'windows', 'macos', 'ohos',
|
||||
],
|
||||
description : 'window systems to support. If this is set to `auto`, all ' +
|
||||
'platforms applicable will be enabled.'
|
||||
@@ -24,7 +24,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')
|
43
ohos/build_ohos_x86.py
Normal file
43
ohos/build_ohos_x86.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_x86.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 -Dgallium-drivers=crocus,iris \
|
||||
-Dvulkan-drivers= -Dgbm=enabled -Degl=enabled -Dcpp_rtti=false -Dglx=disabled -Dtools=intel '
|
||||
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')
|
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])
|
219
ohos/meson_cross_process_x86.py
Normal file
219
ohos/meson_cross_process_x86.py
Normal file
@@ -0,0 +1,219 @@
|
||||
#!/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=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fPIC',
|
||||
'-fno-emulated-tls']
|
||||
|
||||
cpp_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fPIC',
|
||||
'-fno-emulated-tls']
|
||||
|
||||
c_link_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'-fPIC',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-Lsysroot_stub/usr/lib/x86_64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/15.0.4/lib/x86_64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/15.0.4/llvm/include/x86_64-linux-ohos/c++',
|
||||
'--rtlib=compiler-rt',
|
||||
]
|
||||
|
||||
cpp_link_args = [
|
||||
'-march=x86-64',
|
||||
'--target=x86_64-linux-ohosmusl',
|
||||
'--sysroot=sysroot_stub',
|
||||
'-fPIC',
|
||||
'-Lsysroot_stub/usr/lib/x86_64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/15.0.4/lib/x86_64-linux-ohos',
|
||||
'-Lproject_stub/prebuilts/clang/ohos/linux-x86_64/llvm/lib/include/x86_64-linux-ohos/c++',
|
||||
'-Wl,--exclude-libs=libunwind_llvm.a',
|
||||
'-Wl,--exclude-libs=libc++_static.a',
|
||||
'-Wl,--warn-shared-textrel',
|
||||
'--rtlib=compiler-rt',
|
||||
'-Lproject_stub/third_party/mesa3d/subprojects/llvm',
|
||||
'-lLLVMMCDisassembler',
|
||||
'-lLLVMSelectionDAG',
|
||||
'-lLLVMExtensions',
|
||||
'-lLLVMRemarks',
|
||||
'-lLLVMRuntimeDyld',
|
||||
'-lLLVMDemangle',
|
||||
'-lLLVMBinaryFormat',
|
||||
'-lLLVMAsmParser',
|
||||
'-lLLVMTarget',
|
||||
'-lLLVMX86Disassembler',
|
||||
'-lLLVMInterfaceStub',
|
||||
'-lLLVMX86Info',
|
||||
'-lLLVMLTO',
|
||||
'-lLLVMMCA',
|
||||
'-lLLVMOption',
|
||||
'-lLLVMFuzzerCLI',
|
||||
'-lLLVMDlltoolDriver',
|
||||
'-lLLVMDebugInfoPDB',
|
||||
'-lLLVMTextAPI',
|
||||
'-lLLVMMCJIT',
|
||||
'-lLLVMAggressiveInstCombine',
|
||||
'-lLLVMCore',
|
||||
'-lLLVMOrcTargetProcess',
|
||||
'-lLLVMAnalysis',
|
||||
'-lLLVMBitWriter',
|
||||
'-lLLVMObjCopy',
|
||||
'-lLLVMBitstreamReader',
|
||||
'-lLLVMTransformUtils',
|
||||
'-lLLVMExecutionEngine',
|
||||
'-lLLVMObjCARCOpts',
|
||||
'-lLLVMAMDGPUCodeGen',
|
||||
'-lLLVMFrontendOpenACC',
|
||||
'-lLLVMAMDGPUInfo',
|
||||
'-lLLVMDWARFLinker',
|
||||
'-lLLVMTableGen',
|
||||
'-lLLVMX86Desc',
|
||||
'-lLLVMMCParser',
|
||||
'-lLLVMInstrumentation',
|
||||
'-lLLVMOrcShared',
|
||||
'-lLLVMInstCombine',
|
||||
'-lLLVMSupport',
|
||||
'-lLLVMAsmPrinter',
|
||||
'-lLLVMWindowsManifest',
|
||||
'-lLLVMLineEditor',
|
||||
'-lLLVMAMDGPUDisassembler',
|
||||
'-lLLVMDebugInfoGSYM',
|
||||
'-lLLVMDebugInfoCodeView',
|
||||
'-lLLVMInterpreter',
|
||||
'-lLLVMVectorize',
|
||||
'-lLLVMX86CodeGen',
|
||||
'-lLLVMAMDGPUUtils',
|
||||
'-lLLVMParts',
|
||||
'-lLLVMDebugInfoMSF',
|
||||
'-lLLVMXRay',
|
||||
'-lLLVMPasses',
|
||||
'-lLLVMTableGenGlobalISel',
|
||||
'-lLLVMGlobalISel',
|
||||
'-lLLVMBitReader',
|
||||
'-lLLVMipo',
|
||||
'-lLLVMLinker',
|
||||
'-lLLVMX86TargetMCA',
|
||||
'-lLLVMProfileData',
|
||||
'-lLLVMCoroutines',
|
||||
'-lLLVMScalarOpts',
|
||||
'-lLLVMCodeGen',
|
||||
'-lLLVMObject',
|
||||
'-lLLVMWindowsDriver',
|
||||
'-lLLVMCFGuard',
|
||||
'-lLLVMDebugInfoDWARF',
|
||||
'-lLLVMAMDGPUAsmParser',
|
||||
'-lLLVMFrontendOpenMP',
|
||||
'-lLLVMJITLink',
|
||||
'-lLLVMIRReader',
|
||||
'-lLLVMX86AsmParser',
|
||||
'-lLLVMMC',
|
||||
'-lLLVMSymbolize',
|
||||
'-lLLVMLibDriver',
|
||||
'-lLLVMObjectYAML',
|
||||
'-lLLVMFileCheck',
|
||||
'-lLLVMDWP',
|
||||
'-lLLVMAMDGPUTargetMCA',
|
||||
'-lLLVMMIRParser',
|
||||
'-lLLVMAMDGPUDesc',
|
||||
'-lLLVMFuzzMutate',
|
||||
'-lLLVMCoverage',
|
||||
'-lLLVMOrcJIT',
|
||||
]
|
||||
|
||||
[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/tools/llvm-project-llvmorg-18.1.8/build/bin/llvm-strip'
|
||||
llvm-config = 'project_stub/tools/llvm-project-llvmorg-18.1.8/build/bin/llvm-config'
|
||||
pkgconfig = '/usr/bin/pkg-config'
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'x86_64'
|
||||
cpu = 'x86_64'
|
||||
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])
|
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/libdrm_amdgpu.pc
Normal file
9
ohos/pkgconfig_template/libdrm_amdgpu.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm_amdgpu
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm_amdgpu
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/ -I${includedir}/amdgpu
|
9
ohos/pkgconfig_template/libdrm_radeon.pc
Normal file
9
ohos/pkgconfig_template/libdrm_radeon.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm_radeon
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm_radeon
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/ -I${includedir}/radeon
|
9
ohos/pkgconfig_template/libelf.pc
Normal file
9
ohos/pkgconfig_template/libelf.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/elfutils/libelf/
|
||||
|
||||
Name: libelf
|
||||
Description: elfutils libelf library to read and write ELF files
|
||||
Version: 0.185
|
||||
Libs: -L${libdir} -lelf
|
||||
Cflags: -I${includedir}
|
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-turbo/
|
||||
includedir=${ohos_project_dir}/third_party/libjpeg-turbo
|
||||
|
||||
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/thirdparty/libpng/
|
||||
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-x86_64/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/obj/foundation/multimodalinput/input/libudev/
|
||||
includedir=${ohos_project_dir}/foundation/multimodalinput/input/libudev/include/
|
||||
|
||||
Name: udev
|
||||
Description: udev
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -lmmi_libudev
|
||||
Cflags: -I${includedir}
|
9
ohos/pkgconfig_template/libxml2.pc
Normal file
9
ohos/pkgconfig_template/libxml2.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=ohos_project_directory_stub
|
||||
libdir=${ohos_project_dir}/out/ohos-arm-release/thirdparty/libxml2/
|
||||
includedir=${ohos_project_dir}/third_party/libxml2/include
|
||||
|
||||
Name: xml2
|
||||
Description: xml2
|
||||
Version: 2.9.13
|
||||
Libs: -L${libdir} -lxml2.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}
|
12
pkgconfig/LLVMSPIRVLib.pc
Normal file
12
pkgconfig/LLVMSPIRVLib.pc
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/tools/SPIRV-LLVM-Translator-18.1.12/build
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: LLVMSPIRVLib
|
||||
Description: LLVM/SPIR-V bi-directional translator
|
||||
Version: 18.1.0.0
|
||||
URL: https://github.com/KhronosGroup/SPIRV-LLVM-Translator
|
||||
|
||||
Libs: -L${libdir} -lLLVMSPIRVLib
|
||||
Cflags: -I${includedir}
|
12
pkgconfig/SPIRV-Tools-shared.pc
Normal file
12
pkgconfig/SPIRV-Tools-shared.pc
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/tools/SPIRV-Tools-2024.4/build
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: SPIRV-Tools
|
||||
Description: Tools for SPIR-V
|
||||
Version: 2024.4.1
|
||||
URL: https://github.com/KhronosGroup/SPIRV-Tools
|
||||
|
||||
Libs: -L${libdir} -lSPIRV-Tools-shared
|
||||
Cflags: -I${includedir}
|
12
pkgconfig/SPIRV-Tools.pc
Normal file
12
pkgconfig/SPIRV-Tools.pc
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/tools/SPIRV-Tools-2024.4/build
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: SPIRV-Tools
|
||||
Description: Tools for SPIR-V
|
||||
Version: 2024.4.1
|
||||
URL: https://github.com/KhronosGroup/SPIRV-Tools
|
||||
|
||||
Libs: -L${libdir} -lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link
|
||||
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/surface/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/surface/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/libdrm_amdgpu.pc
Normal file
9
pkgconfig/libdrm_amdgpu.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/surface/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm_amdgpu
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm_amdgpu
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/ -I${includedir}/amdgpu
|
9
pkgconfig/libdrm_radeon.pc
Normal file
9
pkgconfig/libdrm_radeon.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/surface/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/libdrm
|
||||
|
||||
Name: libdrm_radeon
|
||||
Description: Userspace interface to kernel DRM services
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -ldrm_radeon
|
||||
Cflags: -I${includedir} -I${includedir}/include/drm/ -I${includedir}/radeon
|
9
pkgconfig/libelf.pc
Normal file
9
pkgconfig/libelf.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/surface/vortexnova_soc_products/vortexnova_x86_general/
|
||||
includedir=${ohos_project_dir}/third_party/elfutils/libelf/
|
||||
|
||||
Name: libelf
|
||||
Description: elfutils libelf library to read and write ELF files
|
||||
Version: 0.185
|
||||
Libs: -L${libdir} -lelf
|
||||
Cflags: -I${includedir}
|
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/surface/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/surface/obj/third_party/libjpeg-turbo/
|
||||
includedir=${ohos_project_dir}/third_party/libjpeg-turbo
|
||||
|
||||
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/surface/thirdparty/libpng/
|
||||
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/surface/graphic/graphic_surface/
|
||||
includedir=${ohos_project_dir}/out/surface/innerkits/ohos-x86_64/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/surface/obj/foundation/multimodalinput/input/libudev/
|
||||
includedir=${ohos_project_dir}/foundation/multimodalinput/input/libudev/include/
|
||||
|
||||
Name: udev
|
||||
Description: udev
|
||||
Version: 2.5.109
|
||||
Libs: -L${libdir} -lmmi_libudev
|
||||
Cflags: -I${includedir}
|
9
pkgconfig/libxml2.pc
Normal file
9
pkgconfig/libxml2.pc
Normal file
@@ -0,0 +1,9 @@
|
||||
ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release
|
||||
libdir=${ohos_project_dir}/out/surface/thirdparty/libxml2/
|
||||
includedir=${ohos_project_dir}/third_party/libxml2/include
|
||||
|
||||
Name: xml2
|
||||
Description: xml2
|
||||
Version: 2.9.13
|
||||
Libs: -L${libdir} -lxml2.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/surface/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/surface/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/surface/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/surface/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/surface/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/surface/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/surface/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/surface/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/surface/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"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
@@ -2836,6 +2837,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.
|
||||
*/
|
||||
|
@@ -924,6 +924,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;
|
||||
|
@@ -81,6 +81,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"
|
||||
@@ -374,9 +378,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;
|
||||
@@ -390,7 +394,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;
|
||||
@@ -582,6 +586,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);
|
||||
|
||||
|
1142
src/egl/drivers/dri2/platform_ohos.c
Normal file
1142
src/egl/drivers/dri2/platform_ohos.c
Normal file
File diff suppressed because it is too large
Load Diff
116
src/egl/drivers/dri2/platform_ohos.h
Normal file
116
src/egl/drivers/dri2/platform_ohos.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
NativeObjectUnreference(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)
|
||||
{
|
||||
int32_t ret = NativeWindowRequestBuffer(window, buffer, fenceFd);
|
||||
NativeObjectReference(*buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
ANativeWindow_queueBuffer(struct ANativeWindow *window,
|
||||
struct ANativeWindowBuffer *buffer,
|
||||
int fenceFd)
|
||||
{
|
||||
struct Region dirty;
|
||||
dirty.rectNumber = 0;
|
||||
dirty.rects = NULL;
|
||||
int32_t ret = NativeWindowFlushBuffer(window, buffer, fenceFd, dirty);
|
||||
NativeObjectUnreference(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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 */
|
@@ -114,6 +114,8 @@
|
||||
|
||||
#include "GL/mesa_glinterop.h"
|
||||
|
||||
#include "ohos_log.h"
|
||||
|
||||
/**
|
||||
* Macros to help return an API entrypoint.
|
||||
*
|
||||
@@ -461,6 +463,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);
|
||||
@@ -1855,7 +1862,7 @@ _eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target,
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
|
||||
static EGLImage EGLAPIENTRY
|
||||
EGLAPI EGLImage EGLAPIENTRY
|
||||
eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
|
||||
EGLClientBuffer buffer, const EGLint *attr_list)
|
||||
{
|
||||
@@ -1909,7 +1916,7 @@ eglDestroyImage(EGLDisplay dpy, EGLImage image)
|
||||
return _eglDestroyImageCommon(disp, img);
|
||||
}
|
||||
|
||||
static EGLBoolean EGLAPIENTRY
|
||||
EGLAPI EGLBoolean EGLAPIENTRY
|
||||
eglDestroyImageKHR(EGLDisplay dpy, EGLImage image)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
@@ -1982,7 +1989,7 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list,
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
|
||||
static EGLSync EGLAPIENTRY
|
||||
EGLAPI EGLSync EGLAPIENTRY
|
||||
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
@@ -2053,7 +2060,7 @@ eglDestroySync(EGLDisplay dpy, EGLSync sync)
|
||||
return _eglDestroySync(disp, s);
|
||||
}
|
||||
|
||||
static EGLBoolean EGLAPIENTRY
|
||||
EGLAPI EGLBoolean EGLAPIENTRY
|
||||
eglDestroySyncKHR(EGLDisplay dpy, EGLSync sync)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
@@ -2092,7 +2099,7 @@ eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
|
||||
return _eglClientWaitSyncCommon(disp, s, flags, timeout);
|
||||
}
|
||||
|
||||
static EGLint EGLAPIENTRY
|
||||
EGLAPI EGLint EGLAPIENTRY
|
||||
eglClientWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags,
|
||||
EGLTime timeout)
|
||||
{
|
||||
@@ -2125,7 +2132,7 @@ _eglWaitSyncCommon(_EGLDisplay *disp, _EGLSync *s, EGLint flags)
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
|
||||
static EGLint EGLAPIENTRY
|
||||
EGLAPI EGLint EGLAPIENTRY
|
||||
eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
@@ -2196,7 +2203,7 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute,
|
||||
return _eglGetSyncAttribCommon(disp, s, attribute, value);
|
||||
}
|
||||
|
||||
static EGLBoolean EGLAPIENTRY
|
||||
EGLAPI EGLBoolean EGLAPIENTRY
|
||||
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute,
|
||||
EGLint *value)
|
||||
{
|
||||
@@ -2224,7 +2231,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute,
|
||||
return result;
|
||||
}
|
||||
|
||||
static EGLint EGLAPIENTRY
|
||||
EGLAPI EGLint EGLAPIENTRY
|
||||
eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSync sync)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
@@ -2856,6 +2863,8 @@ eglGetProcAddress(const char *procname)
|
||||
};
|
||||
_EGLProc ret = NULL;
|
||||
|
||||
DISPLAY_LOGI("procname = %{public}s", procname);
|
||||
|
||||
if (!procname)
|
||||
RETURN_EGL_SUCCESS(NULL, NULL);
|
||||
|
||||
|
@@ -83,6 +83,7 @@ static const struct {
|
||||
{_EGL_PLATFORM_SURFACELESS, "surfaceless"},
|
||||
{_EGL_PLATFORM_DEVICE, "device"},
|
||||
{_EGL_PLATFORM_WINDOWS, "windows"},
|
||||
{_EGL_PLATFORM_OHOS, "openharmony"},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -695,6 +696,22 @@ _eglGetAndroidDisplay(void *native_display, const EGLAttrib *attrib_list)
|
||||
}
|
||||
#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)
|
||||
{
|
||||
|
@@ -55,6 +55,7 @@ enum _egl_platform_type {
|
||||
_EGL_PLATFORM_SURFACELESS,
|
||||
_EGL_PLATFORM_DEVICE,
|
||||
_EGL_PLATFORM_WINDOWS,
|
||||
_EGL_PLATFORM_OHOS,
|
||||
|
||||
_EGL_NUM_PLATFORMS,
|
||||
_EGL_INVALID_PLATFORM = -1
|
||||
@@ -355,6 +356,12 @@ _EGLDisplay *
|
||||
_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);
|
||||
|
||||
|
@@ -104,7 +104,7 @@ if with_dri
|
||||
endif
|
||||
deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xrandr, dep_xcb_xfixes, dep_xcb_shm]
|
||||
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')]
|
||||
@@ -122,6 +122,10 @@ if with_dri
|
||||
deps_for_egl += [dep_android, idep_u_gralloc]
|
||||
files_egl += files('drivers/dri2/platform_android.c')
|
||||
endif
|
||||
if with_platform_ohos
|
||||
deps_for_egl += dep_ohos
|
||||
files_egl += files('drivers/dri2/platform_ohos.c')
|
||||
endif
|
||||
elif with_platform_haiku
|
||||
c_args_for_egl += [
|
||||
'-D_EGL_BUILT_IN_DRIVER_HAIKU',
|
||||
|
@@ -522,7 +522,7 @@ libgallium = static_library(
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
dependencies : [
|
||||
dep_libdrm, dep_llvm, dep_dl, dep_m, dep_thread, dep_lmsensors, dep_ws2_32,
|
||||
idep_nir, idep_nir_headers, idep_mesautil,
|
||||
idep_nir, idep_nir_headers, idep_mesautil, dep_unwind,
|
||||
],
|
||||
build_by_default : false
|
||||
)
|
||||
|
@@ -87,7 +87,7 @@ if install_intel_gpu_tests and not with_tests
|
||||
error('`install-intel-gpu-tests` requires `build-tests`')
|
||||
endif
|
||||
|
||||
if with_tests and not with_platform_android
|
||||
if with_tests and not with_platform_android and not with_platform_ohos
|
||||
foreach g : [['70', 'gfx7'], ['75', 'hsw'], ['80', 'gfx8'],
|
||||
['90', 'gfx9'], ['110', 'gfx11'], ['120', 'gfx12'],
|
||||
['125', 'gfx125'], ['200', 'gfx20']]
|
||||
|
@@ -137,11 +137,24 @@ idep_genxml = declare_dependency(
|
||||
sources : [gen_xml_pack, gen_cl_xml_pack, genX_bits_h, genX_xml_h]
|
||||
)
|
||||
|
||||
# 1. 声明Python解释器(自动检测系统路径)
|
||||
prog_python = find_program('python3', required: true)
|
||||
|
||||
# 2. 声明测试脚本(无需编译)
|
||||
gen_sort_script = files('gen_sort_tags.py')
|
||||
|
||||
# 3. 定义测试用例(正确调用方式)
|
||||
foreach f : gen_xml_files + gen_xml_rt_files
|
||||
test(
|
||||
'genxml sort @0@'.format(f),
|
||||
prog_python,
|
||||
args : [files('gen_sort_tags.py'), files(f), '--validate', '--quiet'],
|
||||
suite : ['intel'],
|
||||
prog_python, # 使用Python解释器作为可执行目标
|
||||
args: [
|
||||
gen_sort_script, # 直接引用脚本文件
|
||||
f, # 输入文件
|
||||
'--validate',
|
||||
'--quiet'
|
||||
],
|
||||
suite: ['intel'],
|
||||
protocol: 'tap'
|
||||
)
|
||||
endforeach
|
||||
endforeach
|
@@ -736,8 +736,8 @@ intercept_ioctl(int fd, unsigned long request, ...)
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default"))) int
|
||||
ioctl(int fd, unsigned long request, ...)
|
||||
__attribute__ ((visibility ("default"))) static int
|
||||
inte_dump_gpu_ioctl(int fd, unsigned long request, ...)
|
||||
{
|
||||
static thread_local bool entered = false;
|
||||
va_list args;
|
||||
|
@@ -320,8 +320,8 @@ is_i915(int fd) {
|
||||
return strcmp("i915", name) == 0;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default"))) int
|
||||
open(const char *path, int flags, ...)
|
||||
__attribute__ ((visibility ("default"))) static int
|
||||
intel_sanitize_gpu_open(const char *path, int flags, ...)
|
||||
{
|
||||
va_list args;
|
||||
mode_t mode;
|
||||
@@ -342,11 +342,11 @@ open(const char *path, int flags, ...)
|
||||
return fd;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default"), alias ("open"))) int
|
||||
open64(const char *path, int flags, ...);
|
||||
__attribute__ ((visibility ("default"), alias ("intel_sanitize_gpu_open"))) static int
|
||||
intel_sanitize_gpu_open64(const char *path, int flags, ...);
|
||||
|
||||
__attribute__ ((visibility ("default"))) int
|
||||
close(int fd)
|
||||
__attribute__ ((visibility ("default"))) static int
|
||||
intel_sanitize_gpu_close(int fd)
|
||||
{
|
||||
MUTEX_LOCK();
|
||||
|
||||
@@ -358,8 +358,8 @@ close(int fd)
|
||||
return libc_close(fd);
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default"))) int
|
||||
fcntl(int fd, int cmd, ...)
|
||||
__attribute__ ((visibility ("default"))) static int
|
||||
intel_sanitize_gpu_fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
va_list args;
|
||||
int param;
|
||||
@@ -380,8 +380,8 @@ fcntl(int fd, int cmd, ...)
|
||||
return res;
|
||||
}
|
||||
|
||||
__attribute__ ((visibility ("default"))) int
|
||||
ioctl(int fd, unsigned long request, ...)
|
||||
__attribute__ ((visibility ("default"))) static int
|
||||
intel_sanitize_gpu_ioctl(int fd, unsigned long request, ...)
|
||||
{
|
||||
int res;
|
||||
va_list args;
|
||||
|
@@ -72,26 +72,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)vsnprintf(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)
|
||||
@@ -406,12 +439,14 @@ bool loader_get_user_preferred_fd(int *fd_render_gpu, int *original_fd)
|
||||
char *str;
|
||||
} prime = {};
|
||||
prime.str = NULL;
|
||||
|
||||
#ifdef USE_DRICONF
|
||||
if (dri_prime)
|
||||
prime.str = strdup(dri_prime);
|
||||
#ifdef USE_DRICONF
|
||||
else
|
||||
prime.str = loader_get_dri_config_device_id();
|
||||
#else
|
||||
if (dri_prime)
|
||||
prime = strdup(dri_prime);
|
||||
#endif
|
||||
|
||||
if (prime.str == NULL) {
|
||||
|
@@ -39,7 +39,7 @@ extern "C" {
|
||||
/* 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);
|
||||
|
||||
char *
|
||||
loader_get_kernel_driver_name(int fd);
|
||||
|
@@ -28,6 +28,6 @@ libloader = static_library(
|
||||
c_args : loader_c_args,
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_util, inc_gallium],
|
||||
dependencies : [idep_mesautil, dep_libdrm, dep_thread, dep_xcb, dep_xcb_xrandr],
|
||||
dependencies : [idep_mesautil, dep_libdrm, dep_thread, dep_xcb, dep_xcb_xrandr, dep_hilog],
|
||||
build_by_default : false,
|
||||
)
|
||||
|
@@ -79,7 +79,7 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_)
|
||||
info->dlpi_phdr[i].p_vaddr);
|
||||
ptrdiff_t len = info->dlpi_phdr[i].p_filesz;
|
||||
|
||||
while (len >= sizeof(struct build_id_note)) {
|
||||
while (len >= (int)(sizeof(struct build_id_note))) {
|
||||
if (note->nhdr.n_type == NT_GNU_BUILD_ID &&
|
||||
note->nhdr.n_descsz != 0 &&
|
||||
note->nhdr.n_namesz == 4 &&
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
#ifdef HAVE_LIBUNWIND
|
||||
#define UNW_LOCAL_ONLY
|
||||
#include <libunwind.h>
|
||||
#include "libunwind.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user