meson,amd: Remove Windows libelf wrap

Functionality isn't worth the maintenance cost.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18797>
This commit is contained in:
James Park 2022-09-08 09:15:00 -07:00 committed by Yonggang Luo
parent 3da8d29132
commit f297f05c67
7 changed files with 37 additions and 15 deletions

View File

@ -545,6 +545,7 @@ debian-mingw32-x86_64:
VULKAN_DRIVERS: "swrast,amd,microsoft-experimental" VULKAN_DRIVERS: "swrast,amd,microsoft-experimental"
GALLIUM_ST: > GALLIUM_ST: >
-D gallium-opencl=icd -D gallium-opencl=icd
-D opencl-native=false
-D opencl-spirv=true -D opencl-spirv=true
-D microsoft-clc=enabled -D microsoft-clc=enabled
-D static-libclc=all -D static-libclc=all

View File

@ -1903,12 +1903,8 @@ with_opencl_native = _opencl != 'disabled' and get_option('opencl-native')
if (with_amd_vk or with_gallium_radeonsi or if (with_amd_vk or with_gallium_radeonsi or
(with_gallium_opencl and with_opencl_native) or (with_gallium_opencl and with_opencl_native) or
(with_gallium_r600 and with_llvm)) (with_gallium_r600 and with_llvm))
if with_platform_windows dep_elf = dependency('libelf', required : false)
dep_elf = dependency('libelf', required : false, fallback : ['libelf', 'libelf_dep']) if not with_platform_windows and not dep_elf.found()
else
dep_elf = dependency('libelf', required : false)
endif
if not dep_elf.found()
dep_elf = cc.find_library('elf') dep_elf = cc.find_library('elf')
endif endif
else else

View File

@ -27,8 +27,10 @@
#include "util/u_math.h" #include "util/u_math.h"
#include "util/u_memory.h" #include "util/u_memory.h"
#ifndef _WIN32
#include <gelf.h> #include <gelf.h>
#include <libelf.h> #include <libelf.h>
#endif
#include <sid.h> #include <sid.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1002,6 +1002,7 @@ static void ac_sqtt_dump_spm(const struct ac_spm_trace_data *spm_trace,
fseek(output, file_offset, SEEK_SET); fseek(output, file_offset, SEEK_SET);
} }
#ifndef _WIN32
static void ac_sqtt_dump_data(struct radeon_info *rad_info, static void ac_sqtt_dump_data(struct radeon_info *rad_info,
struct ac_thread_trace *thread_trace, struct ac_thread_trace *thread_trace,
const struct ac_spm_trace_data *spm_trace, const struct ac_spm_trace_data *spm_trace,
@ -1188,11 +1189,15 @@ static void ac_sqtt_dump_data(struct radeon_info *rad_info,
ac_sqtt_dump_spm(spm_trace, file_offset, output); ac_sqtt_dump_spm(spm_trace, file_offset, output);
} }
} }
#endif
int ac_dump_rgp_capture(struct radeon_info *info, int ac_dump_rgp_capture(struct radeon_info *info,
struct ac_thread_trace *thread_trace, struct ac_thread_trace *thread_trace,
const struct ac_spm_trace_data *spm_trace) const struct ac_spm_trace_data *spm_trace)
{ {
#ifdef _WIN32
return -1;
#else
char filename[2048]; char filename[2048];
struct tm now; struct tm now;
time_t t; time_t t;
@ -1215,4 +1220,5 @@ int ac_dump_rgp_capture(struct radeon_info *info,
fclose(f); fclose(f);
return 0; return 0;
#endif
} }

View File

@ -73,8 +73,6 @@ amd_common_files = files(
'ac_shader_util.h', 'ac_shader_util.h',
'ac_gpu_info.c', 'ac_gpu_info.c',
'ac_gpu_info.h', 'ac_gpu_info.h',
'ac_rtld.c',
'ac_rtld.h',
'ac_surface.c', 'ac_surface.c',
'ac_surface.h', 'ac_surface.h',
'ac_debug.c', 'ac_debug.c',
@ -89,7 +87,6 @@ amd_common_files = files(
'ac_rgp.h', 'ac_rgp.h',
'ac_msgpack.c', 'ac_msgpack.c',
'ac_msgpack.h', 'ac_msgpack.h',
'ac_rgp_elf_object_pack.c',
'ac_nir.c', 'ac_nir.c',
'ac_nir.h', 'ac_nir.h',
'ac_nir_opt_outputs.c', 'ac_nir_opt_outputs.c',
@ -104,6 +101,14 @@ amd_common_files = files(
'ac_perfcounter.h', 'ac_perfcounter.h',
) )
if not with_platform_windows
amd_common_files += files(
'ac_rtld.c',
'ac_rtld.h',
'ac_rgp_elf_object_pack.c',
)
endif
libamd_common = static_library( libamd_common = static_library(
'amd_common', 'amd_common',
[amd_common_files, sid_tables_h, amdgfxregs_h, gfx10_format_table_c], [amd_common_files, sid_tables_h, amdgfxregs_h, gfx10_format_table_c],

View File

@ -41,7 +41,9 @@
#include "util/debug.h" #include "util/debug.h"
#include "ac_binary.h" #include "ac_binary.h"
#include "ac_nir.h" #include "ac_nir.h"
#ifndef _WIN32
#include "ac_rtld.h" #include "ac_rtld.h"
#endif
#include "aco_interface.h" #include "aco_interface.h"
#include "sid.h" #include "sid.h"
#include "vk_format.h" #include "vk_format.h"
@ -1907,6 +1909,7 @@ radv_postprocess_config(const struct radv_device *device, const struct ac_shader
} }
} }
#ifndef _WIN32
static bool static bool
radv_open_rtld_binary(struct radv_device *device, const struct radv_shader *shader, radv_open_rtld_binary(struct radv_device *device, const struct radv_shader *shader,
const struct radv_shader_binary *binary, struct ac_rtld_binary *rtld_binary) const struct radv_shader_binary *binary, struct ac_rtld_binary *rtld_binary)
@ -1950,12 +1953,16 @@ radv_open_rtld_binary(struct radv_device *device, const struct radv_shader *shad
return ac_rtld_open(rtld_binary, open_info); return ac_rtld_open(rtld_binary, open_info);
} }
#endif
bool bool
radv_shader_binary_upload(struct radv_device *device, const struct radv_shader_binary *binary, radv_shader_binary_upload(struct radv_device *device, const struct radv_shader_binary *binary,
struct radv_shader *shader, void *dest_ptr) struct radv_shader *shader, void *dest_ptr)
{ {
if (binary->type == RADV_BINARY_TYPE_RTLD) { if (binary->type == RADV_BINARY_TYPE_RTLD) {
#ifdef _WIN32
return false;
#else
struct ac_rtld_binary rtld_binary = {0}; struct ac_rtld_binary rtld_binary = {0};
if (!radv_open_rtld_binary(device, shader, binary, &rtld_binary)) { if (!radv_open_rtld_binary(device, shader, binary, &rtld_binary)) {
@ -1977,6 +1984,7 @@ radv_shader_binary_upload(struct radv_device *device, const struct radv_shader_b
shader->code_ptr = dest_ptr; shader->code_ptr = dest_ptr;
ac_rtld_close(&rtld_binary); ac_rtld_close(&rtld_binary);
#endif
} else { } else {
struct radv_shader_binary_legacy *bin = (struct radv_shader_binary_legacy *)binary; struct radv_shader_binary_legacy *bin = (struct radv_shader_binary_legacy *)binary;
memcpy(dest_ptr, bin->data + bin->stats_size, bin->code_size); memcpy(dest_ptr, bin->data + bin->stats_size, bin->code_size);
@ -2004,6 +2012,10 @@ radv_shader_create(struct radv_device *device, const struct radv_shader_binary *
shader->ref_count = 1; shader->ref_count = 1;
if (binary->type == RADV_BINARY_TYPE_RTLD) { if (binary->type == RADV_BINARY_TYPE_RTLD) {
#ifdef _WIN32
free(shader);
return NULL;
#else
struct ac_rtld_binary rtld_binary = {0}; struct ac_rtld_binary rtld_binary = {0};
if (!radv_open_rtld_binary(device, shader, binary, &rtld_binary)) { if (!radv_open_rtld_binary(device, shader, binary, &rtld_binary)) {
@ -2031,6 +2043,7 @@ radv_shader_create(struct radv_device *device, const struct radv_shader_binary *
shader->code_size = rtld_binary.rx_size; shader->code_size = rtld_binary.rx_size;
shader->exec_size = rtld_binary.exec_size; shader->exec_size = rtld_binary.exec_size;
ac_rtld_close(&rtld_binary); ac_rtld_close(&rtld_binary);
#endif
} else { } else {
assert(binary->type == RADV_BINARY_TYPE_LEGACY); assert(binary->type == RADV_BINARY_TYPE_LEGACY);
config = ((struct radv_shader_binary_legacy *)binary)->base.config; config = ((struct radv_shader_binary_legacy *)binary)->base.config;
@ -2050,6 +2063,10 @@ radv_shader_create(struct radv_device *device, const struct radv_shader_binary *
} }
if (binary->type == RADV_BINARY_TYPE_RTLD) { if (binary->type == RADV_BINARY_TYPE_RTLD) {
#ifdef _WIN32
free(shader);
return NULL;
#else
struct radv_shader_binary_rtld *bin = (struct radv_shader_binary_rtld *)binary; struct radv_shader_binary_rtld *bin = (struct radv_shader_binary_rtld *)binary;
struct ac_rtld_binary rtld_binary = {0}; struct ac_rtld_binary rtld_binary = {0};
@ -2075,6 +2092,7 @@ radv_shader_create(struct radv_device *device, const struct radv_shader_binary *
shader->disasm_string[disasm_size] = 0; shader->disasm_string[disasm_size] = 0;
} }
ac_rtld_close(&rtld_binary); ac_rtld_close(&rtld_binary);
#endif
} else { } else {
struct radv_shader_binary_legacy *bin = (struct radv_shader_binary_legacy *)binary; struct radv_shader_binary_legacy *bin = (struct radv_shader_binary_legacy *)binary;

View File

@ -1,6 +0,0 @@
[wrap-git]
directory = libelf-lfg-win32-1.1.0-freebsd-12.1.0
url = https://github.com/LagFreeGames/libelf-lfg-win32.git
revision = 1.1.0
depth = 1