diff --git a/BUILD.gn b/BUILD.gn index 2a03af468f865fbeea3cd0101f7c2d11be0b4f21..34c2481e8b5ae915cb7c970ab8d38ad1dbbb135b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -28,17 +28,54 @@ action("mesa3d_action_build") { ohos_root_path = rebase_path("//") product_name = rebase_path("${root_build_dir}", "//out") mesa3d_source_path = rebase_path("//third_party/mesa3d", root_build_dir) + + if (is_asan) { + if (use_hwasan) { + asan_option = "hwasan" + } else { + asan_option = "swasan" + } + } else { + asan_option = "noasan" + } + + if (use_clang_coverage) { + coverage_option = "use_clang_coverage" + } else { + coverage_option = "no_coverage" + } + if (use_new_skia) { + skia_version = "new_skia" + } else { + skia_version = "skia" + } args = [ "$ohos_root_path", "$product_name", "$mesa3d_source_path", + "$asan_option", + "$coverage_option", + "$skia_version" ] external_deps = [ "hilog:libhilog", "graphic_surface:surface", - "skia:expat", "zlib:libz", ] + if (use_new_skia) { + external_deps += [ "skia:expatm133", ] + } else { + external_deps += [ "skia:expat", ] + } +} + +ohos_copy("mesa3d_unstripped_copy") { + sources = [ + "${root_build_dir}/thirdparty/mesa3d/lib/libEGL_mesa.so", + "${root_build_dir}/thirdparty/mesa3d/lib/libgallium-25.0.1.so", + ] + outputs = [ root_out_dir + "/lib.unstripped/thirdparty/mesa3d/{{source_file_part}}" ] + deps = [ ":mesa3d_action_build" ] } ohos_prebuilt_shared_library("mesa3d_libEGL") { @@ -47,7 +84,12 @@ ohos_prebuilt_shared_library("mesa3d_libEGL") { part_name = "$PART_NAME" module_install_dir = "lib64" install_enable = true - deps = [ ":mesa3d_action_build" ] + enable_strip = true + mini_debug = true + deps = [ + ":mesa3d_action_build", + ":mesa3d_unstripped_copy" + ] } ohos_prebuilt_shared_library("mesa3d_libgallium") { @@ -56,7 +98,12 @@ ohos_prebuilt_shared_library("mesa3d_libgallium") { part_name = "$PART_NAME" module_install_dir = "lib64" install_enable = true - deps = [ ":mesa3d_action_build" ] + enable_strip = true + mini_debug = true + deps = [ + ":mesa3d_action_build", + ":mesa3d_unstripped_copy" + ] } group("zink_opengl") { diff --git a/OAT.xml b/OAT.xml index b0537e94582fc3112cc91982b1d3a73ac67990b2..1ae8aad29ce25aebdcc7b8f26a647f4cfab43ea7 100644 --- a/OAT.xml +++ b/OAT.xml @@ -74,8 +74,10 @@ Note:If the text contains special characters, please escape them according to th + + @@ -84,6 +86,10 @@ Note:If the text contains special characters, please escape them according to th + + + + diff --git a/README.OpenSource b/README.OpenSource index e2f957b42c92fbfb27b23560315e11adf5bda9d6..92d4d6ae8a412137d59fe3d0847beb5e6a7fc5fe 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -1,11 +1,11 @@ [ { - "Name": "mesa", + "Name": "Mesa3D - MesaLib", "License": "MIT license", "License File": "docs/license.rst", "Version Number": "25.0.1", "Owner": "liaosirui@huawei.com", - "Upstream URL": "https://archive.mesa3d.org/mesa-25.0.1.tar.xz", + "Upstream URL": "https://gitlab.freedesktop.org/mesa/mesa", "Description": "mesa is an open-source software implementation of OpenGL, Vulkan, and other graphics API specifications." } ] \ No newline at end of file diff --git a/dependency_inputs.gni b/dependency_inputs.gni index 280de6d689dbf422248c69ae6d39d8a532a2398c..e6c8f63f396fef156c3c777056e86e816248bde1 100644 --- a/dependency_inputs.gni +++ b/dependency_inputs.gni @@ -37,7 +37,6 @@ declare_args() { "./include/drm-uapi/drm.h", "./include/drm-uapi/gpu_scheduler.h", "./include/drm-uapi/lima_drm.h", - "./include/drm-uapi/sync_file.h", "./include/drm-uapi/drm_mode.h", "./include/drm-uapi/d3dkmthk.h", "./include/drm-uapi/msm_drm.h", @@ -223,7 +222,6 @@ declare_args() { "./.gitlab-ci/bare-metal/serial_buffer.py", "./.gitlab-ci/bare-metal/eth008-power-relay.py", "./.gitlab-ci/bare-metal/poe_run.py", - "./.gitlab-ci/bare-metal/google-power-relay.py", "./.gitlab-ci/bare-metal/cros_servo_run.py", "./.gitlab-ci/bare-metal/mkbootimg.py", "./.gitlab-ci/report-flakes.py", @@ -497,7 +495,6 @@ declare_args() { "./src/util/perf/u_perfetto.h", "./src/util/perf/u_gpuvis.c", "./src/util/perf/u_trace.py", - "./src/util/perf/gpuvis_trace_utils.h", "./src/util/perf/u_perfetto_renderpass.h", "./src/util/perf/u_trace.c", "./src/util/perf/cpu_trace.h", @@ -1006,7 +1003,6 @@ declare_args() { "./src/amd/vpelib/src/core/color_gamma.c", "./src/amd/vpelib/src/core/vpe_visual_confirm.c", "./src/amd/vpelib/src/core/color_bg.c", - "./src/amd/vpelib/src/core/geometric_scaling.c", "./src/amd/vpelib/src/core/color_table.c", "./src/amd/vpelib/src/core/resource.c", "./src/amd/vpelib/src/core/background.c", @@ -1537,7 +1533,6 @@ declare_args() { "./src/etnaviv/drm-shim/etnaviv_noop.c", "./src/etnaviv/drm-shim/meson.build", "./src/etnaviv/hwdb/etna_hwdb.h", - "./src/etnaviv/hwdb/amlogic/gc_feature_database.h", "./src/etnaviv/hwdb/hwdb.h.py", "./src/etnaviv/hwdb/st/gc_feature_database.h", "./src/etnaviv/hwdb/etna_hwdb.c", diff --git a/ohos/build_ohos64.py b/ohos/build_ohos64.py index a103065eeb09709ef56693a3d739b819d444eee9..decdfce8017afa3f7cbda98426223fbe5b5e7acd 100755 --- a/ohos/build_ohos64.py +++ b/ohos/build_ohos64.py @@ -24,11 +24,11 @@ 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") + if len(sys.argv) < 7: + print("must input the OpenHarmony directory, the product name, the source dir, the asan option, the coverage option and the skia version") exit(-1) script_dir = os.path.split(os.path.abspath( __file__))[0] - run_cross_pross_cmd = 'python3 ' + script_dir + '/meson_cross_process64.py ' + sys.argv[1] + ' ' + sys.argv[2] + run_cross_pross_cmd = 'python3 ' + script_dir + '/meson_cross_process64.py ' + sys.argv[1] + ' ' + sys.argv[2] + ' ' + sys.argv[4] + ' ' + sys.argv[5] + ' ' + sys.argv[6] os.system(run_cross_pross_cmd) run_build_cmd = 'PKG_CONFIG_PATH=./thirdparty/mesa3d/pkgconfig ' diff --git a/ohos/meson_cross_process64.py b/ohos/meson_cross_process64.py index 6c8d0c85fabe791278b25a7f16d123b81165826d..a9232bee0e3bc476d4cbc755497cf62ca5b1f055 100755 --- a/ohos/meson_cross_process64.py +++ b/ohos/meson_cross_process64.py @@ -36,13 +36,25 @@ c_args = [ '--target=aarch64-linux-ohosmusl', '--sysroot=sysroot_stub', '-fno-emulated-tls', - '-fPIC'] + '-fPIC', + '-g', + '-O2', + '-D_FORTIFY_SOURCE=2', + '-fstack-protector-all', + compile_args_stub + ] cpp_args = [ '--target=aarch64-linux-ohosmusl', '--sysroot=sysroot_stub', '-fno-emulated-tls', - '-fPIC'] + '-fPIC', + '-g', + '-O2', + '-D_FORTIFY_SOURCE=2', + '-fstack-protector-all', + compile_args_stub + ] c_link_args = [ '--target=aarch64-linux-ohosmusl', @@ -52,6 +64,7 @@ c_link_args = [ '-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', + link_args_stub ] cpp_link_args = [ @@ -66,6 +79,7 @@ cpp_link_args = [ '-Wl,--exclude-libs=libvpx_assembly_arm.a', '-Wl,--warn-shared-textrel', '--rtlib=compiler-rt', + link_args_stub ] [binaries] @@ -84,46 +98,104 @@ cpu = 'armv8' endian = 'little' ''' -def generate_cross_file(project_stub_in, sysroot_stub_in): +hwasan_compile_args = ''' + '-shared-libasan', + '-fsanitize=hwaddress', + '-mllvm', + '-hwasan-globals=0', + '-fno-lto', + '-fno-whole-program-vtables', +''' +hwasan_link_args = ''' + '-shared-libasan', + '-fsanitize=hwaddress', +''' + +swasan_compile_args = ''' + '-fsanitize=address', + '-fno-inline-functions', + '-fno-inline', + '-fsanitize-address-use-after-scope', + '-fno-omit-frame-pointer', +''' +swasan_link_args = ''' + '-lclang_rt.asan', +''' +noasan_compile_args = ''' +''' +noasan_link_args = ''' +''' + +coverage_compile_args = ''' + '--coverage', +''' +coverage_link_args = ''' + '--coverage', +''' +def generate_cross_file(project_stub_in, sysroot_stub_in, asan_option, coverage_option): with open("thirdparty/mesa3d/cross_file", 'w+') as file: result = corss_file_content.replace("project_stub", project_stub_in) result = result.replace("sysroot_stub", sysroot_stub_in) + compile_args = "" + link_args = "" + if asan_option == "hwasan": + compile_args = hwasan_compile_args + link_args = hwasan_link_args + elif asan_option == "swasan": + compile_args = swasan_compile_args + link_args = swasan_link_args + else: + compile_args = noasan_compile_args + link_args = noasan_link_args + if coverage_option == "use_clang_coverage": + compile_args = compile_args + coverage_compile_args + link_args = link_args + coverage_link_args + result = result.replace("compile_args_stub", compile_args) + result = result.replace("link_args_stub", link_args) file.write(result) print("generate_cross_file") -def generate_pc_file(file_raw, project_dir, product_name): +def generate_pc_file(file_raw, project_dir, product_name, skia_version): print(file_raw) if not os.path.exists('thirdparty/mesa3d/pkgconfig'): os.makedirs('thirdparty/mesa3d/pkgconfig') - filename = 'thirdparty/mesa3d/pkgconfig/'+ ntpath.basename(file_raw) + shortfilename = ntpath.basename(file_raw) + filename = 'thirdparty/mesa3d/pkgconfig/'+ shortfilename 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") + if shortfilename == "expat.pc": + if skia_version == "new_skia": + raw_content = raw_content.replace("skia_folder_stub", "skia/m133") + raw_content = raw_content.replace("expat_lib_stub", "expatm133") + else: + raw_content = raw_content.replace("skia_folder_stub", "skia") + raw_content = raw_content.replace("expat_lib_stub", "expat") pc_file.write(raw_content) print("generate_pc_file") -def process_pkgconfig(project_dir, product_name): +def process_pkgconfig(project_dir, product_name, skia_version): 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) + generate_pc_file(template_dir + '/' + template, project_dir, product_name, skia_version) print("process_pkgconfig") -def prepare_environment(project_path, product): +def prepare_environment(project_path, product, asan_option, coverage_option, skia_version): 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) + generate_cross_file(project_path, sysroot_stub, asan_option, coverage_option) + process_pkgconfig(project_path, product, skia_version) if __name__ == '__main__': - if len(sys.argv) < 3: - print("must input the OpenHarmony directory and the product name") + if len(sys.argv) < 6: + print("must input the OpenHarmony directory, the product name, the asan option and the coverage option") exit(-1) - prepare_environment(sys.argv[1], sys.argv[2]) + prepare_environment(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]) diff --git a/ohos/pkgconfig_template/expat.pc b/ohos/pkgconfig_template/expat.pc index 7e6331369d82a15802b123a4af1353d75e84de16..d24f466d5ca278450a075d7e0ef4420718cd953c 100644 --- a/ohos/pkgconfig_template/expat.pc +++ b/ohos/pkgconfig_template/expat.pc @@ -1,10 +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 +libdir=${ohos_project_dir}/out/ohos-arm-release/obj/third_party/skia_folder_stub/third_party/expat +includedir=${ohos_project_dir}/third_party/skia_folder_stub/third_party/externals/expat/expat/lib Name: expat Version: 2.4.1 Description: expat XML parser -Libs: -L${libdir} -lexpat +Libs: -L${libdir} -lexpat_lib_stub Cflags: -I${includedir} expat diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 21cae9677588bf636ebe4190239c792cb7f2be65..5354bc0f032bcb26897bf595f5d259d9a50f6c2e 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -447,18 +447,7 @@ get_batch_state(struct zink_context *ctx) if (bs == ctx->last_free_batch_state) ctx->last_free_batch_state = NULL; } - /* try from the ones that are given back to the screen next */ - if (!bs) { - simple_mtx_lock(&screen->free_batch_states_lock); - if (screen->free_batch_states) { - bs = screen->free_batch_states; - bs->ctx = ctx; - screen->free_batch_states = bs->next; - if (bs == screen->last_free_batch_state) - screen->last_free_batch_state = NULL; - } - simple_mtx_unlock(&screen->free_batch_states_lock); - } + /* states are stored sequentially, so if the first one doesn't work, none of them will */ if (!bs && ctx->batch_states && ctx->batch_states->next) { /* only a submitted state can be reused */ diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index fd715b163f1f568d4b8702c6cfcb79f1395ba744..5fa43f4c1ec7d3b4fda0f15be751591c2a80bef7 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -30,6 +30,8 @@ #include "zink_resource.h" #include "zink_kopper.h" +#define SWAP_BUFFER_COUNT 5 + static void zink_kopper_set_present_mode_for_interval(struct kopper_displaytarget *cdt, int interval) { @@ -304,7 +306,11 @@ kopper_CreateSwapchain(struct zink_screen *screen, struct kopper_displaytarget * cswap->scci.clipped = VK_TRUE; } cswap->scci.presentMode = cdt->present_mode; - cswap->scci.minImageCount = cdt->caps.minImageCount; + if (SWAP_BUFFER_COUNT >= cdt->caps.minImageCount && SWAP_BUFFER_COUNT <= cdt->caps.maxImageCount) { + cswap->scci.minImageCount = SWAP_BUFFER_COUNT; + } else { + cswap->scci.minImageCount = cdt->caps.minImageCount; + } cswap->scci.preTransform = cdt->caps.currentTransform; if (cdt->formats[1]) cswap->scci.pNext = &cdt->format_list;