[igt-dev] [PATCH i-g-t 3/6] lib: Kill drm_get_card()

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 13 13:05:36 UTC 2019


Quoting Michał Winiarski (2019-03-13 12:53:29)
> It's not operating on FD, and we've provided a nice reimplementation
> that does. Let's use it instead.
> 
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

> ---
>  static void
> -test_debugfs_reader(bool hibernate)
> +test_debugfs_reader(int fd, bool hibernate)
>  {
>         struct igt_helper_process reader = {};
>         reader.use_SIGKILL = true;
> @@ -112,7 +113,7 @@ test_debugfs_reader(bool hibernate)
>  
>                 snprintf(tmp, sizeof(tmp) - 1,
>                          "while true; do find %s/%i/ -type f ! -path \"*/crc/*\" | xargs cat > /dev/null 2>&1; done",
> -                        dfs_base, drm_get_card());
> +                        dfs_base, igt_device_get_card_index(fd));
>                 igt_assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);

* blinks

I didn't see this.

> diff --git a/tools/intel_gpu_frequency.c b/tools/intel_gpu_frequency.c
> index 80786ad9..52b11a98 100644
> --- a/tools/intel_gpu_frequency.c
> +++ b/tools/intel_gpu_frequency.c
> @@ -28,6 +28,7 @@
>  #include <unistd.h>
>  
>  #include "drmtest.h"
> +#include "igt_device.h"
>  #include "intel_chipset.h"
>  
>  #define VERSION "1.0"
> @@ -280,10 +281,12 @@ int main(int argc, char *argv[])
>  {
>  
>         bool write, fail, targets[MAX+1] = {false};
> -       int i, try = 1, set_freq[MAX+1] = {0};
> +       int i, fd, try = 1, set_freq[MAX+1] = {0};
>  
> -       devid = intel_get_drm_devid(drm_open_driver(DRIVER_INTEL));
> -       device = drm_get_card();
> +       fd = drm_open_driver(DRIVER_INTEL);
> +       devid = intel_get_drm_devid(fd);
> +       device = igt_device_get_card_index(fd);
> +       close(fd);

Weird. Generally this tool should just die, but it should just walk
sysfs and find the i915 nodes.
-Chris


More information about the igt-dev mailing list