meson/tools: split lightweight igt core and reduce tool dependencies
Subsystems (2)
cover meson/tools: split lightweight igt core and reduce tool dependencies
This patch series continues the effort to reduce unnecessary build-time and runtime dependencies in IGT tools by clearly separating a lightweight core subset from the full IGT library and by making tool dependencies explicit in Meson.
The primary motivation is to allow simple utilities (such as lsgpu) to build and run without pulling in heavyweight graphical dependencies (Cairo, Pixman, X11, etc.), while improving maintainability and clarity of the Meson build files.
Sebastian Brzezinka (6):
tools/meson: make per-tool dependencies instead of using global deps tools/meson: sort tools_progs entries
tools/meson: normalize tool dependencies and executable definitions tools/lsgpu: drop cairo and switch to igt_core lib/igt_tools_stub: Add igt_load_igtrc() stub implementation lib/meson: build core sources as per-file static libs with minimal
deps
lib/igt_tools_stub.c | 43 +++++++++++++ lib/meson.build | 42 ++++++++++++ tools/lsgpu.c | 3 +- tools/meson.build | 150 ++++++++++++++++++++----------------------- 4 files changed, 157 insertions(+), 81 deletions(-)
Signature · 1 line
2.52.0
PATCH 1/6 tools/meson: make per-tool dependencies instead of using global deps
This patch updates tools/meson.build to stop linking all tools against the full igt_deps set plus zlib. Most tools don’t actually need cairo, glib, udev, pciaccess, or zlib, so the blanket dependency list pulls in far more libraries than necessary.
The patch replaces the flat tool list with a dictionary that assigns only the required extra dependencies to each tool. A small common base (lib_igt, libdrm) remains shared. Everything else is added per‑tool.
Tools that depended on global deps implicitly now declare their actual requirements (intel_dp_compliance, msm_dp_compliance, intel_l3_parity, intel_reg, amd_hdmi_compliance).
--- tools/meson.build | 100 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 49 deletions(-)
tools/meson.build +51 -49
@@ -11,51 +11,53 @@ foreach prog : tools_progs_noisnt install : false) endforeach -tools_progs = [ - 'igt_facts', - 'igt_power', - 'igt_stats', - 'intel_audio_dump', - 'intel_backlight', - 'intel_bios_dumper', - 'intel_display_bandwidth', - 'intel_display_crc', - 'intel_display_poller', - 'intel_dump_decode', - 'intel_error_decode', - 'intel_forcewaked', - 'intel_gpu_frequency', - 'intel_firmware_decode', - 'intel_framebuffer_dump', - 'intel_gpu_time', - 'intel_gtt', - 'intel_guc_logger', - 'intel_hdcp', - 'intel_infoframes', - 'intel_lid', - 'intel_opregion_decode', - 'intel_panel_fitter', - 'intel_perf_counters', - 'intel_pm_rpm', - 'intel_reg_checker', - 'intel_residency', - 'intel_stepping', - 'intel_tiling_detect', - 'intel_vbt_decode', - 'intel_watermark', - 'intel_gem_info', - 'intel_gvtg_test', - 'dpcd_reg', - 'lsgpu', -] -tool_deps = igt_deps -tool_deps += zlib +tools_progs = { + 'igt_facts': [cairo], + 'igt_power': [], + 'igt_stats': [], + 'intel_audio_dump': [], + 'intel_backlight': [], + 'intel_bios_dumper': [pciaccess], + 'intel_display_bandwidth': [], + 'intel_display_crc': [cairo], + 'intel_display_poller': [], + 'intel_dump_decode': [], + 'intel_error_decode': [zlib], + 'intel_forcewaked': [], + 'intel_gpu_frequency': [], + 'intel_firmware_decode': [], + 'intel_framebuffer_dump': [cairo], + 'intel_gpu_time': [], + 'intel_gtt': [pciaccess], + 'intel_guc_logger': [cairo], + 'intel_hdcp': [cairo], + 'intel_infoframes': [], + 'intel_lid': [], + 'intel_opregion_decode': [], + 'intel_panel_fitter': [], + 'intel_perf_counters': [], + 'intel_pm_rpm': [glib, cairo], + 'intel_reg_checker': [], + 'intel_residency': [cairo], + 'intel_stepping': [pciaccess], + 'intel_tiling_detect': [cairo], + 'intel_vbt_decode': [], + 'intel_watermark': [], + 'intel_gem_info': [cairo], + 'intel_gvtg_test': [cairo], + 'dpcd_reg': [], + 'lsgpu': [libudev, glib, cairo], +} -foreach prog : tools_progs - executable(prog, prog + '.c', - dependencies : tool_deps, - install_rpath : bindir_rpathdir, - install : true) +tool_deps = [lib_igt, libdrm] + +foreach prog, deps : tools_progs + exe_deps = tool_deps + deps + executable( prog, prog + '.c', + dependencies: exe_deps, + install_rpath: bindir_rpathdir, + install: true + ) endforeach if libudev.found()
@@ -65,7 +67,7 @@ if libudev.found() 'igt_compliance_utils.c' ] executable('intel_dp_compliance', sources : intel_dp_compliance_src, - dependencies : [tool_deps, libudev], + dependencies : [tool_deps, libudev, glib, cairo], install_rpath : bindir_rpathdir, install : true) endif
@@ -77,13 +79,13 @@ executable('gputop', 'gputop.c', intel_l3_parity_src = [ 'intel_l3_parity.c', 'intel_l3_udev_listener.c' ] executable('intel_l3_parity', sources : intel_l3_parity_src, - dependencies : tool_deps, + dependencies : [tool_deps, libudev], install_rpath : bindir_rpathdir, install : true) intel_reg_src = [ 'intel_reg.c', 'intel_reg_decode.c', 'intel_reg_spec.c' ] executable('intel_reg', sources : intel_reg_src, - dependencies : tool_deps, + dependencies : [tool_deps, pciaccess, cairo], install : true, install_rpath : bindir_rpathdir, c_args : [
@@ -100,7 +102,7 @@ executable('intel_gpu_top', 'intel_gpu_top.c', dependencies : [lib_igt_perf,lib_igt_device_scan,lib_igt_drm_clients,lib_igt_drm_fdinfo,math]) executable('amd_hdmi_compliance', 'amd_hdmi_compliance.c', - dependencies : [tool_deps], + dependencies : [tool_deps, cairo], install_rpath : bindir_rpathdir, install : true)
@@ -111,7 +113,7 @@ if libudev.found() 'igt_compliance_utils.c' ] executable('msm_dp_compliance', sources : msm_dp_compliance_src, - dependencies : [tool_deps, libudev], + dependencies : [tool_deps, libudev, glib, cairo], install_rpath : bindir_rpathdir, install : true) endif
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 1/6] tools/meson: make per-tool dependencies instead of using global deps
Hi Sebastian,
[...]
Quoted 1 line
-tool_deps =
igt_deps
I have a suggestion for another, separate change here:igt_deps could be defined in the root directory of igt-gpu-tools. The name suggests that those are dependencies for the whole build project and currently this entity sits hidden on the same level as tools/, in lib/ directory.
This is not directly related to your series, but I do not think it would be justifiable as a separate, very trivial patch.
[...]
tools/meson.build foreach prog : tools_progs_noisnt · line 60
Quoted 8 lines
tools/meson.build +8
-0+ +foreach prog, deps : tools_progs + exe_deps = tool_deps + deps + executable( prog, prog + '.c', + dependencies: exe_deps, + install_rpath: bindir_rpathdir, + install: true + )
No need for a newline here.
Rest of the changes in this patch look good to me.
Signature · 2 lines
Best Regards, Krzysztof
Re: [PATCH i-g-t 1/6] tools/meson: make per-tool dependencies instead of using global deps
In reply to Sebastian BrzezinkaHi Sebastian,
Quoted 4 lines · Sebastian Brzezinka
This patch updates
tools/meson.buildto stop linking all tools against the fulligt_depsset plus zlib. Most tools don’t actually need cairo, glib, udev, pciaccess, or zlib, so the blanket dependency list pulls in far more libraries than necessary.
Quoted 8 lines
The patch replaces the flat tool list with a dictionary that assigns only the required extra dependencies to each tool. A small common base (
lib_igt, libdrm) remains shared. Everything else is added per‑tool.Tools that depended on global deps implicitly now declare their actual requirements (
intel_dp_compliance,msm_dp_compliance,intel_l3_parity,intel_reg,amd_hdmi_compliance).
Please add here Closes: tag for this:
Quoted 1 line
Signed-off-by Sebastian Brzezinka <[email protected]>
btw please look into those issue/16 link, there is a script which should help you identify what linking libs you are missing, see below.
Quoted 14 lines
--- tools/meson.build | 100 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 49 deletions(-)tools/meson.build +0
-2@@ -11,51 +11,53 @@ foreach prog : tools_progs_noisnt install : false) endforeach -tools_progs = [ - 'igt_facts',
[cut]
Quoted 13 lines
-]
tools/meson.build +10
-2-tool_deps = igt_deps -tool_deps += zlib +tools_progs = { + 'igt_facts': [cairo], + 'igt_power': [], + 'igt_stats': [], + 'intel_audio_dump': [], + 'intel_backlight': [], + 'intel_bios_dumper': [pciaccess], + 'intel_display_bandwidth': [], + 'intel_display_crc': [cairo], + 'intel_display_poller': [],
tools/meson.build foreach prog : tools_progs_noisnt · line 33
Quoted 10 lines
tools/meson.build +10
-0+ 'intel_dump_decode': [], + 'intel_error_decode': [zlib], + 'intel_forcewaked': [], + 'intel_gpu_frequency': [], + 'intel_firmware_decode': [], + 'intel_framebuffer_dump': [cairo], + 'intel_gpu_time': [], + 'intel_gtt': [pciaccess], + 'intel_guc_logger': [cairo], + 'intel_hdcp': [cairo],
This still do not build:
[1285/2063] Linking target tools/intel_hdcp
FAILED: tools/intel_hdcp
cc -o tools/intel_hdcp tools/intel_hdcp.p/intel_hdcp.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group lib/libigt.so.0 /usr/lib/x86_64-linux-gnu/libdrm.so /usr/lib/x86_64-linux-gnu/libcairo.so -Wl,--end-group '-Wl,-rpath,$ORIGIN/../lib' -Wl,-rpath-link,/opt/builds/build/lib /usr/bin/ld: tools/intel_hdcp.p/intel_hdcp.c.o: undefined reference to symbol 'pthread_join@@GLIBC_2.2.5'/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Regards,
Kamil
Quoted 18 lines
tools/meson.build +17
-0+ 'intel_infoframes': [], + 'intel_lid': [], + 'intel_opregion_decode': [], + 'intel_panel_fitter': [], + 'intel_perf_counters': [], + 'intel_pm_rpm': [glib, cairo], + 'intel_reg_checker': [], + 'intel_residency': [cairo], + 'intel_stepping': [pciaccess], + 'intel_tiling_detect': [cairo], + 'intel_vbt_decode': [], + 'intel_watermark': [], + 'intel_gem_info': [cairo], + 'intel_gvtg_test': [cairo], + 'dpcd_reg': [], + 'lsgpu': [libudev, glib, cairo], +}
[cut]
PATCH 2/6 tools/meson: sort tools_progs entries
In reply to Sebastian BrzezinkaReorder tools_progs entries in tools/meson.build to keep the list organized and avoid duplicate or misplaced tool definitions.
No functional or dependency changes.
--- tools/meson.build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/meson.build +5 -5
@@ -12,6 +12,7 @@ foreach prog : tools_progs_noisnt endforeach tools_progs = { + 'dpcd_reg': [], 'igt_facts': [cairo], 'igt_power': [], 'igt_stats': [],
@@ -23,13 +24,15 @@ tools_progs = { 'intel_display_poller': [], 'intel_dump_decode': [], 'intel_error_decode': [zlib], - 'intel_forcewaked': [], - 'intel_gpu_frequency': [], 'intel_firmware_decode': [], + 'intel_forcewaked': [], 'intel_framebuffer_dump': [cairo], + 'intel_gem_info': [cairo], + 'intel_gpu_frequency': [], 'intel_gpu_time': [], 'intel_gtt': [pciaccess], 'intel_guc_logger': [cairo], + 'intel_gvtg_test': [cairo], 'intel_hdcp': [cairo], 'intel_infoframes': [], 'intel_lid': [],
@@ -43,9 +46,6 @@ tools_progs = { 'intel_tiling_detect': [cairo], 'intel_vbt_decode': [], 'intel_watermark': [], - 'intel_gem_info': [cairo], - 'intel_gvtg_test': [cairo], - 'dpcd_reg': [], 'lsgpu': [libudev, glib, cairo], }
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 2/6] tools/meson: sort tools_progs entries
Hi Sebastian,
Quoted 15 lines · Sebastian Brzezinka
Reorder
tools_progsentries intools/meson.buildto keep the list organized and avoid duplicate or misplaced tool definitions.No functional or dependency changes.
Signed-off-by Sebastian Brzezinka <[email protected]>--- tools/meson.build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)tools/meson.build +0
-0
tools/meson.build foreach prog : tools_progs_noisnt · line 13
Quoted 2 lines
tools/meson.build +0
-0@@ -12,6 +12,7 @@ foreach prog : tools_progs_noisnt endforeach
It might be good to add a comment here:
# Keep in alphabetical order
though, I will not block this change with that suggestion:
Quoted 36 lines
tools/meson.build +5
-5tools_progs = { + 'dpcd_reg': [], 'igt_facts': [cairo], 'igt_power': [], 'igt_stats': [],@@ -23,13 +24,15 @@ tools_progs = { 'intel_display_poller': [], 'intel_dump_decode': [], 'intel_error_decode': [zlib], - 'intel_forcewaked': [], - 'intel_gpu_frequency': [], 'intel_firmware_decode': [], + 'intel_forcewaked': [], 'intel_framebuffer_dump': [cairo], + 'intel_gem_info': [cairo], + 'intel_gpu_frequency': [], 'intel_gpu_time': [], 'intel_gtt': [pciaccess], 'intel_guc_logger': [cairo], + 'intel_gvtg_test': [cairo], 'intel_hdcp': [cairo], 'intel_infoframes': [], 'intel_lid': [],@@ -43,9 +46,6 @@ tools_progs = { 'intel_tiling_detect': [cairo], 'intel_vbt_decode': [], 'intel_watermark': [], - 'intel_gem_info': [cairo], - 'intel_gvtg_test': [cairo], - 'dpcd_reg': [], 'lsgpu': [libudev, glib, cairo], }Signature · 1 line
2.52.0
Signature · 2 lines
Best Regards, Krzysztof
PATCH 3/6 tools/meson: normalize tool dependencies and executable definitions
In reply to Sebastian BrzezinkaRefactor tools/meson.build to consistently use a common tool_deps (lib_igt, libdrm) base and layer per-tool dependencies explicitly.
Fold previously standalone tool definitions (e.g. gputop, intel_gpu_top, amd_hdmi_compliance) into tools_progs and unify executable() creation.
This is a build-system cleanup only; no functional changes.
--- tools/meson.build | 134 +++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 72 deletions(-)
tools/meson.build +62 -72
@@ -11,50 +11,58 @@ foreach prog : tools_progs_noisnt install : false) endforeach +tool_deps = [lib_igt, libdrm] tools_progs = { - 'dpcd_reg': [], - 'igt_facts': [cairo], - 'igt_power': [], - 'igt_stats': [], - 'intel_audio_dump': [], - 'intel_backlight': [], - 'intel_bios_dumper': [pciaccess], - 'intel_display_bandwidth': [], - 'intel_display_crc': [cairo], - 'intel_display_poller': [], - 'intel_dump_decode': [], - 'intel_error_decode': [zlib], - 'intel_firmware_decode': [], - 'intel_forcewaked': [], - 'intel_framebuffer_dump': [cairo], - 'intel_gem_info': [cairo], - 'intel_gpu_frequency': [], - 'intel_gpu_time': [], - 'intel_gtt': [pciaccess], - 'intel_guc_logger': [cairo], - 'intel_gvtg_test': [cairo], - 'intel_hdcp': [cairo], - 'intel_infoframes': [], - 'intel_lid': [], - 'intel_opregion_decode': [], - 'intel_panel_fitter': [], - 'intel_perf_counters': [], - 'intel_pm_rpm': [glib, cairo], - 'intel_reg_checker': [], - 'intel_residency': [cairo], - 'intel_stepping': [pciaccess], - 'intel_tiling_detect': [cairo], - 'intel_vbt_decode': [], - 'intel_watermark': [], - 'lsgpu': [libudev, glib, cairo], + 'amd_hdmi_compliance': [tool_deps, cairo], + 'dpcd_reg': [tool_deps], + 'gputop': [lib_igt_drm_clients, + lib_igt_drm_fdinfo, + lib_igt_profiling, + math], + 'igt_facts': [tool_deps, cairo], + 'igt_power': [tool_deps], + 'igt_stats': [tool_deps], + 'intel_audio_dump': [tool_deps], + 'intel_backlight': [tool_deps], + 'intel_bios_dumper': [tool_deps, pciaccess], + 'intel_display_bandwidth': [tool_deps], + 'intel_display_crc': [tool_deps, cairo], + 'intel_display_poller': [tool_deps], + 'intel_dump_decode': [tool_deps], + 'intel_error_decode': [tool_deps, zlib], + 'intel_firmware_decode': [tool_deps], + 'intel_forcewaked': [tool_deps], + 'intel_framebuffer_dump': [tool_deps, cairo], + 'intel_gem_info': [tool_deps, cairo], + 'intel_gpu_frequency': [tool_deps], + 'intel_gpu_time': [tool_deps], + 'intel_gpu_top': [lib_igt_perf, + lib_igt_device_scan, + lib_igt_drm_clients, + lib_igt_drm_fdinfo, + math], + 'intel_gtt': [tool_deps, pciaccess], + 'intel_guc_logger': [tool_deps, cairo, pthreads], + 'intel_gvtg_test': [tool_deps, cairo], + 'intel_hdcp': [tool_deps, cairo], + 'intel_infoframes': [tool_deps], + 'intel_lid': [tool_deps], + 'intel_opregion_decode': [tool_deps], + 'intel_panel_fitter': [tool_deps], + 'intel_perf_counters': [tool_deps], + 'intel_pm_rpm': [tool_deps, glib, cairo], + 'intel_reg_checker': [tool_deps], + 'intel_residency': [tool_deps, cairo], + 'intel_stepping': [tool_deps, pciaccess], + 'intel_tiling_detect': [tool_deps, cairo], + 'intel_vbt_decode': [tool_deps], + 'intel_watermark': [tool_deps], + 'lsgpu': [tool_deps, libudev, glib, cairo], } -tool_deps = [lib_igt, libdrm] - foreach prog, deps : tools_progs - exe_deps = tool_deps + deps executable( prog, prog + '.c', - dependencies: exe_deps, + dependencies: deps, install_rpath: bindir_rpathdir, install: true )
@@ -70,18 +78,23 @@ if libudev.found() dependencies : [tool_deps, libudev, glib, cairo], install_rpath : bindir_rpathdir, install : true) -endif -executable('gputop', 'gputop.c', - install : true, - install_rpath : bindir_rpathdir, - dependencies : [lib_igt_drm_clients,lib_igt_drm_fdinfo,lib_igt_profiling,math]) + msm_dp_compliance_src = [ + 'msm_dp_compliance.c', + 'igt_dp_compliance_hotplug.c', + 'igt_compliance_utils.c' + ] + executable('msm_dp_compliance', sources : msm_dp_compliance_src, + dependencies : [tool_deps, libudev, glib, cairo], + install_rpath : bindir_rpathdir, + install : true) -intel_l3_parity_src = [ 'intel_l3_parity.c', 'intel_l3_udev_listener.c' ] -executable('intel_l3_parity', sources : intel_l3_parity_src, - dependencies : [tool_deps, libudev], - install_rpath : bindir_rpathdir, - install : true) + intel_l3_parity_src = ['intel_l3_parity.c', 'intel_l3_udev_listener.c'] + executable('intel_l3_parity', sources : intel_l3_parity_src, + dependencies : [tool_deps, libudev], + install_rpath : bindir_rpathdir, + install : true) +endif intel_reg_src = [ 'intel_reg.c', 'intel_reg_decode.c', 'intel_reg_spec.c' ] executable('intel_reg', sources : intel_reg_src,
@@ -93,31 +106,8 @@ executable('intel_reg', sources : intel_reg_src, ]) install_data(['intel_gpu_abrt', 'intel-gfx-fw-info'], install_dir : bindir) - install_subdir('registers', install_dir : datadir) -executable('intel_gpu_top', 'intel_gpu_top.c', - install : true, - install_rpath : bindir_rpathdir, - dependencies : [lib_igt_perf,lib_igt_device_scan,lib_igt_drm_clients,lib_igt_drm_fdinfo,math]) - -executable('amd_hdmi_compliance', 'amd_hdmi_compliance.c', - dependencies : [tool_deps, cairo], - install_rpath : bindir_rpathdir, - install : true) - -if libudev.found() - msm_dp_compliance_src = [ - 'msm_dp_compliance.c', - 'igt_dp_compliance_hotplug.c', - 'igt_compliance_utils.c' - ] - executable('msm_dp_compliance', sources : msm_dp_compliance_src, - dependencies : [tool_deps, libudev, glib, cairo], - install_rpath : bindir_rpathdir, - install : true) -endif - if build_vmtb install_subdir('vmtb', install_dir: libexecdir) endif
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 3/6] tools/meson: normalize tool dependencies and executable definitions
Hi Sebastian,
Quoted 11 lines
Refactor
tools/meson.buildto consistently use a commontool_deps(lib_igt, libdrm) base and layer per-tool dependencies explicitly.Fold previously standalone tool definitions (e.g. gputop,
intel_gpu_top,amd_hdmi_compliance) intotools_progsand unifyexecutable()creation.This is a build-system cleanup only; no functional changes.
Signed-off-by Sebastian Brzezinka <[email protected]>---
Signature · 2 lines
Best Regards, Krzysztof
PATCH 4/6 tools/lsgpu: drop cairo and switch to igt_core
In reply to Sebastian BrzezinkaReplace the full igt.h include with igt_core.h and link lsgpu against lib_core_igt.
This removes the cairo dependency and limits lsgpu to the minimal core IGT functionality required for device enumeration.
--- tools/lsgpu.c | 3 +-- tools/meson.build | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
tools/lsgpu.c +1 -2
@@ -33,8 +33,7 @@#include <string.h> #include <signal.h> #include <sys/ioctl.h> - -#include "igt.h" +#include "igt_core.h" #include "igt_device_scan.h" /**
tools/meson.build +1 -1
@@ -57,7 +57,7 @@ tools_progs = { 'intel_tiling_detect': [tool_deps, cairo], 'intel_vbt_decode': [tool_deps], 'intel_watermark': [tool_deps], - 'lsgpu': [tool_deps, libudev, glib, cairo], + 'lsgpu': [lib_core_igt, libudev, glib], } foreach prog, deps : tools_progs
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 4/6] tools/lsgpu: drop cairo and switch to igt_core
Hi Sebastian,
Quoted 42 lines · Sebastian Brzezinka
Replace the full
igt.hinclude withigt_core.hand link lsgpu againstlib_core_igt.This removes the cairo dependency and limits lsgpu to the minimal core IGT functionality required for device enumeration.
Signed-off-by Sebastian Brzezinka <[email protected]>--- tools/lsgpu.c | 3 +-- tools/meson.build | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)tools/lsgpu.c +1
-2@@ -33,8 +33,7 @@#include <string.h> #include <signal.h> #include <sys/ioctl.h> - -#include "igt.h" +#include "igt_core.h" #include "igt_device_scan.h" /** tools/meson.build +1
-1@@ -57,7 +57,7 @@ tools_progs = { 'intel_tiling_detect': [tool_deps, cairo], 'intel_vbt_decode': [tool_deps], 'intel_watermark': [tool_deps], - 'lsgpu': [tool_deps, libudev, glib, cairo], + 'lsgpu': [lib_core_igt, libudev, glib], } foreach prog, deps : tools_progsSignature · 1 line
2.52.0
This patch should be the last one in the current series, as "lib_core_igt" is undefined until:
lib/meson: build core sources as per-file static libs with minimal deps.
Signature · 2 lines
Best Regards, Krzysztof
PATCH 5/6 lib/igt_tools_stub: Add igt_load_igtrc() stub implementation
In reply to Sebastian BrzezinkaAdd a minimal stub implementation of igt_load_igtrc() to allow lightweight tools like lsgpu to load IGT configuration files without requiring the full igt_core.c and its heavy dependencies (Cairo, Pixman, X11, etc.).
--- lib/igt_tools_stub.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
lib/igt_tools_stub.c +43 -0
@@ -22,6 +22,11 @@* */ #include "igt_core.h" +#include <glib.h> +#include <pwd.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> /* Stub for igt_log, this stub will simply print the msg on stderr device. * Domain and log level are ignored.
@@ -49,3 +54,41 @@ void __igt_fail_assert(const char *domain, const char *file, func, assertion);exit (1 ); } + +/* Stub for igt_load_igtrc - loads ~/.igtrc config file */ +GKeyFile *igt_load_igtrc (void ) +{ +char *key_file_loc; +GKeyFile *file; +GError *error =NULL ; +int ret; + +/* Determine igt config path */ + key_file_loc =getenv ("IGT_CONFIG_PATH" ); +if (!key_file_loc) { +struct passwd *pw =getpwuid (geteuid ()); +if (pw && pw->pw_dir) + ret =asprintf (&key_file_loc,"%s/.igtrc" , pw->pw_dir); +else +return NULL ; + +if (ret ==-1 ) +return NULL ; + }else { + key_file_loc =strdup (key_file_loc); + } + + file =g_key_file_new (); + + ret =g_key_file_load_from_file (file, key_file_loc,G_KEY_FILE_NONE , &error); +if (!ret) { +g_key_file_free (file); +g_error_free (error); +free (key_file_loc); +return NULL ; + } + +free (key_file_loc); + +return file; +}
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 5/6] lib/igt_tools_stub: Add igt_load_igtrc() stub implementation
Hi Sebastian,
Quoted 2 lines
Add a minimal stub implementation of
igt_load_igtrc()to allow lightweight tools like lsgpu to load IGT configuration files without requiring the full
Does lsgpu also depend on igt_tools_stub? I only found indirect reference for intel_gpu_top:intel_tools_stub.c -> lib_igt_device_scan_build
-> lib_igt_device_scan -> intel_gpu_top (executable).
I think that this change is a solid idea, even if only a single app would benefit from decreasing dependency bloat.
Quoted 4 lines
igt_core.cand its heavy dependencies (Cairo, Pixman, X11, etc.).Signed-off-by Sebastian Brzezinka <[email protected]>---
[...]
Signature · 2 lines
Best Regards, Krzysztof
PATCH 6/6 lib/meson: build core sources as per-file static libs with minimal deps
In reply to Sebastian BrzezinkaIntroduce a new lib_core_sources list to isolate low-level/common code (basic data structures, device scanning/info, and basic utilities) and build each file as a small static library.
These per-file static libs are linked via a new declare_dependency() (lib_core_igt) and use a minimal dependency set (glib, libudev, pciaccess).
This improves modularity and keeps core components lightweight.
--- lib/meson.build | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
lib/meson.build +42 -0
@@ -148,6 +148,27 @@ lib_deps = [ zlib ] +lib_core_sources = [ + # Basic data structures (no dependencies) + 'igt_list.c', + 'igt_map.c', + + # Device scanning and info (minimal deps: udev, pci) + 'igt_device_scan.c', + 'intel_chipset.c', + 'intel_device_info.c', + 'intel_cmds_info.c', + + # Basic utilities + 'igt_tools_stub.c', +] + +lib_core_deps = [ + glib, + libudev, + pciaccess, +] + if libdrm_nouveau.found() lib_deps += libdrm_nouveau lib_sources += [
@@ -282,6 +303,27 @@ foreach f: iga64_assembly_sources ) endforeach + +lib_core = [] +foreach f: lib_core_sources + name = f.underscorify() + lib = static_library('igt-core' + name, + [ f, lib_version ], + include_directories: inc, + dependencies : lib_core_deps, + c_args : [ + '-DIGT_DATADIR="@0@"'.format(join_paths(prefix, datadir)), + '-DIGT_SRCDIR="@0@"'.format(srcdir), + '-DIGT_LOG_DOMAIN="@0@"'.format(f.split('.')[0]), + '-DIGT_IMGDIR="@0@"'.format(imgdir), + ]) + lib_core += lib +endforeach + +lib_core_igt = declare_dependency(link_with : lib_core, + include_directories : inc, + dependencies : lib_core_deps) + lib_intermediates = [] foreach f: lib_sources name = f.underscorify()
Signature · 1 line
2.52.0
Re: [PATCH i-g-t 6/6] lib/meson: build core sources as per-file static libs with minimal deps
Hi Sebastian,
Quoted 4 lines · Sebastian Brzezinka
Introduce a new
lib_core_sourceslist to isolate low-level/common code (basic data structures, device scanning/info, and basic utilities) and build each file as a small static library.
Quoted 8 lines
These per-file static libs are linked via a new
declare_dependency()(lib_core_igt) and use a minimal dependency set (glib, libudev, pciaccess).This improves modularity and keeps core components lightweight.
Signed-off-by Sebastian Brzezinka <[email protected]>---
I checked that this builds just fine on my end and I do not have anything against the code, so:
Signature · 2 lines
Best Regards, Krzysztof