igt-gpu-tools: update to 1.27.1.

This commit is contained in:
mhmdanas 2023-02-23 17:59:06 +00:00 committed by Leah Neukirchen
parent ff4ead96d9
commit 111918317d
5 changed files with 732 additions and 211 deletions

View file

@ -0,0 +1,491 @@
Description: Link to libproc2
libproc2 is the new library for libprocps
Author: Craig Small <csmall@debian.org>
Bug-Debian: https://bugs.debian.org/1024221
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2022-12-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -52,8 +52,16 @@
#include <assert.h>
#include <grp.h>
+#ifdef HAVE_LIBPROCPS
#include <proc/readproc.h>
+#endif
+#ifdef HAVE_LIBPROC2
+#include <libproc2/pids.h>
+#endif
+
#include <libudev.h>
+#include <linux/limits.h>
+#include <dirent.h>
#include "drmtest.h"
#include "i915_drm.h"
@@ -1217,6 +1225,7 @@ void igt_unlock_mem(void)
*/
int igt_is_process_running(const char *comm)
{
+#if HAVE_LIBPROCPS
PROCTAB *proc;
proc_t *proc_info;
bool found = false;
@@ -1235,6 +1244,26 @@ int igt_is_process_running(const char *c
closeproc(proc);
return found;
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Item[] = { PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ char *pid_comm;
+ bool found = false;
+
+ if (procps_pids_new(&info, Item, 1) < 0)
+ return false;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ pid_comm = PIDS_VAL(0, str, stack, info);
+ if (!strncasecmp(pid_comm, comm, strlen(pid_comm))) {
+ found = true;
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+ return found;
+#endif
}
/**
@@ -1251,6 +1280,7 @@ int igt_is_process_running(const char *c
*/
int igt_terminate_process(int sig, const char *comm)
{
+#ifdef HAVE_LIBPROCPS
PROCTAB *proc;
proc_t *proc_info;
int err = 0;
@@ -1272,6 +1302,29 @@ int igt_terminate_process(int sig, const
closeproc(proc);
return err;
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ char *pid_comm;
+ int pid;
+ int err = 0;
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return -errno;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ pid = PIDS_VAL(0, s_int, stack, info);
+ pid_comm = PIDS_VAL(1, str, stack, info);
+ if (!strncasecmp(pid_comm, comm, strlen(pid_comm))) {
+ if (kill(pid, sig) < 0)
+ err = -errno;
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+ return err;
+#endif
}
struct pinfo {
@@ -1341,9 +1394,9 @@ igt_show_stat_header(void)
}
static void
-igt_show_stat(proc_t *info, int *state, const char *fn)
+igt_show_stat(const pid_t tid, const char *cmd, int *state, const char *fn)
{
- struct pinfo p = { .pid = info->tid, .comm = info->cmd, .fn = fn };
+ struct pinfo p = { .pid = tid, .comm = cmd, .fn = fn };
if (!*state)
igt_show_stat_header();
@@ -1353,7 +1406,7 @@ igt_show_stat(proc_t *info, int *state,
}
static void
-__igt_lsof_fds(proc_t *proc_info, int *state, char *proc_path, const char *dir)
+__igt_lsof_fds(const pid_t tid, const char *cmd, int *state, char *proc_path, const char *dir)
{
struct dirent *d;
struct stat st;
@@ -1400,7 +1453,7 @@ again:
dirn = dirname(copy_fd_lnk);
if (!strncmp(dir, dirn, strlen(dir)))
- igt_show_stat(proc_info, state, fd_lnk);
+ igt_show_stat(tid, cmd, state, fd_lnk);
free(copy_fd_lnk);
free(fd_lnk);
@@ -1416,13 +1469,14 @@ again:
static void
__igt_lsof(const char *dir)
{
- PROCTAB *proc;
- proc_t *proc_info;
-
char path[30];
char *name_lnk;
struct stat st;
int state = 0;
+#ifdef HAVE_LIBPROCPS
+ PROCTAB *proc;
+ proc_t *proc_info;
+
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1456,6 +1510,44 @@ __igt_lsof(const char *dir)
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ ssize_t read;
+ int tid = PIDS_VAL(0, s_int, stack, info);
+ char *pid_comm = PIDS_VAL(1, str, stack, info);
+
+ /* check current working directory */
+ memset(path, 0, sizeof(path));
+ snprintf(path, sizeof(path), "/proc/%d/cwd", tid);
+
+ if (stat(path, &st) == -1)
+ continue;
+
+ name_lnk = malloc(st.st_size + 1);
+
+ igt_assert((read = readlink(path, name_lnk, st.st_size + 1)));
+ name_lnk[read] = '\0';
+
+ if (!strncmp(dir, name_lnk, strlen(dir)))
+ igt_show_stat(tid, pid_comm, &state, name_lnk);
+
+ /* check also fd, seems that lsof(8) doesn't look here */
+ memset(path, 0, sizeof(path));
+ snprintf(path, sizeof(path), "/proc/%d/fd", tid);
+
+ __igt_lsof_fds(tid, pid_comm, &state, path, dir);
+
+ free(name_lnk);
+ }
+ procps_pids_unref(&info);
+#endif
}
/**
@@ -1490,7 +1582,7 @@ igt_lsof(const char *dpath)
free(sanitized);
}
-static void pulseaudio_unload_module(proc_t *proc_info)
+static void pulseaudio_unload_module(const uid_t euid, const gid_t egid)
{
struct igt_helper_process pa_proc = {};
char xdg_dir[PATH_MAX];
@@ -1498,14 +1590,14 @@ static void pulseaudio_unload_module(pro
struct passwd *pw;
igt_fork_helper(&pa_proc) {
- pw = getpwuid(proc_info->euid);
+ pw = getpwuid(euid);
homedir = pw->pw_dir;
- snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
+ snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", euid);
igt_info("Request pulseaudio to stop using audio device\n");
- setgid(proc_info->egid);
- setuid(proc_info->euid);
+ setgid(egid);
+ setuid(euid);
clearenv();
setenv("HOME", homedir, 1);
setenv("XDG_RUNTIME_DIR",xdg_dir, 1);
@@ -1524,10 +1616,12 @@ static void pipewire_reserve_wait(void)
char xdg_dir[PATH_MAX];
const char *homedir;
struct passwd *pw;
- proc_t *proc_info;
- PROCTAB *proc;
+ int tid=0, euid, egid;
+#ifdef HAVE_LIBPROCPS
igt_fork_helper(&pw_reserve_proc) {
+ proc_t *proc_info;
+ PROCTAB *proc;
igt_info("Preventing pipewire-pulse to use the audio drivers\n");
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
@@ -1539,21 +1633,44 @@ static void pipewire_reserve_wait(void)
freeproc(proc_info);
}
closeproc(proc);
+ tid = proc_info->tid;
+ euid = proc_info->euid;
+ egid = proc_info->egid;
+ freeproc(proc_info);
+#endif
+#ifdef HAVE_LIBPROC2
+ igt_fork(child, 1) {
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_ID_EUID, PIDS_ID_EGID };
+ enum rel_items { EU_PID, EU_EUID, EU_EGID };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ igt_info("Preventing pipewire-pulse to use the audio drivers\n");
+
+ if (procps_pids_new(&info, Items, 3) < 0)
+ return;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ tid = PIDS_VAL(EU_PID, s_int, stack, info);
+ if (pipewire_pulse_pid == tid)
+ break;
+ }
+ euid = PIDS_VAL(EU_EUID, s_int, stack, info);
+ egid = PIDS_VAL(EU_EGID, s_int, stack, info);
+ procps_pids_unref(&info);
+#endif
/* Sanity check: if it can't find the process, it means it has gone */
- if (pipewire_pulse_pid != proc_info->tid)
+ if (pipewire_pulse_pid != tid)
exit(0);
- pw = getpwuid(proc_info->euid);
+ pw = getpwuid(euid);
homedir = pw->pw_dir;
- snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
- setgid(proc_info->egid);
- setuid(proc_info->euid);
+ snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", euid);
+ setgid(egid);
+ setuid(euid);
clearenv();
setenv("HOME", homedir, 1);
setenv("XDG_RUNTIME_DIR",xdg_dir, 1);
- freeproc(proc_info);
-
/*
* pw-reserve will run in background. It will only exit when
* igt_kill_children() is called later on. So, it shouldn't
@@ -1570,9 +1687,7 @@ static void pipewire_reserve_wait(void)
int pipewire_pulse_start_reserve(void)
{
bool is_pw_reserve_running = false;
- proc_t *proc_info;
int attempts = 0;
- PROCTAB *proc;
if (!pipewire_pulse_pid)
return 0;
@@ -1584,6 +1699,10 @@ int pipewire_pulse_start_reserve(void)
* pipewire version 0.3.50 or upper.
*/
for (attempts = 0; attempts < PIPEWIRE_RESERVE_MAX_TIME; attempts++) {
+#ifdef HAVE_LIBPROCPS
+ proc_t *proc_info;
+ PROCTAB *proc;
+
usleep(1000);
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1598,6 +1717,25 @@ int pipewire_pulse_start_reserve(void)
freeproc(proc_info);
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+
+ usleep(1000);
+
+ if (procps_pids_new(&info, Items, 2) < 0)
+ return 1;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ if (!strcmp(PIDS_VAL(1, str, stack, info), "pw-reserve")) {
+ is_pw_reserve_running = true;
+ pipewire_pw_reserve_pid = PIDS_VAL(0, s_int, stack, info);
+ break;
+ }
+ }
+ procps_pids_unref(&info);
+#endif
if (is_pw_reserve_running)
break;
}
@@ -1645,7 +1783,7 @@ void pipewire_pulse_stop_reserve(void)
* If the check fails, it means that the process can simply be killed.
*/
static int
-__igt_lsof_audio_and_kill_proc(proc_t *proc_info, char *proc_path)
+__igt_lsof_audio_and_kill_proc(const pid_t tid, const char *cmd, const uid_t euid, const gid_t egid, char *proc_path)
{
const char *audio_dev = "/dev/snd/";
char path[PATH_MAX * 2];
@@ -1670,10 +1808,10 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* 2) unload/unbind the the audio driver(s);
* 3) stop the pw-reserve thread.
*/
- if (!strcmp(proc_info->cmd, "pipewire-pulse")) {
+ if (!strcmp(cmd, "pipewire-pulse")) {
igt_info("process %d (%s) is using audio device. Should be requested to stop using them.\n",
- proc_info->tid, proc_info->cmd);
- pipewire_pulse_pid = proc_info->tid;
+ tid, cmd);
+ pipewire_pulse_pid = tid;
return 0;
}
/*
@@ -1685,9 +1823,9 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* will respawn them. So, just ignore here, they'll honor pw-reserve,
* when the time comes.
*/
- if (!strcmp(proc_info->cmd, "pipewire-media-session"))
+ if (!strcmp(cmd, "pipewire-media-session"))
return 0;
- if (!strcmp(proc_info->cmd, "wireplumber"))
+ if (!strcmp(cmd, "wireplumber"))
return 0;
dp = opendir(proc_path);
@@ -1723,22 +1861,22 @@ __igt_lsof_audio_and_kill_proc(proc_t *p
* enough to unbind audio modules and won't cause race issues
* with systemd trying to reload it.
*/
- if (!strcmp(proc_info->cmd, "pulseaudio")) {
- pulseaudio_unload_module(proc_info);
+ if (!strcmp(cmd, "pulseaudio")) {
+ pulseaudio_unload_module(euid, egid);
break;
}
/* For all other processes, just kill them */
igt_info("process %d (%s) is using audio device. Should be terminated.\n",
- proc_info->tid, proc_info->cmd);
+ tid, cmd);
- if (kill(proc_info->tid, SIGTERM) < 0) {
+ if (kill(tid, SIGTERM) < 0) {
igt_info("Fail to terminate %s (pid: %d) with SIGTERM\n",
- proc_info->cmd, proc_info->tid);
- if (kill(proc_info->tid, SIGABRT) < 0) {
+ cmd, tid);
+ if (kill(tid, SIGABRT) < 0) {
fail++;
igt_info("Fail to terminate %s (pid: %d) with SIGABRT\n",
- proc_info->cmd, proc_info->tid);
+ cmd, tid);
}
}
@@ -1760,9 +1898,10 @@ int
igt_lsof_kill_audio_processes(void)
{
char path[PATH_MAX];
+ int fail = 0;
+#ifdef HAVE_LIBPROCPS
proc_t *proc_info;
PROCTAB *proc;
- int fail = 0;
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
igt_assert(proc != NULL);
@@ -1772,12 +1911,35 @@ igt_lsof_kill_audio_processes(void)
if (snprintf(path, sizeof(path), "/proc/%d/fd", proc_info->tid) < 1)
fail++;
else
- fail += __igt_lsof_audio_and_kill_proc(proc_info, path);
+ fail += __igt_lsof_audio_and_kill_proc(proc_info->pid, proc_info->cmd, proc_info->euid, proc_info->egid, path);
freeproc(proc_info);
}
closeproc(proc);
+#endif
+#ifdef HAVE_LIBPROC2
+ enum pids_item Items[] = { PIDS_ID_PID, PIDS_CMD, PIDS_ID_EUID, PIDS_ID_EGID };
+ enum rel_items { EU_PID, EU_CMD, EU_EUID, EU_EGID };
+ struct pids_info *info = NULL;
+ struct pids_stack *stack;
+ pid_t tid;
+
+ if (procps_pids_new(&info, Items, 4) < 0)
+ return 1;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
+ tid = PIDS_VAL(EU_PID, s_int, stack, info);
+ if (snprintf(path, sizeof(path), "/proc/%d/fd", tid) < 1)
+ fail++;
+ else
+ fail += __igt_lsof_audio_and_kill_proc(tid,
+ PIDS_VAL(EU_CMD, str, stack, info),
+ PIDS_VAL(EU_EUID, s_int, stack, info),
+ PIDS_VAL(EU_EGID, s_int, stack, info),
+ path);
+ }
+ procps_pids_unref(&info);
+#endif
return fail;
}
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -105,7 +105,6 @@ lib_deps = [
libdrm,
libdw,
libkmod,
- libprocps,
libudev,
math,
pciaccess,
@@ -169,6 +168,12 @@ if chamelium.found()
lib_sources += 'monitor_edids/monitor_edids_helper.c'
endif
+if libprocps.found()
+ lib_deps += libprocps
+else
+ lib_deps += libproc2
+endif
+
if get_option('srcdir') != ''
srcdir = join_paths(get_option('srcdir'), 'tests')
else
--- a/meson.build
+++ b/meson.build
@@ -120,7 +120,15 @@ build_info += 'With libdrm: ' + ','.join
pciaccess = dependency('pciaccess', version : '>=0.10')
libkmod = dependency('libkmod')
-libprocps = dependency('libprocps', required : true)
+libprocps = dependency('libprocps', required : false)
+libproc2 = dependency('libproc2', required : false)
+if libprocps.found()
+ config.set('HAVE_LIBPROCPS', 1)
+elif libproc2.found()
+ config.set('HAVE_LIBPROC2', 1)
+else
+ error('Either libprocps or libproc2 is required')
+endif
libunwind = dependency('libunwind', required : get_option('libunwind'))
build_info += 'With libunwind: @0@'.format(libunwind.found())

View file

@ -1,42 +0,0 @@
From 2107b0a53692fb329175bc16169c3699712187aa Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Feb 2021 14:10:41 -0800
Subject: [PATCH] lib/igt_edid: Allocate raw 8-bytes for VSDB
hdmi_vsdb is an element of cea_vsdb which makes the size of cea_vsdb to
be 8 ( 3bytes ieee_oui ) + ( 5bytes hdmi_vsdb struct), its true that we
only use 7 bytes technically we can only allocate 7byte array but since
we are writing to elements of hdmi_vsdb struct which is sitting at offet
4-8 in cea_vsdb, compiler thinks we have an element which is out of
array bounds since out allocated size is 7bytes
This errors out
../git/lib/igt_edid.c:365:13: error: array subscript 'struct hdmi_vsdb[0]' is partly outside array bounds of 'char[7]' [-Werror=array-bounds]
365 | hdmi->src_phy_addr[0] = 0x10;
| ^~
allocating one extra byte matches with size of cea_vsdb and compiler is
happy
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
---
lib/igt_edid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_edid.c b/lib/igt_edid.c
index 1c85486d..ce09cc47 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -351,7 +351,7 @@ void cea_sad_init_pcm(struct cea_sad *sad, int channels,
const struct cea_vsdb *cea_vsdb_get_hdmi_default(size_t *size)
{
/* We'll generate a VSDB with 2 extension fields. */
- static char raw[CEA_VSDB_HDMI_MIN_SIZE + 2] = {0};
+ static char raw[CEA_VSDB_HDMI_MIN_SIZE + 3] = {0};
struct cea_vsdb *vsdb;
struct hdmi_vsdb *hdmi;
--
GitLab

View file

@ -1,36 +0,0 @@
From 963917a3565466832a3b2fc22e9285d34a0bf944 Mon Sep 17 00:00:00 2001
From: Petri Latvala <petri.latvala@intel.com>
Date: Thu, 28 Oct 2021 11:05:31 +0300
Subject: [PATCH] lib/meson.build: Fix underscorify call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
f.underscorify() is correct, f.underscorify(f) is an error that later
meson versions don't like at all.
Closes: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/107
Fixes: 588555f77909 ("lib/i915: Extract helpers for determining scheduler capabilities")
Cc: Arkadiusz Hiler <arek@hiler.eu>
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
---
lib/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/meson.build b/lib/meson.build
index c3080fc8..297b0ad2 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -155,7 +155,7 @@ lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
lib_intermediates = []
foreach f: lib_sources
- name = f.underscorify(f)
+ name = f.underscorify()
lib = static_library('igt-' + name,
[ f, lib_version ],
include_directories: inc,
--
GitLab

View file

@ -1,22 +1,58 @@
diff --git a/benchmarks/gem_exec_tracer.c b/benchmarks/gem_exec_tracer.c
index 7e86473e..3156dfc2 100644
--- a/benchmarks/gem_exec_tracer.c
+++ b/benchmarks/gem_exec_tracer.c
@@ -271,7 +271,11 @@ static int is_i915(int fd)
}
int
+#ifdef __GLIBC__
ioctl(int fd, unsigned long request, ...)
+#else
+ioctl(int fd, int request, ...)
+#endif
{
struct trace *t, **p;
va_list args;
diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 7671dc4..3ac9544 100644
index 312c428b..e0740fc1 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -44,7 +44,11 @@
@@ -46,6 +46,8 @@
#include <linux/unistd.h>
#endif
-#define sigev_notify_thread_id _sigev_un._tid
+#ifndef __GLIBC__
+#include "signal_compat.h"
+#endif
+
+#define sigev_notify_thread_id sigev_notify_function
+
#include "i915/gem_create.h"
#include "i915/gem_ring.h"
#include "igt_aux.h"
diff --git a/lib/amdgpu/amd_pci_unplug.c b/lib/amdgpu/amd_pci_unplug.c
index 078398b5..554f489c 100644
--- a/lib/amdgpu/amd_pci_unplug.c
+++ b/lib/amdgpu/amd_pci_unplug.c
@@ -21,6 +21,7 @@
*
*/
#include <linux/limits.h>
+#include <limits.h> // PATH_MAX
#include <fcntl.h>
#include <sys/stat.h>
#include <pthread.h>
diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index e0b1bafe..dd5e0d2c 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -26,6 +26,7 @@
static volatile int done;
#include "config.h"
+#include <limits.h> // PATH_MAX
#include <errno.h>
#include <fcntl.h>
#include <gsl/gsl_fft_real.h>
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 578f857..3e98cf0 100644
index 15e30440..9792899d 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -31,6 +31,7 @@
@ -24,49 +60,60 @@ index 578f857..3e98cf0 100644
#include <stdio.h>
#include <fcntl.h>
+#include <limits.h> // PATH_MAX
#include <pwd.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
@@ -73,6 +74,12 @@
#include <libgen.h> /* for dirname() */
#endif
+#ifndef __GLIBC__
+#include "signal_compat.h"
+#endif
+
+//#include <asm-generic/siginfo.h>
+
/**
* SECTION:igt_aux
* @short_description: Auxiliary libraries and support functions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 04d2290..a0ada9e 100644
index e734c87b..b626d28c 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -46,7 +46,7 @@
@@ -48,7 +48,7 @@
# ifndef HAVE_GETTID
# define gettid() (pid_t)(syscall(__NR_gettid))
# endif
-# define sigev_notify_thread_id _sigev_un._tid
+# define sigev_notify_thread_id sigev_notify_function
#endif
-#define sigev_notify_thread_id _sigev_un._tid
+#define sigev_notify_thread_id sigev_notify_function
/* auxialiary igt helpers from igt_aux.c */
/* generally useful helpers */
diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index ed128d24..ebff1ad3 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -27,6 +27,7 @@
#include "igt_list.h"
#include "intel_chipset.h"
+#include <limits.h> // PATH_MAX
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 3d7fd4d..d51774b 100644
index ef6625df..3e9b8a40 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -29,6 +29,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
@@ -26,6 +26,7 @@
#include "config.h"
#include "igt_core.h"
#include "igt_eld.h"
#include <dirent.h>
+#include <limits.h> // PATH_MAX
#include <errno.h>
#include <glob.h>
#include <stdint.h>
diff --git a/lib/igt_frame.c b/lib/igt_frame.c
index 45523a79..86b8aad4 100644
--- a/lib/igt_frame.c
+++ b/lib/igt_frame.c
@@ -26,6 +26,7 @@
#include "config.h"
+#include <limits.h> // PATH_MAX
#include <fcntl.h>
#include <pixman.h>
#include <cairo.h>
diff --git a/lib/igt_halffloat.c b/lib/igt_halffloat.c
index 08ab05f..7d6a6e6 100644
index 08ab05fc..7d6a6e6a 100644
--- a/lib/igt_halffloat.c
+++ b/lib/igt_halffloat.c
@@ -162,7 +162,7 @@ static inline float _half_to_float(uint16_t val)
@ -78,8 +125,20 @@ index 08ab05f..7d6a6e6 100644
#pragma GCC push_options
#pragma GCC target("f16c")
diff --git a/lib/igt_hwmon.c b/lib/igt_hwmon.c
index 309019d6..6216a160 100644
--- a/lib/igt_hwmon.c
+++ b/lib/igt_hwmon.c
@@ -2,6 +2,7 @@
/*
* Copyright © 2022 Intel Corporation
*/
+#include <limits.h> // PATH_MAX
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <dirent.h>
diff --git a/lib/igt_x86.c b/lib/igt_x86.c
index 6ac700d..ddf5edd 100644
index 6ac700df..ddf5edda 100644
--- a/lib/igt_x86.c
+++ b/lib/igt_x86.c
@@ -190,7 +190,7 @@ char *igt_x86_features_to_string(unsigned features, char *line)
@ -91,93 +150,146 @@ index 6ac700d..ddf5edd 100644
#pragma GCC push_options
#pragma GCC target("sse4.1")
#pragma GCC diagnostic ignored "-Wpointer-arith"
diff --git a/lib/signal_compat.h b/lib/signal_compat.h
new file mode 100644
index 0000000..acae648
--- /dev/null
+++ b/lib/signal_compat.h
@@ -0,0 +1,4 @@
+#define SIGEV_SIGNAL 0 /* notify via signal */
+#define SIGEV_NONE 1 /* other notification: meaningless */
+#define SIGEV_THREAD 2 /* deliver via thread creation */
+#define SIGEV_THREAD_ID 4 /* deliver to thread */
diff --git a/tests/drm_read.c b/tests/drm_read.c
index cfb1c04..18be922 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -220,7 +220,7 @@ static void test_short_buffer_wakeup(int in, enum pipe pipe)
pthread_mutex_unlock(&w.mutex);
/* Give each thread a chance to sleep in drm_read() */
- pthread_yield();
+ sched_yield();
/* One event should wake all threads as none consume */
generate_event(w.fd, pipe);
diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
index 8c0d133..f272418 100644
--- a/tests/kms_hdmi_inject.c
+++ b/tests/kms_hdmi_inject.c
@@ -25,7 +25,7 @@
#include "config.h"
#include <dirent.h>
-
+#include <limits.h>
#include "igt.h"
#include "igt_edid.h"
#include "igt_eld.h"
diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
index 1201388..e75c7e9 100644
--- a/tests/kms_sysfs_edid_timing.c
+++ b/tests/kms_sysfs_edid_timing.c
@@ -24,6 +24,7 @@
diff --git a/runner/executor.c b/runner/executor.c
index 9d3623b4..aac3ac56 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1,6 +1,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h> // PATH_MAX
#include <glib.h>
#ifdef __linux__
#include <linux/watchdog.h>
diff --git a/runner/runner_tests.c b/runner/runner_tests.c
index a7e968f8..6d605251 100644
--- a/runner/runner_tests.c
+++ b/runner/runner_tests.c
@@ -1,5 +1,6 @@
#include <dirent.h>
#include <fcntl.h>
+#include <limits.h>
+#include <limits.h> // PATH_MAX
#include <sys/stat.h>
#define THRESHOLD_PER_CONNECTOR 10
diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
index 57e0048..ad5f504 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -51,7 +51,11 @@
static uint32_t devid;
static bool has_64bit_relocations;
-#define sigev_notify_thread_id _sigev_un._tid
+#ifndef __GLIBC__
+#include "signal_compat.h"
+#endif
+
+#define sigev_notify_thread_id sigev_notify_function
static void selfcopy(int fd, uint32_t handle, int loops)
{
#include <sys/types.h>
#include <unistd.h>
diff --git a/tests/device_reset.c b/tests/device_reset.c
index 39ee8dca..fa8e3b9f 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -3,6 +3,7 @@
* Copyright(c) 2020 Intel Corporation. All rights reserved.
*/
#include <fcntl.h>
+#include <limits.h> // PATH_MAX
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <signal.h>
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index e2c7ba2..08e44b7 100644
index 74935430..0dc87d8c 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -36,6 +36,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
+#include <limits.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
diff --git a/tests/panfrost_submit.c b/tests/panfrost_submit.c
index 13ce85b..ceb2e6d 100644
--- a/tests/panfrost_submit.c
+++ b/tests/panfrost_submit.c
@@ -68,7 +68,7 @@ static void check_error(int fd, struct panfrost_submit *submit)
static void check_fb(int fd, struct panfrost_bo *bo)
{
int gpu_prod_id = igt_panfrost_get_param(fd, DRM_PANFROST_PARAM_GPU_PROD_ID);
- __uint32_t *fbo;
+ uint32_t *fbo;
int i;
@@ -27,6 +27,7 @@
fbo = bo->map;
#include "config.h"
+#include <limits.h> // PATH_MAX
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 2a3fb74b..781af5e8 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -830,7 +830,7 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe,
{
int timeline, fence_fd;
void *map;
- const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE);
+ const ptrdiff_t intelsize = sysconf(_SC_PAGE_SIZE);
uint64_t old_mode_id = pipe->values[IGT_CRTC_MODE_ID];
igt_require_sw_sync();
@@ -838,28 +838,28 @@ static void crtc_invalid_params_fence(igt_pipe_t *pipe,
timeline = sw_sync_timeline_create();
/* invalid out_fence_ptr */
- map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ map = mmap(NULL, intelsize, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
igt_assert(map != MAP_FAILED);
igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
- munmap(map, PAGE_SIZE);
+ munmap(map, intelsize);
/* invalid out_fence_ptr */
- map = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ map = mmap(NULL, intelsize, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
igt_assert(map != MAP_FAILED);
igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
- munmap(map, PAGE_SIZE);
+ munmap(map, intelsize);
/* invalid out_fence_ptr */
- map = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ map = mmap(NULL, intelsize, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
igt_assert(map != MAP_FAILED);
igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
crtc_commit_atomic_err(pipe, plane, ATOMIC_RELAX_NONE, EFAULT);
- munmap(map, PAGE_SIZE);
+ munmap(map, intelsize);
/* valid in fence but not allowed prop on crtc */
fence_fd = sw_sync_timeline_create_fence(timeline, 1);
diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
index 77521108..3b16cba8 100644
--- a/tests/kms_sysfs_edid_timing.c
+++ b/tests/kms_sysfs_edid_timing.c
@@ -22,6 +22,7 @@
*/
#include "igt.h"
+#include <limits.h> // PATH_MAX
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index ee272dfb..b8146b41 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -58,6 +58,7 @@
#include <strings.h>
#include <unistd.h>
#include <termios.h>
+#include <limits.h> // PATH_MAX
#include <sys/poll.h>
#include <sys/time.h>
#include <sys/ioctl.h>
diff --git a/tests/tools_test.c b/tests/tools_test.c
index 8412ba52..f36a6192 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <limits.h> // PATH_MAX
#include <libgen.h>
#include <unistd.h>
#ifdef __linux__
diff --git a/tools/igt_compliance_utils.c b/tools/igt_compliance_utils.c
index 0faf3fc8..f6bd970e 100644
--- a/tools/igt_compliance_utils.c
+++ b/tools/igt_compliance_utils.c
@@ -24,6 +24,7 @@
*/
#include "igt.h"
+#include <limits.h> // PATH_MAX
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,11 +1,10 @@
# Template file for 'igt-gpu-tools'
pkgname=igt-gpu-tools
version=1.25
revision=6
version=1.27.1
revision=1
build_style=meson
configure_args="-Db_ndebug=false -Db_lto=false"
# b_lto=true makes the build hang at a random point
hostmakedepends="pkg-config flex peg python3-docutils gtk-doc"
configure_args="-Db_ndebug=false -Ddocs=disabled"
hostmakedepends="pkg-config flex peg python3-docutils"
makedepends="libdrm-devel libkmod-devel liboping-devel procps-ng-devel libunwind-devel
elfutils-devel pixman-devel valgrind-devel cairo-devel xmlrpc-c-devel gsl-devel
alsa-lib-devel json-c-devel libXrandr-devel"
@ -13,18 +12,15 @@ short_desc="Tools for development and testing of the DRM drivers"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://gitlab.freedesktop.org/drm/igt-gpu-tools"
distfiles="${XORG_SITE}/app/${pkgname}-${version}.tar.xz"
checksum=40454d8f0484ea2477862007398a08eef78a6c252c4defce1c934548593fdd11
changelog="https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/raw/master/NEWS"
distfiles="${XORG_SITE}/app/igt-gpu-tools-${version}.tar.xz"
checksum=93b9a4816ed22b5145bb61024314c8a65caeea991ce93027643f1d40723bf417
# tests don't behave in containers
make_check=ci-skip
lib32disabled=yes
archs="i686* x86_64*"
if [ -z "${XBPS_CHECK_PKGS}" ]; then
configure_args+=" -Dtests=disabled -Drunner=disabled -Ddocs=disabled"
fi
post_install() {
vlicense COPYING
}