mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 01:10:16 +01:00
mesa: refactor the glapi/tls includes into a single, reused header
This is done by introduce predefined macro MESA_SYSTEM_HAS_KMS_DRM=system_has_kms_drm And after these change, the usage of USE_*_ASM macros in mesa/glapi are avoided. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36635>
This commit is contained in:
parent
82bafaa1fa
commit
8ca533c942
9 changed files with 59 additions and 78 deletions
|
|
@ -305,6 +305,11 @@ if freedreno_kmds.length() != 0 and freedreno_kmds != [ 'msm' ] and with_freedre
|
|||
endif
|
||||
endif
|
||||
|
||||
pre_args += ['-DMESA_SYSTEM_HAS_KMS_DRM=@0@'.format(system_has_kms_drm.to_int())]
|
||||
if host_machine.cpu_family() == 'x86' and with_glx_read_only_text
|
||||
pre_args += ['-DGLX_X86_READONLY_TEXT']
|
||||
endif
|
||||
|
||||
with_vdrm = [
|
||||
with_amdgpu_virtio,
|
||||
freedreno_kmds.contains('virtio'),
|
||||
|
|
@ -1326,10 +1331,6 @@ if host_machine.cpu_family() == 'x86'
|
|||
if system_has_kms_drm or host_machine.system() == 'gnu'
|
||||
with_asm_arch = 'x86'
|
||||
pre_args += ['-DUSE_X86_ASM']
|
||||
|
||||
if with_glx_read_only_text
|
||||
pre_args += ['-DGLX_X86_READONLY_TEXT']
|
||||
endif
|
||||
endif
|
||||
elif host_machine.cpu_family() == 'x86_64'
|
||||
if system_has_kms_drm
|
||||
|
|
|
|||
|
|
@ -5,28 +5,15 @@
|
|||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "../glapi/glapi.h"
|
||||
#include "glapi/glapi_priv.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86-64_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_ppc64le_tls.h"
|
||||
#if defined(_GLAPI_ENTRY_ARCH_TLS_H)
|
||||
#include _GLAPI_ENTRY_ARCH_TLS_H
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
#endif /* defined(_GLAPI_ENTRY_ARCH_TLS_H) */
|
||||
|
||||
#include "es1_glapi_mapi_tmp.h"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ libglesv1_cm = shared_library(
|
|||
],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : [ld_args_gc_sections],
|
||||
include_directories : [inc_src, inc_include],
|
||||
include_directories : [inc_mesa, inc_src, inc_include],
|
||||
link_with : shared_glapi_lib,
|
||||
dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11],
|
||||
soversion : host_machine.system() == 'windows' ? '' : '1',
|
||||
|
|
|
|||
|
|
@ -5,27 +5,15 @@
|
|||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "../glapi/glapi.h"
|
||||
#include "glapi/glapi_priv.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86-64_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_ppc64le_tls.h"
|
||||
#if defined(_GLAPI_ENTRY_ARCH_TLS_H)
|
||||
#include _GLAPI_ENTRY_ARCH_TLS_H
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#else
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
#endif /* defined(_GLAPI_ENTRY_ARCH_TLS_H) */
|
||||
|
||||
#include "es2_glapi_mapi_tmp.h"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ libgles2 = shared_library(
|
|||
],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : [ld_args_gc_sections],
|
||||
include_directories : [inc_src, inc_include],
|
||||
include_directories : [inc_mesa, inc_src, inc_include],
|
||||
link_with : shared_glapi_lib,
|
||||
dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11],
|
||||
soversion : host_machine.system() == 'windows' ? '' : '2',
|
||||
|
|
|
|||
|
|
@ -5,28 +5,15 @@
|
|||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "glapi/glapi/glapi.h"
|
||||
#include "glapi/glapi_priv.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86-64_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_ppc64le_tls.h"
|
||||
#if defined(_GLAPI_ENTRY_ARCH_TLS_H)
|
||||
#include _GLAPI_ENTRY_ARCH_TLS_H
|
||||
#define MAPI_TMP_STUB_ASM_GCC_NO_HIDDEN
|
||||
#else
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
#endif /* defined(_GLAPI_ENTRY_ARCH_TLS_H) */
|
||||
|
||||
#include "glapi_mapi_tmp.h"
|
||||
|
|
|
|||
25
src/mesa/glapi/glapi_priv.h
Normal file
25
src/mesa/glapi/glapi_priv.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* Copyright (C) 2010 LunarG Inc.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#ifndef _GLAPI_PRIV_H
|
||||
#define _GLAPI_PRIV_H
|
||||
|
||||
#include "glapi/glapi/glapi.h"
|
||||
#include "util/detect_arch.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(REALLY_INITIAL_EXEC)
|
||||
#if DETECT_ARCH_X86 && (MESA_SYSTEM_HAS_KMS_DRM || DETECT_OS_HURD)
|
||||
#define _GLAPI_ENTRY_ARCH_TLS_H "glapi/entry_x86_tls.h"
|
||||
#elif DETECT_ARCH_X86_64 && MESA_SYSTEM_HAS_KMS_DRM
|
||||
#define _GLAPI_ENTRY_ARCH_TLS_H "glapi/entry_x86-64_tls.h"
|
||||
#elif DETECT_ARCH_PPC_64 && UTIL_ARCH_LITTLE_ENDIAN && MESA_SYSTEM_HAS_KMS_DRM
|
||||
#define _GLAPI_ENTRY_ARCH_TLS_H "glapi/entry_ppc64le_tls.h"
|
||||
#endif
|
||||
#endif /* defined(REALLY_INITIAL_EXEC) */
|
||||
|
||||
#endif /* _GLAPI_PRIV_H */
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "../glapi/glapi.h"
|
||||
#include "glapi/glapi_priv.h"
|
||||
|
||||
struct mapi_stub {
|
||||
size_t name_offset;
|
||||
|
|
@ -20,12 +20,13 @@ _mesa_noop_entrypoint(const char *name);
|
|||
#define MAPI_TMP_PUBLIC_STUBS
|
||||
#include "shared_glapi_mapi_tmp.h"
|
||||
|
||||
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
|
||||
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86_tls.h"
|
||||
#if defined(_GLAPI_ENTRY_ARCH_TLS_H)
|
||||
#include _GLAPI_ENTRY_ARCH_TLS_H
|
||||
#define MAPI_TMP_STUB_ASM_GCC
|
||||
#include "shared_glapi_mapi_tmp.h"
|
||||
|
||||
#if DETECT_ARCH_X86
|
||||
|
||||
#ifndef GLX_X86_READONLY_TEXT
|
||||
__asm__(".balign 16\n"
|
||||
"x86_entry_end:");
|
||||
|
|
@ -88,12 +89,7 @@ entry_generate_or_patch(int slot, char *code, size_t size)
|
|||
return entry;
|
||||
}
|
||||
|
||||
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_x86-64_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC
|
||||
#include "shared_glapi_mapi_tmp.h"
|
||||
|
||||
#include <string.h>
|
||||
#elif DETECT_ARCH_X86_64
|
||||
|
||||
static void
|
||||
entry_patch_public(void)
|
||||
|
|
@ -109,12 +105,7 @@ entry_get_public(int slot)
|
|||
return (_glapi_proc) (x86_64_entry_start + slot * 32);
|
||||
}
|
||||
|
||||
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
|
||||
#include "../entry_ppc64le_tls.h"
|
||||
#define MAPI_TMP_STUB_ASM_GCC
|
||||
#include "shared_glapi_mapi_tmp.h"
|
||||
|
||||
#include <string.h>
|
||||
#elif DETECT_ARCH_PPC_64 && UTIL_ARCH_LITTLE_ENDIAN
|
||||
|
||||
static void
|
||||
entry_patch_public(void)
|
||||
|
|
@ -132,6 +123,12 @@ entry_get_public(int slot)
|
|||
|
||||
#else
|
||||
|
||||
#error "Unsupported architecture for:" _GLAPI_ENTRY_ARCH_TLS_H
|
||||
|
||||
#endif
|
||||
|
||||
#else /* !defined(_GLAPI_ENTRY_ARCH_TLS_H) */
|
||||
|
||||
/* C version of the public entries */
|
||||
#define MAPI_TMP_DEFINES
|
||||
#define MAPI_TMP_PUBLIC_ENTRIES
|
||||
|
|
@ -148,7 +145,7 @@ entry_get_public(int slot)
|
|||
return public_entries[slot];
|
||||
}
|
||||
|
||||
#endif /* asm */
|
||||
#endif /* defined(_GLAPI_ENTRY_ARCH_TLS_H) */
|
||||
|
||||
/* Current dispatch and current context variables */
|
||||
__THREAD_INITIAL_EXEC struct _glapi_table *_mesa_glapi_tls_Dispatch
|
||||
|
|
@ -278,7 +275,3 @@ _mesa_glapi_get_dispatch(void)
|
|||
{
|
||||
return _mesa_glapi_tls_Dispatch;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ libglapi = static_library(
|
|||
],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : [ld_args_gc_sections],
|
||||
include_directories : [inc_src, inc_include],
|
||||
include_directories : [inc_mesa, inc_src, inc_include],
|
||||
dependencies : [dep_thread, idep_mesautil],
|
||||
install : false,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue