You've already forked libmali-rockchip
mirror of
https://github.com/armbian/libmali-rockchip.git
synced 2026-01-06 12:03:41 -08:00
Support force enabling thread support for X11
By adding a hook library to call XInitThreads() before getting egl display. Enabled by default, set env "MALI_X11_NO_FORCE_THREADS" to disable. Change-Id: I0af8b29c90149bd7a920bfd54f06d5129b5e446c Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
547
hook/hook.c
Normal file
547
hook/hook.c
Normal file
File diff suppressed because it is too large
Load Diff
6
hook/injector.c
Normal file
6
hook/injector.c
Normal file
@@ -0,0 +1,6 @@
|
||||
extern int mali_injected;
|
||||
|
||||
__attribute__((constructor)) static void
|
||||
_injector() {
|
||||
mali_injected = 1;
|
||||
}
|
||||
79
hook/meson.build
Normal file
79
hook/meson.build
Normal file
@@ -0,0 +1,79 @@
|
||||
# The gbm functions that might be missing
|
||||
gbm_check_funcs = [
|
||||
'gbm_bo_map',
|
||||
'gbm_bo_unmap',
|
||||
'gbm_bo_get_offset',
|
||||
'gbm_bo_get_plane_count',
|
||||
'gbm_device_get_format_modifier_plane_count',
|
||||
'gbm_bo_get_handle_for_plane',
|
||||
'gbm_bo_get_stride_for_plane',
|
||||
'gbm_bo_get_fd_for_plane',
|
||||
'gbm_bo_get_modifier',
|
||||
'gbm_bo_create_with_modifiers',
|
||||
'gbm_surface_create_with_modifiers',
|
||||
'gbm_bo_get_bpp',
|
||||
'gbm_format_get_name',
|
||||
]
|
||||
|
||||
libhook_cflags = [
|
||||
'-DLIBMALI_SO="libmali.so.' + mali_version.split('.')[0] + '"',
|
||||
]
|
||||
|
||||
libhook_dep = [mali]
|
||||
libhook_dep += dependency('threads')
|
||||
libhook_dep += cc.find_library('dl', required : false)
|
||||
libhook_dep += dependency('libdrm', version : '>= 2.4.0')
|
||||
|
||||
libhook_inc = []
|
||||
|
||||
needs_hook = false
|
||||
|
||||
gbm_symbol = map['gbm'][0]
|
||||
if cc.has_function(gbm_symbol, dependencies : mali)
|
||||
# Add hooks to support new GBM APIs
|
||||
libhook_inc += include_directories('../include/GBM')
|
||||
libhook_cflags += '-DHAS_GBM'
|
||||
foreach symbol : gbm_check_funcs
|
||||
if cc.has_function(symbol, dependencies : mali)
|
||||
libhook_cflags += '-DHAS_' + symbol
|
||||
endif
|
||||
endforeach
|
||||
|
||||
needs_hook = true
|
||||
endif
|
||||
|
||||
egl_symbol = map['egl'][0]
|
||||
if cc.has_function(egl_symbol, dependencies : mali) and platform == 'x11'
|
||||
# Add hooks to init X11 threads
|
||||
libhook_inc += include_directories('../include')
|
||||
libhook_dep += dependency('x11')
|
||||
libhook_cflags += '-DHAS_X11_EGL'
|
||||
|
||||
needs_hook = true
|
||||
endif
|
||||
|
||||
if not needs_hook
|
||||
libhook_ldflags = []
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
libhook = shared_library(
|
||||
'mali_hook',
|
||||
'hook.c',
|
||||
c_args : libhook_cflags,
|
||||
include_directories : libhook_inc,
|
||||
dependencies : libhook_dep,
|
||||
install : true,
|
||||
version : mali_version)
|
||||
|
||||
libhook_ldflags = ['-L${libdir}', '-lmali_hook']
|
||||
|
||||
# A dummy library to ensure that the hook library would not be removed as unused
|
||||
libinjector = static_library(
|
||||
'mali_hook_injector',
|
||||
'injector.c',
|
||||
install : true)
|
||||
|
||||
# Ensure that the hook library would not be removed as unused
|
||||
libhook_ldflags += \
|
||||
['-Wl,--whole-archive', '-lmali_hook_injector', '-Wl,--no-whole-archive']
|
||||
Reference in New Issue
Block a user