Re: [PATCH i-g-t v4 13/31] tools/intel_gpu_frequency: link with minimal sub-libraries

Kamil Konieczny <[email protected]> Wed, 29 Jul 2026 16:01:53 +0200
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
Hi Sebastian,
On 2026-07-27 at 15:22:41 +0200, Sebastian Brzezinka wrote:
> intel_gpu_frequency needs only intel_gen/devid helpers and a DRM device
> opener to query the GPU frequency.  Link it against lib_igt_chipset for
> the devid helpers and lib_igt_drm_stub for driver detection and device
> opening, instead of the full libigt.so stack.
> 
> ldd before: 35  (ldd intel_gpu_frequency | wc -l)
> ldd after:   5  (ldd intel_gpu_frequency | wc -l)

On my system it was:

$ ldd build/tools/intel_gpu_frequency
linux-vdso.so.1 (0x00007ffedf5f5000)
libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007bdd60cfa000)
libpciaccess.so.0 => /lib/x86_64-linux-gnu/libpciaccess.so.0 (0x00007bdd60cef000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007bdd60a00000)
/lib64/ld-linux-x86-64.so.2 (0x00007bdd60d43000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007bdd60cd3000)

$ ldd build/tools/intel_gpu_frequency |wc -l
6

and it is big drop, compared to old:

ldd build/tools/intel_gpu_frequency |wc -l
74

Btw looking at raw output, it seems that there are still more
room for future improvement, like removing linked libs libdrm,
libpciaccess and libz. I guess some other tools also do not
need some of them.

Regards,
Kamil

> 
> Signed-off-by: Sebastian Brzezinka <[email protected]>
> Acked-by: Ashutosh Dixit <[email protected]>
> Reviewed-by: Krzysztof Niemiec <[email protected]>
> Reviewed-by: Krzysztof Karas <[email protected]>
> ---
>  tools/meson.build | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/meson.build b/tools/meson.build
> index 53aa31056..01400f53e 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -23,7 +23,6 @@ tools_progs = [
>  	'intel_dump_decode',
>  	'intel_error_decode',
>  	'intel_forcewaked',
> -	'intel_gpu_frequency',
>  	'intel_framebuffer_dump',
>  	'intel_gpu_time',
>  	'intel_gtt',
> @@ -66,6 +65,11 @@ executable('intel_firmware_decode', 'intel_firmware_decode.c',
>  	   install_rpath : bindir_rpathdir,
>  	   install : true)
>  
> +executable('intel_gpu_frequency', 'intel_gpu_frequency.c',
> +	   dependencies : [lib_igt_chipset, lib_igt_tools_stub, lib_igt_drm_stub],
> +	   install_rpath : bindir_rpathdir,
> +	   install : true)
> +
>  if libudev.found()
>  	intel_dp_compliance_src = [
>  		'intel_dp_compliance.c',
> -- 
> 2.53.0
>