Re: [PATCH i-g-t v3 31/31] tools/lsgpu: link with minimal sub-libraries

Krzysztof Karas <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <ws6btku2syw43h3hoie6mflo2slrlfbzxiczhrmu3hfnefz4my@pldxsm3qdweq>
Hi,

On 2026-07-15 at 14:15:41 +0200, Sebastian Brzezinka wrote:
> lsgpu only needs device enumeration and the lightweight tool stubs.
> Replace #include "igt.h" with the minimal header set and stop linking
> against libigt.so.
> 
> ldd before: 35  (ldd | wc -l)
> ldd after:   8  (ldd | wc -l)
> 
> Signed-off-by: Sebastian Brzezinka <[email protected]>
> Acked-by: Ashutosh Dixit <[email protected]>
> Reviewed-by: Krzysztof Niemiec <[email protected]>
> ---
>  tools/lsgpu.c     | 2 +-
>  tools/meson.build | 7 ++++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/lsgpu.c b/tools/lsgpu.c
> index 935371dea..7d6b70b9b 100644
> --- a/tools/lsgpu.c
> +++ b/tools/lsgpu.c
> @@ -34,7 +34,7 @@
>  #include <signal.h>
>  #include <sys/ioctl.h>
>  
> -#include "igt.h"
> +#include "igt_core.h"
>  #include "igt_device_scan.h"
>  
>  /**
> diff --git a/tools/meson.build b/tools/meson.build
> index 6e694164f..fbc6c0a00 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -27,7 +27,6 @@ tools_progs = [
>  	'intel_tiling_detect',
>  	'intel_gem_info',
>  	'dpcd_reg',
> -	'lsgpu',
>  ]
>  tool_deps = igt_deps
>  tool_deps += zlib
> @@ -172,6 +171,12 @@ install_data(['intel_gpu_abrt', 'intel-gfx-fw-info'], install_dir : bindir)
>  
>  install_subdir('registers', install_dir : datadir)
>  
> +executable('lsgpu', 'lsgpu.c',
> +	   dependencies : [lib_igt_device_scan, lib_igt_tools_stub,
> +	                    lib_igt_drm_stub, glib, libudev, libpci],
> +	   install_rpath : bindir_rpathdir,
> +	   install : true)
> +
>  executable('intel_gpu_top', 'intel_gpu_top.c',
>  	   install : true,
>  	   install_rpath : bindir_rpathdir,
> -- 
> 2.53.0
> 

Reviewed-by: Krzysztof Karas <[email protected]>

-- 
Best Regards,
Krzysztof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.