summaryrefslogtreecommitdiff
path: root/lib/igt_device_scan.h
AgeCommit message (Collapse)Author
2020-11-30lib/igt_device_scan: Remember vendor/device for pci devicesZbigniew Kempczyński
If we want to use pci device id for not opened device we need to keep it in card structure. Export igt_device_get_pretty_name() function to the caller to allow return pretty name (for lsgpu, intel_gpu_top and others). 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-17intel_gpu_top: User friendly device listingTvrtko Ursulin
Adding a new device selection print type suitable for user-facing use cases like intel_gpu_top -L and later lsgpu. Instead of: 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 New format looks like: card0 8086:193B drm:/dev/dri/card0 └─renderD128 drm:/dev/dri/renderD128 Advantages are more compact, more readable, one entry per GPU, shorter string to copy and paste to intel_gpu_top -d, or respective usage. v2: * Increase stack filter size. (Zbigniew) 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>
2020-11-05lib/igt_device_scan: Provide function for return integrated cardZbigniew Kempczyński
Sometimes we need to get integrated card (like in intel_gpu_top) so add function which does it. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Cc: Lyude Paul <lyude@redhat.com> Reviewed-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com>
2020-10-26lib/igt_device_scan:Add function to get pci subsystem of requested cardAyaz A Siddiqui
intel_gpu_top requires card information and PCI_SLOT_NAME for dGPU. Only pci subsystem contains both information. In case of user filter is other than pci subsystem then we need card information of associated pci subsystem which is stored as parent of requested card if available. A new api has been added to cater intel_gpu_top requirement. Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com> Cc: Dixit Ashutosh <ashutosh.dixit@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-10-12lib/igt_device_scan: Return true from igt_device_find_first_i915_discrete_card()Lyude Paul
So that we can also print a relevant error message when failing to find any devices in intel_gpu_top. Signed-off-by: Lyude Paul <lyude@redhat.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2020-06-08lib/igt_device_scan: Add extra helpers for intel_gpu_topAyaz A Siddiqui
Will be used in the next patch. 1. set_pci_slot_name(): stores PCI_SLOT_NAME from prop to device 2. igt_device_find_first_discrete_card(): try to find first discrete GPU 3. igt_devices_free(): Free device buffers created during scan Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-06-08lib/igt_device_scan: Make igt_device_scan independent from igt_coreAyaz A Siddiqui
igt_device_scan can now be used as a separate library which only depends glib and libudev - some IGT internals are being stubbed in this case. v2: (mostly) sort includes (Lucas) Cc: Lucas De Marchi <lucas.de.marchi@gmail.com> Signed-off-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2020-05-05lib: Support multiple filtersArkadiusz Hiler
This patch brings back support for multiple filters that was in the original series by Zbyszek. We can now take multiple, semicolon separated filters. Right now the tests are using only the first filter. v2: drop unnecessary check before for-loop (Petri) Cc: Petri Latvala <petri.latvala@intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2019-12-04Introduce device selection APIZbigniew Kempczyński
The new device selection API based on scanning DRM subsystem using udev. It provides a set of functions for enumerating and filtering available graphic cards to get the corresponding /dev/dri nodes. For details check the top level documentation in igt_device_scan.c To be used in lsgpu tool and internally by drm_open_driver*() functions (see the following patches). v2 (Arek): * drop most of the glib code in favor of igt_list and plain C * make sysfs paths handling non-special - introduce sys: filter * drop multiple filter_* structs in favor of just two: - filter_class for defining filters types (e.g. sys:) - filter for "filter instance" - the data provided by the user * promote many macros to real functions for type safety * rename devs->devs to devs->all * rename devs->view to devs->filtered * don't expose "chip" (e.g. DRIVER_ANY) as it's unreadable as int * update docs to reflect those changes * move open functions that open igt_device_card to this patch * remove platform filter class for now * use only a single filter v3 (Arek): * fix some memory leaks and setting to NULL after free() (Zbigniew) * fix even more missing free() (Petri) * use the new igt_list API * fix null pointer dereference on filter->class 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>