#include "gem_stress.h"
+#include <signal.h>
+
#define CMD_POLY_STIPPLE_OFFSET 0x7906
/** TODO:
unsigned max_failed_reads;
} stats;
+static void signal_helper_process(pid_t pid)
+{
+ /* Interrupt the parent process at 500Hz, just to be annoying */
+ while (1) {
+ usleep(1000 * 1000 / 500);
+ if (kill(pid, SIGUSR1)) /* Parent has died, so must we. */
+ exit(0);
+ }
+}
+
+static pid_t fork_signal_helper(void)
+{
+ pid_t pid;
+
+ pid = fork();
+ if (pid == 0) {
+ signal_helper_process(getppid());
+ return -1;
+ }
+
+ return pid;
+}
+
static void tile2xy(struct scratch_buf *buf, unsigned tile, unsigned *x, unsigned *y)
{
assert(tile < buf->num_tiles);
{"no-hw", 0, 0, 'd'},
{"buf-size", 1, 0, 's'},
{"gpu-busy-load", 1, 0, 'g'},
+ {"no-signals", 0, 0, 'S'},
{"buffer-count", 1, 0, 'c'},
{"trace-tile", 1, 0, 't'},
{"disable-blt", 0, 0, 'b'},
options.scratch_buf_size = 256*4096;
options.no_hw = 0;
+ options.use_signal_helper = 1;
options.gpu_busy_load = 0;
options.num_buffers = 0;
options.trace_tile = -1;
options.no_hw = 1;
printf("no-hw debug mode\n");
break;
+ case 'S':
+ options.use_signal_helper = 0;
+ printf("disabling that pesky nuisance who keeps interrupting us\n");
+ break;
case 's':
tmp = atoi(optarg);
if (tmp < options.tile_size*8192)
{
int i, j;
unsigned *current_permutation, *tmp_permutation;
+ pid_t signal_helper = -1;
drm_fd = drm_open_any();
devid = intel_get_drm_devid(drm_fd);
parse_options(argc, argv);
+ /* start our little helper early before too may allocations occur */
+ signal(SIGUSR1, SIG_IGN);
+ if (options.use_signal_helper)
+ signal_helper = fork_signal_helper();
+
init();
check_render_copyfunc();
close(drm_fd);
+ if (signal_helper != -1)
+ kill(signal_helper, SIGQUIT);
+
return 0;
}