diff --git a/.gitignore b/.gitignore index 9b156306415..c84903486dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ *.pyc *.pyo *.out -/build +build-ohos +cross_file +pkgconfig/ +/build \ No newline at end of file diff --git a/cross_file b/cross_file index 5b44db25f6f..ee72ff61a61 100644 --- a/cross_file +++ b/cross_file @@ -3,39 +3,129 @@ needs_exe_wrapper = true c_args = [ - '--target=aarch64-linux-ohosmusl', - '--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl', - '-fno-emulated-tls', - '-fPIC'] + '-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 = [ - '--target=aarch64-linux-ohosmusl', - '--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl', - '-fno-emulated-tls', - '-fPIC'] + '-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 = [ - '--target=aarch64-linux-ohosmusl', + '-march=x86-64', + '--target=x86_64-linux-ohosmusl', '-fPIC', - '--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl/usr/lib/aarch64-linux-ohos', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++', + '--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 = [ - '--target=aarch64-linux-ohosmusl', - '--sysroot=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/out/dyrk3568/obj/third_party/musl/usr/lib/aarch64-linux-ohos', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/current/lib/aarch64-linux-ohos', - '-L/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/lib/aarch64-linux-ohos/c++', + '-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,--exclude-libs=libvpx_assembly_arm.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] @@ -45,10 +135,11 @@ cpp = ['ccache', '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/cl c_ld= 'lld' cpp_ld = 'lld' strip = '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip' +llvm-config = '/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-config' pkgconfig = '/usr/bin/pkg-config' [host_machine] system = 'linux' -cpu_family = 'arm' -cpu = 'armv8' +cpu_family = 'x86_64' +cpu = 'x86_64' endian = 'little' diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index a3a4e3c7ab7..c377a83965e 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -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 @@ -443,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 */ @@ -538,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 */ diff --git a/include/GL/gl.h b/include/GL/gl.h index e2f5408a5d5..f2baf442b6a 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -2085,7 +2085,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 diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h index ba47c26319b..1900b508062 100644 --- a/include/KHR/khrplatform.h +++ b/include/KHR/khrplatform.h @@ -108,7 +108,7 @@ #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C #elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \ - || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) + || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) || (defined(HAVE_OHOS_PLATFORM)) /* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */ # define KHRONOS_APICALL __attribute__((visibility("default"))) #else diff --git a/meson.build b/meson.build index adf9a7371b7..373c2fd1d51 100644 --- a/meson.build +++ b/meson.build @@ -173,7 +173,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'].contains(host_machine.system()) +system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'gnu/kfreebsd', 'dragonfly', 'linux', 'sunos', 'android', 'ohos'].contains(host_machine.system()) dri_drivers = get_option('dri-drivers') if dri_drivers.length() != 0 @@ -1660,7 +1660,7 @@ dep_libdrm_intel = null_dep _drm_amdgpu_ver = '2.4.110' _drm_radeon_ver = '2.4.71' _drm_nouveau_ver = '2.4.102' -_drm_intel_ver = '2.4.75' +_drm_intel_ver = '2.4.111' _drm_ver = '2.4.109' _libdrm_checks = [ @@ -1723,7 +1723,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'] diff --git a/ohos/build_ohos_x86.py b/ohos/build_ohos_x86.py new file mode 100644 index 00000000000..073a4360495 --- /dev/null +++ b/ohos/build_ohos_x86.py @@ -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 -Ddri-drivers= -Dgallium-drivers=crocus,iris \ + -Dvulkan-drivers= -Dgbm=enabled -Degl=enabled -Dcpp_rtti=false -Dglx=disabled -Dtools=intel -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 -j26') + os.system('ninja -C build-ohos install') diff --git a/ohos/meson_cross_process_x86.py b/ohos/meson_cross_process_x86.py new file mode 100644 index 00000000000..316d30a8dbf --- /dev/null +++ b/ohos/meson_cross_process_x86.py @@ -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/prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip' +llvm-config = 'project_stub/prebuilts/clang/ohos/linux-x86_64/llvm/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]) diff --git a/ohos/pkgconfig_template/libdrm_amdgpu.pc b/ohos/pkgconfig_template/libdrm_amdgpu.pc new file mode 100644 index 00000000000..b2f4ab80e00 --- /dev/null +++ b/ohos/pkgconfig_template/libdrm_amdgpu.pc @@ -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 diff --git a/ohos/pkgconfig_template/libdrm_radeon.pc b/ohos/pkgconfig_template/libdrm_radeon.pc new file mode 100644 index 00000000000..86bd291c902 --- /dev/null +++ b/ohos/pkgconfig_template/libdrm_radeon.pc @@ -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 diff --git a/ohos/pkgconfig_template/libelf.pc b/ohos/pkgconfig_template/libelf.pc new file mode 100644 index 00000000000..66b124d1288 --- /dev/null +++ b/ohos/pkgconfig_template/libelf.pc @@ -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} diff --git a/ohos/pkgconfig_template/libjpeg.pc b/ohos/pkgconfig_template/libjpeg.pc index 3ef5838d2fc..cc091dcfb9b 100644 --- a/ohos/pkgconfig_template/libjpeg.pc +++ b/ohos/pkgconfig_template/libjpeg.pc @@ -1,6 +1,6 @@ ohos_project_dir=ohos_project_directory_stub -libdir=${ohos_project_dir}/out/ohos-arm-release/obj/third_party/libjpeg/ -includedir=${ohos_project_dir}/third_party/libjpeg +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 diff --git a/ohos/pkgconfig_template/libpng.pc b/ohos/pkgconfig_template/libpng.pc index 53fcd73b026..6f534c961ee 100644 --- a/ohos/pkgconfig_template/libpng.pc +++ b/ohos/pkgconfig_template/libpng.pc @@ -1,5 +1,5 @@ ohos_project_dir=ohos_project_directory_stub -libdir=${ohos_project_dir}/out//ohos-arm-release/common/graphic_2d/ +libdir=${ohos_project_dir}/out/ohos-arm-release/thirdparty/libpng/ includedir=${ohos_project_dir}/third_party/libpng Name: png diff --git a/ohos/pkgconfig_template/libsurface.pc b/ohos/pkgconfig_template/libsurface.pc index af31e40d6ba..62fff8b0757 100644 --- a/ohos/pkgconfig_template/libsurface.pc +++ b/ohos/pkgconfig_template/libsurface.pc @@ -1,6 +1,6 @@ ohos_project_dir=ohos_project_directory_stub libdir=${ohos_project_dir}/out/ohos-arm-release/graphic/graphic_surface/ -includedir=${ohos_project_dir}/out/ohos-arm-release/innerkits/ohos-arm/graphic_surface/surface/include/ +includedir=${ohos_project_dir}/out/ohos-arm-release/innerkits/ohos-x86_64/graphic_surface/surface/include/ Name: libsurface Version: 2.4.1 diff --git a/ohos/pkgconfig_template/libudev.pc b/ohos/pkgconfig_template/libudev.pc index 2ec44585492..b078feb46d5 100644 --- a/ohos/pkgconfig_template/libudev.pc +++ b/ohos/pkgconfig_template/libudev.pc @@ -1,9 +1,9 @@ ohos_project_dir=ohos_project_directory_stub -libdir=${ohos_project_dir}/out/ohos-arm-release/packages/phone/system/lib/ -includedir=${ohos_project_dir}/third_party/eudev/export_include +libdir=${ohos_project_dir}/out/ohos-arm-release/obj/foundation/multimodalinput/input/libudev/ +includedir=${ohos_project_dir}/foundation/multimodalinput/input/libudev/include/ -Name: eudev -Description: eudev +Name: udev +Description: udev Version: 2.5.109 -Libs: -L${libdir} -ludev.z +Libs: -L${libdir} -lmmi_libudev Cflags: -I${includedir} \ No newline at end of file diff --git a/ohos/pkgconfig_template/libxml2.pc b/ohos/pkgconfig_template/libxml2.pc new file mode 100644 index 00000000000..06ce53a188c --- /dev/null +++ b/ohos/pkgconfig_template/libxml2.pc @@ -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} \ No newline at end of file diff --git a/pkgconfig/expat.pc b/pkgconfig/expat.pc index 9175285c5ea..d8517a4a5ec 100644 --- a/pkgconfig/expat.pc +++ b/pkgconfig/expat.pc @@ -1,5 +1,5 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/obj/third_party/skia/third_party/expat +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 diff --git a/pkgconfig/libdrm.pc b/pkgconfig/libdrm.pc index 1550922a80c..1f6e5221e78 100644 --- a/pkgconfig/libdrm.pc +++ b/pkgconfig/libdrm.pc @@ -1,5 +1,5 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/thirdparty/libdrm/ +libdir=${ohos_project_dir}/out/surface/thirdparty/libdrm/ includedir=${ohos_project_dir}/third_party/libdrm Name: libdrm diff --git a/pkgconfig/libhilog.pc b/pkgconfig/libhilog.pc index 63550513a1b..ffb15b1bfc3 100644 --- a/pkgconfig/libhilog.pc +++ b/pkgconfig/libhilog.pc @@ -1,5 +1,5 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/hiviewdfx/hilog +libdir=${ohos_project_dir}/out/surface/hiviewdfx/hilog includedir=${ohos_project_dir}/base/hiviewdfx/hilog/interfaces/native/innerkits/include Name: libhilog diff --git a/pkgconfig/libjpeg.pc b/pkgconfig/libjpeg.pc index 2f3f79a8d03..784420a3dde 100644 --- a/pkgconfig/libjpeg.pc +++ b/pkgconfig/libjpeg.pc @@ -1,6 +1,6 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/obj/third_party/libjpeg/ -includedir=${ohos_project_dir}/third_party/libjpeg +libdir=${ohos_project_dir}/out/surface/obj/third_party/libjpeg-turbo/ +includedir=${ohos_project_dir}/third_party/libjpeg-turbo Name: jpeg Description: jpeg diff --git a/pkgconfig/libpng.pc b/pkgconfig/libpng.pc index 79947294edc..1929b0b7155 100644 --- a/pkgconfig/libpng.pc +++ b/pkgconfig/libpng.pc @@ -1,5 +1,5 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out//dyrk3568/common/graphic_2d/ +libdir=${ohos_project_dir}/out/surface/thirdparty/libpng/ includedir=${ohos_project_dir}/third_party/libpng Name: png diff --git a/pkgconfig/libsurface.pc b/pkgconfig/libsurface.pc index bf134eea3b6..92753af1142 100644 --- a/pkgconfig/libsurface.pc +++ b/pkgconfig/libsurface.pc @@ -1,6 +1,6 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/graphic/graphic_surface/ -includedir=${ohos_project_dir}/out/dyrk3568/innerkits/ohos-arm64/graphic_surface/surface/include/ +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 diff --git a/pkgconfig/libudev.pc b/pkgconfig/libudev.pc index b64ee615f89..96dbab7aa30 100644 --- a/pkgconfig/libudev.pc +++ b/pkgconfig/libudev.pc @@ -1,9 +1,9 @@ ohos_project_dir=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${ohos_project_dir}/out/dyrk3568/packages/phone/system/lib/ -includedir=${ohos_project_dir}/third_party/eudev/export_include +libdir=${ohos_project_dir}/out/surface/obj/foundation/multimodalinput/input/libudev/ +includedir=${ohos_project_dir}/foundation/multimodalinput/input/libudev/include/ -Name: eudev -Description: eudev +Name: udev +Description: udev Version: 2.5.109 -Libs: -L${libdir} -ludev.z +Libs: -L${libdir} -lmmi_libudev Cflags: -I${includedir} \ No newline at end of file diff --git a/pkgconfig/wayland-client.pc b/pkgconfig/wayland-client.pc index a837e4decf3..b7d147f24a3 100644 --- a/pkgconfig/wayland-client.pc +++ b/pkgconfig/wayland-client.pc @@ -1,11 +1,11 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release datarootdir=${prefix}/share pkgdatadir=${datarootdir}/wayland -libdir=${prefix}/out/dyrk3568/graphic/graphic_2d +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/dyrk3568/gen/third_party/wayland_standard/protocol +Cflags: -I${includedir} -I${prefix}/out/surface/gen/third_party/wayland_standard/protocol Libs: -L${libdir} -lwayland_client.0.z diff --git a/pkgconfig/wayland-cursor.pc b/pkgconfig/wayland-cursor.pc index 5da56470df6..87a453c0792 100644 --- a/pkgconfig/wayland-cursor.pc +++ b/pkgconfig/wayland-cursor.pc @@ -1,5 +1,5 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release -libdir=${prefix}/out/dyrk3568/obj/third_party/wayland_standard/ +libdir=${prefix}/out/surface/obj/third_party/wayland_standard/ includedir=${prefix}/third_party/wayland_standard/cursor Name: wayland_cursor diff --git a/pkgconfig/wayland-egl.pc b/pkgconfig/wayland-egl.pc index dfe60d5cab7..c3f32c77700 100644 --- a/pkgconfig/wayland-egl.pc +++ b/pkgconfig/wayland-egl.pc @@ -1,6 +1,6 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release exec_prefix=${prefix} -libdir=${prefix}/out/dyrk3568/graphic/graphic_2d/ +libdir=${prefix}/out/surface/graphic/graphic_2d/ includedir=${prefix}/third_party/wayland_standard/egl Name: wayland-egl diff --git a/pkgconfig/wayland-protocols.pc b/pkgconfig/wayland-protocols.pc index 06de45bf2b6..09e68d683d6 100644 --- a/pkgconfig/wayland-protocols.pc +++ b/pkgconfig/wayland-protocols.pc @@ -1,7 +1,7 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release datarootdir=${prefix}/third_party pkgdatadir=${datarootdir}/wayland-protocols_standard -includedir = ${prefix}/out/dyrk3568/gen/third_party/wayland_standard/protocol +includedir = ${prefix}/out/surface/gen/third_party/wayland_standard/protocol Name: Wayland Protocols Description: Wayland protocol files Version: 1.24 diff --git a/pkgconfig/wayland-scanner.pc b/pkgconfig/wayland-scanner.pc index 64eb35a6d15..b749558ffea 100644 --- a/pkgconfig/wayland-scanner.pc +++ b/pkgconfig/wayland-scanner.pc @@ -2,7 +2,7 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release exec_prefix=${prefix} datarootdir=${prefix}/share pkgdatadir=${datarootdir}/wayland -wayland_scanner=${prefix}/out/dyrk3568/clang_x64/graphic/graphic_2d/wayland_scanner +wayland_scanner=${prefix}/out/surface/clang_x64/graphic/graphic_2d/wayland_scanner Name: Wayland Scanner Description: Wayland scanner diff --git a/pkgconfig/wayland-server.pc b/pkgconfig/wayland-server.pc index 4d11261e622..c1bc38e7d31 100644 --- a/pkgconfig/wayland-server.pc +++ b/pkgconfig/wayland-server.pc @@ -2,11 +2,11 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release exec_prefix=${prefix} datarootdir=${prefix}/share pkgdatadir=${datarootdir}/wayland -libdir=${prefix}/out/dyrk3568/graphic/graphic_2d +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/dyrk3568/gen/third_party/wayland_standard/protocol +Cflags: -I${includedir} -I${prefix}/out/surface/gen/third_party/wayland_standard/protocol Libs: -L${libdir} -lwayland_server.0.z diff --git a/pkgconfig/zlib.pc b/pkgconfig/zlib.pc index 987ff01d855..0cc348c89a4 100644 --- a/pkgconfig/zlib.pc +++ b/pkgconfig/zlib.pc @@ -1,6 +1,6 @@ prefix=/home/geekyharmony/ohsc/OpenHarmony-5.1.0-Release exec_prefix=${prefix} -libdir=${prefix}/out/dyrk3568/obj/third_party/zlib +libdir=${prefix}/out/surface/obj/third_party/zlib sharedlibdir=${libdir} includedir=${prefix}/third_party/zlib diff --git a/src/egl/drivers/dri2/platform_ohos.c b/src/egl/drivers/dri2/platform_ohos.c index 5922cc5433b..de3cd7aec5c 100644 --- a/src/egl/drivers/dri2/platform_ohos.c +++ b/src/egl/drivers/dri2/platform_ohos.c @@ -1293,3 +1293,5 @@ cleanup: dri2_display_destroy(disp); return _eglError(EGL_NOT_INITIALIZED, err); } + +GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image){} \ No newline at end of file diff --git a/src/egl/drivers/dri2/platform_ohos.h b/src/egl/drivers/dri2/platform_ohos.h index dfec8bd38a7..801ded2c39c 100644 --- a/src/egl/drivers/dri2/platform_ohos.h +++ b/src/egl/drivers/dri2/platform_ohos.h @@ -50,7 +50,7 @@ ANativeWindow_acquire(struct ANativeWindow *window) static inline void ANativeWindow_release(struct ANativeWindow *window) { - NativeObjectReference(window); + NativeObjectUnreference(window); } static inline int32_t @@ -66,7 +66,9 @@ ANativeWindow_dequeueBuffer(struct ANativeWindow *window, struct ANativeWindowBuffer **buffer, int *fenceFd) { - return NativeWindowRequestBuffer(window, buffer, fenceFd); + int32_t ret = NativeWindowRequestBuffer(window, buffer, fenceFd); + NativeObjectReference(*buffer); + return ret; } static inline int32_t @@ -77,7 +79,9 @@ ANativeWindow_queueBuffer(struct ANativeWindow *window, struct Region dirty; dirty.rectNumber = 0; dirty.rects = NULL; - return NativeWindowFlushBuffer(window, buffer, fenceFd, dirty); + int32_t ret = NativeWindowFlushBuffer(window, buffer, fenceFd, dirty); + NativeObjectUnreference(buffer); + return ret; } static inline int32_t diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index c1a1d8540af..7553f208ea7 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1764,7 +1764,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) { @@ -1820,7 +1820,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); @@ -1896,7 +1896,7 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list, } -static EGLSync EGLAPIENTRY +EGLAPI EGLSync EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list) { _EGLDisplay *disp = _eglLockDisplay(dpy); @@ -1970,7 +1970,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); @@ -2024,7 +2024,7 @@ eglClientWaitSync(EGLDisplay dpy, EGLSync sync, return _eglClientWaitSyncCommon(disp, dpy, s, flags, timeout); } -static EGLint EGLAPIENTRY +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) { @@ -2059,7 +2059,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); @@ -2129,7 +2129,7 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *valu } -static EGLBoolean EGLAPIENTRY +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value) { _EGLDisplay *disp = _eglLockDisplay(dpy); @@ -2156,7 +2156,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *valu return result; } -static EGLint EGLAPIENTRY +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSync sync) { _EGLDisplay *disp = _eglLockDisplay(dpy); diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index a9597b002b9..6f7ce85be35 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -529,7 +529,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 ) diff --git a/src/intel/common/meson.build b/src/intel/common/meson.build index 4cd076c73fd..0bfd9822456 100644 --- a/src/intel/common/meson.build +++ b/src/intel/common/meson.build @@ -79,7 +79,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 gentest_xml = files('tests/gentest.xml') _name = 'gentest_pack.h' gentest_pack = custom_target( diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c index f2f41334c07..ce272450511 100644 --- a/src/intel/tools/intel_dump_gpu.c +++ b/src/intel/tools/intel_dump_gpu.c @@ -496,8 +496,8 @@ maybe_init(int fd) output_filename, device, devinfo.ver); } -__attribute__ ((visibility ("default"))) int -ioctl(int fd, unsigned long request, ...) +__attribute__ ((visibility ("default"))) static int +inte_dump_gpu_ioctl(int fd, unsigned long request, ...) { va_list args; void *argp; diff --git a/src/intel/tools/intel_sanitize_gpu.c b/src/intel/tools/intel_sanitize_gpu.c index f2fe9692f93..a9e624e147d 100644 --- a/src/intel/tools/intel_sanitize_gpu.c +++ b/src/intel/tools/intel_sanitize_gpu.c @@ -317,8 +317,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; @@ -339,11 +339,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(); @@ -355,8 +355,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; @@ -377,8 +377,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; diff --git a/src/loader/loader.c b/src/loader/loader.c index e843fc7af32..3a5bbe754e5 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -89,7 +89,7 @@ static void ohos_logger(int level, const char *fmt, ...) char log_string[MAX_BUFFER_LEN]; va_list args; va_start(args, fmt); - (void)snprintf(log_string, MAX_BUFFER_LEN, fmt, args); + (void)vsnprintf(log_string, MAX_BUFFER_LEN, fmt, args); va_end(args); switch (level) { case _LOADER_WARNING: diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index b6249031730..2d0e5c920b4 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -245,19 +245,6 @@ panfrost_supports_compressed_format(struct panfrost_device *dev, unsigned fmt) return dev->compressed_formats & (1 << idx); } -/* Check for AFBC hardware support. AFBC is introduced in v5. Implementations - * may omit it, signaled as a nonzero value in the AFBC_FEATURES property. */ - -static bool -panfrost_query_afbc(int fd, unsigned arch) -{ - unsigned reg = panfrost_query_raw(fd, - DRM_PANFROST_PARAM_AFBC_FEATURES, - false, 0); - - return (arch >= 5) && (reg == 0); -} - /* * To pipeline multiple tiles, a given tile may use at most half of the tile * buffer. This function returns the optimal size (assuming pipelining). @@ -277,6 +264,19 @@ panfrost_query_optimal_tib_size(const struct panfrost_device *dev) return dev->model->tilebuffer_size / 2; } +/* Check for AFBC hardware support. AFBC is introduced in v5. Implementations + * may omit it, signaled as a nonzero value in the AFBC_FEATURES property. */ + +static bool +panfrost_query_afbc(int fd, unsigned arch) +{ + unsigned reg = panfrost_query_raw(fd, + DRM_PANFROST_PARAM_AFBC_FEATURES, + false, 0); + + return (arch >= 5) && (reg == 0); +} + void panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev) { diff --git a/src/util/build_id.c b/src/util/build_id.c index e56eecd4d6b..3e029d6742c 100644 --- a/src/util/build_id.c +++ b/src/util/build_id.c @@ -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 && @@ -91,13 +91,6 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_) size_t offset = sizeof(ElfW(Nhdr)) + ALIGN_POT(note->nhdr.n_namesz, 4) + ALIGN_POT(note->nhdr.n_descsz, 4); - - // 05 00 00 00 04 00 00 00 4f 48 4f 53 00 01 00 00 00 00 00 00 - if ((note->nhdr.n_type == 0x534f484f) && (len > 20)) { - // .note.ohos.ident is not a valid PT_NOTE section, use offset in section header later - offset = 20; - } - note = (struct build_id_note *)((char *)note + offset); len -= offset; } diff --git a/src/util/u_debug_stack.h b/src/util/u_debug_stack.h index e8177580dca..7df936ab79d 100644 --- a/src/util/u_debug_stack.h +++ b/src/util/u_debug_stack.h @@ -32,7 +32,7 @@ #ifdef HAVE_LIBUNWIND #define UNW_LOCAL_ONLY -#include +#include "libunwind.h" #endif /**