[Spice-devel] [PATCH v3] common: Add a udev helper to identify GPU Vendor (v3)

Frediano Ziglio freddy77 at gmail.com
Tue Oct 17 09:48:14 UTC 2023


Il giorno mar 17 ott 2023 alle ore 08:43 Vivek Kasireddy
<vivek.kasireddy at intel.com> ha scritto:
>
> Given that libudev is widely available on many Linux distros, we
> can use the relevant APIs to iterate over all the devices associated
> with the drm subsystem to figure out if a specific vendor GPU
> is available or not.
>
> This capability (identifying GPU Vendor) is useful to determine
> whether to launch Gstreamer pipeline using h/w accelerated
> plugins. On systems where libudev is not available (Windows,
> MacOS, etc) we'd have to make this determination based on the
> availability of the relevant plugins in the Gstreamer registry.
>
> v2: (Frediano)
> - Add autoconf support
> - Add license text
> - Add pragma once and SPICE_BEGIN/END_DECLS to the header
> - Check the vendor id udev attribute of the pci device to
>   determine a vendor GPU instead of checking the driver name
>
> v3: (fixups by Frediano)
> - Fix broken autoconf support added in v2
> - Fix compiler error on systems with no libudev support
> - Return VENDOR_GPU_UNKNOWN if we cannot create udev instance
> - Make libudev dependency optional
> - Change the type of gpu_vendor from long to int as PCI vendor IDs
>   are defined as 16-bit unsigned int
>
> Cc: Frediano Ziglio <freddy77 at gmail.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau at redhat.com>
> Cc: Dongwon Kim <dongwon.kim at intel.com>
> Cc: Hazwan Arif Mazlan <hazwan.arif.mazlan at intel.com>
> Cc: Jin Chung Teng <jin.chung.teng at intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
> ---
>  common/Makefile.am |  3 ++
>  common/meson.build |  2 ++
>  common/udev.c      | 78 ++++++++++++++++++++++++++++++++++++++++++++++
>  common/udev.h      | 33 ++++++++++++++++++++
>  configure.ac       |  1 +
>  m4/spice-deps.m4   | 12 +++++++
>  meson.build        |  7 +++++
>  7 files changed, 136 insertions(+)
>  create mode 100644 common/udev.c
>  create mode 100644 common/udev.h
>

Merged. Minor space change.

Frediano


More information about the Spice-devel mailing list