mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-25 10:55:58 +00:00
overlay: Take a snapshot on SIGUSR1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
57e573ecc1
commit
5cb8c77d69
@ -8,6 +8,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "overlay.h"
|
#include "overlay.h"
|
||||||
#include "chart.h"
|
#include "chart.h"
|
||||||
@ -556,6 +557,13 @@ static void show_gem_objects(struct overlay_context *ctx, struct overlay_gem_obj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int take_snapshot;
|
||||||
|
|
||||||
|
static void signal_snapshot(int sig)
|
||||||
|
{
|
||||||
|
take_snapshot = sig;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct overlay_context ctx;
|
struct overlay_context ctx;
|
||||||
@ -566,6 +574,8 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal(SIGUSR1, signal_snapshot);
|
||||||
|
|
||||||
ctx.width = 640;
|
ctx.width = 640;
|
||||||
ctx.height = 236;
|
ctx.height = 236;
|
||||||
ctx.surface = x11_overlay_create(POS_TOP_RIGHT, &ctx.width, &ctx.height);
|
ctx.surface = x11_overlay_create(POS_TOP_RIGHT, &ctx.width, &ctx.height);
|
||||||
@ -609,6 +619,13 @@ int main(int argc, char **argv)
|
|||||||
cairo_destroy(ctx.cr);
|
cairo_destroy(ctx.cr);
|
||||||
|
|
||||||
overlay_show(ctx.surface);
|
overlay_show(ctx.surface);
|
||||||
|
|
||||||
|
if (take_snapshot) {
|
||||||
|
char buf[80];
|
||||||
|
sprintf(buf, "overlay-snapshot-%d.png", i-1);
|
||||||
|
cairo_surface_write_to_png(ctx.surface, buf);
|
||||||
|
take_snapshot = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user