dri: put shared-glapi into libgallium.*.so

so that we don't have to maintain a stable ABI for it.

This will allow removal of the remapping table to reduce CALL_* overhead
for GL dispatch tables.

Also we can now clean it up.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32789>
This commit is contained in:
Marek Olšák
2024-12-26 14:35:44 -05:00
committed by Marge Bot
parent 08560b8ff8
commit 44bda7c258
16 changed files with 58 additions and 75 deletions

View File

@@ -205,7 +205,7 @@ libegl = shared_library(
cpp_args : [cpp_args_for_egl],
gnu_symbol_visibility : 'hidden',
include_directories : incs_for_egl,
link_with : [link_for_egl, libglapi],
link_with : [link_for_egl],
link_args : [ld_args_bsymbolic, ld_args_gc_sections, link_args_for_egl],
link_depends : [link_deps_for_egl],
dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil],

View File

@@ -1,5 +1,16 @@
{
global:
# shared-glapi exported from libgallium:
_glapi_get_context;
_glapi_get_dispatch;
_glapi_get_dispatch_table_size;
_glapi_get_proc_address;
_glapi_get_proc_offset;
_glapi_set_context;
_glapi_set_dispatch;
_glapi_tls_Context;
_glapi_tls_Dispatch;
ddebug_screen_create;
noop_screen_create;
util_run_tests;

View File

@@ -68,6 +68,8 @@ libgallium_dri = shared_library(
name_suffix : libname_suffix,
)
shared_glapi_lib = libgallium_dri
if with_gallium_va or with_gallium_vdpau
va_drivers = []
vdpau_drivers = []

View File

@@ -1,5 +1,9 @@
{
global:
_glapi_Dispatch;
_glapi_tls_Dispatch;
_glapi_get_dispatch_table_size; # only for tests
_glapi_get_proc_offset; # only for tests
gl*;
local:
*;

View File

@@ -37,3 +37,5 @@ libgl = shared_library(
version : '1.5.0',
darwin_versions: '4.0.0',
)
shared_glapi_lib = libgl

View File

@@ -31,3 +31,5 @@ libgallium_wgl = shared_library(
install : true,
)
libgallium_wgl_build_dir = meson.current_build_dir()
shared_glapi_lib = libgallium_wgl

View File

@@ -133,7 +133,7 @@ libglx = static_library(
libgl = shared_library(
gl_lib_name,
[],
link_with : [libglapi_static, libglapi],
link_with : [libglapi_static],
link_whole : libglx,
link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
dependencies : [

View File

@@ -36,7 +36,7 @@ libglesv1_cm = shared_library(
gnu_symbol_visibility : 'hidden',
link_args : [ld_args_gc_sections],
include_directories : [inc_src, inc_include, inc_mapi],
link_with : libglapi,
link_with : shared_glapi_lib,
dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11],
soversion : host_machine.system() == 'windows' ? '' : '1',
version : '1.1.0',

View File

@@ -36,7 +36,7 @@ libgles2 = shared_library(
gnu_symbol_visibility : 'hidden',
link_args : [ld_args_gc_sections],
include_directories : [inc_src, inc_include, inc_mapi],
link_with : libglapi,
link_with : shared_glapi_lib,
dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11],
soversion : host_machine.system() == 'windows' ? '' : '2',
version : '2.0.0',

View File

@@ -11,11 +11,3 @@ if with_shared_glapi
else
libglapi = []
endif
if not with_glvnd
if with_gles1
subdir('es1api')
endif
if with_gles2
subdir('es2api')
endif
endif

View File

@@ -1,20 +0,0 @@
_glapi_Context
_glapi_Dispatch
_glapi_add_dispatch
_glapi_check_multithread
_glapi_destroy_multithread
_glapi_get_context
_glapi_get_dispatch
_glapi_get_dispatch_table_size
_glapi_get_proc_address
_glapi_get_proc_name
_glapi_get_proc_offset
_glapi_new_nop_table
_glapi_noop_enable_warnings
_glapi_set_context
_glapi_set_dispatch
_glapi_set_nop_handler
_glapi_set_warning_func
(optional) _glapi_tls_Context
(optional) _glapi_tls_Dispatch
_glthread_GetID

View File

@@ -26,7 +26,7 @@ if with_platform_windows
_glapi_c_args += ['-D_GLAPI_DLL_EXPORTS']
endif
libglapi = shared_library(
libglapi = static_library(
'glapi',
[files_shared_glapi, shared_glapi_mapi_tmp_h],
c_args : [
@@ -40,37 +40,6 @@ libglapi = shared_library(
link_args : [ld_args_gc_sections],
include_directories : [inc_src, inc_include, inc_mapi],
dependencies : [dep_thread, idep_mesautil],
soversion : host_machine.system() == 'windows' ? '' : '0',
version : '0.0.0',
name_prefix : host_machine.system() == 'windows' ? 'lib' : [], # always use lib, but avoid warnings on !windows
install : true,
install : false,
)
libglapi_build_dir = meson.current_build_dir()
if with_any_opengl and with_tests
test(
'shared-glapi-test',
executable(
['shared-glapi-test', glapitable_h],
'tests/check_table.cpp',
cpp_args : [cpp_msvc_compat_args],
include_directories : [inc_src, inc_include, inc_mapi],
link_with : [libglapi],
dependencies : [dep_thread, idep_gtest, idep_mesautilc11],
),
suite : ['mapi'],
protocol : 'gtest',
)
if with_symbols_check
test(
'shared-glapi symbols check',
symbols_check,
args : [
'--lib', libglapi,
'--symbols-file', files('glapi-symbols.txt'),
symbols_check_args,
],
suite : ['mapi'],
)
endif
endif

View File

@@ -0,0 +1,18 @@
# Copyright © 2017 Intel Corporation
# SPDX-License-Identifier: MIT
if with_any_opengl and with_tests
test(
'shared-glapi-test',
executable(
['shared-glapi-test', glapitable_h],
'check_table.cpp',
cpp_args : [cpp_msvc_compat_args],
include_directories : [inc_src, inc_include, inc_mapi],
link_with : [shared_glapi_lib],
dependencies : [dep_thread, idep_gtest, idep_mesautilc11],
),
suite : ['mapi'],
protocol : 'gtest',
)
endif

View File

@@ -446,12 +446,9 @@ endif
_mesa_windows_args = []
if with_platform_windows
_mesa_windows_args += [
'-D_GLAPI_NO_EXPORTS',
'-D_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
]
if not with_shared_glapi
# prevent _glapi_* from being declared __declspec(dllimport)
_mesa_windows_args += '-D_GLAPI_NO_EXPORTS'
endif
endif
libmesa = static_library(

View File

@@ -8,7 +8,7 @@ test(
['st_format.c'],
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
link_with : [
libmesa, libglapi, libgallium,
libmesa, shared_glapi_lib, libgallium,
],
dependencies : [idep_gtest, idep_mesautil],
),

View File

@@ -111,11 +111,17 @@ endif
if with_gallium_or_lvp
subdir('gallium')
endif
if with_gallium and with_tests
# This has to be here since it requires libgallium, and subdir cannot
# contain ..
subdir('mesa/main/tests')
if with_shared_glapi
# These require libgallium (shared_glapi_lib)
if with_gallium and (with_glx != 'disabled' or with_egl)
if with_gles1 and not with_glvnd
subdir('mapi/es1api')
endif
if with_gles2 and not with_glvnd
subdir('mapi/es2api')
endif
if with_tests and with_shared_glapi
subdir('mapi/shared-glapi/tests')
subdir('mesa/main/tests')
subdir('mesa/state_tracker/tests')
endif
endif