summaryrefslogtreecommitdiff
path: root/tools/lsgpu.c
AgeCommit message (Collapse)Author
2021-04-07tool/lsgpu: Fix memory leak when no device is foundAyaz A Siddiqui
Memory allocated during device scan were not being freed. added call of igt_devices_free(). Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Matt Roper <matthew.d.roper@intel.com>
2020-11-30tools/lsgpu: Add -n switch to list devices using vendor:device hex idZbigniew Kempczyński
Default device list prefers vendor and device names. Add -n switch to display vendor/device as hex strings. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2020-11-17lsgpu: Add filter type print-out selectionTvrtko Ursulin
In the previous patch we switched the lsgpu output to a short and user friendly format but some users will need a shorthand for getting other types of device selection filters than the defaut drm. Add some command line switches to enable this: $ lsgpu card0 8086:193B drm:/dev/dri/card0 └─renderD128 drm:/dev/dri/renderD128 $ lsgpu --sysfs card0 8086:193B sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0 └─renderD128 sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 $ lsgpu --pci card0 8086:193B pci:vendor=8086,device=193B,card=0 └─renderD128 v2: * Fix pci filter format. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Suggested-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-11-17lsgpu: User friendly device listingTvrtko Ursulin
New default user frindly device listing mode which replaces: sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0 subsystem : drm drm card : /dev/dri/card0 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 subsystem : drm drm render : /dev/dri/renderD128 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/pci0000:00/0000:00:02.0 subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 vendor : 8086 device : 193B With: card0 8086:193B drm:/dev/dri/card0 └─renderD128 drm:/dev/dri/renderD128 Advantages are more compact, more readable, one entry per GPU. Legacy format can be chose using the -s / --print-simple command line switches. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2019-12-04Introduce device selection lsgpu toolZbigniew Kempczyński
Tool uses device selection API to scan and display GPU devices. It can be used to check filter correctness as well as order of applying the filters (.igtrc, IGT_DEVICE and --device argument). v2 (Arek): * don't print chip as it's no longer there * make it a second patch, before any alterations to igt_core or drmtest * use only a single filter v3 (Arek): * use igt_load_igtrc() (Petri) * add usage example (Chris) * general logic cleanup LONG EXAMPLE: $ ./build/tools/lsgpu --help usage: lsgpu [options] Options: -p, --print-details Print devices with details -v, --list-vendors List recognized vendors -l, --list-filter-types List registered device filters types -d, --device filter Device filter, can be given multiple times -h, --help Show this help message and exit $ ./build/tools/lsgpu sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0 subsystem : drm drm card : /dev/dri/card0 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 subsystem : drm drm render : /dev/dri/renderD128 parent : sys:/sys/devices/pci0000:00/0000:00:02.0 sys:/sys/devices/platform/vgem/drm/card1 subsystem : drm drm card : /dev/dri/card1 parent : sys:/sys/devices/platform/vgem sys:/sys/devices/platform/vgem/drm/renderD129 subsystem : drm drm render : /dev/dri/renderD129 parent : sys:/sys/devices/platform/vgem sys:/sys/devices/pci0000:00/0000:00:02.0 subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 vendor : 8086 device : 5927 sys:/sys/devices/platform/vgem subsystem : platform drm card : /dev/dri/card1 drm render : /dev/dri/renderD129 $ ./build/tools/lsgpu -l Filter types: --- filter syntax --- sys sys:/sys/devices/pci0000:00/0000:00:02.0 find device by its sysfs path drm drm:/dev/dri/* path find drm device by /dev/dri/* node pci pci:[vendor=%04x/name][,device=%04x][,card=%d] vendor is hex number or vendor name $ ./build/tools/lsgpu -d pci:vendor=Intel Notice: Using --device filters === Device filter === pci:vendor=Intel === Testing device open === Device detail: subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 Device /dev/dri/card0 successfully opened Device /dev/dri/renderD128 successfully opened ------------------------------------------- $ ./build/tools/lsgpu -d pci:vendor=intel Notice: Using --device filters === Device filter === pci:vendor=intel === Testing device open === Device detail: subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 Device /dev/dri/card0 successfully opened Device /dev/dri/renderD128 successfully opened ------------------------------------------- $ ./build/tools/lsgpu -d pci:vendor=intel -p Notice: Using --device filters === Device filter === pci:vendor=intel === Testing device open === Device detail: subsystem : pci drm card : /dev/dri/card0 drm render : /dev/dri/renderD128 Device /dev/dri/card0 successfully opened Device /dev/dri/renderD128 successfully opened ========== pci:/sys/devices/pci0000:00/0000:00:02.0 ========== card device : /dev/dri/card0 render device : /dev/dri/renderD128 [properties] DEVPATH : /devices/pci0000:00/0000:00:02.0 DRIVER : i915 FWUPD_GUID : 0x8086:0x5927 ID_MODEL_FROM_DATABASE : Iris Plus Graphics 650 ID_PCI_CLASS_FROM_DATABASE : Display controller ID_PCI_INTERFACE_FROM_DATABASE : VGA controller ID_PCI_SUBCLASS_FROM_DATABASE : VGA compatible controller ID_VENDOR_FROM_DATABASE : Intel Corporation MODALIAS : pci:v00008086d00005927sv00008086sd00002068bc03sc00i00 PCI_CLASS : 30000 PCI_ID : 8086:5927 PCI_SLOT_NAME : 0000:00:02.0 PCI_SUBSYS_ID : 8086:2068 SUBSYSTEM : pci USEC_INITIALIZED : 22881171 [attributes] ari_enabled : 0 boot_vga : 1 broken_parity_status : 0 class : 0x030000 consistent_dma_mask_bits : 39 current_link_speed : Unknown speed current_link_width : 0 d3cold_allowed : 1 device : 0x5927 dma_mask_bits : 39 driver_override : (null) enable : 1 firmware_node : LNXVIDEO:00 index : 1 irq : 129 label : CPU local_cpulist : 0-3 local_cpus : f max_link_speed : Unknown speed max_link_width : 255 msi_bus : 1 numa_node : -1 revision : 0x06 subsystem : pci subsystem_device : 0x2068 subsystem_vendor : 0x8086 vendor : 0x8086 ------------------------------------------- Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>